Commit ace320df7251863e3d3faceaf21bb68a200fe853

Authored by erick.sato
2 parents 1b477aae 419c90f4
Exists in master

Merge branch 'tarefa-4455' into cnt-1.0.0-alfa13

# Conflicts:
#	cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/ContratoController.js
#	cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/EstudoTecnicoController.js
#	cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/OrdemFornecimentoController.js
#	cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/TermoReferenciaController.js
Showing 21 changed files with 304 additions and 110 deletions   Show diff stats
cit-contratos-api/src/main/java/br/com/centralit/api/dao/ProgramaDao.java
... ... @@ -31,5 +31,19 @@ public interface ProgramaDao extends CitGenericDAO {
31 31 * @return Collection<Programa>
32 32 */
33 33 Collection<Programa> findAutoCompleteProgramaByNumeroOrNomeAndOrganizacao(String numeroOrNome, Long idOrganizacao);
  34 +
  35 + /**
  36 + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p>
  37 + *
  38 + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p>
  39 + *
  40 + * Método responsável por trazer um programa através do id do programa ação.
  41 + *
  42 + * @author luis.camargo
  43 + *
  44 + * @param idProgramaAcao
  45 + * @return
  46 + */
  47 + Programa findByProgramaAcao(Long idProgramaAcao);
34 48  
35 49 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/dao/impl/ProgramaDaoHibernate.java
... ... @@ -2,6 +2,8 @@ package br.com.centralit.api.dao.impl;
2 2  
3 3 import java.util.Collection;
4 4  
  5 +import javax.persistence.Query;
  6 +
5 7 import org.apache.commons.lang.StringUtils;
6 8 import org.springframework.stereotype.Repository;
7 9  
... ... @@ -75,4 +77,19 @@ public class ProgramaDaoHibernate extends CitGenericDAOImpl implements ProgramaD
75 77 return this.search(searchSeven, this.persistentClass);
76 78  
77 79 }
  80 +
  81 + @Override
  82 + public Programa findByProgramaAcao(Long idProgramaAcao) {
  83 +
  84 + StringBuilder query = new StringBuilder();
  85 + query.append("select p.* ")
  86 + .append(" from cnt_programa p ")
  87 + .append(" inner join cnt_p_acao pa on pa.programa_id = p.id ")
  88 + .append(" where pa.id = :idProgramaAcao ");
  89 +
  90 + Query resultado = em().createNativeQuery(query.toString(), Programa.class);
  91 + resultado.setParameter("idProgramaAcao", idProgramaAcao);
  92 + return (Programa) resultado.getSingleResult();
  93 + }
  94 +
78 95 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/model/Contrato.java
... ... @@ -367,6 +367,10 @@ public class Contrato extends PersistentObjectAuditOrganizacao {
367 367 @JsonView({ ViewsContrato.ContratoEditView.class, ViewsContrato.ContratoAutoCompleteView.class })
368 368 private TermoReferencia termoReferencia;
369 369  
  370 + @Transient
  371 + @JsonView({ ViewsContrato.ContratoEditView.class })
  372 + private Long rascunho;
  373 +
370 374 /**
371 375 * Retorna o valor do atributo <code>id</code>
372 376 *
... ... @@ -1143,4 +1147,11 @@ public class Contrato extends PersistentObjectAuditOrganizacao {
1143 1147 this.termoReferencia = termoReferencia;
1144 1148 }
1145 1149  
  1150 + public Long getRascunho() {
  1151 + return rascunho;
  1152 + }
  1153 +
  1154 + public void setRascunho(Long rascunho) {
  1155 + this.rascunho = rascunho;
  1156 + }
1146 1157 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/model/EstudoTecnico.java
... ... @@ -16,6 +16,7 @@ import javax.persistence.OneToMany;
16 16 import javax.persistence.Table;
17 17 import javax.persistence.Temporal;
18 18 import javax.persistence.TemporalType;
  19 +import javax.persistence.Transient;
19 20  
20 21 import br.com.centralit.api.viewHelper.ViewsContrato;
21 22 import br.com.centralit.framework.json.JsonCalendarSimpleDateDeserializer;
... ... @@ -167,6 +168,10 @@ public class EstudoTecnico extends PersistentObjectAuditOrganizacao {
167 168 @JsonView({ ViewsContrato.EstudoTecnicoEditView.class })
168 169 private Collection<EstudoTecnicoDocumento> documentos;
169 170  
  171 + @Transient
  172 + @JsonView({ ViewsContrato.EstudoTecnicoEditView.class })
  173 + private Long rascunho;
  174 +
170 175 public RegistroSequencial getRegistroSequencial() {
171 176  
172 177 return registroSequencial;
... ... @@ -623,4 +628,11 @@ public class EstudoTecnico extends PersistentObjectAuditOrganizacao {
623 628 this.documentos = documentos;
624 629 }
625 630  
  631 + public Long getRascunho() {
  632 + return rascunho;
  633 + }
  634 +
  635 + public void setRascunho(Long rascunho) {
  636 + this.rascunho = rascunho;
  637 + }
626 638 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/model/TermoReferencia.java
... ... @@ -16,6 +16,7 @@ import javax.persistence.OneToMany;
16 16 import javax.persistence.Table;
17 17 import javax.persistence.Temporal;
18 18 import javax.persistence.TemporalType;
  19 +import javax.persistence.Transient;
19 20  
20 21 import org.hibernate.annotations.Type;
21 22  
... ... @@ -151,6 +152,10 @@ public class TermoReferencia extends PersistentObjectAuditOrganizacao {
151 152 @JsonView({ ViewsContrato.TermoReferenciaEditView.class })
152 153 private Collection<TermoReferenciaDocumento> documentos;
153 154  
  155 + @Transient
  156 + @JsonView({ ViewsContrato.TermoReferenciaEditView.class })
  157 + private Long rascunho;
  158 +
154 159 /**
155 160 * Retorna o valor do atributo <code>id</code>
156 161 *
... ... @@ -663,4 +668,11 @@ public class TermoReferencia extends PersistentObjectAuditOrganizacao {
663 668 this.dataTermoGerado = dataTermoGerado;
664 669 }
665 670  
  671 + public Long getRascunho() {
  672 + return rascunho;
  673 + }
  674 +
  675 + public void setRascunho(Long rascunho) {
  676 + this.rascunho = rascunho;
  677 + }
666 678 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/service/ProgramaService.java
... ... @@ -32,4 +32,18 @@ public interface ProgramaService extends GenericService&lt;Programa, Long&gt; {
32 32 */
33 33 Collection <Programa> findAutoCompleteProgramaByNumeroOrNomeAndOrganizacao(String numeroOrNome, Long idOrganizacao);
34 34  
  35 + /**
  36 + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p>
  37 + *
  38 + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p>
  39 + *
  40 + * Método responsável por trazer um programa através do id do programa ação.
  41 + *
  42 + * @author luis.camargo
  43 + *
  44 + * @param idProgramaAcao
  45 + * @return
  46 + */
  47 + Programa findByProgramaAcao(Long idProgramaAcao);
  48 +
35 49 }
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/ContratoServiceImpl.java
... ... @@ -40,6 +40,7 @@ import br.com.centralit.api.service.EventoAditivoService;
40 40 import br.com.centralit.api.service.FornecedorService;
41 41 import br.com.centralit.api.service.InternacionalizacaoService;
42 42 import br.com.centralit.api.service.ParceiroService;
  43 +import br.com.centralit.api.service.RascunhoService;
