<eg-grid-column path="index" [index]="true"
label="Row Index" i18n-label [hidden]="true"></eg-grid-column>
<eg-grid-column path="circ.id" label="Circ ID" i18n-label></eg-grid-column>
+
+ <!-- TODO
+ [datePlusTime]="true" when non-full-day circ
+ -->
+ <eg-grid-column path="dueDate" label="Due Date" i18n-label
+ datatype="timestamp"></eg-grid-column>
+
+ <eg-grid-column path="copy.barcode" label="Barcode" i18n-label></eg-grid-column>
+
<eg-grid-column path="title" label="Title" i18n-label
[cellTemplate]="titleTemplate"></eg-grid-column>
</eg-grid>
import {OrgService} from '@eg/core/org.service';
import {NetService} from '@eg/core/net.service';
import {PatronService} from '@eg/staff/share/patron/patron.service';
-import {PatronManagerService} from './patron.service';
+import {PatronManagerService, CircGridEntry} from './patron.service';
import {CheckoutParams, CheckoutResult, CircService} from '@eg/staff/share/circ/circ.service';
import {PromptDialogComponent} from '@eg/share/dialog/prompt.component';
import {GridDataSource, GridColumn, GridCellTextGenerator} from '@eg/share/grid/grid';
import {GridComponent} from '@eg/share/grid/grid.component';
import {Pager} from '@eg/share/util/pager';
-interface CircGridEntry {
- title?: string;
- circ?: IdlObject;
- copyAlertCount: number;
-}
-
@Component({
templateUrl: 'checkout.component.html',
selector: 'eg-patron-checkout'
maxNoncats = 99; // Matches AngJS version
checkoutNoncat: IdlObject = null;
checkoutBarcode = '';
- checkouts: CircGridEntry[] = [];
gridDataSource: GridDataSource = new GridDataSource();
cellTextGenerator: GridCellTextGenerator;
this.circ.getNonCatTypes();
this.gridDataSource.getRows = (pager: Pager, sort: any[]) => {
- return from(this.checkouts);
+ return from(this.context.checkouts);
};
this.cellTextGenerator = {
gridifyResult(result: CheckoutResult) {
const entry: CircGridEntry = {
+ title: '',
+ copy: result.copy,
circ: result.circ,
+ dueDate: null,
copyAlertCount: 0 // TODO
};
- if (this.checkoutNoncat) {
+ if (result.nonCatCirc) {
+
entry.title = this.checkoutNoncat.name();
- } else if (result.record) {
- entry.title = result.record.title();
+ entry.dueDate = result.nonCatCirc.duedate();
+
+ } else {
+
+ if (result.record) {
+ entry.title = result.record.title();
+ }
+
+ if (result.circ) {
+ entry.dueDate = result.circ.due_date();
+ }
}
- this.checkouts.unshift(entry);
+ this.context.checkouts.unshift(entry);
this.checkoutsGrid.reload();
}
import {PatronService} from '@eg/staff/share/patron/patron.service';
import {PatronSearch} from '@eg/staff/share/patron/search.component';
+export interface CircGridEntry {
+ title?: string;
+ copy?: IdlObject;
+ circ?: IdlObject;
+ dueDate?: string;
+ copyAlertCount: number;
+}
+
const PATRON_FLESH_FIELDS = [
'card',
'cards',
lastPatronSearch: PatronSearch;
+ // These should persist tab changes
+ checkouts: CircGridEntry[] = [];
+
constructor(
private net: NetService,
private auth: AuthService,
loadPatron(id: number): Promise<any> {
this.loaded = false;
this.patron = null;
+ this.checkouts = [];
return this.net.request(
'open-ils.actor',