--- /dev/null
+<div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">
+ [% l('Renew Items with Specific Due Date') %]
+ </h4>
+</div>
+<div class="modal-body">
+ <div class="pad-vert row">
+ <div class="col-md-12">
+ [% l('Enter due date for items: [_1]', '{{args.barcodes.join(" ")}}') %]
+ </div>
+ </div>
+ <div class="pad-vert row">
+ <div class="col-md-5">
+ <input eg-date-input required
+ class="form-control" ng-model="args.date"/>
+ </div>
+ </div>
+</div>
+<div class="modal-footer">
+ <button class="btn btn-primary" ng-click="ok()">[% l('Submit') %]</button>
+ <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+</div>
angular.module('egPatronApp').controller('PatronItemsOutCtrl',
['$scope','$q','$routeParams','egCore','egUser','patronSvc',
- 'egGridDataProvider','$modal','egCirc','egConfirmDialog',
+ 'egGridDataProvider','$modal','egCirc','egConfirmDialog','egBilling',
function($scope, $q, $routeParams, egCore , egUser, patronSvc ,
- egGridDataProvider , $modal , egCirc , egConfirmDialog) {
+ egGridDataProvider , $modal , egCirc , egConfirmDialog , egBilling) {
$scope.initTab('items_out', $routeParams.id);
$scope.renew = function(items, msg) {
if (!items.length) return;
-
var barcodes = items.map(function(circ)
{ return circ.target_copy().barcode() });
$scope.renew_all = function() {
var circs = patronSvc.items_out.filter(function(circ) {
- // all others will be rejected at the server
return (
+ // all others will be rejected at the server
!circ.stop_fines() ||
circ.stop_fines() == 'MAXFINES'
);
$scope.renew(circs, egCore.strings.RENEW_ALL_ITEMS);
}
+ $scope.renew_with_date = function(items) {
+ if (!items.length) return;
+ var barcodes = items.map(function(circ)
+ { return circ.target_copy().barcode() });
+
+ return $modal.open({
+ templateUrl : './circ/patron/t_edit_due_date_dialog',
+ templateUrl : './circ/patron/t_renew_with_date_dialog',
+ controller : [
+ '$scope','$modalInstance',
+ function($scope , $modalInstance) {
+ $scope.args = {
+ barcodes : barcodes,
+ date : new Date()
+ }
+ $scope.cancel = function() {$modalInstance.dismiss()}
+
+ // Fire off the due-date updater for each circ.
+ // When all is done, close the dialog
+ $scope.ok = function() {
+ var due = $scope.args.date.toISOString().replace(/T.*/,'');
+ console.debug("renewing with due date: " + due);
+
+ function do_one() {
+ if (bc = barcodes.pop()) {
+ egCirc.renew({copy_barcode : bc, due_date : due})
+ .finally(do_one);
+ } else {
+ $modalInstance.close();
+ reset_page();
+ }
+ }
+ do_one(); // kick it off
+ }
+ }
+ ]
+ }).result;
+ }
+
+ $scope.checkin = function(items) {
+ if (!items.length) return;
+ var barcodes = items.map(function(circ)
+ { return circ.target_copy().barcode() });
+
+ return egConfirmDialog.open(
+ egCore.strings.CHECK_IN_CONFIRM, barcodes.join(' '), {
+
+ }).result.then(function() {
+ function do_one() {
+ if (bc = barcodes.pop()) {
+ egCirc.checkin({copy_barcode : bc})
+ .finally(do_one);
+ } else {
+ reset_page();
+ }
+ }
+ do_one(); // kick it off
+ });
+ }
+
+ $scope.add_billing = function(items) {
+ if (!items.length) return;
+ var circs = items.concat(); // don't pop from grid array
+ function do_one() {
+ var circ; // don't clobber window.circ!
+ if (circ = circs.pop()) {
+ egBilling.showBillDialog({
+ // let the dialog fetch the transaction, since it's
+ // not sufficiently fleshed here.
+ xact_id : circ.id(),
+ patron : patronSvc.current
+ }).finally(do_one);
+ } else {
+ reset_page();
+ }
+ }
+ do_one();
+ }
+
}]);