43 44 import br.com.centralit.api.service.UsuarioService;
44 45 import br.com.centralit.framework.exception.CodigoErro;
45 46 import br.com.centralit.framework.model.Dominio;
... ... @@ -102,7 +103,7 @@ public class ContratoServiceImpl extends GenericServiceImpl&lt;Contrato, Long&gt; impl
102 103  
103 104 @Autowired
104 105 private ConfiguracaoParametroSistemaService configuracaoParametroSistemaService;
105   - /** Atributo colaboradorService. */
  106 +
106 107 @Autowired
107 108 private EstudoTecnicoService estudoTecnicoService;
108 109  
... ... @@ -115,6 +116,9 @@ public class ContratoServiceImpl extends GenericServiceImpl&lt;Contrato, Long&gt; impl
115 116 @Autowired
116 117 private EventoAditivoService aditivoService;
117 118  
  119 + @Autowired
  120 + private RascunhoService rascunhoService;
  121 +
118 122 /**
119 123 * Responsável pela criação de novas instâncias desta classe.
120 124 * @param contratoDao
... ... @@ -156,6 +160,8 @@ public class ContratoServiceImpl extends GenericServiceImpl&lt;Contrato, Long&gt; impl
156 160  
157 161 validarPapeisEnvolvidos(contrato);
158 162  
  163 + rascunhoService.removeById(contrato.getRascunho());
  164 +
159 165 return super.save(contrato);
160 166 }
161 167  
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/EstudoTecnicoServiceImpl.java
... ... @@ -39,6 +39,7 @@ import br.com.centralit.api.service.EstudoTecnicoService;
39 39 import br.com.centralit.api.service.FuncaoService;
40 40 import br.com.centralit.api.service.ObjetivoEstrategicoNecessidadeService;
41 41 import br.com.centralit.api.service.ParceiroService;
  42 +import br.com.centralit.api.service.RascunhoService;
42 43 import br.com.centralit.api.service.TermoReferenciaService;
43 44 import br.com.centralit.api.service.UsuarioService;
44 45 import br.com.centralit.framework.exception.CodigoErro;
... ... @@ -114,6 +115,9 @@ public class EstudoTecnicoServiceImpl extends GenericServiceImpl&lt;EstudoTecnico,
114 115 @Autowired
115 116 private FuncaoService funcaoService;
116 117  
  118 + @Autowired
  119 + private RascunhoService rascunhoService;
  120 +
117 121 /** Atributo statico CAMPO_BUSCA_PARAMETRIZADA_ULTIMO_REGISTRO. */
118 122 public static final String CAMPO_BUSCA_PARAMETRIZADA_ULTIMO_REGISTRO = "codigo";
119 123  
... ... @@ -150,6 +154,8 @@ public class EstudoTecnicoServiceImpl extends GenericServiceImpl&lt;EstudoTecnico,
150 154 // monta objeto estudoTecnico com todas as suas listas e objetos transients
151 155 this.montarObjetoEstudoTecnico(estudoTecnico);
152 156  
  157 + rascunhoService.removeById(estudoTecnico.getRascunho());
  158 +
