From b3e68e5a6f3e08fdf867984360dc16d7f7da8556 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 12 Jul 2021 12:38:16 -0400 Subject: [PATCH] LP1888723 Manage mode for single-copy edits notes/tags/alerts When editing multiple items, always open the Item Alerts/Tags/Notes dialogs in "manage" mode so users can see and edit existing values on the edited copy. In batch copy mode, these dialogs still only allow adding new values. Signed-off-by: Bill Erickson Signed-off-by: Ruth Frasur Signed-off-by: Galen Charlton --- .../app/staff/cat/volcopy/copy-attrs.component.ts | 6 +++--- .../share/holdings/copy-alerts-dialog.component.ts | 20 ++++++++------------ .../share/holdings/copy-notes-dialog.component.ts | 11 ++++------- .../share/holdings/copy-tags-dialog.component.ts | 11 ++++------- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts index 6e7b67d07c..807d7ca101 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts @@ -417,7 +417,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { } openCopyAlerts() { - this.copyAlertsDialog.inPlaceMode = true; + this.copyAlertsDialog.inPlaceCreateMode = true; this.copyAlertsDialog.copyIds = this.context.copyList().map(c => c.id()); this.copyAlertsDialog.open({size: 'lg'}).subscribe( @@ -437,7 +437,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { } openCopyTags() { - this.copyTagsDialog.inPlaceMode = true; + this.copyTagsDialog.inPlaceCreateMode = true; this.copyTagsDialog.copyIds = this.context.copyList().map(c => c.id()); this.copyTagsDialog.open({size: 'lg'}).subscribe(newTags => { @@ -464,7 +464,7 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit { } openCopyNotes() { - this.copyNotesDialog.inPlaceMode = true; + this.copyNotesDialog.inPlaceCreateMode = true; this.copyNotesDialog.copyIds = this.context.copyList().map(c => c.id()); this.copyNotesDialog.open({size: 'lg'}).subscribe(newNotes => { diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts index 0a55f79c59..5115ffa41d 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-alerts-dialog.component.ts @@ -26,15 +26,14 @@ export class CopyAlertsDialogComponent extends DialogComponent implements OnInit { // If there are multiple copyIds, only new alerts may be applied. - // If there is only one copyId, then tags may be applied or removed. + // If there is only one copyId, then alerts may be applied or removed. @Input() copyIds: number[] = []; mode: string; // create | manage - // If true, no attempt is made to save the new alerts to the + // If true, no attempt is made to save new alerts to the // database. It's assumed this takes place in the calling code. - // This is useful for creating alerts for new copies. - @Input() inPlaceMode = false; + @Input() inPlaceCreateMode = false; // In 'create' mode, we may be adding notes to multiple copies. copies: IdlObject[]; @@ -74,13 +73,13 @@ export class CopyAlertsDialogComponent this.newAlert = this.idl.create('aca'); this.newAlert.create_staff(this.auth.user().id()); - if (this.copyIds.length === 0 && !this.inPlaceMode) { + if (this.copyIds.length === 0 && !this.inPlaceCreateMode) { return throwError('copy ID required'); } // In manage mode, we can only manage a single copy. - // But in create mode, we can add tags to multiple copies. - if (this.copyIds.length === 1 && !this.inPlaceMode) { + // But in create mode, we can add alerts to multiple copies. + if (this.copyIds.length === 1) { this.mode = 'manage'; } else { this.mode = 'create'; @@ -110,8 +109,6 @@ export class CopyAlertsDialogComponent } getCopies(): Promise { - if (this.inPlaceMode) { return Promise.resolve(); } - return this.pcrud.search('acp', {id: this.copyIds}, {}, {atomic: true}) .toPromise().then(copies => { this.copies = copies; @@ -126,11 +123,10 @@ export class CopyAlertsDialogComponent // acknowledged by staff and are within org unit range of // the alert type. getCopyAlerts(): Promise { - const copyIds = this.copies.map(c => c.id()); const typeIds = this.alertTypes.map(a => a.id); return this.pcrud.search('aca', - {copy: copyIds, ack_time: null, alert_type: typeIds}, + {copy: this.copyIds, ack_time: null, alert_type: typeIds}, {}, {atomic: true}) .toPromise().then(alerts => { alerts.forEach(a => { @@ -144,7 +140,7 @@ export class CopyAlertsDialogComponent addNew() { if (!this.newAlert.alert_type()) { return; } - if (this.inPlaceMode) { + if (this.inPlaceCreateMode) { this.close(this.newAlert); return; } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts index 3f9fff5214..7d277940e1 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-notes-dialog.component.ts @@ -32,8 +32,7 @@ export class CopyNotesDialogComponent // If true, no attempt is made to save the new notes to the // database. It's assumed this takes place in the calling code. - // This is useful for creating notes for new copies. - @Input() inPlaceMode = false; + @Input() inPlaceCreateMode = false; // In 'create' mode, we may be adding notes to multiple copies. copies: IdlObject[] = []; @@ -73,14 +72,14 @@ export class CopyNotesDialogComponent this.copies = []; this.newNotes = []; - if (this.copyIds.length === 0 && !this.inPlaceMode) { + if (this.copyIds.length === 0 && !this.inPlaceCreateMode) { return throwError('copy ID required'); } // In manage mode, we can only manage a single copy. // But in create mode, we can add notes to multiple copies. - if (this.copyIds.length === 1 && !this.inPlaceMode) { + if (this.copyIds.length === 1) { this.mode = 'manage'; } else { this.mode = 'create'; @@ -94,8 +93,6 @@ export class CopyNotesDialogComponent } getCopies(): Promise { - if (this.inPlaceMode) { return Promise.resolve(); } - return this.pcrud.search('acp', {id: this.copyIds}, {flesh: 1, flesh_fields: {acp: ['notes']}}, {atomic: true} @@ -143,7 +140,7 @@ export class CopyNotesDialogComponent applyChanges() { - if (this.inPlaceMode) { + if (this.inPlaceCreateMode) { this.close(this.newNotes); return; } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts index c58e82d6a6..d4641042e0 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holdings/copy-tags-dialog.component.ts @@ -33,8 +33,7 @@ export class CopyTagsDialogComponent // If true, no attempt is made to save the new tags to the // database. It's assumed this takes place in the calling code. - // This is useful for creating tags for new copies. - @Input() inPlaceMode = false; + @Input() inPlaceCreateMode = false; // In 'create' mode, we may be adding notes to multiple copies. copies: IdlObject[] = []; @@ -96,14 +95,14 @@ export class CopyTagsDialogComponent this.newTags = []; this.deletedMaps = []; - if (this.copyIds.length === 0 && !this.inPlaceMode) { + if (this.copyIds.length === 0 && !this.inPlaceCreateMode) { return throwError('copy ID required'); } // In manage mode, we can only manage a single copy. // But in create mode, we can add tags to multiple copies. - if (this.copyIds.length === 1 && !this.inPlaceMode) { + if (this.copyIds.length === 1) { this.mode = 'manage'; } else { this.mode = 'create'; @@ -130,8 +129,6 @@ export class CopyTagsDialogComponent } getCopies(): Promise { - if (this.inPlaceMode) { return Promise.resolve(); } - return this.pcrud.search('acp', {id: this.copyIds}, {flesh: 3, flesh_fields: { acp: ['tags'], acptcm: ['tag'], acpt: ['tag_type']}}, @@ -203,7 +200,7 @@ export class CopyTagsDialogComponent applyChanges() { - if (this.inPlaceMode) { + if (this.inPlaceCreateMode) { this.close(this.newTags); return; } -- 2.11.0