.pipe(tap(circ => {
const entry: CircGridEntry = {
+ index: `ancc-${circ.id()}`,
title: circ.item_type().name(),
dueDate: circ.duedate()
};
[disablePaging]="true" [persistKey]="persistKey">
<eg-grid-toolbar-action
+ i18n-group group="View" i18n-label label="Print Item Receipt(s)"
+ (onClick)="printReceipts($event)">
+ </eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action
i18n-group group="Add" i18n-label label="Add Item Alerts"
(onClick)="openItemAlerts($event, 'create')">
</eg-grid-toolbar-action>
- <eg-grid-column [index]="true" path="circ.id"
+ <eg-grid-column [index]="true" path="index" [hidden]="true"
+ label="Row Index" i18n-label></eg-grid-column>
+
+ <eg-grid-column path="circ.id"
label="Circ ID" i18n-label></eg-grid-column>
<!-- TODO
import {CopyAlertsDialogComponent
} from '@eg/staff/share/holdings/copy-alerts-dialog.component';
import {ArrayUtil} from '@eg/share/util/array';
+import {PrintService} from '@eg/share/print/print.service';
export interface CircGridEntry {
+ index: string; // class + id -- row index
title?: string;
author?: string;
isbn?: string;
export class CircGridComponent implements OnInit {
@Input() persistKey: string;
+ @Input() printTemplate: string; // defaults to items_out
entries: CircGridEntry[] = null;
gridDataSource: GridDataSource = new GridDataSource();
public circ: CircService,
private audio: AudioService,
private store: StoreService,
+ private printer: PrintService,
private serverStore: ServerStoreService
) {}
gridify(circ: IdlObject): CircGridEntry {
const entry: CircGridEntry = {
+ index: `circ-${circ.id()}`,
circ: circ,
dueDate: circ.due_date(),
copyAlertCount: 0 // TODO
}
);
}
+
+ printReceipts(rows: any) {
+ if (rows.length > 0) {
+ this.printer.print({
+ templateName: this.printTemplate || 'items_out',
+ contextData: {circulations: rows},
+ printContext: 'default'
+ });
+ }
+ }
}
'cwst', 'label'
)
);
-*/
eg.circ.patron.holds.prefetch
holds_for_patron print template
+items out print template
+*/
+
+-- insert then update for easier iterative development tweaks
+/*
+INSERT INTO config.print_template
+ (name, label, owner, active, locale, content_type, template)
+VALUES ('items_out', 'Patron Items Out', 1, TRUE, 'en-US', 'text/html', '');
+*/
+
+UPDATE config.print_template SET template = $TEMPLATE$
+[%
+ USE date;
+ circulations = template_data.circulations;
+%]
+<div>
+ <div>Welcome to [% staff_org.name %]</div>
+ <div>You have the following items:</div>
+ <hr/>
+ <ol>
+ [% FOR checkout IN circulations %]
+ <li>
+ <div>[% checkout.title %]</div>
+ <div>
+ [% IF checkout.copy %]Barcode: [% checkout.copy.barcode %][% END %]
+ Due: [% date.format(helpers.format_date(checkout.dueDate, staff_org_timezone), '%x %r') %]
+ </div>
+ </li>
+ [% END %]
+ </ol>
+ <hr/>
+ <div>[% staff_org.name %] [% date.format(date.now, '%x %r') %]</div>
+ <div>You were helped by [% staff.first_given_name %]</div>
+ <br/>
+</div>
+$TEMPLATE$ WHERE name = 'items_out';
+
COMMIT;
+
+