LP1936233 Recent circs tab
authorBill Erickson <berickxx@gmail.com>
Wed, 14 Jul 2021 21:18:37 +0000 (17:18 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 14 Jul 2021 21:18:37 +0000 (17:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/item/circ-history.component.html
Open-ILS/src/eg2/src/app/staff/cat/item/circ-history.component.ts
Open-ILS/src/eg2/src/app/staff/cat/item/item.module.ts
Open-ILS/src/eg2/src/app/staff/cat/item/recent-history.component.html

index 24eb48a..44d0987 100644 (file)
@@ -1,2 +1,65 @@
 
-<b>I have {{recentCircs.length}} recent circs</b>
+<eg-add-billing-dialog #billingDialog></eg-add-billing-dialog>
+
+<eg-string key="staff.cat.item.circs.billing" i18n-text text="Billing Added">
+</eg-string>
+
+<div class="row" *ngFor="let circ of recentCircs">
+  <div class="col-lg-12 well-table">
+    <div class="well-row">
+      <div class="well-value">
+        <a i18n
+          routerLink="/staff/circ/patron/{{circ.usr().id()}}">
+          {{circ.usr().family_name()}}, 
+          {{circ.usr().first_given_name()}}, 
+          {{circ.usr().second_given_name()}} :
+          {{circ.usr().card().barcode()}}
+        </a>
+        <span class="pl-3" i18n>Circulation ID: {{circ.id()}}</span>
+      </div>
+      <div class="mt-2">
+        <button class="btn btn-outline-dark" (click)="addBilling(circ.id())" i18n>
+          Add Billing
+        </button>
+      </div>
+    </div>
+    <div class="well-row">
+      <div class="well-label" i18n>Check Out Date</div>
+      <div class="well-value">
+          {{circ.xact_start() | formatValue:'timestamp'}}
+      </div>
+      <div class="well-label" i18n>Due Date</div>
+      <div class="well-value">
+        {{circ | egDueDate}}
+      </div>
+      <div class="well-label" i18n>Stop Fines Time</div>
+      <div class="well-value">
+          {{circ.stop_fines_time() | formatValue:'timestamp'}}
+      </div>
+      <div class="well-label" i18n>Checkin Time</div>
+      <div class="well-value">
+          {{circ.checkin_time() | formatValue:'timestamp'}}
+      </div>
+    </div>
+    <div class="well-row">
+      <div class="well-label" i18n>Check Out Library</div>
+      <div class="well-value">
+        {{circ.circ_lib().shortname()}}
+      </div>
+      <div class="well-label" i18n>Renewal?</div>
+      <div class="well-value">
+        <eg-bool [value]="circ.parent_circ() != null"></eg-bool>
+      </div>
+      <div class="well-label" i18n>Stop Fines Reason</div>
+      <div class="well-value">
+        {{circ.stop_fines()}}
+      </div>
+      <div class="well-label" i18n>Check In Library</div>
+      <div class="well-value">
+        <ng-container *ngIf="circ.checkin_lib()">
+          {{circ.checkin_lib().shortname()}}
+        </ng-container>
+      </div>
+    </div>
+  </div>
+</div>
index c754936..2a73bbe 100644 (file)
@@ -16,6 +16,9 @@ import {CircService, ItemCircInfo} from '@eg/staff/share/circ/circ.service';
 import {CopyAlertsDialogComponent
     } from '@eg/staff/share/holdings/copy-alerts-dialog.component';
 import {FormatService} from '@eg/core/format.service';
+import {AddBillingDialogComponent} from '@eg/staff/share/billing/billing-dialog.component';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {StringService} from '@eg/share/string/string.service';
 
 @Component({
   selector: 'eg-item-circ-history',
@@ -28,6 +31,7 @@ export class ItemCircHistoryComponent implements OnInit {
     recentCircs: IdlObject[] = [];
 
     loading = false;
+    @ViewChild('billingDialog') private billingDialog: AddBillingDialogComponent;
 
     constructor(
         private router: Router,
@@ -43,15 +47,38 @@ export class ItemCircHistoryComponent implements OnInit {
         private cat: CatalogService,
         private holdings: HoldingsService,
         private circs: CircService,
+        private toast: ToastService,
+        private strings: StringService,
         public  format: FormatService
     ) { }
 
     ngOnInit() {
+        this.load();
+    }
+
+    load(): Promise<any> {
         this.loading = true;
-        this.circs.getRecentCircs(this.item)
-        .then(circs => this.recentCircs = circs)
+        return this.circs.getRecentCircs(this.item)
+        .then(circs => {
+            circs.forEach(circ => {
+                circ.circ_lib(this.org.get(circ.circ_lib()));
+                circ.checkin_lib(this.org.get(circ.checkin_lib()));
+            });
+            this.recentCircs = circs;
+        })
         .then(_ => this.loading = false);
     }
+
+    addBilling(circId: number) {
+        this.billingDialog.xactId = circId;
+        this.billingDialog.open().subscribe(data => {
+            // No need to reload the data since money is not displayed.
+            if (data) {
+                this.strings.interpolate('staff.cat.item.circs.billing')
+                .then(str => this.toast.success(str));
+            }
+        });
+    }
 }
 
 
index 5bad3bc..28d527c 100644 (file)
@@ -4,6 +4,7 @@ import {CommonWidgetsModule} from '@eg/share/common-widgets.module';
 import {ItemRoutingModule} from './routing.module';
 import {HoldingsModule} from '@eg/staff/share/holdings/holdings.module';
 import {PatronModule} from '@eg/staff/share/patron/patron.module';
+import {BillingModule} from '@eg/staff/share/billing/billing.module';
 import {MarkItemMissingPiecesComponent} from './missing-pieces.component';
 import {ItemStatusComponent} from './status.component';
 import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module';
@@ -27,7 +28,8 @@ import {ItemCircHistoryComponent} from './circ-history.component';
     HoldingsModule,
     BarcodesModule,
     CircModule,
-    PatronModule
+    PatronModule,
+    BillingModule
   ],
   providers: [
   ]
index e794e3a..39b30dc 100644 (file)
@@ -38,7 +38,7 @@
       <div class="well-row">
         <div class="well-label" i18n>Last Renewed On</div>
         <div class="well-value">
-          {{circInfo.prevCircSummary.last_renewal_time() |  formatValue:'timestamp'}}
+          {{circInfo.prevCircSummary.last_renewal_time() | formatValue:'timestamp'}}
         </div>
       </div>
 
       <div class="well-row">
         <div class="well-label" i18n>Checkout Date</div>
         <div class="well-value">
-          {{circInfo.circSummary.start_time() |  formatValue:'timestamp'}}
+          {{circInfo.circSummary.start_time() | formatValue:'timestamp'}}
         </div>
       </div>
 
       <div class="well-row">
         <div class="well-label" i18n>Last Renewed On</div>
         <div class="well-value">
-          {{circInfo.circSummary.last_renewal_time() |  formatValue:'timestamp'}}
+          {{circInfo.circSummary.last_renewal_time() | formatValue:'timestamp'}}
         </div>
       </div>