--- /dev/null
+
+
+<div class="row mt-3" *ngIf="noRecents">
+ <div class="col-lg-6 offset-lg-3 alert alert-warning" i18n>
+ No patrons recently accessed
+ </div>
+</div>
--- /dev/null
+import {Component, Input, OnInit, AfterViewInit, ViewChild} from '@angular/core';
+import {Router, ActivatedRoute, ParamMap} from '@angular/router';
+import {AlertDialogComponent} from '@eg/share/dialog/alert.component';
+import {StoreService} from '@eg/core/store.service';
+
+@Component({
+ templateUrl: 'last.component.html'
+})
+export class LastPatronComponent implements OnInit {
+ noRecents = false;
+
+ constructor(
+ private router: Router,
+ private route: ActivatedRoute,
+ private store: StoreService
+ ) {}
+
+ ngOnInit() {
+
+ const ids = this.store.getLoginSessionItem('eg.circ.recent_patrons');
+ if (ids && ids[0]) {
+ this.noRecents = false;
+ this.router.navigate([`/staff/circ/patron/${ids[0]}/checkout`]);
+ } else {
+ this.noRecents = true;
+ }
+ }
+}
import {PatronPermsComponent} from './perms.component';
import {BillingHistoryComponent} from './billing-history.component';
import {WorkLogModule} from '@eg/staff/share/worklog/worklog.module';
+import {LastPatronComponent} from './last.component';
@NgModule({
declarations: [
RegisterPatronComponent,
PatronStatCatsComponent,
PatronPermsComponent,
+ LastPatronComponent,
PatronBarcodesDialogComponent,
SecondaryGroupsDialogComponent,
HoldNotifyUpdateDialogComponent
} from '@eg/staff/share/patron/patron.service';
import {PatronSearch} from '@eg/staff/share/patron/search.component';
import {StoreService} from '@eg/core/store.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
import {CircService, CircDisplayInfo} from '@eg/staff/share/circ/circ.service';
export interface BillGridEntry extends CircDisplayInfo {
// These should persist tab changes
checkouts: CircGridEntry[] = [];
+ maxRecentPatrons = 1;
+
settingsCache: {[key: string]: any} = {};
constructor(
private store: StoreService,
+ private serverStore: ServerStoreService,
private org: OrgService,
private circ: CircService,
public patrons: PatronService
return this.patrons.getFleshedById(id, PATRON_FLESH_FIELDS)
.then(p => this.summary = new PatronSummary(p))
.then(_ => this.getPatronStats(id))
- .then(_ => this.compileAlerts());
+ .then(_ => this.compileAlerts())
+ .then(_ => this.addRecentPatron())
+ }
+
+ addRecentPatron(): Promise<any> {
+
+ return this.serverStore.getItem('ui.staff.max_recent_patrons')
+ .then(sets => {
+ const num = sets['ui.staff.max_recent_patrons'];
+ if (num) { this.maxRecentPatrons = num; }
+
+ const patrons: number[] =
+ this.store.getLoginSessionItem('eg.circ.recent_patrons') || [];
+
+ patrons.splice(0, 0, this.summary.id); // put this user at front
+ patrons.splice(this.maxRecentPatrons, 1); // remove excess
+
+ // remove any other occurrences of this user, which may have been
+ // added before the most recent user.
+ const idx = patrons.indexOf(this.summary.id, 1);
+ if (idx > 0) { patrons.splice(idx, 1); }
+
+ this.store.setLoginSessionItem('eg.circ.recent_patrons', patrons);
+ });
}
getPatronStats(id: number): Promise<any> {
'eg.circ.patron.summary.collapse',
'circ.do_not_tally_claims_returned',
'circ.tally_lost',
+ 'ui.staff.max_recent_patrons',
'ui.staff.require_initials.patron_standing_penalty',
'ui.admin.work_log.max_entries',
'ui.admin.patron_log.max_entries',
import {PatronResolver} from './resolver.service';
import {TestPatronPasswordComponent} from './test-password.component';
import {RegisterPatronComponent} from './register.component';
+import {LastPatronComponent} from './last.component';
import {CanDeactivateGuard} from '@eg/share/util/can-deactivate.guard';
const routes: Routes = [{
component: RegisterPatronComponent,
resolve: {resolver : PatronResolver}
}, {
+ path: 'last',
+ component: LastPatronComponent,
+ resolve: {resolver : PatronResolver}
+ }, {
path: 'register/clone/:cloneId',
component: RegisterPatronComponent,
resolve: {resolver : PatronResolver}