better idea with Check Number
authorJason Etheridge <jason@esilibrary.com>
Mon, 14 Nov 2016 21:44:25 +0000 (16:44 -0500)
committerKathy Lussier <klussier@masslnc.org>
Tue, 22 Nov 2016 19:10:05 +0000 (14:10 -0500)
unset default Check Number, disable widget if not Check Payment,
and disable Apply Payment button if Check Payment with invalid Check Number

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/templates/staff/circ/patron/t_bills.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/bills.js

index 99abe6f..4378e32 100644 (file)
@@ -64,7 +64,8 @@
           </label>
           <div class="col-md-6">
             <input type="number" min="1" step="any" id="check-input" 
-              ng-model="check_number" focus-me="focus_check" 
+              ng-model="check_number" focus-me="focus_check"
+              ng-disabled="payment_type!='check_payment'"
               value="" class="form-control col-md-6 "/>
           </div>
         <div class="form-group">
@@ -86,7 +87,7 @@
             <button
                 type="submit"
                 class="btn btn-default"
-                ng-disabled="!gridControls.selectedItems().length"
+                ng-disabled="invalid_check_number() || !gridControls.selectedItems().length"
             >[% l('Apply Payment') %]</button>
           </div>
         </div>
index 4412c97..35bab20 100644 (file)
@@ -140,7 +140,7 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
     billSvc.userId = $routeParams.id;
 
     // set up some defaults
-    $scope.check_number = 1;
+    $scope.check_number = null;
     $scope.payment_amount = null;
     $scope.session_voided = 0;
     $scope.payment_type = 'cash_payment';
@@ -229,6 +229,9 @@ function($scope , $q , $routeParams , egCore , egConfirmDialog , $location,
         });
         return -(amount / 100);
     }
+    $scope.invalid_check_number = function() { 
+        return $scope.payment_type == 'check_payment' && ! $scope.check_number; 
+    }
 
     // update the item.payment_pending value each time the user
     // selects different transactions to pay against.