</div>
</div>
+<div class="row pb-1 pt-1" *ngIf="addressAlerts.length > 0">
+ <div class="col-lg-12 d-flex">
+ <div class="ml-auto mr-2">
+ <div *ngFor="let alert of addressAlerts"
+ class="alert alert-danger ml-auto p-2 mt-2" i18n>
+ Address Alert: {{alert.alert_message()}}
+ </div>
+ </div>
+ </div>
+</div>
+
<div class="row pb-1 pt-1" *ngIf="dupesFound().length > 0">
<div class="col-lg-12 d-flex">
<div class="ml-auto mr-2">
import {Router, ActivatedRoute, ParamMap} from '@angular/router';
import {NgbNav, NgbNavChangeEvent} from '@ng-bootstrap/ng-bootstrap';
import {OrgService} from '@eg/core/org.service';
+import {IdlService, IdlObject} from '@eg/core/idl.service';
import {NetService} from '@eg/core/net.service';
import {AuthService} from '@eg/core/auth.service';
import {PatronService} from '@eg/staff/share/patron/patron.service';
printClicked: EventEmitter<void> = new EventEmitter<void>();
searches: {[category: string]: DupeSearch} = {};
+ addressAlerts: IdlObject[] = [];
constructor(
private org: OrgService,
+ private idl: IdlService,
private net: NetService,
private auth: AuthService,
private patronService: PatronService,
return Object.values(this.searches).filter(dupe => dupe.count > 0);
}
-
-
checkDupes(category: string, search: PatronSearchFieldSet) {
this.net.request(
};
});
}
+
+ checkAddressAlerts(addr: IdlObject) {
+ const addrHash = this.idl.toHash(addr);
+ const patron = this.context.summary.patron;
+ addrHash.mailing_address = addr.id() === patron.mailing_address().id();
+ addrHash.billing_address = addr.id() === patron.billing_address().id();
+ this.net.request(
+ 'open-ils.actor',
+ 'open-ils.actor.address_alert.test',
+ this.auth.token(), this.auth.user().ws_ou(), addrHash
+ ).subscribe(alerts => this.addressAlerts = alerts);
+ }
}
i18n-dialogBody dialogBody="An address is required during registration">
</eg-alert-dialog>
+<eg-alert-dialog #xactCollisionAlert
+ i18n-dialogTitle dialogTitle="Save Collision"
+ i18n-dialogBody dialogBody="Patron record was modified by another user while you were
+ editing it. Your changes were not saved; please reapply them.">
+</eg-alert-dialog>
+
<eg-hold-notify-update-dialog #holdNotifyUpdateDialog>
</eg-hold-notify-update-dialog>
@ViewChild('addrAlert') private addrAlert: AlertDialogComponent;
@ViewChild('addrRequiredAlert')
private addrRequiredAlert: AlertDialogComponent;
+ @ViewChild('xactCollisionAlert')
+ private xactCollisionAlert: AlertDialogComponent;
autoId = -1;
case 'city':
// dupe search on address wants the address object as the value.
this.dupeValueChange('address', obj);
- // TODO address_alert(obj);
+ this.toolbar.checkAddressAlerts(obj);
break;
case 'post_code':
if (evt) {
console.error('Patron update failed with', evt);
if (evt.textcode === 'XACT_COLLISION') {
- // TODO alert
+ this.xactCollisionAlert.open().toPromise().then(_ =>
+ window.location.href = window.location.href
+ );
}
- }
+ } else {
- alert('Patron update failed:' + result);
+ alert('Patron update failed:' + result);
+ }
return Promise.reject('Save Failed');
});
<a href class="nav-link" (click)="toggleSummaryPane(); false"
title="Toggle Summary Pane" i18n-title>
<ng-container *ngIf="showSummaryPane()">
- <span class="material-icons">navigate_before</span>
+ <span class="material-icons">fullscreen</span>
</ng-container>
<ng-container *ngIf="!showSummaryPane()">
- <span class="material-icons">navigate_next</span>
+ <span class="material-icons">fullscreen_exit</span>
</ng-container>
</a>
</li>
import {tap, take, switchMap} from 'rxjs/operators';
import {IdlService, IdlObject} from '@eg/core/idl.service';
import {OrgService} from '@eg/core/org.service';
+import {ServerStoreService} from '@eg/core/server-store.service';
import {AuthService} from '@eg/core/auth.service';
import {NetService} from '@eg/core/net.service';
import {EventService} from '@eg/core/event.service';
private idl: IdlService,
private org: OrgService,
private net: NetService,
+ private store: ServerStoreService,
private evt: EventService,
private toast: ToastService,
private auth: AuthService,
this.penaltyTypeFromButton = this.SILENT_NOTE;
}
- this.org.settings(['ui.staff.require_initials.patron_standing_penalty'])
- .then(sets => this.requireInitials =
- sets['ui.staff.require_initials.patron_standing_penalty']);
+ this.store.getItem('ui.staff.require_initials.patron_standing_penalty')
+ .then(require => this.requireInitials = require);
const obs1 = this.pcrud.retrieve('au', this.patronId)
.pipe(tap(usr => this.patron = usr));