153 159 // verifica se tem codigo, senao gera e salva entidade
154 160 if (UtilObjeto.isReferencia(estudoTecnico.getRegistroSequencial())) {
155 161  
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/ProgramaServiceImpl.java
... ... @@ -49,6 +49,23 @@ public class ProgramaServiceImpl extends GenericServiceImpl&lt;Programa, Long&gt; impl
49 49 public Collection<Programa> findAllByOrganizacao(Long organizacaoId) {
50 50 return this.programaDao.findAllByOrganizacao(organizacaoId);
51 51 }
  52 +
  53 + /**
  54 + * <p><b>Iniciativa(s):</b> <a href="LINK_PORTAL">NUMERO_INICIATIVA</a></p>
  55 + *
  56 + * <p><b>Regra(s) de negócio:</b> <a href="LINK_PORTAL">NUMERO_REGRA_DE_NEGOCIO</a></p>
  57 + *
  58 + * Método responsável por trazer um programa através do id do programa ação.
  59 + *
  60 + * @author luis.camargo
  61 + *
  62 + * @param idProgramaAcao
  63 + * @return
  64 + */
  65 + @Override
  66 + public Programa findByProgramaAcao(Long idProgramaAcao) {
  67 + return this.programaDao.findByProgramaAcao(idProgramaAcao);
  68 + }
52 69  
53 70 /**
54 71 * <p>
... ...
cit-contratos-api/src/main/java/br/com/centralit/api/service/impl/TermoReferenciaServiceImpl.java
... ... @@ -12,6 +12,14 @@ import java.util.Map;
12 12  
13 13 import javax.servlet.http.HttpServletResponse;
14 14  
  15 +import net.sf.jasperreports.engine.JRException;
  16 +import net.sf.jasperreports.engine.JasperCompileManager;
  17 +import net.sf.jasperreports.engine.JasperFillManager;
  18 +import net.sf.jasperreports.engine.JasperPrint;
  19 +import net.sf.jasperreports.engine.JasperReport;
  20 +import net.sf.jasperreports.engine.design.JasperDesign;
  21 +import net.sf.jasperreports.engine.xml.JRXmlLoader;
  22 +
15 23 import org.apache.commons.collections.CollectionUtils;
16 24 import org.apache.commons.lang3.StringUtils;
17 25 import org.apache.log4j.Logger;
... ... @@ -33,6 +41,7 @@ import br.com.centralit.api.service.ContratoService;
33 41 import br.com.centralit.api.service.DominioService;
34 42 import br.com.centralit.api.service.InternacionalizacaoService;
35 43 import br.com.centralit.api.service.ParceiroService;
  44 +import br.com.centralit.api.service.RascunhoService;
36 45 import br.com.centralit.api.service.TermoReferenciaDetalhamentoSolucaoService;
37 46 import br.com.centralit.api.service.TermoReferenciaPenalidadeService;
38 47 import br.com.centralit.api.service.TermoReferenciaSancaoService;
... ... @@ -46,13 +55,6 @@ import br.com.centralit.framework.model.Usuario;
46 55 import br.com.centralit.framework.service.arquitetura.GenericServiceImpl;
47 56 import br.com.centralit.framework.util.UtilDataBase;
48 57 import br.com.centralit.framework.util.UtilObjeto;
49   -import net.sf.jasperreports.engine.JRException;
50   -import net.sf.jasperreports.engine.JasperCompileManager;
51   -import net.sf.jasperreports.engine.JasperFillManager;
52   -import net.sf.jasperreports.engine.JasperPrint;
53   -import net.sf.jasperreports.engine.JasperReport;
54   -import net.sf.jasperreports.engine.design.JasperDesign;
55   -import net.sf.jasperreports.engine.xml.JRXmlLoader;
56 58  
57 59 /**
58 60 * <p>
... ... @@ -127,8 +129,10 @@ public class TermoReferenciaServiceImpl extends GenericServiceImpl&lt;TermoReferenc
127 129 @Autowired
128 130 private ContratoService contratoService;
129 131  
130   - private Dominio idioma;
  132 + @Autowired
  133 + private RascunhoService rascunhoService;
131 134  
  135 + private Dominio idioma;
132 136  
133 137 @Autowired
134 138 public TermoReferenciaServiceImpl( TermoReferenciaDao termoReferenciaDao, @Qualifier("termoReferenciaValidator") Validator validator ) {
... ... @@ -148,6 +152,8 @@ public class TermoReferenciaServiceImpl extends GenericServiceImpl&lt;TermoReferenc
148 152 termoReferencia = (TermoReferencia) termoReferenciaDao.save(termoReferencia);
149 153  
150 154 configurarCodigo(termoReferencia);
  155 +
  156 + rascunhoService.removeById(termoReferencia.getRascunho());
151 157  
152 158 return termoReferencia;
153 159 }
... ...
cit-contratos-web/src/main/java/br/com/centralit/controller/ProgramaController.java
... ... @@ -104,6 +104,13 @@ public class ProgramaController extends GenericController&lt;Programa&gt; {
104 104 return responseBody;
105 105 }
106 106  
  107 + @RequestMapping(value = "/findByProgramaAcao", method = RequestMethod.GET, produces = "application/json")
  108 + @ResponseBody
  109 + public ResponseBodyWrapper getValorTotalOS(@RequestParam(value = "idProgramaAcao") Long idProgramaAcao) {
  110 + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(this.programaService.findByProgramaAcao(idProgramaAcao), ViewsContrato.ProgramaAutoCompleteView.class);
  111 + return responseBody;
  112 + }
  113 +
107 114 /**
108 115 * {@inheritDoc}
109 116 */
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/ContratoController.js
... ... @@ -30,7 +30,7 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
30 30 $scope.acaoEmMassaEnvolvido = false;
31 31 $scope.acaoEmMassaValorPagamento = false;
32 32 $scope.contratoValorPagamentoUnicoTemp = {};
33   -
  33 +
34 34 $scope.uploader = new FileUploader({
35 35 autoUpload: false,
36 36 queueLimit: 1,
... ... @@ -85,6 +85,12 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
85 85 $scope.dominioPapelEnvolvidoListFixa = result;
86 86 });
87 87 };
  88 +
  89 + $scope.atualizaPaginaPesquisa = function () {
  90 + $scope.$showPageSearchWorkspace($scope.workspace);
  91 + angular.element('#searchContrato').scope().fetchResult();
  92 + };
  93 +
