<eg-link-table-link i18n-label label="Transit List"
url="/eg/staff/circ/transits/list"></eg-link-table-link>
<eg-link-table-link i18n-label label="Work Log"
- url="/eg/staff/admin/workstation/log"></eg-link-table-link>
+ routerLink="/staff/circ/worklog"></eg-link-table-link>
</eg-link-table>
</div>
loadChildren: () =>
import('./item/routing.module').then(m => m.CircItemRoutingModule)
}, {
+ path: 'worklog',
+ loadChildren: () =>
+ import('./worklog/worklog.module').then(m => m.CircWorkLogModule)
+}, {
path: 'holds',
loadChildren: () =>
import('./holds/holds.module').then(m => m.HoldsUiModule)
--- /dev/null
+import {NgModule} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {CircWorkLogComponent} from './worklog.component';
+
+const routes: Routes = [{
+ path: '',
+ component: CircWorkLogComponent
+}];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule]
+})
+export class CircWorkLogRoutingModule {}
--- /dev/null
+<eg-staff-banner i18n-bannerText bannerText="Work Log"></eg-staff-banner>
+
+<eg-worklog-strings-components></eg-worklog-strings-components>
+
+<ng-template #barcodeTemplate let-r="row">
+ <a target="_blank" href="/eg/staff/circ/patron/{{r.usr().id()}}/edit">
+ {{r.usr().card().barcode()}}
+ </a>
+</ng-template>
+
+<ng-template #userTemplate let-row="row">
+ <a *ngIf="row.user && row.patron_id"
+ routerLink="/staff/circ/patron/{{row.patron_id}}">{{row.user}}</a>
+</ng-template>
+
+<ng-template #itemTemplate let-row="row">
+ <a *ngIf="row.item && row.item_id"
+ routerLink="/staff/cat/item/{{row.item_id}}/summary">{{row.item}}</a>
+</ng-template>
+
+
+<eg-grid #grid [dataSource]="actionDataSource"
+ [sortable]="true" [useLocalSort]="true" [cellTextGenerator]="cellTextGenerator"
+ toolbarLabel="Most Recently Logged Staff Actions" i18n-toolbarLabel
+ persistKey="circ.worklog.actions" (onRowActivate)="showPatron($event)">
+
+ <eg-grid-toolbar-action i18n-label label="Retrieve Patron"
+ (onClick)="showPatron($event[0])"></eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action i18n-label label="Retrieve Item"
+ (onClick)="showItem($event[0])"></eg-grid-toolbar-action>
+
+ <eg-grid-column path='index' i18n-label label="Index" [index]="true"
+ [hidden]="true"></eg-grid-column>
+
+ <eg-grid-column path='action' i18n-label label="Code" [hidden]="true">
+ </eg-grid-column>
+
+ <eg-grid-column path='msg' i18n-label label="Message"></eg-grid-column>
+
+ <eg-grid-column path='amount' i18n-label label="Amount" [hidden]="true">
+ </eg-grid-column>
+
+ <eg-grid-column path='user' i18n-label label="Patron"
+ [cellTemplate]="userTemplate"></eg-grid-column>
+
+ <eg-grid-column path='item' i18n-label label="Item"
+ [cellTemplate]="itemTemplate"></eg-grid-column>
+
+ <eg-grid-column path='when' i18n-label label="When" datatype="timestamp"
+ [datePlusTime]="true"></eg-grid-column>
+
+ <eg-grid-column path='actor' i18n-label label="Staff" [hidden]="true">
+ </eg-grid-column>
+
+
+</eg-grid>
+
+<hr class="mt-2 mb-2"/>
+
+<eg-grid #grid [dataSource]="patronDataSource"
+ [sortable]="true" [useLocalSort]="true" [cellTextGenerator]="cellTextGenerator"
+ toolbarLabel="Most Recently Affected Patrons" i18n-toolbarLabel
+ persistKey="circ.worklog.patrons" (onRowActivate)="showPatron($event)">
+
+ <eg-grid-toolbar-action i18n-label label="Retrieve Patron"
+ (onClick)="showPatron($event[0])"></eg-grid-toolbar-action>
+
+ <eg-grid-toolbar-action i18n-label label="Retrieve Item"
+ (onClick)="showItem($event[0])"></eg-grid-toolbar-action>
+
+ <eg-grid-column path='index' i18n-label label="Index" [index]="true"
+ [hidden]="true"></eg-grid-column>
+
+ <eg-grid-column path='action' i18n-label label="Code" [hidden]="true">
+ </eg-grid-column>
+
+ <eg-grid-column path='msg' i18n-label label="Message"></eg-grid-column>
+
+ <eg-grid-column path='amount' i18n-label label="Amount" [hidden]="true">
+ </eg-grid-column>
+
+ <eg-grid-column path='user' i18n-label label="Patron"
+ [cellTemplate]="userTemplate"></eg-grid-column>
+
+ <eg-grid-column path='item' i18n-label label="Item"
+ [cellTemplate]="itemTemplate"></eg-grid-column>
+
+ <eg-grid-column path='when' i18n-label label="When" datatype="timestamp"
+ [datePlusTime]="true"></eg-grid-column>
+
+ <eg-grid-column path='actor' i18n-label label="Staff" [hidden]="true">
+ </eg-grid-column>
+
+ <!--
+ <eg-grid-column name="barcode" [cellTemplate]="barcodeTemplate">
+ </eg-grid-column>
+ -->
+
+</eg-grid>
+
--- /dev/null
+import {Component, OnInit, Renderer2, ViewChild} from '@angular/core';
+import {Router, ActivatedRoute} from '@angular/router';
+import {Observable, empty, of, from} from 'rxjs';
+import {concatMap} from 'rxjs/operators';
+import {IdlObject} from '@eg/core/idl.service';
+import {OrgService} from '@eg/core/org.service';
+import {AuthService} from '@eg/core/auth.service';
+import {PcrudService} from '@eg/core/pcrud.service';
+import {GridDataSource, GridCellTextGenerator} from '@eg/share/grid/grid';
+import {GridComponent} from '@eg/share/grid/grid.component';
+import {Pager} from '@eg/share/util/pager';
+import {Location} from '@angular/common';
+import {WorkLogEntry, WorkLogService} from '@eg/staff/share/worklog/worklog.service';
+
+@Component({
+ templateUrl: 'worklog.component.html'
+})
+
+export class CircWorkLogComponent implements OnInit {
+
+ autoIndex = 1;
+ cellTextGenerator: GridCellTextGenerator;
+ actionDataSource: GridDataSource = new GridDataSource();
+ patronDataSource: GridDataSource = new GridDataSource();
+
+ @ViewChild('actionGrid') actionGrid: GridComponent;
+ @ViewChild('patronGrid') patronGrid: GridComponent;
+
+ constructor(
+ private router: Router,
+ private ngLocation: Location,
+ private org: OrgService,
+ private auth: AuthService,
+ private pcrud: PcrudService,
+ private workLog: WorkLogService,
+ ) { }
+
+ ngOnInit() {
+
+ this.workLog.loadSettings();
+
+ this.actionDataSource.getRows =
+ (pager: Pager, sort: any[]): Observable<any> => {
+
+ const actions = this.workLog.getActions()
+ actions.forEach(p => p.index = this.autoIndex++);
+
+ return from(actions);
+ };
+
+ this.patronDataSource.getRows =
+ (pager: Pager, sort: any[]): Observable<any> => {
+
+ const patrons = this.workLog.getPatrons();
+ patrons.forEach(p => p.index = this.autoIndex++);
+
+ return from(patrons);
+ };
+
+ this.cellTextGenerator = {
+ user: row => row.user,
+ item: row => row.item
+ };
+ }
+
+ showPatron(row: IdlObject) {
+ if (row.patron_id) {
+ const url = this.ngLocation.prepareExternalUrl(
+ `/staff/circ/patron/${row.patron_id}/checkout`);
+ window.open(url);
+ }
+ }
+
+ showItem(row: IdlObject) {
+ if (row.item_id) {
+ const url = this.ngLocation.prepareExternalUrl(
+ `/staff/cat/item/${row.item_id}/summary`);
+ window.open(url);
+ }
+ }
+
+}
+
--- /dev/null
+import {NgModule} from '@angular/core';
+import {StaffCommonModule} from '@eg/staff/common.module';
+import {CircWorkLogRoutingModule} from './routing.module';
+import {CircWorkLogComponent} from './worklog.component';
+import {WorkLogModule} from '@eg/staff/share/worklog/worklog.module';
+
+@NgModule({
+ declarations: [
+ CircWorkLogComponent
+ ],
+ imports: [
+ StaffCommonModule,
+ CircWorkLogRoutingModule,
+ WorkLogModule
+ ],
+ providers: [
+ ]
+})
+
+export class CircWorkLogModule {}
+
<span class="material-icons" aria-hidden="true">grid_on</span>
<span i18n>Scan Item as Missing Pieces</span>
</a>
+ <a class="dropdown-item" routerLink="/staff/circ/worklog">
+ <span class="material-icons">history</span>
+ <span i18n>Work Log</span>
+ </a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" (click)="reprintLast()"
egAccessKey keyCtx="navbar" i18n-keySpec i18n-keyDesc
patron_id?: number;
hold_id?: number;
amount?: number; // paid amount
+ index?: number; // for grid display
}
});
}
+ getPatrons(): WorkLogEntry[] {
+ return this.store.getLocalItem('eg.patron_log') || [];
+ }
+
+ getActions(): WorkLogEntry[] {
+ return this.store.getLocalItem('eg.work_log') || [];
+ }
+
record(entry: WorkLogEntry) {
if (this.maxEntries === null) {
<span>[% l('Scan Item as Missing Pieces') %]</span>
</a>
</li>
+ <li>
+ <a href="/eg2/staff/circ/worklog">
+ <span class="glyphicon glyphicon-th" aria-hidden="true"></span>
+ <span>[% l('Work Log') %]</span>
+ </a>
+ </li>
<li class="divider"></li>
<li>
<a href="" ng-click="reprintLast($event)"