LP1904036 Checkin cancel transits; lint
authorBill Erickson <berickxx@gmail.com>
Tue, 20 Apr 2021 19:20:08 +0000 (15:20 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:32 +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/checkin/checkin.component.html
Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/bills.component.ts
Open-ILS/src/eg2/src/app/staff/share/circ/circ.module.ts

index b424e80..7c6870f 100644 (file)
@@ -7,6 +7,7 @@
 <eg-string #itemNeverCircedStr i18n-text 
   text="Item CONC40000598 has never circulated."></eg-string>
 <eg-backdate-dialog #backdateDialog></eg-backdate-dialog>
+<eg-cancel-transit-dialog #cancelTransitDialog></eg-cancel-transit-dialog>
 
 <div class="row" *ngIf="hasAlerts()">
   <div class="col-lg-12 alert alert-danger p-1">
   <ng-container *ngIf="!r.record">{{r.title}}</ng-container>
 </ng-template>
 
+<ng-template #barcodeTemplate let-r="row">
+  <ng-container *ngIf="r.copy">
+    <a href="/eg/staff/cat/item/{{r.copy.id()}}">{{r.copy.barcode()}}</a>
+  </ng-container>
+</ng-template>
+
 <div class="row">
   <div class="col-lg-12">
     <eg-grid #grid [dataSource]="gridDataSource" [sortable]="true"
         (onClick)="markDamaged($event)"></eg-grid-toolbar-action>
 
       <eg-grid-toolbar-action
-        i18n-group group="Edit" i18n-label label="Manage Item Alerts"
+        group="Mark" i18n-group i18n-label label="Mark Missing Pieces"
+        (onClick)="markMissingPieces($event)"></eg-grid-toolbar-action>
+
+      <eg-grid-toolbar-action
+        i18n-group group="Manage" i18n-label label="Manage Item Alerts"
         [disabled]="grid.context.rowSelector.selected().length !== 1"
         (onClick)="manageItemAlerts($event)">
       </eg-grid-toolbar-action>
       </eg-grid-toolbar-action>
 
       <eg-grid-toolbar-action
-        i18n-group group="Edit" i18n-label label="Backdate Post-Checkin"
+        i18n-group group="Circulation" i18n-label label="Backdate Post-Checkin"
         (onClick)="backdatePostCheckin($event)">
       </eg-grid-toolbar-action>
 
       <eg-grid-toolbar-action
+        i18n-group group="Circulation" i18n-label label="Cancel Transits"
+        (onClick)="cancelTransits($event)">
+      </eg-grid-toolbar-action>
+
+      <eg-grid-toolbar-action
         i18n-group group="Retrieve" i18n-label 
         label="Retrieve Last Patron Who Circulated Item"
         [disabled]="grid.context.rowSelector.selected().length !== 1"
       <eg-grid-column path="mbts.balance_owed" label="Balance Owed" 
         datatype="money" i18n-label></eg-grid-column>
 
-      <eg-grid-column path="copy.barcode" label="Barcode" i18n-label>
-      </eg-grid-column>
+      <eg-grid-column path="copy.barcode" label="Barcode" 
+        i18n-label [cellTemplate]="barcodeTemplate"></eg-grid-column>
 
       <eg-grid-column path="circ.id" label="Bill #" i18n-label>
       </eg-grid-column>
index 68f2a9f..e627385 100644 (file)
@@ -1,4 +1,5 @@
 import {Component, ViewChild, OnInit, AfterViewInit, HostListener} from '@angular/core';
+import {Location} from '@angular/common';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import {from} from 'rxjs';
 import {concatMap} from 'rxjs/operators';
@@ -25,6 +26,9 @@ import {BucketDialogComponent
 import {ToastService} from '@eg/share/toast/toast.service';
 import {StringComponent} from '@eg/share/string/string.component';
 import {BackdateDialogComponent} from '@eg/staff/share/circ/backdate-dialog.component';
+import {CancelTransitDialogComponent
+    } from '@eg/staff/share/circ/cancel-transit-dialog.component';
+
 
 interface CheckinGridEntry extends CheckinResult {
     // May need to extend...
@@ -78,10 +82,12 @@ export class CheckinComponent implements OnInit, AfterViewInit {
     @ViewChild('bucketDialog') private bucketDialog: BucketDialogComponent;
     @ViewChild('itemNeverCircedStr') private itemNeverCircedStr: StringComponent;
     @ViewChild('backdateDialog') private backdateDialog: BackdateDialogComponent;
+    @ViewChild('cancelTransitDialog') private cancelTransitDialog: CancelTransitDialogComponent;
 
     constructor(
         private router: Router,
         private route: ActivatedRoute,
+        private ngLocation: Location,
         private net: NetService,
         private org: OrgService,
         private auth: AuthService,
@@ -318,5 +324,26 @@ export class CheckinComponent implements OnInit, AfterViewInit {
             }
         });
     }
+
+    markMissingPieces(rows: CheckinGridEntry[]) {
+        const copyId = this.getCopyIds(rows)[0];
+        if (copyId) {
+            const url = this.ngLocation.prepareExternalUrl(
+                `/staff/cat/item/missing_pieces/${copyId}`);
+            window.open(url);
+        }
+    }
+
+
+    cancelTransits(rows: CheckinGridEntry[]) {
+        const ids = rows
+            .filter(row => Boolean(row.transit))
+            .map(row => row.transit.id());
+
+        if (ids.length > 0) {
+            this.cancelTransitDialog.transitIds = ids;
+            this.cancelTransitDialog.open().subscribe();
+        }
+    }
 }
 
index 6056061..b9ff5db 100644 (file)
@@ -110,7 +110,7 @@ export class BillsComponent implements OnInit, AfterViewInit {
                 row.paymentPending = 0;
                 row.billingLocation =
                     row['grocery.billing_location.shortname'] ||
-                    row['circulation.circ_lib.shortname']
+                    row['circulation.circ_lib.shortname'];
             }));
         };
 
index b712fdd..3e9c13d 100644 (file)
@@ -12,6 +12,7 @@ import {CircEventsComponent} from './events-dialog.component';
 import {OpenCircDialogComponent} from './open-circ-dialog.component';
 import {RouteDialogComponent} from './route-dialog.component';
 import {CopyInTransitDialogComponent} from './in-transit-dialog.component';
+import {CancelTransitDialogComponent} from './cancel-transit-dialog.component';
 import {BackdateDialogComponent} from './backdate-dialog.component';
 
 @NgModule({
@@ -25,6 +26,7 @@ import {BackdateDialogComponent} from './backdate-dialog.component';
         RouteDialogComponent,
         BackdateDialogComponent,
         CopyInTransitDialogComponent,
+        CancelTransitDialogComponent,
         OpenCircDialogComponent
     ],
     imports: [
@@ -35,6 +37,7 @@ import {BackdateDialogComponent} from './backdate-dialog.component';
     exports: [
         CircGridComponent,
         BackdateDialogComponent,
+        CancelTransitDialogComponent,
         CircComponentsComponent
     ],
     providers: [