88 94 // ###################### FIM: INICIALIZACAO DE VARIAVEIS ###########################
89 95  
90 96 // Limpa formulario para novo cadastro
... ... @@ -116,7 +122,8 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
116 122 $scope.atualizarListaSizeSelectEnvolvido();
117 123 $scope.edit = true;
118 124 $scope.setCurrentStep(0);
119   -
  125 +
  126 + $scope.startTimerIntervalSaveDraft($scope.workspace , $scope.contrato, true);
120 127 $timeout(function(){
121 128 $scope.contratoForm.informacoesGeraisContratoForm.$submitted = false;
122 129 $scope.contratoForm.informacoesContratoForm.$submitted = false;
... ... @@ -132,6 +139,7 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
132 139 $scope.contratoForm.informacoesEnvolvidosContratoForm.$setPristine();
133 140 $scope.contratoForm.anexosObservacoesContratoForm.$setPristine();
134 141 });
  142 +
135 143 };
136 144  
137 145 $scope.gerarRelatorioTermoContrato = function() {
... ... @@ -177,9 +185,26 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
177 185 $scope.atualizarListaSizeSelectEnvolvido();
178 186 $scope.edit = edit;
179 187 $scope.setCurrentStep(0);
  188 + $scope.stopTimerIntervalDraft($scope.workspace);
180 189 $scope.setLoading(false);
181 190 });
182 191 };
  192 +
  193 + $scope.setRascunho = function(rascunho){
  194 +
  195 + if (rascunho) {
  196 + $scope.contrato = rascunho;
  197 + if ($scope.contrato.programaAcao) {
  198 + ProgramaRepository.findByProgramaAcao($scope.contrato.programaAcao.id).then(function(result) {
  199 + $scope.programaTemp = result.originalElement;
  200 + });
  201 + }
  202 + }
  203 + $scope.workspace.objetoScope = $scope.contrato;
  204 + $scope.startTimerIntervalSaveDraft($scope.workspace);
  205 + $scope.edit = true;
  206 + $scope.setLoading(false);
  207 + };
183 208  
184 209  
185 210 $scope.atualizaPercentualGarantia = function (){
... ... @@ -325,6 +350,7 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
325 350 $scope.setLoadingSalva(true);
326 351  
327 352 $scope.contrato.exercicio = new Date($scope.contrato.exercicio);
  353 + $scope.contrato.rascunho = $scope.workspace.rascunho ? $scope.workspace.rascunho.id : null;
328 354 ContratoRepository.save($scope.contrato).then(function(result) {
329 355  
330 356 $scope.contrato = result.originalElement;
... ... @@ -338,12 +364,11 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
338 364 });
339 365  
340 366 $scope.contrato.ctrtEmpenhos = empenhosTemp;
341   -
  367 + salvarListaDocumentos($scope.contratoTemp);
  368 + $scope.atualizaPaginaPesquisa();
342 369 $scope.setLoading(false);
343 370 $scope.showAlert("success", $translate.instant("MSG.SUCESSO_CONTRATO"));
344 371  
345   - // depois de salvar a baixa ja tendo uma referencia do id da baixa, esse metodo ira salvar os documentos se existir
346   - salvarListaDocumentos($scope.contratoTemp);
347 372 });
348 373 }
349 374  
... ... @@ -1652,7 +1677,6 @@ citApp.controller(&#39;ContratoController&#39;, [&#39;$scope&#39;, &#39;$filter&#39;, &#39;FileUploader&#39;, &#39;C
1652 1677  
1653 1678 $scope.listaSizeEnvolvido = lista.length;
1654 1679 };
1655   -
1656   -
  1680 +
1657 1681 // ########################### FIM: STEP: INFORMACOES DE ENVOLVIDOS #######################
1658 1682 }]);
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/EncerramentoContratoController.js
... ... @@ -17,6 +17,11 @@ citApp.controller(&#39;EncerramentoContratoController&#39;, [&#39;$scope&#39;, &#39;EncerramentoCont
17 17 url: '/cit-tabelas-corp-web/rest/anexo/uploadAnexo?idDocumento='
18 18 });
19 19  
  20 + $scope.atualizaPaginaPesquisa = function () {
  21 + angular.element('#EncerramentoContratoListControllerId').scope().fetchResult();
  22 + $scope.$showPageSearchWorkspace($scope.workspace);
  23 + };
  24 +
