<div class="row">
<div class="col-md-12">
- <div ng-if="is_backdate()" class="alert-danger pad-all-min">
- [% l('Backdated Check In [_1]',
- '{{checkinArgs.backdate | date:$root.egDateFormat}}') %]
+ <div ng-if="is_backdate()">
+ <div class="alert-danger pad-all-min">
+ [% l('Backdated Check In [_1]',
+ '{{checkinArgs.backdate | date:$root.egDateFormat}}') %]
+ </div>
+ <div ng-if="backdate.untilLogout" class="alert-danger pad-all-min">
+ [% l('Use Effective Date Until Logout') %]
+ </div>
</div>
<div ng-if="modifiers.no_precat_alert" class="alert-danger pad-all-min">
[% l('Ignore Pre-Cataloged Items') %]
<div><eg-date-input ng-model="checkinArgs.backdate"></eg-date-input>
</div>
</div>
+ <div class="flex-row" ng-show="is_backdate()">
+ <div class="flex-cell"></div>
+ <div class="checkbox pad-horiz">
+ <label>
+ <input type="checkbox" ng-model="backdate.untilLogout" ng-change="onUntilLogoutChange()"/>
+ [% l('Use effective date until logout') %]
+ </label>
+ </div>
+ </div>
</div>
</div>
$scope.focusMe = true;
$scope.checkins = checkinSvc.checkins;
- var today = new Date();
+ var today = new Date(new Date().setHours(0,0,0,0));
$scope.checkinArgs = {backdate : today}
$scope.modifiers = {};
$scope.fine_total = 0;
modifiers.push('noop'); // AKA suppress holds and transits
modifiers.push('auto_print_holds_transits');
modifiers.push('do_inventory_update');
+
+ // backdate is possible so load options
+ $scope.backdate = {date: egCore.hatch.getSessionItem('eg.circ.checkin.backdate')};
+ $scope.backdate.untilLogout = !!$scope.backdate.date;
+ if ($scope.backdate.untilLogout)
+ $scope.checkinArgs.backdate = new Date($scope.backdate.date);
+
+ // watch backdate to enable/disable the sticky option
+ // and ensure the backdate is not in the future
+ // note: input type=date max=foo not yet supported anywhere
+ $scope.$watch('checkinArgs.backdate', function(newval) {
+ if (!newval || newval.getTime() == today.getTime()) {
+ $scope.backdate.untilLogout = false;
+ egCore.hatch.removeSessionItem('eg.circ.checkin.backdate');
+ } else if (newval > today) {
+ $scope.checkinArgs.backdate = today;
+ } else if ($scope.backdate.untilLogout) {
+ egCore.hatch.setSessionItem('eg.circ.checkin.backdate', newval);
+ }
+ });
}
// set modifiers from stored preferences
}
}
-
- // ensure the backdate is not in the future
- // note: input type=date max=foo not yet supported anywhere
- $scope.$watch('checkinArgs.backdate', function(newval) {
- if (newval && newval > today)
- $scope.checkinArgs.backdate = today;
- });
+ $scope.onUntilLogoutChange = function() {
+ if ($scope.backdate.untilLogout)
+ egCore.hatch.setSessionItem('eg.circ.checkin.backdate',
+ $scope.checkinArgs.backdate
+ );
+ else
+ egCore.hatch.removeSessionItem('eg.circ.checkin.backdate');
+ };
$scope.is_backdate = function() {
- return $scope.checkinArgs.backdate < today;
+ return $scope.checkinArgs.backdate && $scope.checkinArgs.backdate < today;
}
var checkinGrid = $scope.gridControls = {};