LP1904036 Address deletion / replace repair
authorBill Erickson <berickxx@gmail.com>
Thu, 16 Sep 2021 15:38:35 +0000 (11:38 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:37 +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.html
Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts

index 48dc650..a557004 100644 (file)
     <div class="m-auto font-weight-bold" i18n>Addresses</div>
   </div>
 
-  <div class="mb-2" *ngFor="let addr of nonDeletedAddresses(); let index = index">
-
-    <div class="alert alert-info p-1">
-      <div class="row">
-        <div class="col-lg-3" i18n>Address #{{index + 1}}</div>
-        <div class="col-lg-9">
-          <div class="form-check form-check-inline mr-2">
-            <input class="form-check-input" type="checkbox" 
-              name="addr-{{addr.id()}}-mailing" id="addr-{{addr.id()}}-mailing" 
-              [ngModel]="patron.mailing_address() && addr.id() == patron.mailing_address().id()"
-              (ngModelChange)="setAddrType('mailing', addr, $event)"/>
-            <label class="form-check-label" 
-              for="addr-{{addr.id()}}-mailing" i18n>Mailing</label>
-          </div>
-          <div class="form-check form-check-inline mr-2">
-            <input class="form-check-input" type="checkbox" 
-              name="addr-{{addr.id()}}-billing" id="addr-{{addr.id()}}-billing" 
-              [ngModel]="patron.billing_address() && addr.id() == patron.billing_address().id()"
-              (ngModelChange)="setAddrType('billing', addr, $event)"/>
-            <label class="form-check-label" 
-              for="addr-{{addr.id()}}-billing" i18n>Physical</label>
+  <ng-container *ngFor="let addr of patron.addresses(); let index = index">
+    <div class="mb-2" *ngIf="!addr.isdeleted()">
+
+      <div class="alert alert-info p-1">
+        <div class="row">
+          <div class="col-lg-3" i18n>Address #{{index + 1}}</div>
+          <div class="col-lg-9">
+            <div class="form-check form-check-inline mr-2">
+              <input class="form-check-input" type="checkbox" 
+                name="addr-{{addr.id()}}-mailing" id="addr-{{addr.id()}}-mailing" 
+                [ngModel]="patron.mailing_address() && addr.id() == patron.mailing_address().id()"
+                (ngModelChange)="setAddrType('mailing', addr, $event)"/>
+              <label class="form-check-label" 
+                for="addr-{{addr.id()}}-mailing" i18n>Mailing</label>
+            </div>
+            <div class="form-check form-check-inline mr-2">
+              <input class="form-check-input" type="checkbox" 
+                name="addr-{{addr.id()}}-billing" id="addr-{{addr.id()}}-billing" 
+                [ngModel]="patron.billing_address() && addr.id() == patron.billing_address().id()"
+                (ngModelChange)="setAddrType('billing', addr, $event)"/>
+              <label class="form-check-label" 
+                for="addr-{{addr.id()}}-billing" i18n>Physical</label>
+            </div>
+            <button class="btn btn-danger" (click)="deleteAddr(addr)" i18n>Delete</button>
           </div>
-          <button class="btn btn-danger" (click)="deleteAddr(addr)" i18n>Delete</button>
         </div>
       </div>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'address_type', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'post_code', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'street1', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'street2', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'city', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'county', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'state', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldInput, field: 'country', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldCheckbox, field: 'valid', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
+      <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
+        fieldCheckbox, field: 'within_city_limits', cls: 'aua', path: 'addresses', index: index}}">
+      </ng-container>
     </div>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'address_type', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'post_code', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'street1', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'street2', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'city', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'county', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'state', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldInput, field: 'country', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldCheckbox, field: 'valid', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-    <ng-container *ngTemplateOutlet="fieldRow; context: {args: {template: 
-      fieldCheckbox, field: 'within_city_limits', cls: 'aua', path: 'addresses', index: index}}">
-    </ng-container>
-  </div>
+  </ng-container>
 
   <button class="btn btn-success" (click)="newAddr()" i18n>New Address</button>
 
index 5c02838..f9c0ea2 100644 (file)
@@ -1369,6 +1369,7 @@ 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());
     }