LP1889128 Staffcat hold form reset option
authorBill Erickson <berickxx@gmail.com>
Tue, 28 Jul 2020 15:48:33 +0000 (11:48 -0400)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 6 Jan 2021 00:48:27 +0000 (16:48 -0800)
Adds a Reset button to the staff catalog holds form so subsequent holds
may be placed for the same items but for different patrons.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>

Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts

index 48c2bed..a708708 100644 (file)
               </eg-combobox>
             </div>
           </li>
+          <li class="list-group-item">
+            <button class="btn btn-success" (click)="placeHolds()" 
+              [disabled]="!user || placeHoldsClicked" i18n>Place Hold(s)</button>
+
+            <button class="btn btn-outline-dark ml-2" (click)="reset()" i18n>Reset</button>
+          </li>
         </ul><!-- col -->
       </div><!-- row -->
     </div><!--card -->
   </div><!-- col -->
-  <div class="row mt-2">
-    <div class="col-lg-3">
-      <button class="btn btn-success" (click)="placeHolds()" 
-        [disabled]="!user || placeHoldsClicked" i18n>Place Hold(s)</button>
-    </div>
-  </div>
 </form>
 
 <div class="row"><div class="col-lg-12"><hr/></div></div>
index 9564587..74bf9f1 100644 (file)
@@ -101,15 +101,10 @@ export class HoldComponent implements OnInit {
         this.smsCarriers = [];
     }
 
-    ngOnInit() {
-
-        // Respond to changes in hold type.  This currently assumes hold
-        // types only toggle post-init between copy-level types (C,R,F)
-        // and no other params (e.g. target) change with it.  If other
-        // types require tracking, additional data collection may be needed.
-        this.route.paramMap.subscribe(
-            (params: ParamMap) => this.holdType = params.get('type'));
+    reset() {
 
+        this.user = null;
+        this.userBarcode = null;
         this.holdType = this.route.snapshot.params['type'];
         this.holdTargets = this.route.snapshot.queryParams['target'];
         this.holdFor = this.route.snapshot.queryParams['holdFor'] || 'patron';
@@ -136,11 +131,26 @@ export class HoldComponent implements OnInit {
             return ctx;
         });
 
+        this.resetForm();
+
         if (this.holdFor === 'staff' || this.userBarcode) {
             this.holdForChanged();
         }
 
         this.getTargetMeta();
+        this.placeHoldsClicked = false;
+    }
+
+    ngOnInit() {
+
+        // Respond to changes in hold type.  This currently assumes hold
+        // types only toggle post-init between copy-level types (C,R,F)
+        // and no other params (e.g. target) change with it.  If other
+        // types require tracking, additional data collection may be needed.
+        this.route.paramMap.subscribe(
+            (params: ParamMap) => this.holdType = params.get('type'));
+
+        this.reset();
 
         this.org.settings(['sms.enable', 'circ.holds.max_duplicate_holds'])
         .then(sets => {