From: Mike Rylander Date: Wed, 2 Sep 2015 20:12:44 +0000 (-0400) Subject: webstaff: Add copy note creation/editing X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3b89ef139e2d98783493b9a7e134fd34a3ea5fed;p=evergreen%2Fmasslnc.git webstaff: Add copy note creation/editing TODO: move copy note dialog to a service so others can use it Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 index d4277043d1..9a0b48ed1e 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 @@ -360,6 +360,15 @@ +
+ +
diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_copy_notes.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_copy_notes.tt2 new file mode 100644 index 0000000000..7bd26a70b1 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_copy_notes.tt2 @@ -0,0 +1,91 @@ +
+ + + +
diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 index f589139914..6c356c22df 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2 @@ -229,6 +229,10 @@
+
@@ -240,7 +244,10 @@
-
[% l('Statistical Categories') %]
+
@@ -252,9 +259,7 @@
- +
[% l('Statistical Categories') %]
@@ -267,8 +272,10 @@
@@ -281,6 +288,10 @@
+
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 87f734aeb3..638a77fa56 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -153,7 +153,7 @@ function(egCore , $q) { service.flesh = { flesh : 3, flesh_fields : { - acp : ['call_number','parts','stat_cat_entries'], + acp : ['call_number','parts','stat_cat_entries', 'notes'], acn : ['label_class','prefix','suffix'] } } @@ -499,11 +499,12 @@ function(egCore , $q) { * Edit controller! */ .controller('EditCtrl', - ['$scope','$q','$window','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc', -function($scope , $q , $window , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc) { + ['$scope','$q','$window','$routeParams','$location','$timeout','egCore','egNet','egGridDataProvider','itemSvc','$modal', +function($scope , $q , $window , $routeParams , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc , $modal) { $scope.defaults = { // If defaults are not set at all, allow everything statcats : true, + copy_notes : true, attributes : { status : true, loan_duration : true, @@ -1048,7 +1049,6 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , 'open-ils.cat.asset.volume.fleshed.batch.update.override', egCore.auth.token(), cnList, 1, { auto_merge_vols : 1, create_parts : 1 } ).then(function(update_count) { - alert(update_count + ' call numbers updated'); if (and_exit) { $scope.dirty = false; $timeout(function(){$window.close()}); @@ -1062,6 +1062,60 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , } + $scope.copy_notes_dialog = function(copy_list) { + var default_pub = Boolean($scope.defaults.copy_notes_pub); + if (!angular.isArray(copy_list)) copy_list = [copy_list]; + + return $modal.open({ + templateUrl: './cat/volcopy/t_copy_notes', + animation: true, + controller: + ['$scope','$modalInstance', + function($scope , $modalInstance) { + $scope.focusNote = true; + $scope.note = { + creator : egCore.auth.user().id(), + 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 = []; + if (copy_list.length == 1) { + $scope.note_list = copy_list[0].notes(); + } + + $scope.ok = function(note) { + + if (note.initials) note.value += ' [' + note.initials + ']'; + angular.forEach(copy_list, function (cp) { + var n = new egCore.idl.acpn(); + n.creator(note.creator); + n.pub(note.pub); + n.title(note.title); + n.value(note.value); + n.owning_copy(cp.id()); + cp.notes().push( n ); + }); + + $modalInstance.close(); + } + + $scope.cancel = function($event) { + $modalInstance.dismiss(); + $event.preventDefault(); + } + }] + }); + } + }]) .directive("egVolTemplate", function () { @@ -1075,6 +1129,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , $scope.defaults = { // If defaults are not set at all, allow everything statcats : true, + copy_notes : true, attributes : { status : true, loan_duration : true,