LP1888723 Angular volcopy Apply All actions
authorBill Erickson <berickxx@gmail.com>
Mon, 12 Jul 2021 16:02:58 +0000 (12:02 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Sun, 15 Aug 2021 23:56:40 +0000 (19:56 -0400)
Replace Save and SAve & Exit buttons in the Angular holdings editor with
'Apply All & Save' and 'Apply All, Save & Exit' buttons.  With this,
staff are not required to click Apply on every change.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/cat/volcopy/copy-attrs.component.ts
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.html
Open-ILS/src/eg2/src/app/staff/cat/volcopy/volcopy.component.ts

index 1967a77..6e7b67d 100644 (file)
@@ -651,6 +651,13 @@ export class CopyAttrsComponent implements OnInit, AfterViewInit {
     hasActiveInput(): boolean {
         return this.batchAttrs.filter(attr => attr.editing).length > 0;
     }
+
+    applyPendingChanges() {
+        // If a user has left any changes in the 'editing' state, this
+        // will go through and apply the values so they do not have to
+        // click Apply for every one.
+        this.batchAttrs.filter(attr => attr.editing).forEach(attr => attr.save());
+    }
 }
 
 
index 2f4ac1f..bfa9217 100644 (file)
         </ng-container>
 
         <div class="flex-1"> </div>
-        <button class="btn btn-outline-dark" (click)="save()" 
+        <button class="btn btn-outline-dark" (click)="save(false, true)" 
           [ngClass]="{'border-danger': isNotSaveable()}"
-          [disabled]="isNotSaveable()" i18n>Save</button>
-        <button class="btn btn-outline-dark ml-2" (click)="save(true)"
+          [disabled]="isNotSaveable()" i18n>Apply All &amp; Save</button>
+        <button class="btn btn-outline-dark ml-2" (click)="save(true, true)"
           [ngClass]="{'border-danger': isNotSaveable()}"
-          [disabled]="isNotSaveable()" i18n>Save &amp; Exit</button>
+          [disabled]="isNotSaveable()" i18n>Apply All, Save &amp; Exit</button>
       </div>
     </div>
   </ng-container>
index d08c7ff..6d2a0b6 100644 (file)
@@ -336,6 +336,8 @@ export class VolCopyComponent implements OnInit {
     save(close?: boolean): Promise<any> {
         this.loading = true;
 
+        this.copyAttrs.applyPendingChanges();
+
         // Volume update API wants volumes fleshed with copies, instead
         // of the other way around, which is what we have here.
         const volumes: IdlObject[] = [];