Skip to content

Commit

Permalink
Merge pull request #1141 from eclipse-tractusx/chore/#984-add-validat…
Browse files Browse the repository at this point in the history
…ion-to-notification-hover

chore(uux): 984 validation on notification save hover
  • Loading branch information
ds-mwesener authored Jul 3, 2024
2 parents f59fb36 + 8bd03a6 commit 5c403de
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@
</div>
<div class="detail--action">
<div class="detail--action--button"
matTooltip="{{(isSaveButtonDisabled ? ( affectedPartIds.length < 1 ? 'requestNotification.noPartsSelected' : 'requestNotification.saveNotAllowed') : 'requestNotification.save') | i18n}}"
matTooltip="{{
isSaveButtonDisabled
? (affectedPartIds.length < 1
? ('requestNotification.noPartsSelected' | i18n)
: notificationFormGroup?.pristine
? ('requestNotification.noChanges' | i18n)
: ('requestNotification.saveNotAllowed' | i18n))
: 'requestNotification.save' | i18n}}"
matTooltipClass="table--header--tooltip"
matTooltipPosition="above"
[class.mdc-tooltip--multiline]="true"
Expand All @@ -51,6 +58,7 @@
</div>
</app-button>
</div>

</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
********************************************************************************/

import { Location } from '@angular/common';
import { Component, OnDestroy, TemplateRef, ViewChild } from '@angular/core';
import { ChangeDetectorRef, Component, OnDestroy, TemplateRef, ViewChild } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Pagination } from '@core/model/pagination.model';
Expand Down Expand Up @@ -93,6 +93,7 @@ export class NotificationEditComponent implements OnDestroy {
private readonly toastService: ToastService,
private readonly sharedPartService: SharedPartService,
private location: Location,
private readonly cdr: ChangeDetectorRef,
) {
this.editMode = this.determineEditModeOrCreateMode();

Expand Down Expand Up @@ -178,6 +179,8 @@ export class NotificationEditComponent implements OnDestroy {

this.notificationFormGroup = notificationFormGroup;
this.isSaveButtonDisabled = (notificationFormGroup.invalid || this.affectedPartIds.length < 1) || !this.notificationFormGroup.dirty;
this.cdr.detectChanges();

if (this.notificationFormGroup && this.notificationFormGroup.getRawValue().type === NotificationType.INVESTIGATION.valueOf() && !this.notificationFormGroup.getRawValue().bpn && this.sharedPartService.affectedParts && this.sharedPartService.affectedParts.length > 0) {
this.notificationFormGroup.get('bpn').setValue(this.sharedPartService.affectedParts[0].businessPartner);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ export class RequestNotificationNewComponent implements OnDestroy, OnInit {
}

this.allTouched?.subscribe(next => {
console.log(next);
if (next === true) {
this.formGroup.markAllAsTouched();
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/assets/locales/de/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@
"saveError": "Bei der Erstellung des Qualitätsthemas ist ein Fehler aufgetreten.",
"saveEditSuccess": "Qualitätsthema wurde erfolgreich aktualisiert.",
"saveEditError": "Bei der Aktualisierung des Qualitätsthemas ist ein Fehler aufgetreten.",
"save": "Qualitätsthema speichern"
"save" : "Qualitätsthema speichern",
"noChanges" : "Erfordert eine Änderung am Qualitätsthema"
},
"editNotification": {
"saveButton": "Speichern",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/assets/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@
"saveError": "An error occurred while creating the quality topic.",
"saveEditSuccess": "Quality topic was updated successfully.",
"saveEditError": "An error occurred while updating the quality topic.",
"save": "Save quality topic"
"save" : "Save quality topic",
"noChanges" : "Requires a change on the quality topic"
},
"editNotification": {
"saveButton": "Save",
Expand Down

0 comments on commit 5c403de

Please sign in to comment.