From: Bill Erickson <berickxx@gmail.com> Date: Fri, 7 Jan 2022 22:46:10 +0000 (-0500) Subject: LP1904036 Patron edit unsaved changes dialog fix X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d2da1a7347ff77bf27c0545996e0020e5ff6243a;p=evergreen%2Ftadl.git LP1904036 Patron edit unsaved changes dialog fix Signed-off-by: Bill Erickson <berickxx@gmail.com> Signed-off-by: Jane Sandberg <js7389@princeton.edu> Signed-off-by: Galen Charlton <gmc@equinoxOLI.org> --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html index e78c11017f..6128c8c6f2 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.html @@ -35,7 +35,7 @@ <eg-hold-notify-update-dialog #holdNotifyUpdateDialog> </eg-hold-notify-update-dialog> -<div class="row" *ngIf="loading"> +<div class="row" *ngIf="!showForm"> <div class="col-lg-6 offset-lg-3"> <eg-progress-inline></eg-progress-inline> </div> @@ -180,7 +180,7 @@ <!-- The List O' Fields --> -<div class="mt-3 striped-rows-even patron-edit-container form-validated" *ngIf="patron && !loading"> +<div class="mt-3 striped-rows-even patron-edit-container form-validated" *ngIf="patron && showForm"> <div class="row pt-1 pb-1 mt-1" *ngIf="showField('ac.barcode')"> <ng-container *ngTemplateOutlet="fieldLabel; diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts index 92b7763ef2..9fa83b8e31 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts @@ -156,7 +156,15 @@ export class EditComponent implements OnInit, AfterViewInit { modifiedPatron: IdlObject; changeHandlerNeeded = false; nameTab = 'primary'; + + // Are we still fetching data and applying values? loading = false; + // Should the user be able to see the form? + // On page load, we want to show the form just before we are + // done loading, so values can be applied to inputs after they + // are rendered but before those changes would result in setting + // changesPending = true + showForm = false; surveys: IdlObject[]; smsCarriers: ComboboxEntry[]; @@ -238,6 +246,7 @@ export class EditComponent implements OnInit, AfterViewInit { load(): Promise<any> { this.loading = true; + this.showForm = false; return this.setStatCats() .then(_ => this.getFieldDocs()) .then(_ => this.setSurveys()) @@ -252,7 +261,7 @@ export class EditComponent implements OnInit, AfterViewInit { .then(_ => this.setOptInSettings()) .then(_ => this.setSmsCarriers()) .then(_ => this.setFieldPatterns()) - .then(_ => this.loading = false) + .then(_ => this.showForm = true) // Not my preferred way to handle this, but some values are // applied to widgets slightly after the load() is done and the // widgets are rendered. If a widget is required and has no @@ -261,7 +270,10 @@ export class EditComponent implements OnInit, AfterViewInit { // non-saveable state on page load without forcing the page into // an nonsaveable state on every page load, check the save state // after a 1 second delay. - .then(_ => setTimeout(() => this.emitSaveState(), 1000)); + .then(_ => setTimeout(() => { + this.emitSaveState(); + this.loading = false; + }, 1000)); } setEditProfiles(): Promise<any> { @@ -1363,7 +1375,6 @@ export class EditComponent implements OnInit, AfterViewInit { } nonDeletedAddresses(): IdlObject[] { - console.log('nonDeletedAddresses() are ', this.patron.addresses().filter(a => !a.isdeleted()).map(a => a.id())); return this.patron.addresses().filter(a => !a.isdeleted()); } @@ -1371,6 +1382,7 @@ export class EditComponent implements OnInit, AfterViewInit { this.changesPending = false; this.loading = true; + this.showForm = false; return this.saveUser() .then(_ => this.saveUserSettings())