statcat_filter: undefined
};
+ $scope.copyNoteUpdate = function (notes) {
+ if (!$scope.in_item_select &&
+ $scope.workingGridControls &&
+ $scope.workingGridControls.selectedItems) {
+ angular.forEach(
+ $scope.workingGridControls.selectedItems(),
+ function (cp) {
+ $scope.dirty = true;
+ angular.forEach(notes, function(note) {
+ var n = egCore.idl.fromHash('acpn', note);
+ n.isnew(1);
+ n.creator(egCore.auth.user().id());
+ n.owning_copy(cp.id());
+ cp.notes().push( n );
+ });
+ cp.ischanged(1);
+ }
+ );
+
+ }
+ }
+
$scope.statcatUpdate = function (id) {
var newval = $scope.working.statcats[id];
angular.forEach($scope.templates[n], function (v,k) {
if (k == 'circ_lib') {
$scope.working[k] = egCore.org.get(v);
+ } else if (k == 'copy_notes' && v.length) {
+ $scope.copyNoteUpdate(v);
} else if (!angular.isObject(v)) {
$scope.working[k] = angular.copy(v);
} else {
scope: {
editTemplates: '=',
},
- controller : ['$scope','$window','itemSvc','egCore','ngToast',
- function ( $scope , $window , itemSvc , egCore , ngToast) {
+ controller : ['$scope','$window','itemSvc','egCore','ngToast','$uibModal',
+ function ( $scope , $window , itemSvc , egCore , ngToast , $uibModal) {
$scope.i18n = egCore.i18n;
angular.forEach($scope.templates[n], function (v,k) {
if (k == 'circ_lib') {
$scope.working[k] = egCore.org.get(v);
- } else if (!angular.isObject(v)) {
+ } else if (angular.isArray(v) || !angular.isObject(v)) {
$scope.working[k] = angular.copy(v);
} else {
angular.forEach(v, function (sv,sk) {
}
ngToast.create(egCore.strings.VOL_COPY_TEMPLATE_SUCCESS_SAVE);
}
-
+
$scope.templates = {};
$scope.imported_templates = { data : '' };
$scope.template_name = '';
}
$scope.working = {
+ copy_notes: [],
statcats: {},
statcat_filter: undefined
};
createStatcatUpdateWatcher(s.id());
});
});
+
+ $scope.copy_notes_dialog = function() {
+ var default_pub = Boolean($scope.defaults.copy_notes_pub);
+ var working = $scope.working;
+
+ return $uibModal.open({
+ templateUrl: './cat/volcopy/t_copy_notes',
+ animation: true,
+ controller:
+ ['$scope','$uibModalInstance',
+ function($scope , $uibModalInstance) {
+ $scope.focusNote = true;
+ $scope.note = {
+ title : '',
+ value : '',
+ pub : default_pub,
+ };
+
+ $scope.require_initials = false;
+ egCore.org.settings([
+ 'ui.staff.require_initials.copy_notes'
+ ]).then(function(set) {
+ $scope.require_initials = Boolean(set['ui.staff.require_initials.copy_notes']);
+ });
+
+ $scope.note_list = [];
+ angular.forEach(working.copy_notes, function(note) {
+ var acpn = egCore.idl.fromHash('acpn', note);
+ $scope.note_list.push(acpn);
+ });
+
+ $scope.ok = function(note) {
+
+ if (!working.copy_notes) {
+ working.copy_notes = [];
+ }
+
+ // clear slate
+ working.copy_notes.length = 0;
+ angular.forEach($scope.note_list, function(existing_note) {
+ if (!existing_note.isdeleted()) {
+ working.copy_notes.push({
+ pub : existing_note.pub() ? 't' : 'f',
+ title : existing_note.title(),
+ value : existing_note.value()
+ });
+ }
+ });
+
+ // add new note, if any
+ if (note.initials) note.value += ' [' + note.initials + ']';
+ note.pub = note.pub ? 't' : 'f';
+ if (note.title.length && note.value.length) {
+ working.copy_notes.push(note);
+ }
+
+ $uibModalInstance.close();
+ }
+
+ $scope.cancel = function($event) {
+ $uibModalInstance.dismiss();
+ $event.preventDefault();
+ }
+ }]
+ });
+ }
$scope.status_list = [];
itemSvc.get_magic_statuses().then(function(list){