LP1904036 Messages
authorBill Erickson <berickxx@gmail.com>
Mon, 5 Apr 2021 14:14:10 +0000 (10:14 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:29 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts
Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.html
Open-ILS/src/eg2/src/app/staff/circ/patron/messages.component.ts

index 508e22c..805f3ab 100644 (file)
@@ -111,7 +111,7 @@ export class EditComponent implements OnInit, AfterViewInit {
             // patron tab is open.  Wait until we know it's defined.
             if (tb) {
                 tb.saveClicked.subscribe(_ => this.save());
-                tb.saveCloneClicked.subscribe(_ => this.saveClone());
+                tb.saveCloneClicked.subscribe(_ => this.save(true));
                 tb.printClicked.subscribe(_ => this.printPatron());
             }
         }
@@ -1308,7 +1308,7 @@ export class EditComponent implements OnInit, AfterViewInit {
         return this.patron.addresses().filter(a => !a.isdeleted());
     }
 
-    save(): Promise<any> {
+    save(clone?: boolean): Promise<any> {
 
         // TODO clear unload prompt
 
@@ -1317,10 +1317,10 @@ export class EditComponent implements OnInit, AfterViewInit {
         .then(_ => this.saveUserSettings())
         .then(_ => this.updateHoldPrefs())
         .then(_ => this.removeStagedUser())
-        .then(_ => this.postSaveRedirect());
+        .then(_ => this.postSaveRedirect(clone));
     }
 
-    postSaveRedirect() {
+    postSaveRedirect(clone: boolean) {
 
         if (this.stageUser) {
             this.broadcaster.broadcast('eg.pending_usr.update',
@@ -1333,11 +1333,15 @@ export class EditComponent implements OnInit, AfterViewInit {
             return;
         }
 
-        window.location.href = window.location.href;
-    }
+        if (clone) {
+            this.context.patron = null;
+            this.router.navigate(
+                ['/staff/circ/patron/register/clone', this.modifiedPatron.id()]);
 
-    saveClone() {
-        // TODO
+        } else {
+            // Full refresh to force reload of modified patron data.
+            window.location.href = window.location.href;
+        }
     }
 
     // Resolves on success, rejects on error
index bec7338..0bd5d19 100644 (file)
   </eg-grid-column>
 </eg-grid>
 
-<hr class="mt-4 mb-2"/>
-
-<div class="row mt-4 mb-2">
+<div class="row mt-5 mb-2">
   <div class="col-lg-4">
     <h3 i18n>Archived Penalties / Messages</h3>
   </div>
+  <div class="col-lg-4 form-inline">
+    <label class="mr-2" i18n>Start Date:</label>
+    <eg-date-select [initialIso]="startDateYmd"
+      (onChangeAsIso)="dateChange($event, true)"></eg-date-select>
+  </div>
+  <div class="col-lg-4 form-inline">
+    <label class="mr-2" i18n>End Date:</label>
+    <eg-date-select [initialIso]="endDateYmd" 
+      (onChangeAsIso)="dateChange($event, false)"></eg-date-select>
+  </div>
 </div>
 
 <eg-grid #archiveGrid idlClass="ausp" [dataSource]="archiveDataSource"
index b5f0a91..5d388c6 100644 (file)
@@ -105,6 +105,15 @@ export class PatronMessagesComponent implements OnInit {
         return [this.startDateYmd, endDate];
     }
 
+    dateChange(iso: string, start?: boolean) {
+        if (start) {
+            this.startDateYmd = iso;
+        } else {
+            this.endDateYmd = iso;
+        }
+        this.archiveGrid.reload();
+    }
+
     applyPenalty() {
     }
 }