Commit 514d1bd9e3a2661d7dc1c8b132a8802d977cad23
1 parent
e106898d
Exists in
master
[Redmine Atendimento #4734]Campo genérico bloqueado e marcado quando selecionado…
… um material tipo consumo
Showing
2 changed files
with
22 additions
and
1 deletions
Show diff stats
cit-adm-materiais-web/src/main/webapp/assets/js/angular/custom/controller/MaterialController.js
... | ... | @@ -28,6 +28,21 @@ citApp.controller('MaterialController', ['$scope', 'MaterialRepository', 'Classi |
28 | 28 | $scope.edit = true; |
29 | 29 | $scope.limpar(); |
30 | 30 | }; |
31 | + | |
32 | + function verificaMaterialConsumoSetGenerico(){ | |
33 | + if ($scope.material.dominioTipoMaterial && $scope.material.dominioTipoMaterial.codigo) { | |
34 | + if($scope.material.dominioTipoMaterial.codigo == 1){ | |
35 | + $scope.materialCaracteristica.generico = true; | |
36 | + $scope.bloquearMaterialConsumo = true; | |
37 | + }else{ | |
38 | + $scope.bloquearMaterialConsumo = false; | |
39 | + $scope.materialCaracteristica.generico = false; | |
40 | + } | |
41 | + }else{ | |
42 | + $scope.bloquearMaterialConsumo = false; | |
43 | + $scope.materialCaracteristica.generico = false; | |
44 | + } | |
45 | + } | |
31 | 46 | |
32 | 47 | $scope.getMaterial = function (material, edit) { |
33 | 48 | $scope.setLoadingSalva(true); |
... | ... | @@ -42,6 +57,7 @@ citApp.controller('MaterialController', ['$scope', 'MaterialRepository', 'Classi |
42 | 57 | } |
43 | 58 | |
44 | 59 | configurarDadosClassificacaoMaterial(); |
60 | + verificaMaterialConsumoSetGenerico(); | |
45 | 61 | $scope.setLoading(false); |
46 | 62 | }); |
47 | 63 | }; |
... | ... | @@ -259,6 +275,11 @@ citApp.controller('MaterialController', ['$scope', 'MaterialRepository', 'Classi |
259 | 275 | } |
260 | 276 | } |
261 | 277 | }; |
278 | + | |
279 | + $scope.$watch('material.dominioTipoMaterial.codigo', function() { | |
280 | + verificaMaterialConsumoSetGenerico(); | |
281 | + }); | |
282 | + | |
262 | 283 | |
263 | 284 | DominioRepository.findAllDominio('tipoMaterial').then(function(result) { |
264 | 285 | $scope.tiposMaterial = result; | ... | ... |
cit-adm-materiais-web/src/main/webapp/html/material/materialCaracteristica.html
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | <div class="form-group no-label"> |
32 | 32 | <div class="input-group"> |
33 | 33 | <label> |
34 | - <input type="checkbox" ng-model="materialCaracteristica.generico" value="false" /> | |
34 | + <input type="checkbox" ng-model="materialCaracteristica.generico" value="false" ng-disabled="bloquearMaterialConsumo"/> | |
35 | 35 | <translate>ADMINISTRACAODEMATERIAIS.LABEL.GENERICO</translate> |
36 | 36 | </label> |
37 | 37 | </div> | ... | ... |