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'
item: IdlObject;
tab: string;
- @ViewChild('barcodeSelect') barcodeSelect: BarcodeSelectComponent;
+ @ViewChild('barcodeSelect') private barcodeSelect: BarcodeSelectComponent;
+ @ViewChild('bucketDialog') private bucketDialog: BucketDialogComponent;
constructor(
private router: Router,
+
+<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 -->
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',
maxHistoryCount: number;
loading = false;
+ @ViewChild('copyAlertsDialog') private copyAlertsDialog: CopyAlertsDialogComponent;
+
constructor(
private router: Router,
private route: ActivatedRoute,
private idl: IdlService,
private evt: EventService,
private cat: CatalogService,
- private holdings: HoldingsService
- ) {
- }
+ private holdings: HoldingsService,
+ private circs: CircService
+ ) { }
ngOnInit() {
this.loading = true;
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;
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();
}
-
}
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();
+ }
}