</ng-template>
-<ng-template #userSettingsInputRow let-args="args">
+<ng-template #userSettingInputRow let-args="args">
<div class="row pt-1 pb-1 mt-1">
<ng-container *ngTemplateOutlet="userSettingLabel; context: {args: args}">
</ng-container>
<div class="m-auto font-weight-bold" i18n>User Settings</div>
</div>
- <ng-container *ngTemplateOutlet="userSettingsInputRow; context:
+ <ng-container *ngTemplateOutlet="userSettingInputRow; context:
{args: {settingName: 'opac.default_phone'}}">
</ng-container>
<ng-container *ngTemplateOutlet="userSettingLabel;
context: {args: {settingName: 'opac.default_sms_notify'}}">
</ng-container>
- <ng-container *ngTemplateOutlet="userSettingsInput;
+ <ng-container *ngTemplateOutlet="userSettingInput;
context: {args: {settingName: 'opac.default_sms_notify'}}">
</ng-container>
<div class="col-lg-6">
'opac.hold_notify',
'opac.default_phone',
'opac.default_pickup_location',
- 'opac.default_sms_carrier_id',
+ 'opac.default_sms_carrier',
'opac.default_sms_notify'
];
evening_phone: null,
default_phone: null,
default_sms: null,
- default_sms_carrier_id: null,
+ default_sms_carrier: null,
phone_notify: false,
email_notify: false,
sms_notify: false
= holdNotify.match(/sms/) !== null;
}
- if (setting = usets['opac.default_sms_carrier_id']) {
- setting = usets['opac.default_sms_carrier_id'] = Number(setting);
- this.holdNotifyValues.default_sms_carrier_id = setting;
+ if (setting = usets['opac.default_sms_carrier']) {
+ setting = usets['opac.default_sms_carrier'] = Number(setting);
+ this.holdNotifyValues.default_sms_carrier = setting;
}
if (setting = usets['opac.default_phone']) {
let settings: any = {};
+ const holdMethods = [];
+
+ ['email', 'phone', 'sms'].forEach(method => {
+ if (this.holdNotifyTypes[method]) {
+ holdMethods.push(method);
+ }
+ });
+
+ this.userSettings['opac.hold_notify'] =
+ holdMethods.length > 0 ? holdMethods.join(':') : null;
+
if (this.patronId) {
// Update all user editor setting values for existing
// users regardless of whether a value changed.
return this.collectHoldNotifyChange()
.then(mods => {
+
if (mods.length === 0) { return Promise.resolve(); }
+ console.log('HOLD NOTIFY MODS', mods);
+
this.holdNotifyUpdateDialog.smsCarriers = this.smsCarriers;
this.holdNotifyUpdateDialog.mods = mods;
+ this.holdNotifyUpdateDialog.defaultSms =
+ this.userSettings['opac.default_sms_notify']
+ || this.holdNotifyValues.default_sms;
+
+ this.holdNotifyUpdateDialog.defaultPhone =
+ this.userSettings['opac.default_phone']
+ || this.holdNotifyValues.default_phone;
+
+ this.holdNotifyUpdateDialog.defaultCarrier =
+ this.userSettings['opac.default_sms_carrier']
+ || this.holdNotifyValues.default_sms_carrier;
+
return this.holdNotifyUpdateDialog.open().toPromise();
});
}
// No change to apply?
if (newValue === oldValue) { return empty(); }
+ // API / user setting name mismatch
+ if (field.match(/carrier/)) { field += '_id'; }
+
+ const apiValue = field.match(/notify|carrier/) ? oldValue : newValue;
+
return this.net.request(
'open-ils.circ',
'open-ils.circ.holds.retrieve_by_notify_staff',
- this.auth.token(), this.patronId, newValue, field
+ this.auth.token(), this.patronId, apiValue, field
).pipe(tap(holds => {
if (holds && holds.length > 0) {
mods.push({
<div class="row mt-2" *ngFor="let mod of mods">
<div class="col-lg-12">
- <!-- TODO pref change wording -->
+ <div [ngSwitch]="mod.field" class="mt-2 mb-2">
+ <span *ngSwitchCase="'phone_notify'">You have set Notify by Phone to</span>
+ <span *ngSwitchCase="'sms_notify'">You have set Notify by SMS to</span>
+ <span *ngSwitchCase="'email_notify'">You have set Notify by Email to</span>
+ <span *ngSwitchCase="'default_phone'">You have set Default Phone Number to</span>
+ <span *ngSwitchCase="'default_sms'">You have set Default SMS/Text Number to</span>
+ <eg-bool [value]="mod.newValue"></eg-bool>
+ </div>
+
+ <div class="mt-2 mb-2" *ngIf="mod.name == 'default_sms_carrier_id'">
+ You have set Default SMS Carrier to {{carrierName(mod.newValue)}}
+ </div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox"
id="{{mod.field}}-checkbox" [(ngModel)]="selected[mod.field]"/>
<label class="form-check-label" for="{{mod.field}}-checkbox">
<ng-container *ngIf="isCarrierChange(mod)" i18n>
- A carrier other than "{{carrierName(mod.oldValue)}}"
- is currently used in {{mod.holds.length}} hold(s).
- Update to "{{carrierName(mod.newValue)}}"?
+ A carrier other than "{{carrierName(mod.oldValue)}}" is
+ currently used in {{mod.holds.length}} hold(s). Update to
+ "{{carrierName(mod.newValue)}}"?
</ng-container>
<ng-container *ngIf="isBoolChange(mod)" i18n>
{{mod.holds.length}} hold(s) have it set to