Commit 867411579d85128cf75efea0ddbcb4cde5669fd8
1 parent
4902267a
Exists in
master
redmine #4347 Melhoria na pop-up "Recebimento de objeto";
Showing
7 changed files
with
199 additions
and
226 deletions
Show diff stats
cit-contratos-api/src/main/java/br/com/centralit/api/model/Contrato.java
@@ -235,7 +235,8 @@ public class Contrato extends PersistentObjectAuditOrganizacao { | @@ -235,7 +235,8 @@ public class Contrato extends PersistentObjectAuditOrganizacao { | ||
235 | @JsonView({ ViewsContrato.ContratoEditView.class, | 235 | @JsonView({ ViewsContrato.ContratoEditView.class, |
236 | ViewsContrato.ContratoAutoCompleteView.class, | 236 | ViewsContrato.ContratoAutoCompleteView.class, |
237 | ViewsContrato.EncerramentoContratoEditView.class, | 237 | ViewsContrato.EncerramentoContratoEditView.class, |
238 | - ViewsContrato.EventoApostilamentoEditView.class }) | 238 | + ViewsContrato.EventoApostilamentoEditView.class, |
239 | + ViewsContrato.EventoRecebimentoObjetoEditView.class }) | ||
239 | @Column(length = 1024, nullable = false) | 240 | @Column(length = 1024, nullable = false) |
240 | private String objetoContratacao; | 241 | private String objetoContratacao; |
241 | 242 |
cit-contratos-api/src/main/java/br/com/centralit/api/model/EventoRecebimentoObjeto.java
@@ -97,11 +97,6 @@ public class EventoRecebimentoObjeto extends ContratoEvento { | @@ -97,11 +97,6 @@ public class EventoRecebimentoObjeto extends ContratoEvento { | ||
97 | @JsonView({ ViewsContrato.EventoRecebimentoObjetoEditView.class }) | 97 | @JsonView({ ViewsContrato.EventoRecebimentoObjetoEditView.class }) |
98 | private Dominio tipoAvaliacaoAdesao; | 98 | private Dominio tipoAvaliacaoAdesao; |
99 | 99 | ||
100 | - /** Atributo nomeObjeto. */ | ||
101 | - @Column(length = 200, nullable = false) | ||
102 | - @JsonView({ ViewsContrato.EventoRecebimentoObjetoEditView.class }) | ||
103 | - private String nomeObjeto; | ||
104 | - | ||
105 | /** Atributo justificativa. */ | 100 | /** Atributo justificativa. */ |
106 | @Column(length = 2000, nullable = true) | 101 | @Column(length = 2000, nullable = true) |
107 | @JsonView({ ViewsContrato.EventoRecebimentoObjetoEditView.class }) | 102 | @JsonView({ ViewsContrato.EventoRecebimentoObjetoEditView.class }) |
@@ -177,27 +172,6 @@ public class EventoRecebimentoObjeto extends ContratoEvento { | @@ -177,27 +172,6 @@ public class EventoRecebimentoObjeto extends ContratoEvento { | ||
177 | this.tipoStatus = tipoStatus; | 172 | this.tipoStatus = tipoStatus; |
178 | } | 173 | } |
179 | 174 | ||
180 | - | ||
181 | - /** | ||
182 | - * Retorna o valor do atributo <code>nomeObjeto</code> | ||
183 | - * | ||
184 | - * @return <code>String</code> | ||
185 | - */ | ||
186 | - public String getNomeObjeto() { | ||
187 | - | ||
188 | - return nomeObjeto; | ||
189 | - } | ||
190 | - | ||
191 | - /** | ||
192 | - * Define o valor do atributo <code>nomeObjeto</code>. | ||
193 | - * | ||
194 | - * @param nomeObjeto | ||
195 | - */ | ||
196 | - public void setNomeObjeto(String nomeObjeto) { | ||
197 | - | ||
198 | - this.nomeObjeto = nomeObjeto; | ||
199 | - } | ||
200 | - | ||
201 | public Dominio getTipoAvaliacaoPrazo() { | 175 | public Dominio getTipoAvaliacaoPrazo() { |
202 | 176 | ||
203 | return tipoAvaliacaoPrazo; | 177 | return tipoAvaliacaoPrazo; |
cit-contratos-api/src/main/java/br/com/centralit/api/service/validation/EventoRecebimentoObjetoValidator.java
@@ -37,7 +37,6 @@ public class EventoRecebimentoObjetoValidator implements Validator{ | @@ -37,7 +37,6 @@ public class EventoRecebimentoObjetoValidator implements Validator{ | ||
37 | 37 | ||
38 | ValidationUtils.rejectIfEmpty(errors, "contrato", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.CONTRATO"); | 38 | ValidationUtils.rejectIfEmpty(errors, "contrato", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.CONTRATO"); |
39 | ValidationUtils.rejectIfEmpty(errors, "tipoRecebimento", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.TIPO_RECEBIMENTO"); | 39 | ValidationUtils.rejectIfEmpty(errors, "tipoRecebimento", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.TIPO_RECEBIMENTO"); |
40 | - ValidationUtils.rejectIfEmpty(errors, "nomeObjeto", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.NOME_OBJETO"); | ||
41 | ValidationUtils.rejectIfEmpty(errors, "tipoStatus", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.STATUS"); | 40 | ValidationUtils.rejectIfEmpty(errors, "tipoStatus", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "LABEL.STATUS"); |
42 | ValidationUtils.rejectIfEmpty(errors, "tipoAvaliacaoPrazo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.AVALIACAO_OBJETO"); | 41 | ValidationUtils.rejectIfEmpty(errors, "tipoAvaliacaoPrazo", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.AVALIACAO_OBJETO"); |
43 | ValidationUtils.rejectIfEmpty(errors, "tipoAvaliacaoAdesao", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.AVALIACAO_OBJETO"); | 42 | ValidationUtils.rejectIfEmpty(errors, "tipoAvaliacaoAdesao", CodigoErro.VALIDACAO_CAMPOS_OBRIGATORIOS.getValue().toString(), "CONTRATOS.LABEL.AVALIACAO_OBJETO"); |
cit-contratos-api/src/main/resources/script-bd/v1.0.0-alpha11/01-cit-contratos-1.0.0-ALFA-11-postgres.sql
@@ -11,3 +11,7 @@ INSERT INTO menufile (id, datacriacao, dataedicao, version, ativo, caminho, domi | @@ -11,3 +11,7 @@ INSERT INTO menufile (id, datacriacao, dataedicao, version, ativo, caminho, domi | ||
11 | VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true, '/cit-contratos-web/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.min.js', | 11 | VALUES (NEXTVAL('hibernate_sequence'), LOCALTIMESTAMP, LOCALTIMESTAMP, 0, true, '/cit-contratos-web/assets/js/angular/custom/repository/EventoLiberacaoPagamentoEmpenhoRepository.min.js', |
12 | (SELECT id FROM dominio WHERE chave = 'tipoFile' AND codigo = 2), (SELECT id FROM menu WHERE chave = 'ACOMPANHAMENTO')); | 12 | (SELECT id FROM dominio WHERE chave = 'tipoFile' AND codigo = 2), (SELECT id FROM menu WHERE chave = 'ACOMPANHAMENTO')); |
13 | -- LUÍS CÉSAR FIM 05/04/2016 | 13 | -- LUÍS CÉSAR FIM 05/04/2016 |
14 | + | ||
15 | +-- LUÍS CÉSAR INÍCIO 06/04/2016 | ||
16 | +ALTER TABLE cnt_ev_recebimentoobjeto DROP COLUMN nomeobjeto; | ||
17 | +-- LUÍS CÉSRA FIM 06/04/2016 | ||
14 | \ No newline at end of file | 18 | \ No newline at end of file |
cit-contratos-web/src/main/resources/reports/eventoRecebimentoObjeto.jrxml
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | -<!-- Created with Jaspersoft Studio version 6.2.0.final using JasperReports Library version 6.2.0 --> | ||
3 | -<!-- 2016-04-01T17:16:34 --> | ||
4 | <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="eventoRecebimentoObjeto" language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="e04cf746-a11a-488e-9c73-7c7069a15371"> | 2 | <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="eventoRecebimentoObjeto" language="groovy" pageWidth="555" pageHeight="802" columnWidth="555" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="e04cf746-a11a-488e-9c73-7c7069a15371"> |
5 | <property name="com.jaspersoft.studio.data.sql.tables" value=""/> | 3 | <property name="com.jaspersoft.studio.data.sql.tables" value=""/> |
6 | <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Postgres citgrpdb"/> | 4 | <property name="com.jaspersoft.studio.data.defaultdataadapter" value="Postgres citgrpdb"/> |
7 | <property name="ireport.zoom" value="1.7715610000000062"/> | 5 | <property name="ireport.zoom" value="1.7715610000000062"/> |
8 | <property name="ireport.x" value="0"/> | 6 | <property name="ireport.x" value="0"/> |
9 | - <property name="ireport.y" value="0"/> | 7 | + <property name="ireport.y" value="11"/> |
10 | <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> | 8 | <style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"> |
11 | <box> | 9 | <box> |
12 | <pen lineWidth="0.5" lineColor="#000000"/> | 10 | <pen lineWidth="0.5" lineColor="#000000"/> |
@@ -39,6 +37,7 @@ | @@ -39,6 +37,7 @@ | ||
39 | <![CDATA[select | 37 | <![CDATA[select |
40 | contrato.numeroanocontrato as numeroAnoContrato, | 38 | contrato.numeroanocontrato as numeroAnoContrato, |
41 | contrato.numeroprocesso AS numeroProcesso, | 39 | contrato.numeroprocesso AS numeroProcesso, |
40 | +contrato.objetocontratacao, | ||
42 | pesForn.nome AS contratada, | 41 | pesForn.nome AS contratada, |
43 | pesJForn.cnpj AS cnpjcontratado, | 42 | pesJForn.cnpj AS cnpjcontratado, |
44 | ro.sequencialano as numeroRecebimento, | 43 | ro.sequencialano as numeroRecebimento, |
@@ -47,7 +46,6 @@ ro.datarecebimento as dataRecebimento, | @@ -47,7 +46,6 @@ ro.datarecebimento as dataRecebimento, | ||
47 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipostatus_id) AS tipoStatus, | 46 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipostatus_id) AS tipoStatus, |
48 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipoavaliacaoprazo_id) AS tipoAvaliacaoPrazo, | 47 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipoavaliacaoprazo_id) AS tipoAvaliacaoPrazo, |
49 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipoavaliacaoadesao_id) AS tipoAvaliacaoAdesao, | 48 | (SELECT dominio.descricao FROM dominio WHERE dominio.id = ro.tipoavaliacaoadesao_id) AS tipoAvaliacaoAdesao, |
50 | -ro.nomeObjeto as nomeObjeto, | ||
51 | ro.justificativa as justificativa, | 49 | ro.justificativa as justificativa, |
52 | pesGestor.nome AS gestor, | 50 | pesGestor.nome AS gestor, |
53 | cGestor.matricula AS gestorMatricula, | 51 | cGestor.matricula AS gestorMatricula, |
@@ -76,6 +74,7 @@ where ro.id = $P{RECEBIMENTO_ID}]]> | @@ -76,6 +74,7 @@ where ro.id = $P{RECEBIMENTO_ID}]]> | ||
76 | </queryString> | 74 | </queryString> |
77 | <field name="numeroanocontrato" class="java.lang.String"/> | 75 | <field name="numeroanocontrato" class="java.lang.String"/> |
78 | <field name="numeroprocesso" class="java.lang.Long"/> | 76 | <field name="numeroprocesso" class="java.lang.Long"/> |
77 | + <field name="objetocontratacao" class="java.lang.String"/> | ||
79 | <field name="contratada" class="java.lang.String"/> | 78 | <field name="contratada" class="java.lang.String"/> |
80 | <field name="cnpjcontratado" class="java.lang.String"/> | 79 | <field name="cnpjcontratado" class="java.lang.String"/> |
81 | <field name="numerorecebimento" class="java.lang.String"/> | 80 | <field name="numerorecebimento" class="java.lang.String"/> |
@@ -84,7 +83,6 @@ where ro.id = $P{RECEBIMENTO_ID}]]> | @@ -84,7 +83,6 @@ where ro.id = $P{RECEBIMENTO_ID}]]> | ||
84 | <field name="tipostatus" class="java.lang.String"/> | 83 | <field name="tipostatus" class="java.lang.String"/> |
85 | <field name="tipoavaliacaoprazo" class="java.lang.String"/> | 84 | <field name="tipoavaliacaoprazo" class="java.lang.String"/> |
86 | <field name="tipoavaliacaoadesao" class="java.lang.String"/> | 85 | <field name="tipoavaliacaoadesao" class="java.lang.String"/> |
87 | - <field name="nomeobjeto" class="java.lang.String"/> | ||
88 | <field name="justificativa" class="java.lang.String"/> | 86 | <field name="justificativa" class="java.lang.String"/> |
89 | <field name="gestor" class="java.lang.String"/> | 87 | <field name="gestor" class="java.lang.String"/> |
90 | <field name="gestormatricula" class="java.lang.String"/> | 88 | <field name="gestormatricula" class="java.lang.String"/> |
@@ -452,7 +450,7 @@ $F{cnpjcontratado}.substring(12, 14)]]></textFieldExpression> | @@ -452,7 +450,7 @@ $F{cnpjcontratado}.substring(12, 14)]]></textFieldExpression> | ||
452 | <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> | 450 | <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/> |
453 | </box> | 451 | </box> |
454 | <textElement verticalAlignment="Middle"/> | 452 | <textElement verticalAlignment="Middle"/> |
455 | - <textFieldExpression><![CDATA[$F{nomeobjeto}]]></textFieldExpression> | 453 | + <textFieldExpression><![CDATA[$F{objetocontratacao}]]></textFieldExpression> |
456 | </textField> | 454 | </textField> |
457 | <textField isStretchWithOverflow="true"> | 455 | <textField isStretchWithOverflow="true"> |
458 | <reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="220" height="25" isPrintWhenDetailOverflows="true" backcolor="#CCCCCC" uuid="2a73e93e-b151-4d8a-be9d-32a7c4bb9c46"/> | 456 | <reportElement stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="220" height="25" isPrintWhenDetailOverflows="true" backcolor="#CCCCCC" uuid="2a73e93e-b151-4d8a-be9d-32a7c4bb9c46"/> |
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/EventoRecebimentoObjetoController.js
@@ -20,171 +20,169 @@ citApp.controller('EventoRecebimentoObjetoController', ['$scope', | @@ -20,171 +20,169 @@ citApp.controller('EventoRecebimentoObjetoController', ['$scope', | ||
20 | FileUploader) { | 20 | FileUploader) { |
21 | 21 | ||
22 | 22 | ||
23 | - $scope.getRecebimentoObjeto = function(){ | ||
24 | - var idRecebimentoObjeto = $scope.evento.id; | ||
25 | - $scope.setLoadingGet(true); | ||
26 | - EventoRecebimentoObjetoRepository.get(idRecebimentoObjeto).then(function(result) { | ||
27 | - $scope.recebimentoObjeto = result.originalElement; | ||
28 | - if($scope.contratoTemp == undefined){ | ||
29 | - $scope.contratoTemp= angular.copy($scope.recebimentoObjeto.contrato); | ||
30 | - } | ||
31 | - $scope.setLoading(false); | ||
32 | - }); | ||
33 | - }; | ||
34 | - | ||
35 | - $scope.resetForm = function(form) { | ||
36 | - | ||
37 | - if($scope.contratoTemp == undefined){ | ||
38 | - $scope.contratoTemp= angular.copy($scope.contrato); | ||
39 | - } | ||
40 | - if($scope.evento){ | ||
41 | - $scope.recebimentoObjeto.dataRecebimento = null; | ||
42 | - $scope.recebimentoObjeto.nomeObjeto = ""; | ||
43 | - $scope.recebimentoObjeto.justificativa = ""; | ||
44 | - } else { | ||
45 | - $scope.recebimentoObjeto = { | ||
46 | - contrato: $scope.contratoTemp, | ||
47 | - dataRecebimento : $filter('date')(new Date(), "dd/MM/yyyy"), | ||
48 | - tipoStatus : null, | ||
49 | - tipoRecebimento : null, | ||
50 | - tipoAvaliacaoPrazo : null, | ||
51 | - tipoAvaliacaoAdesao : null, | ||
52 | - nomeObjeto : "", | ||
53 | - justificativa : "" | ||
54 | - }; | ||
55 | - } | ||
56 | - if(form != undefined){ | ||
57 | - $timeout(function(){ | ||
58 | - form.$submitted = true; | ||
59 | - form.$setPristine(); | ||
60 | - }); | ||
61 | - }; | ||
62 | - }; | ||
63 | - | ||
64 | - $scope.carregarDominios = function(){ | ||
65 | - DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjeto').then(function(result) { | ||
66 | - angular.forEach(result, function(item, key){ | ||
67 | - switch (item.codigo){ | ||
68 | - case 1 : | ||
69 | - $scope.dominiosRecebimentoObjeto.tiposRecebimentos.push(item.originalElement); | ||
70 | - break; | ||
71 | - case 2 : | ||
72 | - $scope.dominiosRecebimentoObjeto.tiposRecebimentos.push(item.originalElement); | ||
73 | - break; | ||
74 | - case 3 : | ||
75 | - $scope.dominiosRecebimentoObjeto.tiposStatus.push(item.originalElement); | ||
76 | - break; | ||
77 | - case 4 : | ||
78 | - $scope.dominiosRecebimentoObjeto.tiposStatus.push(item.originalElement); | ||
79 | - break; | ||
80 | - } | ||
81 | - }); | ||
82 | - }); | ||
83 | - | ||
84 | - DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjetoAvaliacaoPrazo').then(function(result) { | ||
85 | - angular.forEach(result, function(item, key){ | ||
86 | - $scope.dominiosRecebimentoObjeto.tiposAvaliacaoPrazo.push(item.originalElement); | ||
87 | - }); | ||
88 | - }); | ||
89 | - DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjetoAvaliacaoAdesao').then(function(result) { | ||
90 | - angular.forEach(result, function(item, key){ | ||
91 | - $scope.dominiosRecebimentoObjeto.tiposAvaliacaoAdesao.push(item.originalElement); | ||
92 | - }); | ||
93 | - }); | ||
94 | - }; | ||
95 | - | ||
96 | - $scope.uploader = new FileUploader({ | ||
97 | - autoUpload: false, | ||
98 | - queueLimit: 1, | ||
99 | - url : '/cit-tabelas-corp-web/rest/anexo/uploadAnexo?idDocumento=' | ||
100 | - }); | ||
101 | - | ||
102 | - $scope.salvarEvento = function(form){ | ||
103 | - | ||
104 | - form.$submitted = true; | ||
105 | - if(form && !form.$invalid) { | ||
106 | - if ($scope.isInformacoesValidas()){ | ||
107 | - $scope.setLoadingSalva(true); | ||
108 | - | ||
109 | - if($scope.recebimentoObjetoTemp == null){ | ||
110 | - $scope.recebimentoObjetoTemp = { | ||
111 | - documentos : [] | ||
112 | - }; | ||
113 | - angular.forEach($scope.recebimentoObjeto.documentos, function(documento, key) { | ||
114 | - $scope.recebimentoObjetoTemp.documentos.push({ | ||
115 | - uploadsDocumento : clone(documento.uploadsDocumento), | ||
116 | - numero : clone(documento.numero) | ||
117 | - }); | ||
118 | - delete documento.uploadsDocumento; | ||
119 | - }); | ||
120 | - }; | ||
121 | - | ||
122 | - EventoRecebimentoObjetoRepository.save($scope.recebimentoObjeto).then(function(result) { | ||
123 | - $scope.recebimentoObjeto = result.originalElement; | ||
124 | - | ||
125 | - angular.forEach($scope.recebimentoObjeto.documentos, function(documentoSalvo, key) { | ||
126 | - if(documentoSalvo !== undefined && documentoSalvo.id !== undefined){ | ||
127 | - angular.forEach($scope.recebimentoObjetoTemp.documentos, function(documentoTransient, key) { | ||
128 | - if(documentoSalvo.numero === documentoTransient.numero){ | ||
129 | - salvarUpload(documentoSalvo, documentoTransient.uploadsDocumento); | ||
130 | - } | ||
131 | - }); | ||
132 | - }; | ||
133 | - }); | ||
134 | - $scope.setLoading(false); | ||
135 | - $scope.$modalInstance.dismiss('cancel'); | ||
136 | - $scope.showAlert("success", $translate.instant("MSG.MG001")); | ||
137 | - $scope.buscaOcorrencias($scope.contratoTemp); | ||
138 | - }); | ||
139 | - }; | ||
140 | - } else { | ||
141 | - $scope.showAlert('error', $translate.instant('MSG.MN001')); | ||
142 | - } | ||
143 | - }; | ||
144 | - | ||
145 | - $scope.isInformacoesValidas = function () { | ||
146 | - | ||
147 | - var valido = true; | ||
148 | - | ||
149 | - if(!isDataDentroPeriodo($scope.contratoTemp.dataVigenciaInicial, $scope.contratoTemp.dataUltimaVigenciaFinal, | ||
150 | - $scope.recebimentoObjeto.dataRecebimento)){ | ||
151 | - $scope.showAlert('warning', $translate.instant('MSG.DATA_RECEBIMENTO_INVALIDA')); | ||
152 | - valido = false; | ||
153 | - } | ||
154 | - return valido; | ||
155 | - }; | ||
156 | - | ||
157 | - var salvarUpload = function(documento, uploadsDocumento){ | ||
158 | - if (uploadsDocumento != undefined && uploadsDocumento != null) { | ||
159 | - $scope.uploader.queue = uploadsDocumento; | ||
160 | - angular.forEach($scope.uploader.queue, function(item, key) { | ||
161 | - item.url = item.url + documento.id; | ||
162 | - }); | ||
163 | - $scope.uploader.uploadAll(); | ||
164 | - $scope.uploader.isUploading = false; | ||
165 | - }; | ||
166 | - }; | ||
167 | - | ||
168 | - $scope.gerarRelatorioRecebimentoObjeto = function(){ | ||
169 | - $scope.url = '/cit-contratos-web/rest/eventoRecebimentoObjeto/pdfGerarRecebimentoObjeto?idRecebimentoObjeto=' + $scope.recebimentoObjeto.id; | ||
170 | - $scope.visualizarRelatorio($scope.url, $translate.instant('LABEL.TITULO_DOCUMENTO_RECEBIMENTO')); | ||
171 | - $scope.$modalInstance.dismiss('cancel'); | ||
172 | - | ||
173 | - }; | ||
174 | - | ||
175 | - (function init(){ | ||
176 | - $scope.dominiosRecebimentoObjeto = { | ||
177 | - tiposStatus: [], | ||
178 | - tiposRecebimentos : [], | ||
179 | - tiposAvaliacaoPrazo : [], | ||
180 | - tiposAvaliacaoAdesao : [], | ||
181 | - }; | ||
182 | - $scope.carregarDominios(); | ||
183 | - if($scope.evento){ | ||
184 | - $scope.getRecebimentoObjeto(); | ||
185 | - } else { | ||
186 | - $scope.resetForm(); | ||
187 | - } | ||
188 | - })(); | 23 | + $scope.getRecebimentoObjeto = function(){ |
24 | + var idRecebimentoObjeto = $scope.evento.id; | ||
25 | + $scope.setLoadingGet(true); | ||
26 | + EventoRecebimentoObjetoRepository.get(idRecebimentoObjeto).then(function(result) { | ||
27 | + $scope.recebimentoObjeto = result.originalElement; | ||
28 | + if($scope.contratoTemp == undefined){ | ||
29 | + $scope.contratoTemp= angular.copy($scope.recebimentoObjeto.contrato); | ||
30 | + } | ||
31 | + $scope.setLoading(false); | ||
32 | + }); | ||
33 | + }; | ||
34 | + | ||
35 | + $scope.resetForm = function(form) { | ||
36 | + | ||
37 | + if($scope.contratoTemp == undefined){ | ||
38 | + $scope.contratoTemp= angular.copy($scope.contrato); | ||
39 | + } | ||
40 | + if($scope.evento){ | ||
41 | + $scope.recebimentoObjeto.dataRecebimento = null; | ||
42 | + $scope.recebimentoObjeto.justificativa = ""; | ||
43 | + } else { | ||
44 | + $scope.recebimentoObjeto = { | ||
45 | + contrato: $scope.contratoTemp, | ||
46 | + dataRecebimento : $filter('date')(new Date(), "dd/MM/yyyy"), | ||
47 | + tipoStatus : null, | ||
48 | + tipoRecebimento : null, | ||
49 | + tipoAvaliacaoPrazo : null, | ||
50 | + tipoAvaliacaoAdesao : null, | ||
51 | + justificativa : "" | ||
52 | + }; | ||
53 | + } | ||
54 | + if(form != undefined){ | ||
55 | + $timeout(function(){ | ||
56 | + form.$submitted = true; | ||
57 | + form.$setPristine(); | ||
58 | + }); | ||
59 | + }; | ||
60 | + }; | ||
61 | + | ||
62 | + $scope.carregarDominios = function(){ | ||
63 | + DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjeto').then(function(result) { | ||
64 | + angular.forEach(result, function(item, key){ | ||
65 | + switch (item.codigo){ | ||
66 | + case 1 : | ||
67 | + $scope.dominiosRecebimentoObjeto.tiposRecebimentos.push(item.originalElement); | ||
68 | + break; | ||
69 | + case 2 : | ||
70 | + $scope.dominiosRecebimentoObjeto.tiposRecebimentos.push(item.originalElement); | ||
71 | + break; | ||
72 | + case 3 : | ||
73 | + $scope.dominiosRecebimentoObjeto.tiposStatus.push(item.originalElement); | ||
74 | + break; | ||
75 | + case 4 : | ||
76 | + $scope.dominiosRecebimentoObjeto.tiposStatus.push(item.originalElement); | ||
77 | + break; | ||
78 | + } | ||
79 | + }); | ||
80 | + }); | ||
81 | + | ||
82 | + DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjetoAvaliacaoPrazo').then(function(result) { | ||
83 | + angular.forEach(result, function(item, key){ | ||
84 | + $scope.dominiosRecebimentoObjeto.tiposAvaliacaoPrazo.push(item.originalElement); | ||
85 | + }); | ||
86 | + }); | ||
87 | + DominioRepository.findAllDominio('tipoEventoContratoRecebimentoObjetoAvaliacaoAdesao').then(function(result) { | ||
88 | + angular.forEach(result, function(item, key){ | ||
89 | + $scope.dominiosRecebimentoObjeto.tiposAvaliacaoAdesao.push(item.originalElement); | ||
90 | + }); | ||
91 | + }); | ||
92 | + }; | ||
93 | + | ||
94 | + $scope.uploader = new FileUploader({ | ||
95 | + autoUpload: false, | ||
96 | + queueLimit: 1, | ||
97 | + url : '/cit-tabelas-corp-web/rest/anexo/uploadAnexo?idDocumento=' | ||
98 | + }); | ||
99 | + | ||
100 | + $scope.salvarEvento = function(form){ | ||
101 | + | ||
102 | + form.$submitted = true; | ||
103 | + if(form && !form.$invalid) { | ||
104 | + if ($scope.isInformacoesValidas()){ | ||
105 | + $scope.setLoadingSalva(true); | ||
106 | + | ||
107 | + if($scope.recebimentoObjetoTemp == null){ | ||
108 | + $scope.recebimentoObjetoTemp = { | ||
109 | + documentos : [] | ||
110 | + }; | ||
111 | + angular.forEach($scope.recebimentoObjeto.documentos, function(documento, key) { | ||
112 | + $scope.recebimentoObjetoTemp.documentos.push({ | ||
113 | + uploadsDocumento : clone(documento.uploadsDocumento), | ||
114 | + numero : clone(documento.numero) | ||
115 | + }); | ||
116 | + delete documento.uploadsDocumento; | ||
117 | + }); | ||
118 | + }; | ||
119 | + | ||
120 | + EventoRecebimentoObjetoRepository.save($scope.recebimentoObjeto).then(function(result) { | ||
121 | + $scope.recebimentoObjeto = result.originalElement; | ||
122 | + | ||
123 | + angular.forEach($scope.recebimentoObjeto.documentos, function(documentoSalvo, key) { | ||
124 | + if(documentoSalvo !== undefined && documentoSalvo.id !== undefined){ | ||
125 | + angular.forEach($scope.recebimentoObjetoTemp.documentos, function(documentoTransient, key) { | ||
126 | + if(documentoSalvo.numero === documentoTransient.numero){ | ||
127 | + salvarUpload(documentoSalvo, documentoTransient.uploadsDocumento); | ||
128 | + } | ||
129 | + }); | ||
130 | + }; | ||
131 | + }); | ||
132 | + $scope.setLoading(false); | ||
133 | + $scope.$modalInstance.dismiss('cancel'); | ||
134 | + $scope.showAlert("success", $translate.instant("MSG.MG001")); | ||
135 | + $scope.buscaOcorrencias($scope.contratoTemp); | ||
136 | + }); | ||
137 | + }; | ||
138 | + } else { | ||
139 | + $scope.showAlert('error', $translate.instant('MSG.MN001')); | ||
140 | + } | ||
141 | + }; | ||
142 | + | ||
143 | + $scope.isInformacoesValidas = function () { | ||
144 | + | ||
145 | + var valido = true; | ||
146 | + | ||
147 | + if(!isDataDentroPeriodo($scope.contratoTemp.dataVigenciaInicial, $scope.contratoTemp.dataUltimaVigenciaFinal, | ||
148 | + $scope.recebimentoObjeto.dataRecebimento)){ | ||
149 | + $scope.showAlert('warning', $translate.instant('MSG.DATA_RECEBIMENTO_INVALIDA')); | ||
150 | + valido = false; | ||
151 | + } | ||
152 | + return valido; | ||
153 | + }; | ||
154 | + | ||
155 | + var salvarUpload = function(documento, uploadsDocumento){ | ||
156 | + if (uploadsDocumento != undefined && uploadsDocumento != null) { | ||
157 | + $scope.uploader.queue = uploadsDocumento; | ||
158 | + angular.forEach($scope.uploader.queue, function(item, key) { | ||
159 | + item.url = item.url + documento.id; | ||
160 | + }); | ||
161 | + $scope.uploader.uploadAll(); | ||
162 | + $scope.uploader.isUploading = false; | ||
163 | + }; | ||
164 | + }; | ||
165 | + | ||
166 | + $scope.gerarRelatorioRecebimentoObjeto = function(){ | ||
167 | + $scope.url = '/cit-contratos-web/rest/eventoRecebimentoObjeto/pdfGerarRecebimentoObjeto?idRecebimentoObjeto=' + $scope.recebimentoObjeto.id; | ||
168 | + $scope.visualizarRelatorio($scope.url, $translate.instant('LABEL.TITULO_DOCUMENTO_RECEBIMENTO')); | ||
169 | + $scope.$modalInstance.dismiss('cancel'); | ||
170 | + | ||
171 | + }; | ||
172 | + | ||
173 | + (function init(){ | ||
174 | + $scope.dominiosRecebimentoObjeto = { | ||
175 | + tiposStatus: [], | ||
176 | + tiposRecebimentos : [], | ||
177 | + tiposAvaliacaoPrazo : [], | ||
178 | + tiposAvaliacaoAdesao : [], | ||
179 | + }; | ||
180 | + $scope.carregarDominios(); | ||
181 | + if($scope.evento){ | ||
182 | + $scope.getRecebimentoObjeto(); | ||
183 | + } else { | ||
184 | + $scope.resetForm(); | ||
185 | + } | ||
186 | + })(); | ||
189 | 187 | ||
190 | }]); | 188 | }]); |
cit-contratos-web/src/main/webapp/html/eventos/cnt_ev_recebimentoobjeto.html
@@ -79,6 +79,18 @@ | @@ -79,6 +79,18 @@ | ||
79 | ng-mask="99999/9999" | 79 | ng-mask="99999/9999" |
80 | form="formDialogRecebimentoObjeto"/> | 80 | form="formDialogRecebimentoObjeto"/> |
81 | </div><!-- .col --> | 81 | </div><!-- .col --> |
82 | + <div class="col-sm-9"> | ||
83 | + <label-input ng-type="text" | ||
84 | + ng-id="contrato.objetoContratacao" | ||
85 | + ng-label="LABEL.OBJETO_CONTRATACAO" | ||
86 | + ng-disabled="true" | ||
87 | + ng-custom-maxlength="150" | ||
88 | + ng-model="contrato.objetoContratacao" | ||
89 | + form="formDialogRecebimentoObjeto"/> | ||
90 | + </div><!-- .col --> | ||
91 | + </div><!-- .row --> | ||
92 | + | ||
93 | + <div class="row"> | ||
82 | <div class="col-sm-3"> | 94 | <div class="col-sm-3"> |
83 | <label-input-data ng-id="recebimentoObjeto.dataRecebimento" | 95 | <label-input-data ng-id="recebimentoObjeto.dataRecebimento" |
84 | ng-label="LABEL.DATA_RECEBIMENTO_OBJETO" | 96 | ng-label="LABEL.DATA_RECEBIMENTO_OBJETO" |
@@ -102,18 +114,18 @@ | @@ -102,18 +114,18 @@ | ||
102 | </select> | 114 | </select> |
103 | </div><!--.col --> | 115 | </div><!--.col --> |
104 | <div class="col-sm-3"> | 116 | <div class="col-sm-3"> |
105 | - <label-input ng-type="text" | ||
106 | - ng-id="recebimentoObjeto.nomeObjeto" | ||
107 | - ng-label="LABEL.NOME_OBJETO" | ||
108 | - ng-disabled="!edit" | ||
109 | - ng-custom-maxlength="150" | ||
110 | - ng-obrigatorio="true" | ||
111 | - ng-model="recebimentoObjeto.nomeObjeto" | ||
112 | - form="formDialogRecebimentoObjeto"/> | ||
113 | - </div><!-- .col --> | ||
114 | - </div><!-- .row --> | ||
115 | - | ||
116 | - <div class="row"> | 117 | + <label-select ng-id="recebimentoObjeto.tiposStatus" |
118 | + ng-label="LABEL.STATUS" | ||
119 | + ng-model="recebimentoObjeto.tipoStatus" | ||
120 | + form="formDialogRecebimentoObjeto" | ||
121 | + ng-obrigatorio="true" | ||
122 | + ng-disabled="!edit" | ||
123 | + ng-list="dominiosRecebimentoObjeto.tiposStatus" | ||
124 | + ng-custom-options="tipoStatus as tipoStatus.descricao for tipoStatus" | ||
125 | + track-by="track by tipoStatus.id"/> | ||
126 | + <option value="">Selecione</option> | ||
127 | + </select> | ||
128 | + </div><!-- .col --> | ||
117 | <div class="col-sm-3"> | 129 | <div class="col-sm-3"> |
118 | <div class="row"> | 130 | <div class="row"> |
119 | <div class="col-sm-12"> | 131 | <div class="col-sm-12"> |
@@ -150,20 +162,7 @@ | @@ -150,20 +162,7 @@ | ||
150 | </select> | 162 | </select> |
151 | </div> | 163 | </div> |
152 | </div> | 164 | </div> |
153 | - </div> | ||
154 | - <div class="col-sm-3"> | ||
155 | - <label-select ng-id="recebimentoObjeto.tiposStatus" | ||
156 | - ng-label="LABEL.STATUS" | ||
157 | - ng-model="recebimentoObjeto.tipoStatus" | ||
158 | - form="formDialogRecebimentoObjeto" | ||
159 | - ng-obrigatorio="true" | ||
160 | - ng-disabled="!edit" | ||
161 | - ng-list="dominiosRecebimentoObjeto.tiposStatus" | ||
162 | - ng-custom-options="tipoStatus as tipoStatus.descricao for tipoStatus" | ||
163 | - track-by="track by tipoStatus.id"/> | ||
164 | - <option value="">Selecione</option> | ||
165 | - </select> | ||
166 | - </div><!-- .col --> | 165 | + </div> |
167 | </div><!-- .row --> | 166 | </div><!-- .row --> |
168 | 167 | ||
169 | <div class="row"> | 168 | <div class="row"> |