From e514061efbc29563cd992e476882f750abdf74c7 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 5 May 2017 15:36:43 -0400 Subject: [PATCH] webstaff: embed serials prediction wizard into modal Signed-off-by: Galen Charlton --- Open-ILS/src/templates/staff/serials/t_manage.tt2 | 1 - .../staff/serials/t_pattern_editor_dialog.tt2 | 13 +++++++++++++ .../templates/staff/serials/t_prediction_manager.tt2 | 2 +- .../templates/staff/serials/t_prediction_wizard.tt2 | 2 +- .../staff/serials/directives/prediction_manager.js | 20 ++++++++++++++++++++ .../staff/serials/directives/prediction_wizard.js | 14 ++++++++++---- 6 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 diff --git a/Open-ILS/src/templates/staff/serials/t_manage.tt2 b/Open-ILS/src/templates/staff/serials/t_manage.tt2 index 8791b1f313..38758d0717 100644 --- a/Open-ILS/src/templates/staff/serials/t_manage.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_manage.tt2 @@ -15,7 +15,6 @@ -

View Issues TODO

diff --git a/Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 b/Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 new file mode 100644 index 0000000000..a42db7415a --- /dev/null +++ b/Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 @@ -0,0 +1,13 @@ + +
+ + +
diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 index ea0c9af2db..a68e1810a1 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 @@ -22,7 +22,7 @@ - +
diff --git a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 index 6a30a1182f..976dd0a3ad 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_wizard.tt2 @@ -451,7 +451,7 @@ -
diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js index fe5d5ba616..e64ebb1d5f 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_manager.js @@ -28,6 +28,26 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , if (newVal && newVal != oldVal) reload(newVal); }); + $scope.openPatternEditorDialog = function(pred) { + $uibModal.open({ + templateUrl: './serials/t_pattern_editor_dialog', + size: 'lg', + windowClass: 'eg-wide-modal', + controller: + ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) { + $scope.focusMe = true; + $scope.patternCode = pred.pattern_code; + $scope.ok = function(patternCode) { $uibModalInstance.close(patternCode) } + $scope.cancel = function () { $uibModalInstance.dismiss() } + }] + }).result.then(function (patternCode) { + if (pred.patternCode !== patternCode) { + pred.patternCode = patternCode; + + } + }); + } + }] } }) diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js index ff370fc76b..5ac79090f3 100644 --- a/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js +++ b/Open-ILS/web/js/ui/default/staff/serials/directives/prediction_wizard.js @@ -5,7 +5,8 @@ angular.module('egSerialsAppDep') transclude: true, restrict: 'E', scope: { - patternCode : '=' + patternCode : '=', + onSave : '=' }, templateUrl: './serials/t_prediction_wizard', controller: @@ -474,9 +475,14 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider) { } // TODO chron only - // dummy pattern - $scope.pattern = new PredictionPattern(["3","0","8","1","a","v.","b","no.","u","6","v","r","g","sequence","i","(year)","j","month","m","(day)","w","m","x","06,12","y","pw02we","y","ow0402th,0501"]); - console.debug($scope.pattern); + $scope.pattern = new PredictionPattern(JSON.parse($scope.patternCode)); + $scope.handle_save = function() { + $scope.patternCode = JSON.stringify($scope.pattern.compile()); + if (angular.isFunction($scope.onSave)) { + $scope.onSave($scope.patternCode); + } + } + }] } }) -- 2.11.0