LPXXX Item Status Angular WIP
authorBill Erickson <berickxx@gmail.com>
Wed, 16 Jun 2021 22:19:45 +0000 (18:19 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 29 Jun 2021 20:31:33 +0000 (16:31 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/item/status.component.ts
Open-ILS/src/eg2/src/app/staff/cat/item/summary.component.html
Open-ILS/src/eg2/src/app/staff/cat/item/summary.component.ts

index 0d0fa46..531d1b0 100644 (file)
@@ -120,11 +120,21 @@ export class ItemStatusComponent implements OnInit, AfterViewInit {
     getItemById(id: number): Promise<any> {
 
         const flesh = {
-            flesh: 3,
-            flesh_fields: {
-                acp: ['call_number'],
-                acn: ['record'],
-                bre: ['flat_display_entries']
+            flesh : 4,
+            flesh_fields : {
+                acp : [
+                    'call_number','location','status','floating','circ_modifier',
+                    'age_protect','circ_lib','copy_alerts', 'creator',
+                    'editor', 'circ_as_type', 'latest_inventory', 'floating'
+                ],
+                acn : ['record','prefix','suffix','label_class', 'owning_lib'],
+                bre : ['simple_record','creator','editor'],
+                alci : ['inventory_workstation']
+            },
+            select : {
+                // avoid fleshing MARC on the bre
+                // note: don't add simple_record.. not sure why
+                bre : ['id','tcn_value','creator','editor', 'create_date', 'edit_date'],
             }
         };
 
index ac3fd69..47c18a4 100644 (file)
@@ -1 +1,230 @@
-summary
+<div class="alert alert-danger" *ngIf="item.deleted() == 't'">
+  This item has been marked as Deleted.
+</div>
+
+<div class="well-table">
+
+  <div class="well-row" *ngIf="item.dummy_title() || item.dummy_author()">
+    <div class="well-label" *ngIf="item.dummy_title()" i18n>Precat Title</div>
+    <div class="well-value" *ngIf="item.dummy_title()">{{item.dummy_title()}}</div>
+    
+    <div class="well-label" *ngIf="item.dummy_author()" i18n>Precat Author</div>
+    <div class="well-value" *ngIf="item.dummy_author()">{{item.dummy_author()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Barcode</div>
+    <div class="well-value">{{item.barcode()}}</div>
+
+    <div class="well-label" i18n>Circ Library</div>
+    <div class="well-value">{{item.circ_lib().shortname()}}</div>
+
+    <div class="well-label" i18n>Call # Prefix</div>
+    <div class="well-value">
+      {{item.call_number().prefix().label()}}
+    </div>
+
+    <div class="well-label" i18n>Status</div>
+    <div
+      class="well-value"
+      title="Holdable: {{item.status().holdable()}} / 
+        OPAC Visible: {{item.status().opac_visible()}}"
+    >{{item.status().name()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Price</div>
+    <div class="well-value">{{item.price()}}</div>
+
+    <div class="well-label" i18n>Owning Library</div>
+    <div class="well-value">{{item.call_number().owning_lib().shortname()}}</div>
+
+    <div class="well-label" i18n>Call #</div>
+    <div class="well-value">{{item.call_number().label()}}</div>
+
+    <div class="well-label" i18n>Due Date</div>
+    <div class="well-value">{{circ.due_date() | date:'shortDate'}}</div>
+  </div>
+
+  <div class="well-row">
+       <div class="well-label" i18n>Acquisition Cost</div>
+    <div class="well-value">{{item.cost()}}</div>
+
+    <div class="well-label" i18n>Shelving Location</div>
+    <div
+      class="well-value"
+      title="Holdable: {{item.location().holdable()}} / 
+        OPAC Visible: {{item.location().opac_visible()}}"
+    >{{item.location().name()}}</div>
+
+    <div class="well-label" i18n>Call # Suffix</div>
+    <div class="well-value">
+      {{item.call_number().suffix().label()}}
+    </div>
+
+    <div class="well-label" i18n>Checkout Date</div>
+    <div class="well-value">{{circSummary.start_time() | date:'shortDate'}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>ISBN</div>
+    <div class="well-value">
+      {{item.call_number().record().simple_record().isbn() || item.dummy_isbn()}}
+    </div>
+
+    <div class="well-label" i18n>Loan Duration</div>
+    <div class="well-value">
+      <div *ngIf="item.loan_duration() == 1" i18n>Short</div>
+      <div *ngIf="item.loan_duration() == 2" i18n>Normal</div>
+      <div *ngIf="item.loan_duration() == 3" i18n>Long</div>
+    </div>
+
+    <div class="well-label" i18n>Renewal Type</div>
+    <div class="well-value">
+      <div *ngIf="circ.opac_renewal() == 't'" i18n>OPAC</div>
+      <div *ngIf="circ.desk_renewal() == 't'" i18n>Desk</div>
+      <div *ngIf="circ.phone_renewal() == 't'" i18n>Phone</div>
+      <div *ngIf="circ.auto_renewal() == 't'" i18n>Automatic</div>
+    </div>
+
+    <div class="well-label" i18n>Checkout Workstation</div>
+    <div class="well-value">{{circSummary.checkout_workstation()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Date Created</div>
+    <div class="well-value">{{item.create_date() | date:'shortDate'}}</div>
+    <div class="well-label" i18n>Fine Level</div>
+    <div class="well-value">
+      <div *ngIf="item.fine_level() == 1" i18n>Low</div>
+      <div *ngIf="item.fine_level() == 2" i18n>Normal</div>
+      <div *ngIf="item.fine_level() == 3" i18n>High</div>
+    </div>
+
+    <div class="well-label" i18n>Total Circs</div>
+    <div class="well-value">{{total_circs}}</div>
+
+    <div class="well-label" i18n>Duration Rule</div>
+    <div class="well-value">{{circ.duration_rule().name()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Date Active</div>
+    <div class="well-value">{{item.active_date() | date:'shortDate'}}</div>
+
+    <div class="well-label" i18n>Reference</div>
+    <div class="well-value">{{item.ref()}}</div>
+
+    <div class="well-label" i18n>Total Circs - Current Year</div>
+    <div class="well-value">{{total_circs_this_year}}</div>
+
+    <div class="well-label" i18n>Recurring Fine Rule</div>
+    <div class="well-value">{{circ.recurring_fine_rule().name()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Status Changed</div>
+    <div class="well-value">{{item.status_changed_time() | date:'shortDate'}}</div>
+
+    <div class="well-label" i18n>OPAC Visible</div>
+    <div class="well-value">{{item.opac_visible()}}</div>
+
+    <div class="well-label" i18n>Total Circs - Prev Year</div>
+    <div class="well-value">{{total_circs_prev_year}}</div>
+
+    <div class="well-label" i18n>Max Fine Rule</div>
+    <div class="well-value">{{circ.max_fine_rule().name()}}</div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Item ID</div>
+    <div class="well-value">{{item.id()}}</div>
+
+    <div class="well-label" i18n>Holdable</div>
+    <div class="well-value">{{item.holdable()}}</div>
+
+    <div class="well-label" i18n>In-House Uses</div>
+    <div class="well-value">{{item._inHouseUseCount}}</div>
+
+    <div class="well-label" i18n>Checkin Time</div>
+    <div class="well-value">
+      {{circ.checkin_time() || 
+        circSummary.last_checkin_time() | date:'shortDate'}}
+    </div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Circulate</div>
+    <div class="well-value">{{item.circulate()}}</div>
+
+    <div class="well-label" i18n>Renewal Workstation</div>
+    <div class="well-value">{{circSummary.last_renewal_workstation()}}</div>
+
+    <div class="well-label" i18n>Remaining Renewals</div>
+    <div class="well-value">{{circ.renewal_remaining()}}</div>
+
+    <div class="well-label" i18n>Checkin Scan Time</div>
+    <div class="well-value">
+      {{circ.checkin_scan_time() || 
+        circSummary.last_checkin_scan_time() | date:'shortDate'}}
+    </div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Floating</div>
+    <div class="well-value">
+      <ng-container *ngIf="item.floating()">
+        {{item.floating().name()}}
+      </ng-container>
+    </div>
+
+    <div class="well-label" i18n>Circ Modifier</div>
+    <div class="well-value">
+      <ng-container *ngIf="item.circ_modifier()">
+        {{item.circ_modifier().name()}}
+      </ng-container>
+    </div>
+
+    <div class="well-label" i18n>Age-based Hold Protection</div>
+    <div class="well-value">
+      <ng-container *ngIf="item.age_protect()">
+        {{item.age_protect().name()}}
+      </ng-container>
+    </div>
+
+    <div class="well-label" i18n>Checkin Workstation</div>
+    <div class="well-value">
+      {{circ.checkin_workstation().name() || 
+        circSummary.last_checkin_workstation().name()}}
+    </div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Inventory Date</div>
+    <div class="well-value">{{item.latest_inventory().inventory_date() | date:'shortDate'}}</div>
+
+    <div class="well-label" i18n>Inventory Workstation</div>
+    <div class="well-value">{{item.latest_inventory().inventory_workstation().name()}}</div>
+
+    <div class="well-label"></div>
+    <div class="well-value"></div>
+    <div class="well-label"></div>
+    <div class="well-value"></div>
+  </div>
+
+  <div class="well-row">
+    <div class="well-label" i18n>Item Alerts</div>
+    <div class="well-value" id="item-status-alert-msg">
+      <button class="btn btn-default" ng-click="additemAlerts(item.id())"  i18n>Add</button>
+      <button class="btn btn-default" ng-disabled="!item_alert_count" ng-click="manageitemAlerts(item.id())"  i18n>Manage</button>
+    </div>
+    <!-- hack to adjust positioning -->
+    <div class="well-label"></div>
+    <div class="well-value"></div>
+    <div class="well-label"></div>
+    <div class="well-value"></div>
+    <div class="well-label"></div>
+    <div class="well-value"></div>
+  </div>
+
+</div>
index 6fac2c1..ea9e6db 100644 (file)
@@ -1,6 +1,6 @@
 import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core';
 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
-import {IdlObject} from '@eg/core/idl.service';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
 import {PcrudService} from '@eg/core/pcrud.service';
 import {AuthService} from '@eg/core/auth.service';
 import {NetService} from '@eg/core/net.service';
@@ -10,7 +10,6 @@ import {EventService} from '@eg/core/event.service';
 import {PatronPenaltyDialogComponent} from '@eg/staff/share/patron/penalty-dialog.component';
 import {BarcodeSelectComponent} from '@eg/staff/share/barcodes/barcode-select.component';
 import {CatalogService} from '@eg/share/catalog/catalog.service';
-import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap';
 
 @Component({
   selector: 'eg-item-summary',
@@ -21,6 +20,9 @@ export class ItemSummaryComponent implements OnInit {
 
     @Input() item: IdlObject;
 
+    circ: IdlObject;
+    circSummary: IdlObject;
+
     constructor(
         private router: Router,
         private route: ActivatedRoute,
@@ -28,18 +30,23 @@ export class ItemSummaryComponent implements OnInit {
         private printer: PrintService,
         private pcrud: PcrudService,
         private auth: AuthService,
+        private idl: IdlService,
         private evt: EventService,
         private cat: CatalogService,
         private holdings: HoldingsService
-    ) {}
+    ) {
+        // Create dummy objects so we can avoid a lot of *ngIf's in the template
+        this.circ = this.idl.create('circ');
+        this.circSummary = this.idl.create('accs');
+        this.circ.duration_rule(this.idl.create('crcd'));
+        this.circ.recurring_fine_rule(this.idl.create('crrf'));
+        this.circ.max_fine_rule(this.idl.create('crmf'));
+    }
 
     ngOnInit() {
 
     }
 
 
-    tabChange(evt: NgbNavChangeEvent) {
-        this.router.navigate([`/staff/cat/item/${this.item.id()}/${evt.nextId}`]);
-    }
 }