LP1936233 Item status more columns; speed up refresh
authorBill Erickson <berickxx@gmail.com>
Thu, 2 Dec 2021 15:29:44 +0000 (10:29 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 24 Oct 2022 15:08:20 +0000 (11:08 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html
Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts

index b9b50c8..c7590e8 100644 (file)
   <eg-grid-column path="alert_message"></eg-grid-column>
   <eg-grid-column path="barcode"></eg-grid-column>
 
+  <eg-grid-column path="circ_lib.shortname" label="Circulating Library" i18n-label>
+  </eg-grid-column>
+
   <eg-grid-column i18n-label label="Location" path="location.name">
   </eg-grid-column>
 
   <eg-grid-column i18n-label label="Title" name="title" 
     [cellTemplate]="titleTemplate"></eg-grid-column>
 
-  <eg-grid-column i18n-label label="Owning Library"
+  <eg-grid-column i18n-label label="Checkout/Renewal Workstation"
+    path="_circ.workstation.name"></eg-grid-column>
+
+  <eg-grid-column i18n-label label="Checkout Location"
+    path="_circ.circ_lib.shortname"></eg-grid-column>
+
+  <eg-grid-column i18n-label label="Checkin Workstation" [hidden]="true"
+    path="_circ.checkin_workstation.name"></eg-grid-column>
+
+  <eg-grid-column i18n-label label="Owning Library" [hidden]="true"
     path="call_number.owning_lib.shortname"></eg-grid-column>
 
   <eg-grid-column path="call_number.*" [hidden]="true"></eg-grid-column>
index 1965f33..ac744d9 100644 (file)
@@ -1,9 +1,10 @@
-import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core';
+import {Component, ChangeDetectorRef, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core';
 import {Location} from '@angular/common';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
 import {from, of, empty} from 'rxjs';
 import {concatMap, tap} from 'rxjs/operators';
 import {IdlObject, IdlService} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {AuthService} from '@eg/core/auth.service';
 import {NetService} from '@eg/core/net.service';
@@ -113,11 +114,13 @@ export class ItemStatusComponent implements OnInit, AfterViewInit {
         private router: Router,
         private route: ActivatedRoute,
         private ngLocation: Location,
+        private changeDetector: ChangeDetectorRef,
         private net: NetService,
         private idl: IdlService,
         private printer: PrintService,
         private store: StoreService,
         private pcrud: PcrudService,
+        private org: OrgService,
         private auth: AuthService,
         private circ: CircService,
         private evt: EventService,
@@ -256,6 +259,13 @@ export class ItemStatusComponent implements OnInit, AfterViewInit {
         })).toPromise().then(_ => {
             if (this.grid) {
                 this.grid.reload();
+                // Modifying items that already exist in the grid creates
+                // scenarios where Angular does not realize a change
+                // has occurred until another digest cycle naturally
+                // occurrs.  Force it to check.  The setTimeout is
+                // needed because grid.reload() runs it its own timeout
+                // and we want this to happen after its timeout.
+                setTimeout(() => this.changeDetector.detectChanges());
             }
         });
     }
@@ -417,9 +427,17 @@ export class ItemStatusComponent implements OnInit, AfterViewInit {
             return Promise.resolve();
         }
 
-        return this.pcrud.search('circ', {target_copy: item.id()},
-            {order_by: {circ: 'xact_start DESC'}, limit: 1})
-        .toPromise().then(circ => item._circ = circ);
+        return this.pcrud.search('circ',
+            {target_copy: item.id()},
+            {   flesh: 1,
+                flesh_fields: {circ: ['workstation', 'checkin_workstation']},
+                order_by: {circ: 'xact_start DESC'},
+                limit: 1
+            }
+        ).toPromise().then(circ => {
+            circ.circ_lib(this.org.get(circ.circ_lib()));
+            item._circ = circ;
+        });
     }
 
     // A bit of cleanup to make the ISBN's look friendlier