LP1904036 checkout more events
authorBill Erickson <berickxx@gmail.com>
Mon, 12 Apr 2021 21:30:34 +0000 (17:30 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:30 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html
Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts
Open-ILS/src/eg2/src/app/staff/share/circ/components.component.html
Open-ILS/src/eg2/src/app/staff/share/circ/components.component.ts
Open-ILS/src/eg2/src/app/staff/share/circ/grid.component.ts

index f938378..49ae971 100644 (file)
         fieldName="au-expire_date-input"
         [noMaxWidth]="true"
         [required]="fieldRequired('au.expire_date')"
+        (onChangeAsIso)="
+          fieldValueChange(null, null, 'expire_date', $event); 
+          afterFieldChange(null, null, 'expire_date')"
         [(ngModel)]="expireDate">
       </eg-date-select>
     </div>
index f0a6a91..ae7f817 100644 (file)
@@ -420,12 +420,11 @@ export class CircService {
     }
 
     processCheckoutResult(result: CheckoutResult): Promise<CheckoutResult> {
+        const renewing = result.params._renewal;
+        const key = renewing ? 'renew' : 'checkout';
 
-        let overridable;
-        try {
-        overridable = result.params._renewal ?
+        const overridable = renewing ?
             CAN_OVERRIDE_RENEW_EVENTS : CAN_OVERRIDE_CHECKOUT_EVENTS;
-        } catch (E) { console.error(E) }
 
         if (result.allEvents.filter(
             e => overridable.includes(e.textcode)).length > 0) {
@@ -435,8 +434,8 @@ export class CircService {
         switch (result.firstEvent.textcode) {
             case 'SUCCESS':
                 result.success = true;
-                this.audio.play('success.checkout');
-                break;
+                this.audio.play(`success.${key}`);
+                return Promise.resolve(result);
 
             case 'ITEM_NOT_CATALOGED':
                 return this.handlePrecat(result);
@@ -445,48 +444,37 @@ export class CircService {
                 return this.handleOpenCirc(result);
 
             case 'COPY_IN_TRANSIT':
-                this.audio.play('warning.checkout.in_transit');
+                this.audio.play(`warning.${key}.in_transit`);
                 return this.copyInTransitDialog(result);
 
-            /*
-            case 'PATRON_CARD_INACTIVE':
-            case 'PATRON_INACTIVE':
-            case 'PATRON_ACCOUNT_EXPIRED':
-            case 'CIRC_CLAIMS_RETURNED':
-                egCore.audio.play('warning.checkout');
-                return service.exit_alert(
-                    egCore.strings[evt[0].textcode],
-                    {barcode : params.copy_barcode}
-                );
-                */
-
-
-            /*
             case 'PATRON_CARD_INACTIVE':
             case 'PATRON_INACTIVE':
             case 'PATRON_ACCOUNT_EXPIRED':
             case 'CIRC_CLAIMS_RETURNED':
-                egCore.audio.play('warning.checkout');
-                return this.exit_alert(
-                    egCore.strings[evt[0].textcode],
-                    {barcode : params.copy_barcode}
-                );
+                this.audio.play(`warning.${key}`);
+                return this.exitAlert({
+                    textcode: result.firstEvent.textcode,
+                    barcode: result.params.copy_barcode
+                });
 
             default:
-                egCore.audio.play('error.checkout.unknown');
-                return this.exit_alert(
-                    egCore.strings.CHECKOUT_FAILED_GENERIC, {
-                        barcode : params.copy_barcode,
-                        textcode : evt[0].textcode,
-                        desc : evt[0].desc
-                    }
-                );
-            */
+                this.audio.play(`error.${key}.unknown`);
+                return this.exitAlert({
+                    textcode: 'CHECKOUT_FAILED_GENERIC',
+                    barcode: result.params.copy_barcode
+                });
         }
-
-        return Promise.resolve(result);
     }
 
+    exitAlert(context: any): Promise<any> {
+        let key = 'staff.circ.events.' + context.textcode;
+        return this.strings.interpolate(key, context)
+        .then(str => {
+            this.components.circFailedDialog.dialogBody = str;
+            return this.components.circFailedDialog.open().toPromise();
+        })
+        .then(_ => Promise.reject('Bailling on event ' + context.textcode));
+    }
 
     copyInTransitDialog(result: CheckoutResult): Promise<CheckoutResult> {
         this.components.copyInTransitDialog.checkout = result;
index 123acda..3a29fcc 100644 (file)
@@ -8,6 +8,10 @@
   i18n-dialogBody dialogBody="This item needs to be routed to CATALOGING">
 </eg-alert-dialog>
 
+<eg-alert-dialog #circFailedDialog
+  i18n-dialogTitle dialogTitle="Unable to Complete Action">
+</eg-alert-dialog>
+
 <ng-template #locAlertTemplate let-barcode="barcode" let-location="location" i18n>
   Item {{barcode}} needs to be routed to {{location}}.
 </ng-template>
 <eg-string #holdShelfStr i18n-text text="Hold Shelf"></eg-string>
 <eg-string #catalogingStr i18n-text text="Cataloging"></eg-string>
 
+<eg-string key="staff.circ.events.PATRON_CARD_INACTIVE" i18n-text
+  text="The card used to retrieve this account is inactive and 
+  may not be used to circulate items."></eg-string>
+
+<eg-string key="staff.circ.events.PATRON_INACTIVE" i18n-text
+  text="This account is inactive and may not circulate items."></eg-string>
 
+<eg-string key="staff.circ.events.PATRON_ACCOUNT_EXPIRED" i18n-text
+  text="This account has expired and may not circulate items."></eg-string>
+
+<ng-template #claimsReturnsTmpl>
+  Item "{{barcode}}" is marked as Claims Returned</ng-template>
+<eg-string key="staff.circ.events.CIRC_CLAIMS_RETURNED" 
+  [template]="claimsReturnsTmpl"></eg-string>
+
+<ng-template #genericCheckoutFailedTmpl>
+  Unable to checkout item "{{barcode}}" : {{textcode}}
+</ng-template>
 
+<eg-string key="staff.circ.events.CHECKOUT_FAILED_GENERIC" 
+  [template]="genericCheckoutFailedTmpl"></eg-string>
 
index 921e591..c7f8202 100644 (file)
@@ -27,6 +27,7 @@ export class CircComponentsComponent {
     @ViewChild('openCircDialog') openCircDialog: OpenCircDialogComponent;
     @ViewChild('locationAlertDialog') locationAlertDialog: AlertDialogComponent;
     @ViewChild('uncatAlertDialog') uncatAlertDialog: AlertDialogComponent;
+    @ViewChild('circFailedDialog') circFailedDialog: AlertDialogComponent;
     @ViewChild('routeDialog') routeDialog: RouteDialogComponent;
     @ViewChild('copyInTransitDialog') copyInTransitDialog: CopyInTransitDialogComponent;
 
index 3954c21..2622081 100644 (file)
@@ -154,12 +154,6 @@ export class CircGridComponent implements OnInit {
                 return 'less-intense-alert';
             }
         };
-
-        this.serverStore.getItemBatch(['ui.circ.suppress_checkin_popups'])
-        .then(sets => {
-            this.circ.suppressCheckinPopups =
-                sets['ui.circ.suppress_checkin_popups'];
-        });
     }
 
     reportError(err: any) {