id="patron-checkout-barcode" type="text"/>
<input class="btn btn-default" type="submit"
- ng-class="{disabled : disable_checkout()}" value="[% l('Submit') %]"/>
+ ng-disabled="disable_checkout()"
+ value="[% l('Submit') %]"/>
</div>
</form>
</label>
</div> -->
<div class="col-md-12 col-lg-6">
- <eg-date-input ng-model="checkoutArgs.due_date" ng-disabled="!date_options.has_sticky_date" show-time-picker></eg-date-input>
+ <eg-date-input min-date="minDate" out-of-range="outOfRange"
+ ng-model="checkoutArgs.due_date" ng-disabled="!date_options.has_sticky_date" show-time-picker>
+ </eg-date-input>
</div>
</div>
</div>
due_date : new Date()
};
+ $scope.minDate = new Date();
+ $scope.outOfRange = false;
$scope.gridDataProvider = egGridDataProvider.instance({
get : function(offset, count) {
return this.arrayNotifier($scope.checkouts, offset, count);
patronSvc.current.active() == 'f' ||
patronSvc.current.deleted() == 't' ||
patronSvc.current.card().active() == 'f' ||
- patronSvc.fetchedWithInactiveCard()
+ patronSvc.fetchedWithInactiveCard() ||
+ $scope.outOfRange == true
);
}
});
$scope.$watch('checkoutArgs.due_date', function(newval) {
- if ( $scope.date_options.is_until_logout ) {
- egCore.hatch.setSessionItem('eg.circ.checkout.due_date', newval);
+ if ( $scope.date_options.is_until_logout && !isNaN(newval)) {
+ if (!$scope.outOfRange) {
+ egCore.hatch.setSessionItem('eg.circ.checkout.due_date', newval);
+ } else {
+ egCore.hatch.setSessionItem('eg.circ.checkout.due_date', $scope.checkoutArgs.due_date);
+ }
}
});
if ($scope.outOfRange !== undefined && (maxDateObj || minDateObj)) {
$scope.$watch('ngModel', function (n,o) {
- if (n && n != o) {
- var bad = false;
- var newdate = new Date(n);
- if (maxDateObj && newdate.getTime() > maxDateObj.getTime()) bad = true;
- if (minDateObj && newdate.getTime() < minDateObj.getTime()) bad = true;
- $scope.outOfRange = bad;
- }
+ var bad = false;
+ var newdate = new Date(n);
+ if (isNaN(newdate.getTime())) bad = true;
+ if (maxDateObj && newdate.getTime() > maxDateObj.getTime()) bad = true;
+ if (minDateObj && newdate.getTime() < minDateObj.getTime()) bad = true;
+ $scope.outOfRange = bad;
});
}
}],