LPXXX Item Status Angular WIP
authorBill Erickson <berickxx@gmail.com>
Mon, 21 Jun 2021 15:49:24 +0000 (11:49 -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/item.module.ts
Open-ILS/src/eg2/src/app/staff/cat/item/status.component.html
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
Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts

index 9da2992..a9e31b1 100644 (file)
@@ -7,6 +7,7 @@ import {PatronModule} from '@eg/staff/share/patron/patron.module';
 import {MarkItemMissingPiecesComponent} from './missing-pieces.component';
 import {ItemStatusComponent} from './status.component';
 import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module';
+import {CircModule} from '@eg/staff/share/circ/circ.module';
 import {ItemSummaryComponent} from './summary.component';
 
 @NgModule({
@@ -21,6 +22,7 @@ import {ItemSummaryComponent} from './summary.component';
     ItemRoutingModule,
     HoldingsModule,
     BarcodesModule,
+    CircModule,
     PatronModule
   ],
   providers: [
index 9c91bd7..b44b315 100644 (file)
@@ -2,6 +2,9 @@
 </eg-staff-banner>
 
 <eg-barcode-select #barcodeSelect></eg-barcode-select>
+<eg-circ-components></eg-circ-components>
+<eg-copy-alerts-dialog #copyAlertsDialog></eg-copy-alerts-dialog>
+<eg-bucket-dialog #bucketDialog></eg-bucket-dialog>
 
 <div class="row">
   <div class="col-lg-12 form-inline">
index 531d1b0..38f3e1c 100644 (file)
@@ -11,6 +11,10 @@ import {PatronPenaltyDialogComponent} from '@eg/staff/share/patron/penalty-dialo
 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';
+import {CopyAlertsDialogComponent
+    } from '@eg/staff/share/holdings/copy-alerts-dialog.component';
+import {BucketDialogComponent
+    } from '@eg/staff/share/buckets/bucket-dialog.component';
 
 @Component({
   templateUrl: 'status.component.html'
@@ -24,7 +28,8 @@ export class ItemStatusComponent implements OnInit, AfterViewInit {
     item: IdlObject;
     tab: string;
 
-    @ViewChild('barcodeSelect') barcodeSelect: BarcodeSelectComponent;
+    @ViewChild('barcodeSelect') private barcodeSelect: BarcodeSelectComponent;
+    @ViewChild('bucketDialog') private bucketDialog: BucketDialogComponent;
 
     constructor(
         private router: Router,
index 8be3f98..f688317 100644 (file)
@@ -1,3 +1,6 @@
+
+<eg-copy-alerts-dialog #copyAlertsDialog></eg-copy-alerts-dialog>
+
 <div class="alert alert-danger" *ngIf="item.deleted() == 't'">
   This item has been marked as Deleted.
 </div>
     <div class="well-value" id="item-status-alert-msg">
       <button class="btn btn-outline-dark" (click)="addItemAlerts()" i18n>Add</button>
       <button class="btn btn-outline-dark" [disabled]="item.copy_alerts().length == 0"
-        (click)="manageitemAlerts()"  i18n>Manage</button>
+        (click)="manageItemAlerts()"  i18n>Manage</button>
     </div>
 
     <!-- maintain positioning -->
index 8f6379e..41cc81c 100644 (file)
@@ -12,6 +12,9 @@ import {PermService} from '@eg/core/perm.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 {CircService} from '@eg/staff/share/circ/circ.service';
+import {CopyAlertsDialogComponent
+    } from '@eg/staff/share/holdings/copy-alerts-dialog.component';
 
 @Component({
   selector: 'eg-item-summary',
@@ -29,6 +32,8 @@ export class ItemSummaryComponent implements OnInit {
     maxHistoryCount: number;
     loading = false;
 
+    @ViewChild('copyAlertsDialog') private copyAlertsDialog: CopyAlertsDialogComponent;
+
     constructor(
         private router: Router,
         private route: ActivatedRoute,
@@ -41,9 +46,9 @@ export class ItemSummaryComponent implements OnInit {
         private idl: IdlService,
         private evt: EventService,
         private cat: CatalogService,
-        private holdings: HoldingsService
-    ) {
-    }
+        private holdings: HoldingsService,
+        private circs: CircService
+    ) { }
 
     ngOnInit() {
         this.loading = true;
@@ -95,24 +100,14 @@ export class ItemSummaryComponent implements OnInit {
 
             if (!circ) return Promise.resolve();
 
-            // load the chain for this circ
-            return this.net.request(
-                'open-ils.circ',
-                'open-ils.circ.renewal_chain.retrieve_by_circ.summary',
-                this.auth.token(), this.circ.id()
-            ).toPromise().then(summary => {
+            return this.circs.getCircChain(this.circ.id())
+            .then(summary => {
                 this.circSummary = summary
 
                 if (this.maxHistoryCount <= 1) { return; }
 
-                // load the chain for the previous circ, plus the user
-
-                return this.net.request(
-                    'open-ils.circ',
-                    'open-ils.circ.prev_renewal_chain.retrieve_by_circ.summary',
-                    this.auth.token(), this.circ.id()
-
-                ).toPromise().then(summary => {
+                return this.circs.getPrevCircChain(this.circ.id())
+                .then(summary => {
                     if (!summary) { return; }
 
                     this.prevCircSummary = summary.summary;
@@ -130,10 +125,15 @@ export class ItemSummaryComponent implements OnInit {
 
 
     addItemAlerts() {
+        this.copyAlertsDialog.copyIds = [this.item.id()];
+        this.copyAlertsDialog.mode = 'create';
+        this.copyAlertsDialog.open({size: 'lg'}).subscribe();
     }
 
     manageItemAlerts() {
+        this.copyAlertsDialog.copyIds = [this.item.id()];
+        this.copyAlertsDialog.mode = 'manage';
+        this.copyAlertsDialog.open({size: 'lg'}).subscribe();
     }
-
 }
 
index ffe0d38..882a808 100644 (file)
@@ -1228,5 +1228,23 @@ export class CircService {
 
         return checkDigit;
     }
+
+    getCircChain(circId: number): Promise<IdlObject> {
+        return this.net.request(
+            'open-ils.circ',
+            'open-ils.circ.renewal_chain.retrieve_by_circ.summary',
+            this.auth.token(), circId
+        ).toPromise();
+    }
+
+    getPrevCircChain(circId: number): Promise<IdlObject> {
+
+        return this.net.request(
+            'open-ils.circ',
+            'open-ils.circ.prev_renewal_chain.retrieve_by_circ.summary',
+            this.auth.token(), circId
+
+        ).toPromise();
+    }
 }