<eg-grid-field label="[% l('Distribution Library') %]" path="stream.distribution.holding_lib.name" visible></eg-grid-field>
<eg-grid-field label="[% l('Issuance') %]" path="issuance.label" visible></eg-grid-field>
- <eg-grid-field label="[% l('Publication Date') %]" path="issuance.date_published" visible></eg-grid-field>
+ <eg-grid-field label="[% l('Publication Date') %]" path="issuance.date_published" visible>{{item.issuance.date_published|date:'shortDate'}}</eg-grid-field>
+ <eg-grid-field label="[% l('Status') %]" path="status" visible></eg-grid-field>
+ <eg-grid-field label="[% l('Date Expected') %]" path="date_expected" visible>{{item.date_expected|date:'shortDate'}}</eg-grid-field>
+ <eg-grid-field label="[% l('Date Received') %]" path="date_received" visible>{{item.date_received|date:'shortDate'}}</eg-grid-field>
<eg-grid-field label="[% l('Holding Type') %]" path="issuance.holding_type" visible></eg-grid-field>
<eg-grid-field label="[% l('Route To') %]" path="stream.routing_label"></eg-grid-field>
<eg-grid-field label="[% l('Receiving Template') %]" path="stream.distribution.receive_unit_template.name" visible></eg-grid-field>
templateUrl: './serials/t_view_items_grid',
controller:
['$scope','$q','egSerialsCoreSvc','egCore','egGridDataProvider',
- '$uibModal','ngToast',
+ '$uibModal','ngToast','egConfirmDialog',
function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider ,
- $uibModal , ngToast) {
+ $uibModal , ngToast , egConfirmDialog) {
$scope.svc = egSerialsCoreSvc; // just for debugging
}
});
+ $scope.delete_items = function (items) {
+ var list = [];
+
+ angular.forEach(items, function (i) {
+ var obj = egCore.idl.fromHash('sitem',i);
+ obj.isdeleted(1);
+ obj.stream(obj.stream().id); // API wants scalar or FM object
+ list.push(obj);
+ });
+
+ egConfirmDialog.open(
+ egCore.strings.CONFIRM_DELETE_ITEMS,
+ egCore.strings.CONFIRM_DELETE_ITEMS_MESSAGE,
+ {items : list.length}
+ ).result.then(function () {
+ return egCore.net.request(
+ 'open-ils.serial',
+ 'open-ils.serial.item.fleshed.batch.update',
+ egCore.auth.token(),
+ list
+ ).then( function(resp) {
+ var evt = egCore.evt.parse(resp);
+ if (evt) { // any way to just throw or return this to the error handler?
+ ngToast.danger(egCore.strings.SERIALS_ISSUANCE_FAIL_SAVE);
+ } else {
+ ngToast.success(egCore.strings.SERIALS_ISSUANCE_SUCCESS_SAVE);
+ return reload($scope.ssubId);
+ }
+ });
+ });
+ }
+
$scope.edit_issuance_holding_code = function (items) {
var promises = [];
var edits = [];
$scope.add_issuances = function () {
var lastItem = egSerialsCoreSvc.itemList[egSerialsCoreSvc.itemList.length - 1];
- var base_iss;
- if (lastItem) {
- lastItem = egCore.idl.fromHash('siss', lastItem.issuance);
- } else {
- base_iss = new egCore.idl.siss();
- base_iss.creator( egCore.auth.user().id() );
- base_iss.editor( egCore.auth.user().id() );
- base_iss.date_published( hc.date );
- base_iss.subscription( $scope.ssubId );
- base_iss.caption_and_pattern( hc.scap );
- base_iss.holding_code( JSON.stringify(hc.holding_code) );
- base_iss.holding_type( hc.type );
- }
+ if (lastItem) lastItem = egCore.idl.fromHash('siss', lastItem.issuance);
return egSerialsCoreSvc.new_holding_code({
title : egCore.strings.SERIALS_ISSUANCE_PREDICT,
prev_iss : lastItem
}).then(function(hc) {
console.log(hc)
+
+ var base_iss;
+ if (!lastItem) {
+ base_iss = new egCore.idl.siss();
+ base_iss.creator( egCore.auth.user().id() );
+ base_iss.editor( egCore.auth.user().id() );
+ base_iss.date_published( hc.date );
+ base_iss.subscription( $scope.ssubId );
+ base_iss.caption_and_pattern( hc.scap );
+ base_iss.holding_code( JSON.stringify(hc.holding_code) );
+ base_iss.holding_type( hc.type );
+ }
+
+ // if we're predicting without a preexisting holding, reduce the count
+ if (!lastItem) hc.count--;
+
return egCore.net.request(
'open-ils.serial',
'open-ils.serial.make_predictions',