<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/ui.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/services/user.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/services/circ.js"></script>
+<script>
+angular.module('egCoreMod').run(['egStrings', function(s) {
+s.CONFIRM_MARK_MISSING_TITLE = "[% l('Mark item as missing pieces?') %]";
+s.CONFIRM_MARK_MISSING_BODY =
+ "[% l('[_1] / [_2]', '{{barcode}}', '{{title}}') %]";
+s.CIRC_NOT_FOUND =
+ "[% l('No circulation found for item with barcode [_1]. Item not modified.', '{{barcode}}') %]"
+}])
+</script>
+
[% INCLUDE 'staff/circ/share/circ_strings.tt2' %]
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/item/app.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/checkin/app.js"></script>
<link rel="stylesheet" href="[% ctx.base_path %]/staff/css/circ.css" />
[% END %]
grid-controls="gridControls"
persist-key="{{grid_persist_key}}"
dateformat="{{$root.egDateAndTimeFormat}}">
-
+
+ <eg-grid-action handler="add_copies_to_bucket" label="[% l('Add Items to Bucket') %]">
+ </eg-grid-action>
<eg-grid-action
handler="fetchLastCircPatron"
label="[% l('Retrieve Last Patron Who Circulated Item') %]">
handler="showBackdateDialog"
label="[% l('Backdate Post-Checkin') %]">
</eg-grid-action>
- <eg-grid-action
+ <eg-grid-action
+ group="[% l('Show')"
handler="showMarkDamaged"
label="[% l('Mark Items Damaged') %]">
</eg-grid-action>
+ <eg-grid-action
+ group="[% l('Show')"
+ handler="show_mark_missing_pieces"
+ label="[% l('Mark Missing Pieces') %]">
+ </eg-grid-action>
<eg-grid-action
handler="abortTransit"
label="[% l('Cancel Transits') %]">
</eg-grid-action>
+ <!-- Show Group -->
+ <eg-grid-action handler="showBibHolds" group="[% l('Show') %]"
+ label="[% l('Record Holds') %]">
+ </eg-grid-action>
+ <eg-grid-action handler="showLastCircs" group="[% l('Show') %]"
+ label="[% l('Last Few Circs') %]">
+ </eg-grid-action>
+
+ <!-- Edit Group -->
+ <eg-grid-action handler="selectedHoldingsVolCopyEdit" group="[% l('Edit') %]"
+ label="[% l('Volumes and Items') %]">
+ </eg-grid-action>
+ <eg-grid-action handler="printSpineLabels" group="[% l('Print') %]"
+ label="[% l('Spine Labels') %]">
+ </eg-grid-action>
<eg-grid-field label="[% l('Alert Msg') %]"
path="acp.alert_message"></eg-grid-field>
})
.factory('itemSvc',
- ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog',
-function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog ) {
+ ['egCore','egCirc','$uibModal','$q','$timeout','$window','egConfirmDialog','egAlertDialog',
+function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog, egAlertDialog ) {
var service = {
copies : [], // copy barcode search results
return egCore.pcrud.retrieve( 'acp', id, service.flesh)
.then(function(copy) {return copy});
}
+
service.getCirc = function(id) {
return egCore.pcrud.search('aacs', { target_copy : id },
service.circFlesh).then(function(circ) {return circ});
}
+
service.getSummary = function(id) {
return circ_summary = egCore.net.request(
'open-ils.circ',
}
}
+ service.mark_missing_pieces = function(copy) {
+ var b = copy.barcode();
+ var t = egCore.idl.toHash(copy.call_number()).record.title;
+ egConfirmDialog.open(
+ egCore.strings.CONFIRM_MARK_MISSING_TITLE,
+ egCore.strings.CONFIRM_MARK_MISSING_BODY,
+ { barcode : b, title : t }
+ ).result.then(function() {
+
+ // kick off mark missing
+ return egCore.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.mark_item_missing_pieces',
+ egCore.auth.token(), copy.id()
+ )
+
+ }).then(function(resp) {
+ var evt = egCore.evt.parse(resp); // should always produce event
+
+ if (evt.textcode == 'ACTION_CIRCULATION_NOT_FOUND') {
+ return egAlertDialog.open(
+ egCore.strings.CIRC_NOT_FOUND, {barcode : copy.barcode()});
+ }
+
+ var payload = evt.payload;
+
+ // TODO: open copy editor inline? new tab?
+
+ // print the missing pieces slip
+ var promise = $q.when();
+ if (payload.slip) {
+ // wait for completion, since it may spawn a confirm dialog
+ promise = egCore.print.print({
+ context : 'default',
+ content_type : 'text/html',
+ content : payload.slip.template_output().data()
+ });
+ }
+
+ if (payload.letter) {
+ $scope.letter = payload.letter.template_output().data();
+ }
+
+ // apply patron penalty
+ if (payload.circ) {
+ promise.then(function() {
+ egCirc.create_penalty(payload.circ.usr())
+ });
+ }
+
+ });
+ }
+
return service;
}])
angular.module('egCheckinApp', ['ngRoute', 'ui.bootstrap',
- 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod'])
+ 'egCoreMod', 'egUiMod', 'egGridMod', 'egUserMod', 'egItemStatus'])
.config(function($routeProvider, $locationProvider, $compileProvider) {
$locationProvider.html5Mode(true);
* Manages checkin
*/
.controller('CheckinCtrl',
- ['$scope','$q','$window','$location','egCore','checkinSvc','egGridDataProvider','egCirc',
-function($scope , $q , $window , $location , egCore , checkinSvc , egGridDataProvider , egCirc) {
+ ['$scope','$q','$window','$location', '$timeout','egCore','checkinSvc','egGridDataProvider','egCirc', 'itemSvc',
+function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , egGridDataProvider , egCirc, itemSvc) {
$scope.focusMe = true;
$scope.checkins = checkinSvc.checkins;
});
}
+ $scope.add_copies_to_bucket = function(items){
+ var itemsIds = [];
+ angular.forEach(items, function(cp){
+ itemsIds.push(cp.acp.id());
+ });
+
+ itemSvc.add_copies_to_bucket(itemsIds);
+ }
+
+ $scope.showBibHolds = function(items){
+ var recordIds = [];
+ angular.forEach(items, function(i){
+ recordIds.push(i.acn.record());
+ });
+ angular.forEach(recordIds, function (r) {
+ var url = egCore.env.basePath + 'cat/catalog/record/' + r + '/holds';
+ $timeout(function() { $window.open(url, '_blank') });
+ });
+ }
+
+ $scope.showLastCircs = function(items){
+ var itemIds = [];
+ angular.forEach(items, function(cp){
+ itemIds.push(cp.acp.id());
+ });
+ angular.forEach(itemIds, function (id) {
+ var url = egCore.env.basePath + 'cat/item/' + id + '/circs';
+ $timeout(function() { $window.open(url, '_blank') });
+ });
+ }
+
+ $scope.selectedHoldingsVolCopyEdit = function (items) {
+ var itemObjs = [];
+ angular.forEach(items, function(i){
+ var h = egCore.idl.toHash(i);
+ h['call_number.record.id'] = h.record.doc_id;
+ itemObjs.push(h);
+ });
+ itemSvc.spawnHoldingsEdit(itemObjs,false,false);
+ }
+
+ $scope.show_mark_missing_pieces = function(items){
+ angular.forEach(items, function(i){
+ i.acp.call_number(i.acn);
+ i.acp.call_number().record(i.record);
+ itemSvc.mark_missing_pieces(i.acp);
+ });
+ }
}])