20 25 $scope.findContrato = function(value) {
21 26 return ContratoRepository.findContrato(value, $scope.usuarioLogado.organizacao.id).then(function(result) {
22 27 return result;
... ... @@ -120,12 +125,15 @@ citApp.controller(&#39;EncerramentoContratoController&#39;, [&#39;$scope&#39;, &#39;EncerramentoCont
120 125 $scope.encerramentoContrato = result.originalElement;
121 126 $scope.encerramentoContrato.existePendencia = $scope.encerramentoContrato.pendencias ? true : false;
122 127  
  128 + // depois de salvar a baixa ja tendo uma referencia do id da baixa, esse metodo ira salvar os documentos se existir
  129 + salvarListaDocumentos(encerramentoContratoTemp);
  130 +
  131 + $scope.atualizaPaginaPesquisa();
  132 +
123 133 $scope.setLoading(false);
124 134  
125 135 $scope.showAlert("success", $translate.instant("MSG.SUCESSO_ENCERRAMENTO_CONTRATO"));
126 136  
127   - // depois de salvar a baixa ja tendo uma referencia do id da baixa, esse metodo ira salvar os documentos se existir
128   - salvarListaDocumentos(encerramentoContratoTemp);
129 137 });
130 138 } else {
131 139 $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'));
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/EstudoTecnicoController.js
... ... @@ -96,37 +96,41 @@ citApp.controller(&#39;EstudoTecnicoController&#39;, [&#39;$scope&#39;, &#39;EstudoTecnicoRepository
96 96  
97 97 // limpa o formulario
98 98 $scope.resetForm = function() {
99   - $scope.edit = true;
100   - $scope.estudoTecnico = {
101   - etRecursosMateriais : [],
102   - etRecursosHumanos : []
103   - };
104   - $scope.reqNegocio = {};
105   - $scope.beneficioEsperado = {};
106   - $scope.estudoTecnicoRecursoMaterialTemp = {};
107   - $scope.estudoTecnicoRecursoHumanoTemp = {};
108   - $scope.acaoEmMassaRecursosMateriais = false;
109   - $scope.acaoEmMassaRecursosHumanos = false;
110   - $scope.setCurrentStep(0);
111   - $scope.atualizarListaSizeSelectReqNegocio();
112   - $scope.atualizarListaSizeSelectSolucao();
113   - $scope.atualizarListaSizeSelectServicoSolucao();
114   - $scope.atualizarListaSizeSelectBeneficio();
115   - $scope.atualizarListaSizeSelectRecursoMaterial();
116   - $scope.atualizarListaSizeSelectRecursoHumano();
117   - $scope.atualizarListaSizeSelectAcaoContigencia();
118   - $timeout(function() {
119   - $scope.estudoTecnicoForm.planejamentoContratacaoForm.$submitted = false;
120   - $scope.estudoTecnicoForm.definicaoRequisitosForm.$submitted = false;
121   - $scope.estudoTecnicoForm.levantamentoAlternativasForm.$submitted = false;
122   - $scope.estudoTecnicoForm.levantamentoAlternativasForm.$submitted = false;
123   - $scope.estudoTecnicoForm.beneficiosNecessidadesForm.$submitted = false;
124   - $scope.estudoTecnicoForm.planejamentoContratacaoForm.$setPristine();
125   - $scope.estudoTecnicoForm.definicaoRequisitosForm.$setPristine();
126   - $scope.estudoTecnicoForm.levantamentoAlternativasForm.$setPristine();
127   - $scope.estudoTecnicoForm.levantamentoAlternativasForm.$setPristine();
128   - $scope.estudoTecnicoForm.beneficiosNecessidadesForm.$setPristine();
129   - });
  99 + $scope.edit = true;
  100 + $scope.estudoTecnico = {
  101 + etRecursosMateriais : [],
  102 + etRecursosHumanos : []
  103 + };
  104 + $scope.reqNegocio = {};
  105 + $scope.beneficioEsperado = {};
  106 + $scope.estudoTecnicoRecursoMaterialTemp = {};
  107 + $scope.estudoTecnicoRecursoHumanoTemp = {};
  108 + $scope.acaoEmMassaRecursosMateriais = false;
  109 + $scope.acaoEmMassaRecursosHumanos = false;
  110 + $scope.setCurrentStep(0);
  111 + $scope.atualizarListaSizeSelectReqNegocio();
  112 + $scope.atualizarListaSizeSelectSolucao();
  113 + $scope.atualizarListaSizeSelectServicoSolucao();
  114 + $scope.atualizarListaSizeSelectBeneficio();
  115 + $scope.atualizarListaSizeSelectRecursoMaterial();
  116 + $scope.atualizarListaSizeSelectRecursoHumano();
  117 + $scope.atualizarListaSizeSelectAcaoContigencia();
  118 +
  119 + $scope.workspace.objetoScope = $scope.estudoTecnico
  120 + $scope.startTimerIntervalSaveDraft($scope.workspace , null, true);
  121 +
  122 + $timeout(function() {
  123 + $scope.estudoTecnicoForm.planejamentoContratacaoForm.$submitted = false;
  124 + $scope.estudoTecnicoForm.definicaoRequisitosForm.$submitted = false;
  125 + $scope.estudoTecnicoForm.levantamentoAlternativasForm.$submitted = false;
  126 + $scope.estudoTecnicoForm.levantamentoAlternativasForm.$submitted = false;
  127 + $scope.estudoTecnicoForm.beneficiosNecessidadesForm.$submitted = false;
  128 + $scope.estudoTecnicoForm.planejamentoContratacaoForm.$setPristine();
  129 + $scope.estudoTecnicoForm.definicaoRequisitosForm.$setPristine();
  130 + $scope.estudoTecnicoForm.levantamentoAlternativasForm.$setPristine();
  131 + $scope.estudoTecnicoForm.levantamentoAlternativasForm.$setPristine();
  132 + $scope.estudoTecnicoForm.beneficiosNecessidadesForm.$setPristine();
  133 + });
130 134 };
131 135  
132 136 $scope.visualizarEditar = function(idEstudoTecnico, edit) {
... ... @@ -148,10 +152,18 @@ citApp.controller(&#39;EstudoTecnicoController&#39;, [&#39;$scope&#39;, &#39;EstudoTecnicoRepository
148 152 $scope.atualizarListaSizeSelectAcaoContigencia();
149 153  
150 154 $scope.setCurrentStep(0);
151   -
  155 + $scope.stopTimerIntervalDraft($scope.workspace);
152 156 $scope.setLoading(false);
153 157 });
154 158 };
  159 +
  160 + $scope.setRascunho = function(rascunho){
  161 +
  162 + $scope.workspace.objetoScope = $scope.contrato;
  163 + $scope.startTimerIntervalSaveDraft($scope.workspace);
  164 + $scope.edit = true;
  165 + $scope.setLoading(false);
  166 + };
155 167  
156 168 //INICIO DE METODOS REFERENTES AOS RELATORIOS
157 169  
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/OrdemFornecimentoController.js
... ... @@ -18,6 +18,11 @@ citApp.controller(&#39;OrdemFornecimentoController&#39;, [&#39;$scope&#39;, &#39;OrdemFornecimentoRe
18 18 $scope.listaSituacaoOrdemFornecimentos = result;
19 19 });
20 20  
  21 + $scope.atualizaPaginaPesquisa = function () {
  22 + $scope.$showPageSearchWorkspace($scope.workspace);
  23 + angular.element('#searchOrdemFornecimento').scope().fetchResult();
  24 + };
  25 +
21 26 $scope.findContrato = function(value) {
22 27 return ContratoRepository.findContrato(value, $scope.usuarioLogado.organizacao.id).then(function(result) {
23 28 return result;
... ... @@ -272,13 +277,13 @@ citApp.controller(&#39;OrdemFornecimentoController&#39;, [&#39;$scope&#39;, &#39;OrdemFornecimentoRe
272 277 OrdemFornecimentoRepository.save($scope.ordemFornecimento).then(function(result) {
273 278  
274 279 $scope.ordemFornecimento = result.originalElement;
275   -
  280 + // depois de salvar a ordem de fornecimento ja tendo uma referencia do id, esse metodo ira salvar os documentos se existir
  281 + salvarListaDocumentos(ordemFornecimentoTemp);
  282 + $scope.atualizaPaginaPesquisa();
276 283 $scope.setLoading(false);
277 284  
278 285 $scope.showAlert("success", $translate.instant("MSG.SUCESSO_ORDEM_FORNECIMENTO"));
279 286  
280   - // depois de salvar a ordem de fornecimento ja tendo uma referencia do id, esse metodo ira salvar os documentos se existir
281   - salvarListaDocumentos(ordemFornecimentoTemp);
282 287 });
283 288 } else {
284 289 $scope.showAlert('error', $translate.instant('VALIDACAO.ALERTA_OBRIGATORIOS'));
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/QuestionarioController.js
... ... @@ -182,6 +182,9 @@ citApp.controller(&#39;QuestionarioController&#39;, [&#39;$scope&#39;, &#39;QuestionarioRepository&#39;,
182 182 $scope.isDesbloquear = !$scope.isBloquear;
183 183 $scope.showAlert("success", $translate.instant('MSG.SUCESSO_SALVAR_QUESTIONARIO'));
184 184 $scope.questionarioForm.$submitted = false;
  185 +
  186 + $scope.$showPageSearchWorkspace($scope.workspace);
  187 + $scope.atualizaPaginaPesquisa();
185 188 });
186 189 $scope.setLoading(false);
187 190 }else{
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/controller/TermoReferenciaController.js
... ... @@ -209,60 +209,62 @@ citApp.controller(&#39;TermoReferenciaController&#39;, [&#39;$scope&#39;,
209 209  
210 210 // Limpa formulario para novo cadastro
211 211 $scope.resetForm = function() {
212   - $scope.termoReferencia = {
213   - detalhamentosSolucoes : [],
214   - penalidades : [],
215   - sancoes : [],
216   - observacoes : [],
217   - documentos : [],
218   - deveresContratante : "",
219   - deveresContratada : "",
220   - deveresOrgaoRegistroPreco : "",
221   - mecanismoComunicacao : ""
222   - };
223   - $scope.listaJustificativaContratacao = [];
224   - $scope.listaBeneficiosEsperados = [];
225   - $scope.listEtBensServicos = [];
226   - $scope.termoReferenciaDetalhamentoSolucao = {formaPagamento: {}, bemServicoSolucao:{}};
227   - $scope.papeis = '';
228   -
229   - $scope.penalidade = {};
230   - $scope.sancao = {};
231   -
232   - $scope.edit = true;
233   - $scope.pgEdit = true;
234   - $scope.editDetalhamento = false;
235   - $scope.editPenalidade = false;
236   - $scope.editSancao = false;
237   - $scope.step = 0;
238   -
239   - $timeout(function(){
240   - $scope.termoReferenciaForm.$submitted = false;
241   - $scope.termoReferenciaForm.equipeContratacaoForm.$submitted = false;
242   - $scope.termoReferenciaForm.justificativaContratacaoForm.$submitted = false;
243   - $scope.termoReferenciaForm.especificacoesTecnicasForm.$submitted = false;
244   - $scope.termoReferenciaForm.modeloGestaoForm.$submitted = false;
245   - $scope.termoReferenciaForm.sancoesForm.$submitted = false;
246   - $scope.termoReferenciaForm.criteriosSelecaoForm.$submitted = false;
247   - $scope.termoReferenciaForm.anexosObservacoesForm.$submitted = false;
248   -
249   - $scope.termoReferenciaForm.$setPristine();
250   - $scope.termoReferenciaForm.equipeContratacaoForm.$setPristine();
251   - $scope.termoReferenciaForm.justificativaContratacaoForm.$setPristine();
252   - $scope.termoReferenciaForm.especificacoesTecnicasForm.$setPristine();
253   - $scope.termoReferenciaForm.modeloGestaoForm.$setPristine();
254   - $scope.termoReferenciaForm.sancoesForm.$setPristine();
255   - $scope.termoReferenciaForm.criteriosSelecaoForm.$setPristine();
256   - $scope.termoReferenciaForm.anexosObservacoesForm.$setPristine();
257   - });
258   -
259   - createTemplates();
260   - $scope.getConfiguracoesTemplate();
261   - $scope.preenchePapeis();
262   - $scope.carregarValoresPadrao();
263   - $scope.atualizarListaSizeSelect();
264   - $scope.atualizarListaSizeSelectPenalidade();
265   - $scope.atualizarListaSizeSelectSancao();
  212 + $scope.termoReferencia = {
  213 + detalhamentosSolucoes : [],
  214 + penalidades : [],
  215 + sancoes : [],
  216 + observacoes : [],
  217 + documentos : [],
  218 + deveresContratante : "",
  219 + deveresContratada : "",
  220 + deveresOrgaoRegistroPreco : "",
  221 + mecanismoComunicacao : ""
  222 + };
  223 + $scope.listaJustificativaContratacao = [];
  224 + $scope.listaBeneficiosEsperados = [];
  225 + $scope.listEtBensServicos = [];
  226 + $scope.termoReferenciaDetalhamentoSolucao = {formaPagamento: {}, bemServicoSolucao:{}};
  227 + $scope.papeis = '';
  228 +
  229 + $scope.penalidade = {};
  230 + $scope.sancao = {};
  231 +
  232 + $scope.edit = true;
  233 + $scope.pgEdit = true;
  234 + $scope.editDetalhamento = false;
  235 + $scope.editPenalidade = false;
  236 + $scope.editSancao = false;
  237 + $scope.step = 0;
  238 +
  239 + $scope.startTimerIntervalSaveDraft($scope.workspace , $scope.termoReferencia, true);
  240 +
  241 + $timeout(function(){
  242 + $scope.termoReferenciaForm.$submitted = false;
  243 + $scope.termoReferenciaForm.equipeContratacaoForm.$submitted = false;
  244 + $scope.termoReferenciaForm.justificativaContratacaoForm.$submitted = false;
  245 + $scope.termoReferenciaForm.especificacoesTecnicasForm.$submitted = false;
  246 + $scope.termoReferenciaForm.modeloGestaoForm.$submitted = false;
  247 + $scope.termoReferenciaForm.sancoesForm.$submitted = false;
  248 + $scope.termoReferenciaForm.criteriosSelecaoForm.$submitted = false;
  249 + $scope.termoReferenciaForm.anexosObservacoesForm.$submitted = false;
  250 +
  251 + $scope.termoReferenciaForm.$setPristine();
  252 + $scope.termoReferenciaForm.equipeContratacaoForm.$setPristine();
  253 + $scope.termoReferenciaForm.justificativaContratacaoForm.$setPristine();
  254 + $scope.termoReferenciaForm.especificacoesTecnicasForm.$setPristine();
  255 + $scope.termoReferenciaForm.modeloGestaoForm.$setPristine();
  256 + $scope.termoReferenciaForm.sancoesForm.$setPristine();
  257 + $scope.termoReferenciaForm.criteriosSelecaoForm.$setPristine();
  258 + $scope.termoReferenciaForm.anexosObservacoesForm.$setPristine();
  259 + });
  260 +
  261 + createTemplates();
  262 + $scope.getConfiguracoesTemplate();
  263 + $scope.preenchePapeis();
  264 + $scope.carregarValoresPadrao();
  265 + $scope.atualizarListaSizeSelect();
  266 + $scope.atualizarListaSizeSelectPenalidade();
  267 + $scope.atualizarListaSizeSelectSancao();
266 268  
267 269 };
268 270  
... ... @@ -707,6 +709,7 @@ citApp.controller(&#39;TermoReferenciaController&#39;, [&#39;$scope&#39;,
707 709 $scope.atualizaListaBeneficiosEsperados($scope.termoReferencia.estudoTecnico);
708 710 $scope.atualizaListaJustificativasContratacao($scope.termoReferencia.estudoTecnico);
709 711 $scope.atualizaInformacoesIntegrantesEstudoTecnico($scope.termoReferencia.estudoTecnico);
  712 + $scope.stopTimerIntervalDraft($scope.workspace);
710 713 $scope.setLoading(false);
711 714 });
712 715 };
... ...
cit-contratos-web/src/main/webapp/assets/js/angular/custom/repository/ProgramaRepository.js
... ... @@ -11,6 +11,11 @@ citApp.factory(&#39;ProgramaRepository&#39;, [&#39;RestangularContratos&#39;, &#39;AbstractRepositor
11 11 this.findAutoCompleteProgramaByNumeroOrNomeAndOrganizacao = function(value, idOrganizacao) {
12 12 return restangularContratos.one('rest/programa').getList("findAutoCompleteProgramaByNumeroOrNomeAndOrganizacao", {"numeroOrNome" : value, "idOrganizacao" : idOrganizacao}).then();
13 13 };
  14 +
  15 + this.findByProgramaAcao = function(idProgramaAcao) {
  16 + return restangularContratos.one(this.route + "/findByProgramaAcao").get({"idProgramaAcao" : idProgramaAcao}).then();
  17 + };
  18 +
14 19 }
15 20  
16 21 AbstractRepository.extend(ProgramaRepository);
... ...
cit-contratos-web/src/main/webapp/html/contrato/contratoList.html
... ... @@ -21,6 +21,10 @@
21 21 <button class="btn btn-clear" ng-click="exportarCSV(filterCriteria, headers, 'ContratoRepository', 'LABEL.CONTRATO')" type="button">
22 22 <i class="fa fa-file-excel-o"></i> <translate>LABEL.EXPORTAR_CSV</translate>
23 23 </button>
  24 +
  25 + <button class="btn btn-clear" ng-click="showListRascunho(workspace.name, 'editContrato')" type="button">
  26 + <i class="fa fa-list"></i> <translate>PORTAL.LABEL.SHOW_RASCUNHO</translate>
  27 + </button>
24 28  
25 29 <!-- <button class="btn btn-clear" ng-click="remove();">
26 30 <i class="fa fa-times red"></i>
... ... @@ -56,4 +60,4 @@
56 60  
57 61 <list-view ng-lista="contratosList" ng-repository="ContratoRepository" ng-use-custom-remove="false" ng-headers="headers" ng-filter-criteria="filterCriteria" ng-item-selecionado="contratoChecked"></list-view>
58 62  
59   -</div><!-- .page-content -->
60 63 \ No newline at end of file
  64 +</div><!-- .page-content -->
... ...
cit-contratos-web/src/main/webapp/html/estudoTecnico/estudoTecnicoList.html
... ... @@ -26,7 +26,11 @@
26 26 <button class="btn btn-clear" ng-click="exportarCSV(filterCriteria, headers, 'EstudoTecnicoRepository', 'LABEL.ESTUDO_TECNICO')" type="button">
27 27 <i class="fa fa-file-excel-o"></i> <translate>LABEL.EXPORTAR_CSV</translate>
28 28 </button>
29   -
  29 +
  30 + <button class="btn btn-clear" ng-click="showListRascunho(workspace.name, 'estudoTecnicoControllerId')" type="button">
  31 + <i class="fa fa-list"></i> <translate>PORTAL.LABEL.SHOW_RASCUNHO</translate>
  32 + </button>
  33 +
30 34 <button
31 35 title="{{$translate.instant('CONTRATOS.LABEL.GERAR_ESTUDO_TECNICO')}}"
32 36 alt="{{$translate.instant('CONTRATOS.LABEL.GERAR_ESTUDO_TECNICO')}}"
... ...
cit-contratos-web/src/main/webapp/html/termoReferencia/termoReferenciaList.html
... ... @@ -29,7 +29,11 @@
29 29 <button class="btn btn-clear" ng-click="exportarCSV(filterCriteria, headers, 'TermoReferenciaRepository', 'CONTRATOS.LABEL.TERMO_REFERENCIA_PROJETO_BASICO')" type="button">
30 30 <i class="fa fa-file-excel-o"></i> <translate>LABEL.EXPORTAR_CSV</translate>
31 31 </button>
32   -
  32 +
  33 + <button class="btn btn-clear" ng-click="showListRascunho(workspace.name, 'editTermoReferencia')" type="button">
  34 + <i class="fa fa-list"></i> <translate>PORTAL.LABEL.SHOW_RASCUNHO</translate>
  35 + </button>
  36 +
33 37 <button
34 38 title="{{$translate.instant('LABEL.GERAR_TERMO_REFERENCIA')}}"
35 39 alt="{{$translate.instant('LABEL.GERAR_TERMO_REFERENCIA')}}"
... ...