LP#1846354: update Angular new penalty dialog
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 9 Mar 2021 15:42:29 +0000 (10:42 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Mon, 20 Sep 2021 19:45:31 +0000 (15:45 -0400)
This patch ensures that the new Angular missing pieces interface
can continue to create penalties. Additional work will be required
on the Angular dialog to match the other changes.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.html
Open-ILS/src/eg2/src/app/staff/share/patron/penalty-dialog.component.ts

index b66e562..ca82d47 100644 (file)
     </div>
     <div class="row">
       <div class="col-lg-12">
-        <textarea class="form-control" [(ngModel)]="noteText"></textarea>
+        <textarea class="form-control" [(ngModel)]="title"
+          i18n-placeholder placeholder="Title..."></textarea>
+      </div>
+    </div>
+    <div class="row">
+      <div class="col-lg-12">
+        <textarea class="form-control" [(ngModel)]="noteText"
+          i18n-placeholder placeholder="Note Text..."></textarea>
       </div>
     </div>
   </div>
index 12cdb5f..4112f3b 100644 (file)
@@ -43,6 +43,7 @@ export class PatronPenaltyDialogComponent
     dataLoaded = false;
     requireInitials = false;
     initials: string;
+    title = '';
     noteText = '';
 
     @ViewChild('successMsg', {static: false}) successMsg: StringComponent;
@@ -92,13 +93,18 @@ export class PatronPenaltyDialogComponent
     apply() {
 
         const pen = this.idl.create('ausp');
+        const msg = {
+            title: this.title,
+            message: this.noteText ? this.noteText : ''
+        };
         pen.usr(this.patronId);
         pen.org_unit(this.auth.user().ws_ou());
         pen.set_date('now');
         pen.staff(this.auth.user().id());
 
-        pen.note(this.initials ?
-            `${this.noteText} [${this.initials}]` : this.noteText);
+        if (this.initials) {
+            msg.message = `${this.noteText} [${this.initials}]`;
+        }
 
         pen.standing_penalty(
             this.penaltyTypeFromSelect || this.penaltyTypeFromButton);
@@ -106,15 +112,15 @@ export class PatronPenaltyDialogComponent
         this.net.request(
             'open-ils.actor',
             'open-ils.actor.user.penalty.apply',
-            this.auth.token(), pen
+            this.auth.token(), pen, msg
         ).subscribe(resp => {
             const e = this.evt.parse(resp);
             if (e) {
-                this.errorMsg.current().then(msg => this.toast.danger(msg));
+                this.errorMsg.current().then(m => this.toast.danger(m));
                 this.error(e, true);
             } else {
                 // resp == penalty ID on success
-                this.successMsg.current().then(msg => this.toast.success(msg));
+                this.successMsg.current().then(m => this.toast.success(m));
                 this.close(resp);
             }
         });