[CST-7755] added cancel button to modal and updated message returned when a supervision order already exists

This commit is contained in:
corrado lombardi
2023-02-09 15:31:03 +01:00
parent 67d401cc77
commit 800d3a9001
4 changed files with 19 additions and 10 deletions

View File

@@ -30,11 +30,16 @@
(select)="updateGroupObjectSelected($event)"></ds-eperson-group-list> (select)="updateGroupObjectSelected($event)"></ds-eperson-group-list>
</div> </div>
</div> </div>
<div class="d-flex flex-row-reverse m-2"> <!-- <div class="d-flex flex-row-reverse m-2"> -->
<button class="btn btn-primary save" <div class="modal-footer">
(click)="save()"> <button class="btn btn-outline-secondary"
<i class="fas fa-save"></i> {{"supervision-group-selector.button.save" | translate}} (click)="close()">
</button> <i class="fas fa-times"></i> {{"supervision-group-selector.button.cancel" | translate}}
</button>
<button class="btn btn-primary save"
(click)="save()">
<i class="fas fa-save"></i> {{"supervision-group-selector.button.save" | translate}}
</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -79,13 +79,13 @@ export class SupervisionGroupSelectorComponent {
if (rd.state === 'Success') { if (rd.state === 'Success') {
this.supervisionOrderDataService.searchByItem(this.itemUUID, null, null, followLink('group')); this.supervisionOrderDataService.searchByItem(this.itemUUID, null, null, followLink('group'));
this.notificationsService.success(this.translateService.get('supervision-group-selector.notification.create.success.title', { name: this.selectedGroup.name })); this.notificationsService.success(this.translateService.get('supervision-group-selector.notification.create.success.title', { name: this.selectedGroup.name }));
this.close();
} else { } else {
this.notificationsService.error( this.notificationsService.error(
this.translateService.get('supervision-group-selector.notification.create.failure.title'), this.translateService.get('supervision-group-selector.notification.create.failure.title'),
rd.errorMessage); rd.statusCode == 422 ? this.translateService.get('supervision-group-selector.notification.create.already-existing') : rd.errorMessage);
} }
}); });
this.close();
} }
} }

View File

@@ -100,7 +100,7 @@ export class ItemSearchResultListElementComponent extends SearchResultListElemen
).pipe( ).pipe(
getAllSucceededRemoteData(), getAllSucceededRemoteData(),
).subscribe((result) => { ).subscribe((result) => {
this.supervisionOrder$ = this.supervisionOrderDataService.searchByItem(this.dso.uuid, null, null, followLink('group')).pipe( this.supervisionOrder$ = this.supervisionOrderDataService.searchByItem(this.dso.uuid, false, true, followLink('group')).pipe(
getAllSucceededRemoteListPayload(), getAllSucceededRemoteListPayload(),
switchMap((supervisionOrders: SupervisionOrder[]) => { switchMap((supervisionOrders: SupervisionOrder[]) => {
const supervisionOrdersArray = supervisionOrders.map((supervisionOrder: SupervisionOrder) => { const supervisionOrdersArray = supervisionOrders.map((supervisionOrder: SupervisionOrder) => {

View File

@@ -1443,6 +1443,8 @@
"supervision-group-selector.select.group.label": "Select a Group", "supervision-group-selector.select.group.label": "Select a Group",
"supervision-group-selector.button.cancel": "Cancel",
"supervision-group-selector.button.save": "Save", "supervision-group-selector.button.save": "Save",
"supervision-group-selector.select.type-of-order.error": "Please select a type of order", "supervision-group-selector.select.type-of-order.error": "Please select a type of order",
@@ -1453,6 +1455,8 @@
"supervision-group-selector.notification.create.failure.title": "Error", "supervision-group-selector.notification.create.failure.title": "Error",
"supervision-group-selector.notification.create.already-existing" : "A supervision order already exists on this item for selected group",
"confirmation-modal.export-metadata.header": "Export metadata for {{ dsoName }}", "confirmation-modal.export-metadata.header": "Export metadata for {{ dsoName }}",
"confirmation-modal.export-metadata.info": "Are you sure you want to export metadata for {{ dsoName }}", "confirmation-modal.export-metadata.info": "Are you sure you want to export metadata for {{ dsoName }}",