From 2b278e30e4c9dee5d9c1c58915bcff30abb6d5bd Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 7 Sep 2015 13:46:01 -0400 Subject: [PATCH] webstaff: Phys Char Wiz : initial dialog / wizard Signed-off-by: Bill Erickson Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- .../staff/cat/share/t_physchar_dialog.tt2 | 15 +++++ .../staff/cat/share/t_physchar_wizard.tt2 | 32 +++++++++ .../ui/default/staff/cat/services/marcedit.js | 65 ++++++++++++++++++- .../ui/default/staff/cat/services/tagtable.js | 18 ++--- 4 files changed, 120 insertions(+), 10 deletions(-) create mode 100644 Open-ILS/src/templates/staff/cat/share/t_physchar_dialog.tt2 create mode 100644 Open-ILS/src/templates/staff/cat/share/t_physchar_wizard.tt2 diff --git a/Open-ILS/src/templates/staff/cat/share/t_physchar_dialog.tt2 b/Open-ILS/src/templates/staff/cat/share/t_physchar_dialog.tt2 new file mode 100644 index 0000000000..00708898a0 --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/share/t_physchar_dialog.tt2 @@ -0,0 +1,15 @@ +
+ + + +
diff --git a/Open-ILS/src/templates/staff/cat/share/t_physchar_wizard.tt2 b/Open-ILS/src/templates/staff/cat/share/t_physchar_wizard.tt2 new file mode 100644 index 0000000000..953ffe93ce --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/share/t_physchar_wizard.tt2 @@ -0,0 +1,32 @@ +
+
+
[% l('007 Value') %]
+
{{field.data}}
+
+
+
+
[% l('Category of Material') %]
+
+ +
+
+
+
{{get_label_for_step()}}
+
+ +
+
+
+ +
+
+ +
+
+
diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index 40235c96bd..4258173956 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -447,13 +447,30 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) '', scope: { field: "=", onKeydown: '=' }, controller : ['$scope','$modal', - function ( $scope, $modal ) { + function ( $scope, $modal) { $scope.showPhysCharLink = function () { return ($scope.$parent.$parent.record_type == 'bre') && $scope.field.tag == '007'; } $scope.spawnPhysCharWizard = function() { - console.log('HERE'); + var args = { + changed : false, + field : $scope.field + }; + $modal.open({ + templateUrl: './cat/share/t_physchar_dialog', + controller: ['$scope','$modalInstance', + function( $scope , $modalInstance) { + $scope.focusMe = true; + $scope.args = args; + $scope.ok = function(args) { $modalInstance.close(args) }; + $scope.cancel = function () { $modalInstance.dismiss() }; + }], + }).result.then(function (args) { + if (!args.changed) return; + // $scope.field.data = ... + }); + } } ] @@ -1427,6 +1444,50 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) } }) +.directive("egPhyscharWizard", function () { + return { + restrict: 'E', + replace: true, + templateUrl: './cat/share/t_physchar_wizard', + scope : { + field : '=' + }, + controller: ['$scope','egTagTable', + function ($scope , egTagTable) { + $scope.step = 'a'; + if ($scope.field.data) $scope.field.data = ''; + + $scope.value_for_step = ''; + $scope.values_for_step = []; + + egTagTable.getPhysCharTypeMap().then(function(list) { + // we start with the types selector + $scope.values_for_step = list; + }); + + $scope.current_ptype = function() { + return $scope.field.data.substr(0, 1); + } + + $scope.get_label_for_step = function() { + return 'TEST'; + } + + $scope.get_values_for_step = function() { + if ($scope.step == 'a') { + egTagTable.getPhysCharTypeMap().then(function(list) { + $scope.values_for_step = list; + }); + } else { + // + } + } + } + ] + } +}) + + .directive("egMarcEditAuthorityBrowser", function () { return { restrict: 'E', diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js b/Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js index de64a13a5e..dcc92beb92 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js @@ -510,8 +510,8 @@ function($q, egCore, egAuth) { return $q.when(service.phys_char_type_map); } - return egCore.pcrud.retrieveAll('cmpctm') - .then(function(map) {service.phys_char_type_map = map}); + return egCore.pcrud.retrieveAll('cmpctm', {}, {atomic : true}) + .then(function(map) {return service.phys_char_type_map = map}); } // Fetch+caches the config.marc21_physical_characteristic_subfield_map @@ -525,9 +525,10 @@ function($q, egCore, egAuth) { return egCore.pcrud.search('cmpcsm', {ptype_key : ptype_key}, - {order_by : {cmpcsm : ['start_pos']}}) - .then(function(maps) { - service.phys_char_sf_map[ptype_key] = maps; + {order_by : {cmpcsm : ['start_pos']}}, + {atomic : true} + ).then(function(maps) { + return service.phys_char_sf_map[ptype_key] = maps; }); } @@ -541,9 +542,10 @@ function($q, egCore, egAuth) { return egCore.pcrud.search('cmpcvm', {ptype_subfield : ptype_subfield}, - {order_by : {cmpcsm : ['value']}}) - .then(function(maps) { - service.phys_char_sf_map[ptype_subfield] = maps; + {order_by : {cmpcsm : ['value']}}, + {atomic : true} + ).then(function(maps) { + return service.phys_char_sf_map[ptype_subfield] = maps; }); } -- 2.43.2