s.CONFIRM_CLEAR_PENDING = "[% l('Clear pending transactions') %]";
s.CONFIRM_CLEAR_PENDING_BODY = "[% l('Are you certain you want to clear these pending offline transactions? This action is irreversible. Transactions cannot be recovered after clearing!') %]";
s.LOCATION_NAME_OU_QUALIFIED = "[% l('{{location_name}} ({{owning_lib_shortname}})') %]";
+ s.CONFIRM_IN_HOUSE_NUM_USES_COUNT_TITLE = "[% l('Are you sure you want to record {{num_uses}} uses for this?') %]";
}]);
</script>
</label>
<input type="number" min="1" max="{{countMax}}"
class="form-control" focus-me="useFocus"
- id="in-house-num-uses" ng-model="args.num_uses"/>
+ id="in-house-num-uses" ng-model="args.num_uses" ng-change="onNumUsesChanged()" />
</div>
</div>
});
$scope.useFocus = true;
- $scope.args = {noncat_type : 'barcode', num_uses : 1};
+ $scope.args = {noncat_type : 'barcode', num_uses : 1, needsCountWarnModal: false };
var checkouts = [];
var provider = egGridDataProvider.instance({});
return type ? type.name() : null;
}
- $scope.checkout = function(args) {
+ $scope.onNumUsesChanged = function(){
+ $scope.args.needsCountWarnModal = countWarn < $scope.args.num_uses;
+ }
+
+ $scope.checkout = function(args){
+ if ($scope.args.needsCountWarnModal) {
+ // show modal to allow warning/confirmation
+ egConfirmDialog.open(egCore.strings.CONFIRM_IN_HOUSE_NUM_USES_COUNT_TITLE, '',
+ { num_uses: $scope.args.num_uses }
+ ).result.then(function(){
+ $scope.args.needsCountWarnModal = false
+ $scope.checkoutStart(args)
+ });
+ } else {
+ $scope.checkoutStart(args);
+ }
+ }
+
+ $scope.checkoutStart = function(args) {
$scope.copyNotFound = false;
var coArgs = {