(onClick)="markMissingPieces($event)"></eg-grid-toolbar-action>
<eg-grid-toolbar-action
- i18n-group group="Manage" i18n-label label="Manage Item Alerts"
+ i18n-group group="Edit" i18n-label label="Manage Item Alerts"
[disabled]="grid.context.rowSelector.selected().length !== 1"
(onClick)="manageItemAlerts($event)">
</eg-grid-toolbar-action>
<eg-grid-toolbar-action
+ i18n-group group="Edit" i18n-label label="Edit Holdings"
+ (onClick)="editHoldings($event)">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action
+ i18n-group group="Print" i18n-label label="Print Labels"
+ (onClick)="openItemPrintLabels($event)">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action
i18n-group group="Add" i18n-label label="Add Item Alerts"
(onClick)="addItemAlerts($event)">
</eg-grid-toolbar-action>
</eg-grid-toolbar-action>
<eg-grid-toolbar-action
- i18n-group group="Retrieve" i18n-label
+ i18n-group group="Show" i18n-label
label="Retrieve Last Patron Who Circulated Item"
[disabled]="grid.context.rowSelector.selected().length !== 1"
(onClick)="retrieveLastPatron($event)">
</eg-grid-toolbar-action>
+ <eg-grid-toolbar-action
+ i18n-group group="Show" i18n-label
+ label="Show Record Holds"
+ [disabled]="grid.context.rowSelector.selected().length !== 1"
+ (onClick)="showRecordHolds($event)">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action
+ i18n-group group="Show" i18n-label
+ label="Show Last Few Circs"
+ [disabled]="grid.context.rowSelector.selected().length !== 1"
+ (onClick)="showRecentCircs($event)">
+ </eg-grid-toolbar-action>
+
<!-- COLUMNS -->
<eg-grid-column path="index" [index]="true"
import {BackdateDialogComponent} from '@eg/staff/share/circ/backdate-dialog.component';
import {CancelTransitDialogComponent
} from '@eg/staff/share/circ/cancel-transit-dialog.component';
+import {HoldingsService} from '@eg/staff/share/holdings/holdings.service';
+import {AnonCacheService} from '@eg/share/util/anon-cache.service';
interface CheckinGridEntry extends CheckinResult {
private circ: CircService,
private toast: ToastService,
private printer: PrintService,
+ private holdings: HoldingsService,
+ private anonCache: AnonCacheService,
public patronService: PatronService
) {}
this.cancelTransitDialog.open().subscribe();
}
}
+
+ showRecordHolds(rows: CheckinGridEntry[]) {
+
+ const row = rows[0];
+ if (row.record) {
+ const id = row.record.doc_id()
+
+ const url = this.ngLocation.prepareExternalUrl(
+ `/staff/catalog/record/${id}/holds`);
+
+ window.open(url);
+ }
+ }
+
+ showRecentCircs(rows: CheckinGridEntry[]) {
+ const copyId = this.getCopyIds(rows)[0];
+ if (copyId) {
+ const url = `/eg/staff/cat/item/${copyId}/circs`;
+ window.open(url);
+ }
+ }
+
+ editHoldings(rows: CheckinGridEntry[]) {
+ const ids = this.getCopyIds(rows);
+ if (ids.length === 0) { return; }
+
+ this.holdings.spawnAddHoldingsUi(null, null, null, ids);
+ }
+
+ openItemPrintLabels(rows: CheckinGridEntry[]) {
+ const ids = this.getCopyIds(rows);
+ if (ids.length === 0) { return; }
+
+ this.anonCache.setItem(null, 'print-labels-these-copies', {copies: ids})
+ .then(key => {
+ const url = `/eg/staff/cat/printlabels/${key}`;
+ window.open(url);
+ });
+ }
}
--- /dev/null
+<eg-string #success i18n-text text="Transit(s) Successfully Canceled">
+</eg-string>
+<eg-string #failure i18n-text text="Some Transits Failed to Cancel">
+</eg-string>
+
+<ng-template #dialogContent>
+ <div class="modal-header bg-info">
+ <h4 i18n>Cancel Transits</h4>
+ <button type="button" class="close"
+ i18n-aria-label aria-label="Close" (click)="close()">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <strong i18n>Cancel {{numTransits}} transits?</strong>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-success" (click)="proceed()" i18n>
+ Cancel Transits
+ </button>
+ <button type="button" class="btn btn-warning" (click)="close()" i18n>
+ Close Dialog
+ </button>
+ </div>
+</ng-template>
+
+
--- /dev/null
+import {Component, OnInit, Output, Input, ViewChild, EventEmitter} from '@angular/core';
+import {empty, of, from, Observable} from 'rxjs';
+import {concatMap, tap} from 'rxjs/operators';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
+import {NetService} from '@eg/core/net.service';
+import {EventService} from '@eg/core/event.service';
+import {StringComponent} from '@eg/share/string/string.component';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
+import {NgbModal, NgbModalOptions} from '@ng-bootstrap/ng-bootstrap';
+import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {CircService, CheckinResult} from './circ.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
+import {AudioService} from '@eg/share/util/audio.service';
+import {ToastService} from '@eg/share/toast/toast.service';
+import {PrintService} from '@eg/share/print/print.service';
+
+/** Route Item Dialog */
+
+@Component({
+ templateUrl: 'cancel-transit-dialog.component.html',
+ selector: 'eg-cancel-transit-dialog'
+})
+export class CancelTransitDialogComponent extends DialogComponent implements OnInit {
+
+ @Input() transitIds: number[];
+ numTransits: number;
+
+ @ViewChild('success') success: StringComponent;
+ @ViewChild('failure') failure: StringComponent;
+
+ constructor(
+ private modal: NgbModal,
+ private auth: AuthService,
+ private net: NetService,
+ private evt: EventService,
+ private toast: ToastService
+ ) { super(modal); }
+
+ ngOnInit() {
+ this.onOpen$.subscribe(_ => {
+ this.numTransits = this.transitIds.length;
+ });
+ }
+
+ proceed() {
+
+ let changesMade = false;
+ let error = false;
+
+ from(this.transitIds).pipe(concatMap(id => {
+ return this.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.transit.abort',
+ this.auth.token(), {transitid: id}
+ ).pipe(tap(resp => {
+ const evt = this.evt.parse(resp);
+ if (evt) {
+ error = true;
+ this.toast.danger(this.failure.text);
+ console.error(evt);
+ } else {
+ changesMade = true;
+ }
+ }));
+ })).subscribe(null, null, () => {
+ if (changesMade && !error) {
+ this.toast.success(this.success.text);
+ }
+ this.close(changesMade);
+ });
+ }
+}
+
+