<span class="caret"></span>
</button>
<ul class="dropdown-menu">
- <li><a href
+ <li><a href dropdown-toggle
ng-click="checkoutArgs.noncat_type='barcode';focusMe=true">
[% l('Barcode') %]</a>
</li>
<li class="divider"></li>
<li>
- <a href ng-repeat='type in nonCatTypes'
+ <a href ng-repeat='type in nonCatTypes' dropdown-toggle
ng-click="checkoutArgs.noncat_type=type.id()">{{type.name()}}</a>
</li>
</ul>
<h4 class="modal-title">[% l('Hold Slip') %]</h4>
</div>
<div class="modal-body">
- <!-- TODO: pub / priv shelf -->
- <div ng-switch on="evt.payload.hold.behind_desk()">
+ <div ng-switch on="hold.behind_desk">
<div ng-switch-when="t">
- [% l('This item should be routed to the Private Holds Shelf') %]
+ [% l('This item should be routed to the [_1]Private Holds Shelf[_2]',
+ '<strong>','</strong>') %]
</div>
<div ng-switch-when="f">
- [% l('This item should be routed to the Public Holds Shelf') %]
+ [% l('This item should be routed to the [_1]Public Holds Shelf[_2]',
+ '<strong>','</strong>') %]
</div>
</div>
<br/>
<div>
<span>[% l('Item Barcode:') %]</span>
- <span>{{evt.payload.copy.barcode()}}</span>
+ <span>{{copy.barcode}}</span>
</div>
<div>
<span>[% l('Title:') %]</span>
- <span>{{evt.payload.record.title()}}</span>
+ <span>{{title}}</span>
</div>
<div>
<span>[% l('Author:') %]</span>
- <span>{{evt.payload.record.author()}}</span>
+ <span>{{author}}</span>
</div>
<br/>
<div>
- <div ng-show="holdUser.alias()">
- [% l('Hold for patron {{holdUser.alias()}}') %]
+ <div ng-show="patron.alias">
+ [% l('Hold for patron {{patron.alias}}') %]
</div>
- <div ng-hide="holdUser.alias()">
+ <div ng-hide="patron.alias">
[% |l %]
- Hold for patron {{holdUser.family_name()}},
- {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
+ Hold for patron {{patron.family_name}},
+ {{patron.first_given_name}} {{patron.second_given_name}}
[% END %]
</div>
<div>
<span>[% l('Patron Barcode:') %]</span>
- <span>{{holdUser.card().barcode()}}</span>
+ <span>{{patron.card.barcode}}</span>
</div>
<br/>
<div>
<span>[% l('Request Date:') %]</span>
- <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
+ <span>{{hold.request_time | date:'shortDate'}}</span>
</div>
<div>
<span>[% l('Slip Date:') %]</span>
- <span>{{now | date:'shortDate'}}</span>
+ <span>{{today | date:'shortDate'}}</span>
</div>
</div>
<div class="modal-footer">
- <!--
- <input type="button" class="btn btn-primary" disabled="disabled"
+ <input type="button" class="btn btn-primary"
ng-click="print()" value="[% l('Print') %]"/>
- -->
<input type="submit" class="btn btn-warning"
ng-click="ok()" value="[% l('Do Not Print') %]"/>
</div>
<!-- edit bucket dialog -->
-<form class="form-validated" novalidate ng-submit="ok(count)" name="form">
- <div class="">
- <div class="">
- <div class="modal-header">
- <button type="button" class="close"
- ng-click="cancel()" aria-hidden="true">×</button>
- <h4 class="modal-title">
- [% l('Enter the number of {{type.name()}} circulating') %]
- </h4>
- </div>
- <div class="modal-body">
- <div class="form-group">
- <label for="noncat-count" class="sr-only">[% l('Count') %]</label>
- <input type="number" class="form-control" focus-me='focusMe' required
- id="noncat-title" ng-model="count" placeholder="[% l('Count...') %]"/>
- </div>
- </div>
- <div class="modal-footer">
- <input type="submit" class="btn btn-primary"
- ng-disabled="form.$invalid" value="[% l('OK') %]"/>
- <button class="btn btn-warning"
- ng-click="cancel()">[% l('Cancel') %]</button>
- </div>
- </div> <!-- modal-content -->
- </div> <!-- modal-dialog -->
+<form ng-submit="ok(count)" role="form">
+ <div class="modal-header">
+ <button type="button" class="close"
+ ng-click="cancel()" aria-hidden="true">×</button>
+ <h4 class="modal-title">
+ [% l('Enter the number of {{type.name()}} circulating') %]
+ </h4>
+ </div>
+ <div class="modal-body">
+ <div class="form-group">
+ <label for="noncat-count" class="sr-only">[% l('Count') %]</label>
+ <input type="number" class="form-control" focus-me='focusMe'
+ required id="noncat-title" ng-model="count"
+ min="1" max="{{noncatMax}}"
+ placeholder="[% l('Count...') %]"/>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <input type="submit" class="btn btn-primary"
+ ng-disabled="form.$invalid" value="[% l('OK') %]"/>
+ <button class="btn btn-warning"
+ ng-click="cancel($event)">[% l('Cancel') %]</button>
+ </div>
</form>
<div class="modal-body">
<div>
<span>[% l('Destination') %]</span>
- <strong>{{dest.shortname()}}</strong>
+ <strong>{{dest_location.shortname}}</strong>
</div>
<br/>
<div>
<address>
- <strong>{{dest.name()}}</strong><br>
- {{destAddr.street1()}} {{destAddr.street2()}}<br/>
- {{destAddr.city()}}, {{destAddr.state()}} {{destAddr.post_code()}}<br/>
- <abbr title="[% l('Phone') %]">P:</abbr> {{dest.phone()}}
+ <strong>{{dest_location.name}}</strong><br>
+ {{dest_address.street1}} {{dest_address.street2}}<br/>
+ {{dest_address.city}}, {{dest_address.state}} {{dest_address.post_code}}<br/>
+ <abbr title="[% l('Phone') %]">P:</abbr> {{dest_location.phone}}
</address>
</div>
<div>
<span>[% l('Item Barcode:') %]</span>
- <span>{{evt.payload.copy.barcode()}}</span>
+ <span>{{copy.barcode}}</span>
</div>
<div>
<span>[% l('Title:') %]</span>
- <span>{{evt.payload.record.title()}}</span>
+ <span>{{title}}</span>
</div>
<div>
<span>[% l('Author:') %]</span>
- <span>{{evt.payload.record.author()}}</span>
+ <span>{{author}}</span>
</div>
- <div ng-if="holdUser">
+ <div ng-if="patron">
<br/>
<div>[% |l %]
- Hold for patron {{holdUser.family_name()}},
- {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
+ Hold for patron {{patron.family_name}},
+ {{patron.first_given_name}} {{patron.second_given_name}}
[% END %]
</div>
<div>
<span>[% l('Patron Barcode:') %]</span>
- <span>{{holdUser.card().barcode()}}</span>
+ <span>{{patron.card.barcode}}</span>
</div>
<br/>
<div>
<span>[% l('Request Date:') %]</span>
- <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
- </div>
- <div>
- <span>[% l('Slip Date:') %]</span>
- <span>{{now | date:'shortDate'}}</span>
+ <span>{{hold.request_time | date:'shortDate'}}</span>
</div>
</div>
- <div ng-if="holdUser">
- <br/>
- <div>[% |l %]
- Hold for patron {{holdUser.family_name()}},
- {{holdUser.first_given_name()}} {{holdUser.second_given_name()}}
- [% END %]
- </div>
- <div>
- <span>[% l('Patron Barcode:') %]</span>
- <span>{{holdUser.card().barcode()}}</span>
- </div>
- <br/>
- <div>
- <span>[% l('Request Date:') %]</span>
- <span>{{evt.payload.hold.request_time() | date:'shortDate'}}</span>
- </div>
+ <div>
<div>
<span>[% l('Slip Date:') %]</span>
- <span>{{now | date:'shortDate'}}</span>
+ <span>{{today | date:'shortDate'}}</span>
</div>
</div>
</div>
--- /dev/null
+<div>
+ <div ng-switch on="hold.behind_desk">
+ <div ng-switch-when="t">
+ [% l('This item needs to be routed to the [_1]Private Holds Shelf[_2].',
+ '<strong>','</strong>') %]
+ </div>
+ <div ng-switch-when="f">
+ [% l('This item needs to be routed to the [_1]Public Holds Shelf[_2].',
+ '<strong>','</strong>') %]
+ </div>
+ </div>
+ <br/>
+
+ [% l('Barcode: [_1]', '{{copy.barcode}}') %]</div>
+ [% l('Title: [_1]', '{{title}}') %]</div>
+
+ <br/>
+ <br/>
+
+ <div>[% l('Hold for patron [_1], [_2] [_3]',
+ '{{patron.family_given_name}}',
+ '{{patron.first_given_name}}',
+ '{{patron.second_given_name}}') %]</div>
+ <div>[% l('Barcode: [_1]', '{{patron.card.barcode}}') %]</div>
+ <div ng-if="hold.phone_notify">[% l('Notify by phone: [_1]', '{{hold.phone_notify}}') %]</div>
+ <div ng-if="hold.sms_notify">[% l('Notify by text: [_1]', '{{hold.sms_notify}}') %]</div>
+ <div ng-if="hold.email_notify == 't'">[% l('Notify by email: [_1]', '{{patron.email}}') %]</div>
+
+ <br/>
+
+ <div>[% l('Request Date: [_1]',
+ '{{hold.request_time | date:"short"}}') %]</div>
+ <div>[% l('Slip Date: [_1]', '{{today | date:"short"}}') %]</div>
+ <div>[% l('Printed by [_1] at [_2]',
+ '{{staff.first_given_name}}', '{{current_location.shortname}}') %]</div>
+
+</div>
}
}
- // TODO: show print dialog
$scope.print_receipt = function() {
var print_data = {circulations : []}
// This assumes the caller has already handled the noncat-type
// selection and just needs to collect the count info.
service.noncat_dialog = function(params, options) {
+ var noncatMax = 99; // hard-coded max
// the caller should presumably have fetched the noncat_types via
// our API already, but fetch them again (from cache) to be safe.
$scope.focusMe = true;
$scope.type = type;
$scope.count = 1;
+ $scope.noncatMax = noncatMax;
$scope.ok = function(count) { $modalInstance.close(count) }
- $scope.cancel = function () { $modalInstance.dismiss() }
+ $scope.cancel = function ($event) {
+ $modalInstance.dismiss()
+ $event.preventDefault();
+ }
}],
}).result.then(
function(count) {
- if (count && count > 0 /* && count < x (TODO) */) {
+ if (count && count > 0 && count <= noncatMax) {
+ // NOTE: in Chrome, form validation ensure a valid number
params.noncat_count = count;
return $q.when(params);
} else {
'$scope','$modalInstance','destAddr','holdUser','transit',
function($scope , $modalInstance , destAddr , holdUser , transit) {
- // TODO: synchronize scope variables with print context vars.
-
- $scope.destAddr = destAddr;
- $scope.holdUser = holdUser;
- $scope.dest = egCore.org.get(evt.org);
- $scope.evt = evt;
- $scope.now = new Date();
+ $scope.today = new Date();
+
+ var print_context = {
+ copy : egCore.idl.toHash(evt.payload.copy),
+ title : evt.payload.record.title(),
+ author : evt.payload.record.author()
+ }
+
+ if (transit) {
+ // route_dialog includes the "route to holds shelf"
+ // dialog, which has no transit
+ print_context.transit = egCore.idl.toHash(transit);
+ print_context.dest_address = egCore.idl.toHash(destAddr);
+ print_context.dest_location =
+ egCore.idl.toHash(egCore.org.get(transit.dest()));
+ }
+
+ if (holdUser) {
+ print_context.hold = egCore.idl.toHash(evt.payload.hold);
+ print_context.patron = egCore.idl.toHash(holdUser);
+ }
+
+ angular.forEach(print_context, function(val, key) {
+ $scope[key] = val;
+ });
+
$scope.ok = function() {$modalInstance.close()}
$scope.print = function() {
$modalInstance.close();
- var print_context = {
- transit : egCore.idl.toHash(transit),
- title : evt.payload.record.title(),
- author : evt.payload.record.author(),
- copy : egCore.idl.toHash(evt.payload.copy),
- dest_location :
- egCore.idl.toHash(egCore.org.get(transit.dest())),
- dest_address : egCore.idl.toHash(destAddr),
- }
-
- var template = 'transit_slip';
- if (holdUser) {
- template = 'hold_transit_slip';
- print_context.hold = egCore.idl.toHash(evt.payload.hold);
- print_context.patron = egCore.idl.toHash(holdUser);
- }
+ template = transit ?
+ (holdUser ? 'hold_transit_slip' : 'transit_slip') :
+ 'hold_shelf_slip';
egCore.print.print({
context : 'default',
});
}
}],
+
resolve : {
destAddr : function() {
- if (!evt.org) return $q.when();
+ if (!evt.org || tmpl.match(/hold_shelf/))
+ return $q.when();
return service.get_org_addr(evt.org, 'holds_address');
},
holdUser : function() {
);
},
transit : function() {
+ if (tmpl.match(/hold_shelf/)) return $q.when();
return service.find_copy_transit(evt, params, options);
}
}