From: Galen Charlton Date: Fri, 7 Jul 2017 22:08:02 +0000 (-0400) Subject: webstaff: check whether a pattern can be edited or deleted X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d1480121cd0697c097fa25caab88d1c80d40a6a7;p=working%2FEvergreen.git webstaff: check whether a pattern can be edited or deleted Signed-off-by: Galen Charlton --- 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 index d34f5a0a9e..c19ef8c0c2 100644 --- a/Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_pattern_editor_dialog.tt2 @@ -8,7 +8,7 @@ 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 1bc9bb9042..0dda638680 100644 --- a/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 +++ b/Open-ILS/src/templates/staff/serials/t_prediction_manager.tt2 @@ -60,11 +60,12 @@ - + +
- +
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 2390f69470..14164f3ffc 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,17 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , function reload(ssubId) { var ssub = egSerialsCoreSvc.get_ssub(ssubId); $scope.predictions = egCore.idl.toTypedHash(ssub.scaps()); + angular.forEach($scope.predictions, function(pred) { + pred._can_edit_or_delete = false; + egCore.net.request( + 'open-ils.serial', + 'open-ils.serial.caption_and_pattern.safe_delete.dry_run', + egCore.auth.token(), + pred.id + ).then(function(result) { + if (result == 1) pred._can_edit_or_delete = true; + }); + }); egSerialsCoreSvc.fetch_spt().then(function() { $scope.pattern_templates = egCore.idl.toTypedHash(egSerialsCoreSvc.sptList); $scope.active_pattern_template = { id : null }; @@ -156,7 +167,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , $timeout(function() { $scope.new_prediction.predform.$setDirty() }); } - $scope.openPatternEditorDialog = function(pred) { + $scope.openPatternEditorDialog = function(pred, viewOnly) { $uibModal.open({ templateUrl: './serials/t_pattern_editor_dialog', size: 'lg', @@ -164,6 +175,7 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , backdrop: 'static', controller: ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) { + $scope.viewOnly = viewOnly; $scope.focusMe = true; $scope.patternCode = pred.pattern_code; $scope.ok = function(patternCode) { $uibModalInstance.close(patternCode) }