Commit aeb2bf1151b010a576a17c38e461862a066145d7
1 parent
1cc00df2
Exists in
master
redmine #4270 Construção das regra de edição do pop-up "Aplicar penalidades";
Showing
4 changed files
with
34 additions
and
5 deletions
Show diff stats
cit-contratos-api/src/main/java/br/com/centralit/api/model/TermoReferenciaPenalidade.java
... | ... | @@ -47,7 +47,7 @@ public class TermoReferenciaPenalidade extends PersistentObjectAuditOrganizacao |
47 | 47 | /** Atributo id. */ |
48 | 48 | @Id |
49 | 49 | @GeneratedValue(strategy = GenerationType.AUTO) |
50 | - @JsonView({ ViewsContrato.TermoReferenciaEditView.class, ViewsContrato.TermoReferenciaPenalidadeListView.class }) | |
50 | + @JsonView({ ViewsContrato.TermoReferenciaEditView.class, ViewsContrato.TermoReferenciaPenalidadeListView.class, ViewsContrato.EventoPenalidadeEditView.class }) | |
51 | 51 | private Long id; |
52 | 52 | |
53 | 53 | ... | ... |
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/EventoPenalidadeServiceImpl.java
... | ... | @@ -87,8 +87,8 @@ public class EventoPenalidadeServiceImpl extends GenericServiceImpl<EventoPenali |
87 | 87 | |
88 | 88 | @Override |
89 | 89 | public EventoPenalidade save(EventoPenalidade eventoPenalidade) { |
90 | - | |
91 | 90 | eventoPenalidade.setContrato(this.contratoService.getReference(eventoPenalidade.getContrato().getId())); |
91 | + | |
92 | 92 | this.validarEntidade(eventoPenalidade, this.validator); |
93 | 93 | |
94 | 94 | montarObjeto(eventoPenalidade); |
... | ... | @@ -96,6 +96,19 @@ public class EventoPenalidadeServiceImpl extends GenericServiceImpl<EventoPenali |
96 | 96 | return super.save(eventoPenalidade); |
97 | 97 | } |
98 | 98 | |
99 | + @Override | |
100 | + public EventoPenalidade merge(EventoPenalidade eventoPenalidade) { | |
101 | + eventoPenalidade.setContrato(this.contratoService.getReference(eventoPenalidade.getContrato().getId())); | |
102 | + | |
103 | + this.validarEntidade(eventoPenalidade, this.validator); | |
104 | + | |
105 | + montarObjeto(eventoPenalidade); | |
106 | + | |
107 | + super.save(eventoPenalidade); | |
108 | + | |
109 | + return eventoPenalidade; | |
110 | + } | |
111 | + | |
99 | 112 | /** |
100 | 113 | * |
101 | 114 | * Método responsável por montar os objetos | ... | ... |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/EventoPenalidadeController.js
... | ... | @@ -19,6 +19,7 @@ citApp.controller('EventoPenalidadeController', ['$scope', '$filter', '$timeout' |
19 | 19 | $scope.setLoadingGet(true); |
20 | 20 | EventoPenalidadeRepository.get($scope.evento.id).then(function(result){ |
21 | 21 | $scope.eventoPenalidade = result.originalElement; |
22 | + $scope.eventoPenalidade.dataPenalizacao = $filter('date')($scope.eventoPenalidade.dataPenalizacao, "dd/MM/yyyy"); | |
22 | 23 | $scope.setLoading(false); |
23 | 24 | }); |
24 | 25 | } |
... | ... | @@ -44,10 +45,25 @@ citApp.controller('EventoPenalidadeController', ['$scope', '$filter', '$timeout' |
44 | 45 | }); |
45 | 46 | |
46 | 47 | RegistroOcorrenciaRepository.findAllOcorrenciasPorContrato($scope.contrato.id).then(function(result) { |
47 | - $scope.listaOcorrencias = result; | |
48 | - $scope.listaOcorrenciasFixa = result; | |
48 | + $timeout(function (){ | |
49 | + $scope.listaOcorrenciasFixa = result; | |
50 | + | |
51 | + removerOcorrenciasExistentes(); | |
52 | + | |
53 | + $scope.listaOcorrencias = angular.copy($scope.listaOcorrenciasFixa); | |
54 | + }); | |
49 | 55 | }); |
50 | 56 | |
57 | + function removerOcorrenciasExistentes() { | |
58 | + for(var i = $scope.eventoPenalidade.ocorrencias.length - 1; i >= 0; i--) { | |
59 | + for (var j = $scope.listaOcorrenciasFixa.length -1; j >= 0; j--) { | |
60 | + if ($scope.listaOcorrenciasFixa[j].id === $scope.eventoPenalidade.ocorrencias[i].registroOcorrencia.id) { | |
61 | + $scope.listaOcorrenciasFixa.splice(j, 1); | |
62 | + } | |
63 | + } | |
64 | + } | |
65 | + }; | |
66 | + | |
51 | 67 | $scope.addRegistroOcorrencia = function(){ |
52 | 68 | |
53 | 69 | if($scope.eventoPenalidade.registroOcorrencia){ | ... | ... |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/VisaoContratoController.js
... | ... | @@ -436,7 +436,7 @@ citApp.controller('VisaoContratoController', ['$scope', |
436 | 436 | break; |
437 | 437 | case 'PENALIDADE': |
438 | 438 | $scope.visualizarEvento = true; |
439 | - $scope.editEvento = false; | |
439 | + $scope.editEvento = true; | |
440 | 440 | $scope.removeEvento = false; |
441 | 441 | break; |
442 | 442 | case 'APOSTILAMENTO': | ... | ... |