Commit 563c503d5458bd0c5da920097bdbf8a8cbed83d2
1 parent
7245ea9f
Exists in
master
Implementação dos recursos de relatório
Showing
13 changed files
with
671 additions
and
91 deletions
Show diff stats
cit-esi-api/src/main/java/br/com/centralit/esi/api/parameter/model/Parameter.java
@@ -53,6 +53,10 @@ public class Parameter extends PersistentObjectAudit { | @@ -53,6 +53,10 @@ public class Parameter extends PersistentObjectAudit { | ||
53 | public static final String DATAOBJECT_CRUD_CONTROLLER = "DATAOBJECT_CRUD_CONTROLLER"; | 53 | public static final String DATAOBJECT_CRUD_CONTROLLER = "DATAOBJECT_CRUD_CONTROLLER"; |
54 | public static final String DATAOBJECT_CRUD_DEPENDENCIES = "DATAOBJECT_CRUD_DEPENDENCIES"; | 54 | public static final String DATAOBJECT_CRUD_DEPENDENCIES = "DATAOBJECT_CRUD_DEPENDENCIES"; |
55 | 55 | ||
56 | + public static final String RESOURCE_REPORT_HTML = "RESOURCE_REPORT_HTML"; | ||
57 | + public static final String RESOURCE_REPORT_CONTROLLER = "RESOURCE_REPORT_CONTROLLER"; | ||
58 | + public static final String RESOURCE_REPORT_DEPENDENCIES = "RESOURCE_REPORT_DEPENDENCIES"; | ||
59 | + | ||
56 | public static final String BPE_SEND_MAIL = "BPE_SEND_MAIL"; | 60 | public static final String BPE_SEND_MAIL = "BPE_SEND_MAIL"; |
57 | public static final String BPE_SEND_NOTIFICATION = "BPE_SEND_NOTIFICATION"; | 61 | public static final String BPE_SEND_NOTIFICATION = "BPE_SEND_NOTIFICATION"; |
58 | public static final String BPE_EMAIL_FROM = "BPE_EMAIL_FROM"; | 62 | public static final String BPE_EMAIL_FROM = "BPE_EMAIL_FROM"; |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/ReportVersion.java
@@ -15,7 +15,6 @@ import javax.persistence.Transient; | @@ -15,7 +15,6 @@ import javax.persistence.Transient; | ||
15 | import br.com.centralit.esi.api.enumerated.ReportEngineEnum; | 15 | import br.com.centralit.esi.api.enumerated.ReportEngineEnum; |
16 | import br.com.centralit.esi.api.enumerated.ResourceTypeEnum; | 16 | import br.com.centralit.esi.api.enumerated.ResourceTypeEnum; |
17 | import br.com.centralit.framework.json.Views; | 17 | import br.com.centralit.framework.json.Views; |
18 | -import br.com.centralit.framework.model.Menu; | ||
19 | 18 | ||
20 | import com.fasterxml.jackson.annotation.JsonView; | 19 | import com.fasterxml.jackson.annotation.JsonView; |
21 | 20 | ||
@@ -34,14 +33,6 @@ public class ReportVersion extends ResourceVersion { | @@ -34,14 +33,6 @@ public class ReportVersion extends ResourceVersion { | ||
34 | @JsonView({ Views.GenericView.class}) | 33 | @JsonView({ Views.GenericView.class}) |
35 | private ReportEngineEnum engine; | 34 | private ReportEngineEnum engine; |
36 | 35 | ||
37 | - @ManyToOne(fetch=FetchType.LAZY, optional=true) | ||
38 | - @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | ||
39 | - private Menu menu; | ||
40 | - | ||
41 | - @Column(nullable = true, length=100) | ||
42 | - @JsonView({ Views.EsiResourceEditView.class, Views.EsiPackageExportView.class}) | ||
43 | - private String menuName; | ||
44 | - | ||
45 | @ManyToOne(fetch=FetchType.LAZY, optional=false) | 36 | @ManyToOne(fetch=FetchType.LAZY, optional=false) |
46 | @JsonView({ Views.EsiResourceEditView.class}) | 37 | @JsonView({ Views.EsiResourceEditView.class}) |
47 | protected Resource form; | 38 | protected Resource form; |
@@ -82,22 +73,6 @@ public class ReportVersion extends ResourceVersion { | @@ -82,22 +73,6 @@ public class ReportVersion extends ResourceVersion { | ||
82 | this.parameters = parameters; | 73 | this.parameters = parameters; |
83 | } | 74 | } |
84 | 75 | ||
85 | - public Menu getMenu() { | ||
86 | - return menu; | ||
87 | - } | ||
88 | - | ||
89 | - public void setMenu(Menu menu) { | ||
90 | - this.menu = menu; | ||
91 | - } | ||
92 | - | ||
93 | - public String getMenuName() { | ||
94 | - return menuName; | ||
95 | - } | ||
96 | - | ||
97 | - public void setMenuName(String menuName) { | ||
98 | - this.menuName = menuName; | ||
99 | - } | ||
100 | - | ||
101 | public ReportEngineEnum getEngine() { | 76 | public ReportEngineEnum getEngine() { |
102 | return engine; | 77 | return engine; |
103 | } | 78 | } |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/model/Resource.java
1 | package br.com.centralit.esi.api.resource.model; | 1 | package br.com.centralit.esi.api.resource.model; |
2 | 2 | ||
3 | import java.util.Calendar; | 3 | import java.util.Calendar; |
4 | +import java.util.HashMap; | ||
4 | 5 | ||
5 | import javax.persistence.Column; | 6 | import javax.persistence.Column; |
6 | import javax.persistence.Entity; | 7 | import javax.persistence.Entity; |
@@ -8,6 +9,7 @@ import javax.persistence.GeneratedValue; | @@ -8,6 +9,7 @@ import javax.persistence.GeneratedValue; | ||
8 | import javax.persistence.GenerationType; | 9 | import javax.persistence.GenerationType; |
9 | import javax.persistence.Id; | 10 | import javax.persistence.Id; |
10 | import javax.persistence.Table; | 11 | import javax.persistence.Table; |
12 | +import javax.persistence.Transient; | ||
11 | 13 | ||
12 | import br.com.centralit.esi.api.enumerated.ResourceTypeEnum; | 14 | import br.com.centralit.esi.api.enumerated.ResourceTypeEnum; |
13 | import br.com.centralit.framework.json.Views; | 15 | import br.com.centralit.framework.json.Views; |
@@ -44,6 +46,10 @@ public class Resource extends PersistentObject { | @@ -44,6 +46,10 @@ public class Resource extends PersistentObject { | ||
44 | @JsonView({ Views.GenericView.class}) | 46 | @JsonView({ Views.GenericView.class}) |
45 | protected Boolean internalResource; | 47 | protected Boolean internalResource; |
46 | 48 | ||
49 | + @Transient | ||
50 | + @JsonView({ Views.GenericView.class}) | ||
51 | + private HashMap<String, Object> inputMap; | ||
52 | + | ||
47 | public Resource() { | 53 | public Resource() { |
48 | } | 54 | } |
49 | 55 | ||
@@ -111,5 +117,13 @@ public class Resource extends PersistentObject { | @@ -111,5 +117,13 @@ public class Resource extends PersistentObject { | ||
111 | 117 | ||
112 | public void setInternalResource(Boolean internalResource) { | 118 | public void setInternalResource(Boolean internalResource) { |
113 | this.internalResource = internalResource; | 119 | this.internalResource = internalResource; |
120 | + } | ||
121 | + | ||
122 | + public HashMap<String, Object> getInputMap() { | ||
123 | + return inputMap; | ||
124 | + } | ||
125 | + | ||
126 | + public void setInputMap(HashMap<String, Object> inputMap) { | ||
127 | + this.inputMap = inputMap; | ||
114 | } | 128 | } |
115 | } | 129 | } |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/ReportVersionService.java
@@ -7,6 +7,6 @@ import br.com.centralit.esi.api.resource.model.Resource; | @@ -7,6 +7,6 @@ import br.com.centralit.esi.api.resource.model.Resource; | ||
7 | 7 | ||
8 | public interface ReportVersionService extends ResourceVersionService { | 8 | public interface ReportVersionService extends ResourceVersionService { |
9 | 9 | ||
10 | - void execute(Resource report, HashMap<String, Object> parameters); | 10 | + byte[] execute(Resource report, HashMap<String, Object> parameters); |
11 | 11 | ||
12 | } | 12 | } |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/JasperReportManagerImpl.java
1 | package br.com.centralit.esi.api.resource.service.impl; | 1 | package br.com.centralit.esi.api.resource.service.impl; |
2 | 2 | ||
3 | import java.sql.Connection; | 3 | import java.sql.Connection; |
4 | -import java.util.ArrayList; | ||
5 | import java.util.HashMap; | 4 | import java.util.HashMap; |
6 | import java.util.List; | 5 | import java.util.List; |
7 | 6 | ||
@@ -93,9 +92,10 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper | @@ -93,9 +92,10 @@ public class JasperReportManagerImpl extends ReportManagerImpl implements Jasper | ||
93 | case FLOW: | 92 | case FLOW: |
94 | RuntimeEnvironmentOutput output = runtimeManager.execute(reportDataSource.getFlow().getName(), inputMap); | 93 | RuntimeEnvironmentOutput output = runtimeManager.execute(reportDataSource.getFlow().getName(), inputMap); |
95 | if (output.getOutputVariables() != null) { | 94 | if (output.getOutputVariables() != null) { |
96 | - List<HashMap<String, Object>> variablesMap = new ArrayList<HashMap<String, Object>>(); | ||
97 | - variablesMap.add(ConvertUtilsESI.environmentVariablesToMap(output.getOutputVariables())); | ||
98 | - dataSource = new JRBeanCollectionDataSource(variablesMap); | 95 | + Object value = output.getValue(reportDataSource.getOutputAttributeName()); |
96 | + if (value != null) { | ||
97 | + dataSource = new JRBeanArrayDataSource(new Object[]{value}); | ||
98 | + } | ||
99 | } | 99 | } |
100 | break; | 100 | break; |
101 | 101 |
cit-esi-api/src/main/java/br/com/centralit/esi/api/resource/service/impl/ReportVersionServiceImpl.java
@@ -74,11 +74,7 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | @@ -74,11 +74,7 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | ||
74 | if (reportVersion.getDataSource() != null) { | 74 | if (reportVersion.getDataSource() != null) { |
75 | reportVersion.getDataSource().setId(null); | 75 | reportVersion.getDataSource().setId(null); |
76 | } | 76 | } |
77 | - | ||
78 | - if (reportVersion.getMenu() != null) { | ||
79 | - reportVersion.setMenu(menuService.getReference(reportVersion.getMenu().getId())); | ||
80 | - } | ||
81 | - | 77 | + |
82 | } | 78 | } |
83 | 79 | ||
84 | @Override | 80 | @Override |
@@ -90,8 +86,6 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | @@ -90,8 +86,6 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | ||
90 | newResourceVersion.setFileName(oldResourceVersion.getFileName()); | 86 | newResourceVersion.setFileName(oldResourceVersion.getFileName()); |
91 | newResourceVersion.setFileSize(oldResourceVersion.getFileSize()); | 87 | newResourceVersion.setFileSize(oldResourceVersion.getFileSize()); |
92 | 88 | ||
93 | - newResourceVersion.setMenu(oldResourceVersion.getMenu()); | ||
94 | - newResourceVersion.setMenuName(oldResourceVersion.getMenuName()); | ||
95 | newResourceVersion.setDataSource(new ReportDataSource(oldResourceVersion.getDataSource())); | 89 | newResourceVersion.setDataSource(new ReportDataSource(oldResourceVersion.getDataSource())); |
96 | 90 | ||
97 | if (oldResourceVersion.getParameters() != null) { | 91 | if (oldResourceVersion.getParameters() != null) { |
@@ -120,13 +114,15 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | @@ -120,13 +114,15 @@ public class ReportVersionServiceImpl extends ResourceVersionServiceImpl impleme | ||
120 | } | 114 | } |
121 | 115 | ||
122 | @Override | 116 | @Override |
123 | - public void execute(Resource report, HashMap<String, Object> parameters) { | 117 | + public byte[] execute(Resource report, HashMap<String, Object> parameters) { |
124 | ReportVersion reportVersion = (ReportVersion) this.findByName(report.getName()); | 118 | ReportVersion reportVersion = (ReportVersion) this.findByName(report.getName()); |
125 | 119 | ||
126 | if (reportVersion.getEngine().equals(ReportEngineEnum.JASPER)) { | 120 | if (reportVersion.getEngine().equals(ReportEngineEnum.JASPER)) { |
127 | - jasperReportManager.execute(reportVersion, parameters); | 121 | + return jasperReportManager.execute(reportVersion, parameters); |
128 | }else if (reportVersion.getEngine().equals(ReportEngineEnum.PENTAHO)) { | 122 | }else if (reportVersion.getEngine().equals(ReportEngineEnum.PENTAHO)) { |
129 | - pentahoReportManager.execute(reportVersion, parameters); | 123 | + return pentahoReportManager.execute(reportVersion, parameters); |
124 | + }else{ | ||
125 | + return null; | ||
130 | } | 126 | } |
131 | } | 127 | } |
132 | 128 |
cit-esi-web/src/main/java/br/com/centralit/controller/ReportController.java
@@ -2,17 +2,37 @@ package br.com.centralit.controller; | @@ -2,17 +2,37 @@ package br.com.centralit.controller; | ||
2 | 2 | ||
3 | import org.springframework.beans.factory.annotation.Autowired; | 3 | import org.springframework.beans.factory.annotation.Autowired; |
4 | import org.springframework.stereotype.Controller; | 4 | import org.springframework.stereotype.Controller; |
5 | +import org.springframework.web.bind.annotation.RequestBody; | ||
5 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
7 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
6 | 9 | ||
10 | +import br.com.centralit.esi.api.resource.model.Resource; | ||
7 | import br.com.centralit.esi.api.resource.service.ReportVersionService; | 11 | import br.com.centralit.esi.api.resource.service.ReportVersionService; |
12 | +import br.com.centralit.framework.json.ResponseBodyWrapper; | ||
8 | 13 | ||
9 | @Controller | 14 | @Controller |
10 | @RequestMapping("/rest/esi/resource/report") | 15 | @RequestMapping("/rest/esi/resource/report") |
11 | public class ReportController extends ResourceController{ | 16 | public class ReportController extends ResourceController{ |
12 | 17 | ||
18 | + @Autowired | ||
19 | + private ReportVersionService reportVersionService; | ||
20 | + | ||
13 | @Autowired | 21 | @Autowired |
14 | public ReportController(ReportVersionService reportVersionService) { | 22 | public ReportController(ReportVersionService reportVersionService) { |
15 | super(reportVersionService); | 23 | super(reportVersionService); |
16 | } | 24 | } |
25 | + | ||
26 | + @RequestMapping(method = RequestMethod.POST, value = "/execute") | ||
27 | + @ResponseBody | ||
28 | + public ResponseBodyWrapper execute(@RequestBody Resource report) { | ||
29 | + | ||
30 | + byte[] response = reportVersionService.execute(report, report.getInputMap()); | ||
31 | + | ||
32 | + ResponseBodyWrapper responseBody = new ResponseBodyWrapper(response, this.getListView()); | ||
33 | + | ||
34 | + return responseBody; | ||
35 | + } | ||
36 | + | ||
17 | 37 | ||
18 | } | 38 | } |
cit-esi-web/src/main/java/br/com/centralit/listener/StartupListenerEsi.java
@@ -771,6 +771,50 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | @@ -771,6 +771,50 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | ||
771 | parameterService.save(parameter); | 771 | parameterService.save(parameter); |
772 | } | 772 | } |
773 | 773 | ||
774 | + parameter = parameterService.findByName(Parameter.RESOURCE_REPORT_CONTROLLER); | ||
775 | + if (parameter == null) { | ||
776 | + String fileName = servletContext.getRealPath("WEB-INF/classes/templates/resource_task_controller.js"); | ||
777 | + | ||
778 | + parameter = new Parameter(); | ||
779 | + parameter.setName(Parameter.RESOURCE_REPORT_CONTROLLER); | ||
780 | + parameter.setType(this.domainService.findByKeyAndName("parameterType", "JS")); | ||
781 | + parameter.setDescription("Template JavaScript para Controller de relatório"); | ||
782 | + try { | ||
783 | + parameter.setTextValue(FileUtils.readFileToString(new File(fileName), "UTF-8")); | ||
784 | + } catch (IOException e) { | ||
785 | + e.printStackTrace(); | ||
786 | + throw new EsiBusinessException(e); | ||
787 | + } | ||
788 | + parameterService.save(parameter); | ||
789 | + } | ||
790 | + | ||
791 | + parameter = parameterService.findByName(Parameter.RESOURCE_REPORT_DEPENDENCIES); | ||
792 | + if (parameter == null) { | ||
793 | + parameter = new Parameter(); | ||
794 | + parameter.setName(Parameter.RESOURCE_REPORT_DEPENDENCIES); | ||
795 | + parameter.setType(this.domainService.findByKeyAndName("parameterType", "TEXTAREA")); | ||
796 | + parameter.setDescription("Dependências para Controller relatório"); | ||
797 | + parameter.setTextValue("FormBuilderRepository, ReportRepository"); | ||
798 | + parameterService.save(parameter); | ||
799 | + } | ||
800 | + | ||
801 | + parameter = parameterService.findByName(Parameter.RESOURCE_REPORT_HTML); | ||
802 | + if (parameter == null) { | ||
803 | + String fileName = servletContext.getRealPath("WEB-INF/classes/templates/resource_task_html.html"); | ||
804 | + | ||
805 | + parameter = new Parameter(); | ||
806 | + parameter.setName(Parameter.RESOURCE_REPORT_HTML); | ||
807 | + parameter.setType(this.domainService.findByKeyAndName("parameterType", "HTML")); | ||
808 | + parameter.setDescription("Template HTML para relatório"); | ||
809 | + try { | ||
810 | + parameter.setTextValue(FileUtils.readFileToString(new File(fileName), "UTF-8")); | ||
811 | + } catch (IOException e) { | ||
812 | + e.printStackTrace(); | ||
813 | + throw new EsiBusinessException(e); | ||
814 | + } | ||
815 | + parameterService.save(parameter); | ||
816 | + } | ||
817 | + | ||
774 | for (Parameter param : parameterService.findAll()) { | 818 | for (Parameter param : parameterService.findAll()) { |
775 | EsiAppUtils.updateParameter(param); | 819 | EsiAppUtils.updateParameter(param); |
776 | } | 820 | } |
@@ -1856,6 +1900,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | @@ -1856,6 +1900,7 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | ||
1856 | internacionalizacaoList.add(new Internacionalizacao("ESI.DADOS", "Dados", dominio, modulo)); | 1900 | internacionalizacaoList.add(new Internacionalizacao("ESI.DADOS", "Dados", dominio, modulo)); |
1857 | internacionalizacaoList.add(new Internacionalizacao("ESI.WORKFLOW_ESI", "Workflow/ESI", dominio, modulo)); | 1901 | internacionalizacaoList.add(new Internacionalizacao("ESI.WORKFLOW_ESI", "Workflow/ESI", dominio, modulo)); |
1858 | internacionalizacaoList.add(new Internacionalizacao("ESI.SENHA", "Senha", dominio, modulo)); | 1902 | internacionalizacaoList.add(new Internacionalizacao("ESI.SENHA", "Senha", dominio, modulo)); |
1903 | + internacionalizacaoList.add(new Internacionalizacao("ESI.VARIAVEL_SAIDA_FLUXO", "Variável de saída do fluxo", dominio, modulo)); | ||
1859 | 1904 | ||
1860 | internacionalizacaoList.add(new Internacionalizacao("ESI.CONTEXTO_JNDI", "Contexto JNDI", dominio, modulo)); | 1905 | internacionalizacaoList.add(new Internacionalizacao("ESI.CONTEXTO_JNDI", "Contexto JNDI", dominio, modulo)); |
1861 | internacionalizacaoList.add(new Internacionalizacao("ESI.VALOR_AUTOMATICO", "Valor atribuído pelo banco", dominio, modulo)); | 1906 | internacionalizacaoList.add(new Internacionalizacao("ESI.VALOR_AUTOMATICO", "Valor atribuído pelo banco", dominio, modulo)); |
@@ -2120,6 +2165,8 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | @@ -2120,6 +2165,8 @@ public class StartupListenerEsi extends UtilStartup implements ApplicationListen | ||
2120 | internacionalizacaoList.add(new Internacionalizacao("ESI.DESTINATARIOS", "Destinatários", dominio, modulo)); | 2165 | internacionalizacaoList.add(new Internacionalizacao("ESI.DESTINATARIOS", "Destinatários", dominio, modulo)); |
2121 | internacionalizacaoList.add(new Internacionalizacao("ESI.TAREFA", "Tarefa", dominio, modulo)); | 2166 | internacionalizacaoList.add(new Internacionalizacao("ESI.TAREFA", "Tarefa", dominio, modulo)); |
2122 | internacionalizacaoList.add(new Internacionalizacao("ESI.ATUALIZADO", "atualizado", dominio, modulo)); | 2167 | internacionalizacaoList.add(new Internacionalizacao("ESI.ATUALIZADO", "atualizado", dominio, modulo)); |
2168 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DATASOURCE", "Data source", dominio, modulo)); | ||
2169 | + internacionalizacaoList.add(new Internacionalizacao("ESI.DATAOBJECT", "Objeto de dados", dominio, modulo)); | ||
2123 | 2170 | ||
2124 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONEXAO", "Conexão de dados", dominio, modulo)); | 2171 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_CONEXAO", "Conexão de dados", dominio, modulo)); |
2125 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_OBJETO_DADOS", "Objeto de dados", dominio, modulo)); | 2172 | internacionalizacaoList.add(new Internacionalizacao("ESI.ENUMERADO.DATASOURCE_OBJETO_DADOS", "Objeto de dados", dominio, modulo)); |
cit-esi-web/src/main/resources/templates/resource_report_controller.js
0 → 100644
@@ -0,0 +1,100 @@ | @@ -0,0 +1,100 @@ | ||
1 | + $scope.validate = function() { | ||
2 | + return true; | ||
3 | + } | ||
4 | + | ||
5 | + $scope.beforeSubmit = function() { | ||
6 | + | ||
7 | + } | ||
8 | + | ||
9 | + $scope.onSubmit = function() { | ||
10 | + | ||
11 | + } | ||
12 | + | ||
13 | + $scope.afterSubmit = function() { | ||
14 | + | ||
15 | + } | ||
16 | + | ||
17 | + $scope.initialize = function() { | ||
18 | + $scope.showExecuteButton = true; | ||
19 | + $scope.removeWorkspace = true; | ||
20 | + $scope.showHelpButton = true; | ||
21 | + $scope.showBreadcrumb = true; | ||
22 | + | ||
23 | + $scope.setLoading(true); | ||
24 | + | ||
25 | + FormBuilderRepository.getByName("${formName}").then(function(result) { | ||
26 | + $scope.resourceVersion = result.originalElement; | ||
27 | + $scope.setLoading(false); | ||
28 | + $scope.initialized = true; | ||
29 | + $scope.resetForm(); | ||
30 | + }); | ||
31 | + | ||
32 | + }; | ||
33 | + | ||
34 | + $scope.resetForm = function() { | ||
35 | + $timeout(function(){ | ||
36 | + $scope.${formName}Form.$submitted = false; | ||
37 | + $scope.${formName}Form.$setPristine(); | ||
38 | + }); | ||
39 | + }; | ||
40 | + | ||
41 | + $scope.submit = function() { | ||
42 | + $scope.${formName}Form.$submitted = true; | ||
43 | + if(!$scope.${formName}Form.$valid){ | ||
44 | + $scope.showAlert("error", $translate.instant("VALIDACAO.ALERTA_OBRIGATORIOS"), " ", false); | ||
45 | + return; | ||
46 | + } | ||
47 | + | ||
48 | + if ($scope.validate && !$scope.validate()) { | ||
49 | + return | ||
50 | + } | ||
51 | + | ||
52 | + if (!$scope.businessRule || $scope.businessRule != '') { | ||
53 | + $scope.businessRule = $scope.resourceVersion.businessRule; | ||
54 | + } | ||
55 | + | ||
56 | + if ($scope.businessRule && $scope.businessRule != '') { | ||
57 | + $scope[$scope.businessRule] = undefined; | ||
58 | + RuntimeManagerRepository.executeBusinessRule($scope.businessRule, $scope.businessRuleVariables).then(function(result) { | ||
59 | + $scope[$scope.businessRule] = result.originalElement.businessRule; | ||
60 | + if ($scope[$scope.businessRule] && $scope[$scope.businessRule].valid) { | ||
61 | + $scope.execute(); | ||
62 | + } | ||
63 | + }); | ||
64 | + }else{ | ||
65 | + $scope.execute(); | ||
66 | + } | ||
67 | + | ||
68 | + }; | ||
69 | + | ||
70 | + $scope.execute = function() { | ||
71 | + $scope.setLoading(true,$translate.instant("ESI.EXECUTANDO")+" "+$scope.resourceVersion.resource.description); | ||
72 | + | ||
73 | + if ($scope.beforeSubmit) { | ||
74 | + $scope.beforeSubmit(); | ||
75 | + } | ||
76 | + if ($scope.onSubmit) { | ||
77 | + $scope.onSubmit(); | ||
78 | + } | ||
79 | + | ||
80 | + $scope.setLoading(false); | ||
81 | + | ||
82 | + if ($scope.afterSubmit) { | ||
83 | + $scope.afterSubmit(); | ||
84 | + }else{ | ||
85 | + $scope.showAlert("success","ESI.MSG.FORM_EXECUTADO",""); | ||
86 | + } | ||
87 | + | ||
88 | + if ($scope.removeWorkspace) { | ||
89 | + $scope.close(); | ||
90 | + } | ||
91 | + }; | ||
92 | + | ||
93 | + $scope.close = function() { | ||
94 | + var workspace = angular.element("#${formName}Edit").scope().workspace; | ||
95 | + if (workspace) { | ||
96 | + angular.element("#citapp-controller").scope().removeWorkspace(workspace.id); | ||
97 | + } | ||
98 | + }; | ||
99 | + | ||
100 | + $scope.initialize(); | ||
0 | \ No newline at end of file | 101 | \ No newline at end of file |
cit-esi-web/src/main/resources/templates/resource_report_html.html
0 → 100644
@@ -0,0 +1,30 @@ | @@ -0,0 +1,30 @@ | ||
1 | +<div id="${formName}Edit" class="page-content clearfix" ng-controller="${controllerName}"> | ||
2 | + <div class="bar-buttons-action fixed"> | ||
3 | + <div class="row"> | ||
4 | + <div class="col-sm-8 text-left"> | ||
5 | + <button ng-show="showExecuteButton" ng-disabled="${formName}Form.$invalid" title="{{$translate.instant('LABEL.EXECUTAR')}}" alt="{{$translate.instant('LABEL.EXECUTAR')}}" class="btn btn-clear" ng-click="submit()"> | ||
6 | + <i class="fa fa-play-circle green"></i> <translate>LABEL.EXECUTAR</translate> | ||
7 | + </button> | ||
8 | + | ||
9 | + <form-actions ng-actions="resourceVersion.actions" ng-if="initialized"></form-actions> | ||
10 | + </div><!-- .col --> | ||
11 | + | ||
12 | + <div class="col-sm-4 text-right" ng-show="showHelpButton"> | ||
13 | + <help-button workspace="workspace" /> | ||
14 | + </div><!-- .col --> | ||
15 | + </div><!-- .row --> | ||
16 | + </div><!-- .bar-buttons-action --> | ||
17 | + | ||
18 | + <breadcrumb ng-if="showBreadcrumb" ng-workspace="workspace"></breadcrumb> | ||
19 | + | ||
20 | + <form name="${formName}Form"> | ||
21 | + | ||
22 | + <p> | ||
23 | + <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small> | ||
24 | + </p> | ||
25 | + | ||
26 | + <form-html ng-form-name="${formName}" ng-parent="${formName}Edit" ng-if="initialized"/> | ||
27 | + | ||
28 | + </form> | ||
29 | + | ||
30 | +</div><!-- .page-content --> | ||
0 | \ No newline at end of file | 31 | \ No newline at end of file |
cit-esi-web/src/main/webapp/assets/js/angular/custom/controller/ReportController.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | -citApp.controller('ReportController', ["$scope", "appService", "ReportRepository", "$filter", "$translate", "DomainRepository", "$timeout", 'FileUploader', "$http", "$modal", | ||
4 | - function ReportController($scope, appService, ReportRepository, $filter, $translate, DomainRepository, $timeout, FileUploader, $http, $modal) { | 3 | +citApp.controller('ReportController', ["$scope", "appService", "ReportRepository", "FlowRepository", "FormWidgetRepository", "ParameterRepository", "MenuRepository", "FormBuilderRepository", "DataSourceRepository", "DataObjectRepository", "$filter", "$translate", "DomainRepository", "$timeout", 'FileUploader', "$http", "$rootScope", "$modal", |
4 | + function ReportController($scope, appService, ReportRepository, FlowRepository, FormWidgetRepository, ParameterRepository, MenuRepository, FormBuilderRepository, DataSourceRepository, DataObjectRepository, $filter, $translate, DomainRepository, $timeout, FileUploader, $http, $rootScope, $modal) { | ||
5 | 5 | ||
6 | + var componentsPage = '/cit-esi-web/assets/js/angular/custom/directive/html/formComponents.html'; | ||
7 | + $scope.appController = angular.element("#citapp-controller").scope(); | ||
8 | + | ||
9 | + $scope.colors = ['yellow','yellow-dark','dark','black','white','red','blue','green','orange','purple','pink','brown','grey']; | ||
10 | + $scope.iconList = FormContainerHelper.iconList; | ||
11 | + | ||
12 | + $scope.widgets = []; | ||
13 | + FormWidgetRepository.getList().then(function(result) { | ||
14 | + angular.forEach(result, function(widget){ | ||
15 | + FormWidgetRepository.get(widget.id).then(function(result) { | ||
16 | + $scope.widgets.push(result.originalElement); | ||
17 | + }); | ||
18 | + }); | ||
19 | + }); | ||
20 | + | ||
21 | + ParameterRepository.getByName("RESOURCE_REPORT_HTML").then(function(result) { | ||
22 | + $scope.RESOURCE_REPORT_HTML = result.originalElement.textValue; | ||
23 | + }); | ||
24 | + ParameterRepository.getByName("RESOURCE_REPORT_CONTROLLER").then(function(result) { | ||
25 | + $scope.RESOURCE_REPORT_CONTROLLER = result.originalElement.textValue; | ||
26 | + }); | ||
27 | + ParameterRepository.getByName("RESOURCE_REPORT_DEPENDENCIES").then(function(result) { | ||
28 | + $scope.RESOURCE_REPORT_DEPENDENCIES = result.originalElement.textValue; | ||
29 | + }); | ||
30 | + | ||
31 | + DomainRepository.getEnumeratedDomain('ReportEngineEnum').then(function(result) { | ||
32 | + $scope.reportEngineList = result; | ||
33 | + }); | ||
34 | + | ||
35 | + DomainRepository.getEnumeratedDomain('ReportDataSourceEnum').then(function(result) { | ||
36 | + $scope.reportDataSourceList = result; | ||
37 | + }); | ||
38 | + | ||
39 | + DomainRepository.getEnumeratedDomain('ExpressionTypeEnum').then(function(result) { | ||
40 | + $scope.expressionTypeList = []; | ||
41 | + for (var i = 0; i < result.length; i++) { | ||
42 | + if (result[i].chave.indexOf('VARIABLE') < 0) | ||
43 | + $scope.expressionTypeList.push(result[i]); | ||
44 | + } | ||
45 | + }); | ||
46 | + | ||
47 | + $scope.menus = []; | ||
48 | + MenuRepository.getAllMenusAtivos().then(function(result) { | ||
49 | + angular.forEach(result, function (menu) { | ||
50 | + if (menu.originalElement.submenu) { | ||
51 | + angular.forEach(menu.originalElement.submenu, function (subMenu) { | ||
52 | + var nome = menu.nome + ' -> ' + subMenu.nome; | ||
53 | + $scope.menus.push({id: subMenu.id, nome: nome, nomeSubmenu: subMenu.nome, originalElement: {id: subMenu.id, nome: nome, nomeSubmenu: subMenu.nome}}); | ||
54 | + }); | ||
55 | + } | ||
56 | + }); | ||
57 | + }); | ||
58 | + | ||
59 | + $scope.createFormVersion = function() { | ||
60 | + var formVersion = {resource: {type: "FORM"}, className: "FormVersion", majorVersion: 1, minorVersion: 0, previewJS: "", files:[], tabs: []}; | ||
61 | + formVersion.defaultPage = { pageCode : $scope.RESOURCE_REPORT_HTML | ||
62 | + ,controllerCode : $scope.RESOURCE_REPORT_CONTROLLER | ||
63 | + ,dependencies: $scope.RESOURCE_REPORT_DEPENDENCIES ? $scope.RESOURCE_REPORT_DEPENDENCIES.split(',') : [] }; | ||
64 | + | ||
65 | + return formVersion; | ||
66 | + }; | ||
67 | + | ||
68 | + $scope.findDataSource = function(value) { | ||
69 | + var dataSourceVH = { | ||
70 | + nome : value | ||
71 | + }; | ||
72 | + return DataSourceRepository.findDataSource(dataSourceVH).then(function(result) { | ||
73 | + return result; | ||
74 | + }); | ||
75 | + }; | ||
76 | + | ||
77 | + $scope.clearDataSourceAutoComplete = function() { | ||
78 | + $scope.report.dataSource.connection = null; | ||
79 | + }; | ||
80 | + | ||
81 | + $scope.setDataSource = function (item) { | ||
82 | + if(item && item.id) { | ||
83 | + $scope.report.dataSource.connection = item; | ||
84 | + } | ||
85 | + }; | ||
86 | + | ||
87 | + $scope.findDataObject = function(value) { | ||
88 | + var dataObjectVH = { | ||
89 | + nome : value | ||
90 | + }; | ||
91 | + return DataObjectRepository.findDataObject(dataObjectVH).then(function(result) { | ||
92 | + return result; | ||
93 | + }); | ||
94 | + }; | ||
95 | + | ||
96 | + $scope.clearDataObjectAutoComplete = function() { | ||
97 | + $scope.report.dataSource.dataObject = null; | ||
98 | + }; | ||
99 | + | ||
100 | + $scope.setDataObject = function (item) { | ||
101 | + if(item && item.id) { | ||
102 | + $scope.report.dataSource.dataObject = item; | ||
103 | + } | ||
104 | + }; | ||
105 | + | ||
106 | + $scope.findFlow = function(value) { | ||
107 | + var flowVH = { | ||
108 | + nome : value | ||
109 | + }; | ||
110 | + return FlowRepository.findFlow(flowVH).then(function(result) { | ||
111 | + var flows = []; | ||
112 | + if (result && result.length > 0) { | ||
113 | + for (var i = 0; i < result.length; i++) { | ||
114 | + var flow = result[i].originalElement; | ||
115 | + if (flow.flowApplication == 'SERVICE_INTEGRATION') { | ||
116 | + flows.push(result[i]); | ||
117 | + } | ||
118 | + } | ||
119 | + } | ||
120 | + return flows; | ||
121 | + }); | ||
122 | + }; | ||
123 | + | ||
124 | + $scope.clearFlowAutoComplete = function() { | ||
125 | + $scope.report.dataSource.flow = null; | ||
126 | + }; | ||
127 | + | ||
128 | + $scope.setFlow = function (item) { | ||
129 | + if(item && item.id) { | ||
130 | + $scope.report.dataSource.flow = item; | ||
131 | + } | ||
132 | + }; | ||
133 | + | ||
134 | + $scope.showComponents = function(){ | ||
135 | + if (!$scope.canShowComponents()) { | ||
136 | + return ; | ||
137 | + } | ||
138 | + | ||
139 | + $rootScope.formVersion = $scope.report.formVersion; | ||
140 | + $rootScope.widgets = $scope.widgets; | ||
141 | + $rootScope.formBuilderControllerScope = $scope; | ||
142 | + $scope.appController.addNewWorkspace($translate.instant("ESI.DESENHO_TELA"), componentsPage, true, 'mod-red-dark', $scope.report.formVersion); | ||
143 | + }; | ||
144 | + | ||
145 | + $scope.canShowComponents = function() { | ||
146 | + return $scope.edit && !appService.existsWorkspace(componentsPage); | ||
147 | + }; | ||
148 | + | ||
149 | + $scope.removeComponentWorkspace = function () { | ||
150 | + var element = angular.element("#formBuilderComponents"); | ||
151 | + if (element && element.scope()) { | ||
152 | + var workspace = element.scope().workspace; | ||
153 | + if (workspace) { | ||
154 | + $scope.appController.removeWorkspace(workspace.id); | ||
155 | + } | ||
156 | + } | ||
157 | + }; | ||
158 | + | ||
159 | + $scope.findMenu = function(value) { | ||
160 | + var result = []; | ||
161 | + for (var i = 0; i < $scope.menus.length; i++) { | ||
162 | + var menu = $scope.menus[i]; | ||
163 | + if (menu.nome.toUpperCase().indexOf(value.toUpperCase()) >= 0) { | ||
164 | + result.push(menu); | ||
165 | + } | ||
166 | + } | ||
167 | + | ||
168 | + return result; | ||
169 | + }; | ||
170 | + | ||
171 | + $scope.limparAutoCompleteMenu = function() { | ||
172 | + $scope.report.formVersion.menu = null; | ||
173 | + }; | ||
174 | + | ||
175 | + $scope.setFormAttributes = function () { | ||
176 | + if (!$scope.report.formVersion.menuName || $scope.report.formVersion.menuName == '') { | ||
177 | + $scope.report.formVersion.menuName = $scope.report.description; | ||
178 | + } | ||
179 | + if (!$scope.report.formVersion.resource.description || $scope.report.formVersion.resource.description == '') { | ||
180 | + $scope.report.formVersion.resource.description = $scope.report.resource.description; | ||
181 | + } | ||
182 | + if (!$scope.report.formVersion.resource.name || $scope.report.formVersion.resource.name == '') { | ||
183 | + $scope.report.formVersion.resource.name = $scope.report.resource.name; | ||
184 | + } | ||
185 | + }; | ||
186 | + | ||
6 | var className = "ReportVersion"; | 187 | var className = "ReportVersion"; |
7 | $scope.report = {}; | 188 | $scope.report = {}; |
8 | $scope.newReport = true; | 189 | $scope.newReport = true; |
@@ -14,11 +195,14 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | @@ -14,11 +195,14 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | ||
14 | $timeout(function(){ | 195 | $timeout(function(){ |
15 | $scope.reportForm.$submitted = false; | 196 | $scope.reportForm.$submitted = false; |
16 | $scope.reportForm.$setPristine(); | 197 | $scope.reportForm.$setPristine(); |
198 | + $scope.showComponents(); | ||
199 | + $scope.appController.activeWorkspace($scope.workspace); | ||
17 | }); | 200 | }); |
18 | }; | 201 | }; |
19 | 202 | ||
20 | // Atualiza pagina de pesquisa | 203 | // Atualiza pagina de pesquisa |
21 | $scope.atualizaPaginaPesquisa = function () { | 204 | $scope.atualizaPaginaPesquisa = function () { |
205 | + $scope.removeComponentWorkspace(); | ||
22 | angular.element('#searchReport').scope().fetchResult(); | 206 | angular.element('#searchReport').scope().fetchResult(); |
23 | }; | 207 | }; |
24 | 208 | ||
@@ -80,7 +264,8 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | @@ -80,7 +264,8 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | ||
80 | 264 | ||
81 | // Limpa o formulario preenchido | 265 | // Limpa o formulario preenchido |
82 | $scope.limparReport = function(){ | 266 | $scope.limparReport = function(){ |
83 | - $scope.report = {resource: {type: "REPORT"}, className: className, majorVersion: 1, minorVersion: 0}; | 267 | + $scope.report = {resource: {type: "REPORT"}, className: className, majorVersion: 1, minorVersion: 0 |
268 | + , formVersion: $scope.createFormVersion(), dataSource: {}, parameters: []}; | ||
84 | $scope.uploader.clearQueue(); | 269 | $scope.uploader.clearQueue(); |
85 | }; | 270 | }; |
86 | 271 | ||
@@ -93,6 +278,32 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | @@ -93,6 +278,32 @@ citApp.controller('ReportController', ["$scope", "appService", "ReportRepository | ||
93 | 278 | ||
94 | $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName); | 279 | $scope.uploader.addToQueue("/cit-esi-web/reports/"+$scope.report.path+"/"+$scope.report.fileName); |
95 | 280 | ||
281 | + $scope.report.formVersion = $scope.createFormVersion(); | ||
282 | + if ($scope.report.form) { | ||
283 | + FormBuilderRepository.getByName($scope.report.form.name).then(function(result) { | ||
284 | + if (result.originalElement && result.originalElement.id) { | ||
285 | + $scope.report.formVersion = result.originalElement; | ||
286 | + $scope.report.formVersion.className = "FormVersion"; | ||
287 | + if (!$scope.report.formVersion.tabs) { | ||
288 | + $scope.report.formVersion.tabs = []; | ||
289 | + } | ||
290 | + if ($scope.report.formVersion.menu) { | ||
291 | + angular.forEach($scope.menus, function (menu) { | ||
292 | + if (menu.id == $scope.report.formVersion.menu.id) { | ||
293 | + $scope.report.formVersion.menu.nome = menu.nome; | ||
294 | + } | ||
295 | + }); | ||
296 | + } | ||
297 | + if (!$scope.report.formVersion.defaultPage || !$scope.report.formVersion.defaultPage.controllerCode) { | ||
298 | + $scope.report.formVersion.defaultPage = { pageCode : $scope.RESOURCE_REPORT_HTML | ||
299 | + ,controllerCode : $scope.RESOURCE_REPORT_CONTROLLER | ||
300 | + ,dependencies: $scope.RESOURCE_REPORT_DEPENDENCIES ? $scope.RESOURCE_REPORT_DEPENDENCIES.split(',') : [] }; | ||
301 | + } | ||
302 | + | ||
303 | + } | ||
304 | + }); | ||
305 | + } | ||
306 | + | ||
96 | $scope.edit = edit; | 307 | $scope.edit = edit; |
97 | 308 | ||
98 | $scope.newReport = false; | 309 | $scope.newReport = false; |
cit-esi-web/src/main/webapp/assets/js/angular/custom/repository/ReportRepository.js
@@ -9,6 +9,9 @@ citApp.factory('ReportRepository', ['RestangularEsi', 'AbstractRepository', '$tr | @@ -9,6 +9,9 @@ citApp.factory('ReportRepository', ['RestangularEsi', 'AbstractRepository', '$tr | ||
9 | this.getAllVersions = function (params) { | 9 | this.getAllVersions = function (params) { |
10 | return this.restangular.all(this.route + '/getAllVersions').post(params); | 10 | return this.restangular.all(this.route + '/getAllVersions').post(params); |
11 | }, | 11 | }, |
12 | + this.execute = function (report) { | ||
13 | + return this.restangular.all(this.route + '/execute').post(report); | ||
14 | + }, | ||
12 | this.replace = function (resource) { | 15 | this.replace = function (resource) { |
13 | return this.restangular.all(this.route + '/replace').post(resource); | 16 | return this.restangular.all(this.route + '/replace').post(resource); |
14 | }, | 17 | }, |
cit-esi-web/src/main/webapp/html/report/reportEdit.html
@@ -59,61 +59,241 @@ | @@ -59,61 +59,241 @@ | ||
59 | <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small> | 59 | <small>( <span class="red">*</span> ) <translate>LABEL.CAMPOS_OBRIGATORIOS</translate></small> |
60 | </p> | 60 | </p> |
61 | 61 | ||
62 | - <fieldset> | ||
63 | - | ||
64 | - <legend><translate>ESI.RELATORIO</translate></legend> | ||
65 | - | ||
66 | - <div class="row"> | ||
67 | - <div class="col-md-5"> | ||
68 | - <label-input-identifier ng-id="report.resource.name" ng-label="LABEL.NOME" ng-model="report.resource.name" | ||
69 | - form="javaScriptForm" ng-obrigatorio="true" ng-custom-maxlength="100" ng-disabled="!edit" /> | ||
70 | - </div><!-- .col --> | ||
71 | - | ||
72 | - <div class="col-md-7"> | ||
73 | - <label-input ng-id="report.resource.description" ng-label="LABEL.DESCRICAO" ng-model="report.resource.description" | ||
74 | - form="javaScriptForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" /> | 62 | + <tabset class="tabbable margin-top margin-bottom"> |
63 | + <tab active="tabs[0].active" ng-click="setTabAtual(0)" select="setTabAtual(0)"> | ||
64 | + <tab-heading><i class="blue ace-icon fa fa-file-text-o"></i> <translate>ESI.RELATORIO</translate></tab-heading> | ||
65 | + <div class="row"> | ||
66 | + <div class="col-md-5"> | ||
67 | + <label-input-identifier ng-id="report.resource.name" ng-label="LABEL.NOME" ng-model="report.resource.name" | ||
68 | + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="100" ng-disabled="!edit" /> | ||
69 | + </div><!-- .col --> | ||
70 | + | ||
71 | + <div class="col-md-7"> | ||
72 | + <label-input ng-id="report.resource.description" ng-label="LABEL.DESCRICAO" ng-model="report.resource.description" | ||
73 | + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" /> | ||
74 | + </div><!-- .col --> | ||
75 | + </div><!-- .row --> | ||
76 | + | ||
77 | + <div class="row"> | ||
78 | + <div class="col-md-5"> | ||
79 | + <label-input ng-id="report.path" ng-label="ESI.PASTA" ng-model="report.path" | ||
80 | + form="reportForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" /> | ||
81 | + </div><!-- .col --> | ||
82 | + | ||
83 | + <div class="col-md-6"> | ||
84 | + <label-select ng-id="report.engine" ng-label="ESI.PROPRIEDADE.ENGINE_EXECUCAO" | ||
85 | + ng-model="report.engine" form="reportForm" ng-custom-options="dominio.originalElement.chave as dominio.descricao for dominio" | ||
86 | + ng-obrigatorio="true" ng-list="reportEngineList | domainFilter" /> | ||
87 | + </div><!-- .col --> | ||
88 | + | ||
89 | + <div class="col-md-1"> | ||
90 | + <div class='form-group'> | ||
91 | + <label class='control-label'><translate>LABEL.VERSAO</translate> </label> | ||
92 | + <input type='text' class='form-control' ng-disabled='true' value='{{report.majorVersion}}.{{report.minorVersion}}'/> | ||
93 | + </div> | ||
94 | + </div> | ||
95 | + </div><!-- .row --> | ||
96 | + | ||
97 | + <fieldset> | ||
98 | + <legend><translate>ESI.CONTEUDO</translate></legend> | ||
99 | + <div class="row"> | ||
100 | + <div class="col-sm-6"> | ||
101 | + <div class="form-group"> | ||
102 | + <div nv-file-drop="" uploader="uploader" id="actionUploadFile" onclick="$('#uploadFile').click();"> | ||
103 | + <div nv-file-over="" uploader="uploader" over-class="another-file-over-class" class="well my-drop-zone"> | ||
104 | + <span ng-show="uploader.queue.length <= 0"><translate>MSG.ARRASTE_SOLTE_ARQUIVO<translate/></span> | ||
105 | + <span ng-show="uploader.queue.length > 0" >{{uploader.queue[0].file.name}}</span> | ||
106 | + </div> | ||
107 | + </div> | ||
108 | + <input id="uploadFile" type="file" nv-file-select="" uploader="uploader" ng-show="false" /> | ||
109 | + </div><!-- .form-group --> | ||
110 | + </div> | ||
111 | + <div class="col-sm-1"> | ||
112 | + <div class="form-group no-label"> | ||
113 | + <button ng-show="!newReport && uploader.queue.length > 0 && report.id" class="btn btn-clear" ng-click="view();"> | ||
114 | + <i class="fa fa-search blue"></i> | ||
115 | + <translate>LABEL.VISUALIZAR</translate> | ||
116 | + </button> | ||
117 | + </div> | ||
118 | + </div><!-- .col --> | ||
119 | + </div><!-- .row --> | ||
120 | + </fieldset> | ||
121 | + </tab> | ||
122 | + | ||
123 | + <tab active="tabs[1].active" ng-click="setTabAtual(1)" select="setTabAtual(1)"> | ||
124 | + <tab-heading><i class="blue ace-icon fa fa-database"></i> <translate>ESI.DATASOURCE</translate></tab-heading> | ||
125 | + <div class="row"> | ||
126 | + <div class="col-md-6"> | ||
127 | + <label-select ng-id="report.dataSource.type" ng-label="LABEL.TIPO" | ||
128 | + ng-model="report.dataSource.type" form="reportForm" ng-custom-options="dominio.originalElement.chave as dominio.descricao for dominio" | ||
129 | + ng-obrigatorio="true" ng-list="reportDataSourceList | domainFilter" /> | ||
75 | </div><!-- .col --> | 130 | </div><!-- .col --> |
76 | - </div><!-- .row --> | ||
77 | 131 | ||
78 | - <div class="row"> | ||
79 | - <div class="col-md-5"> | ||
80 | - <label-input ng-id="report.path" ng-label="ESI.PASTA" ng-model="report.path" | ||
81 | - form="javaScriptForm" ng-obrigatorio="true" ng-custom-maxlength="255" ng-disabled="!edit" /> | ||
82 | - </div><!-- .col --> | 132 | + <div class='col-sm-6' ng-if="report.dataSource.type == 'CONNECTION'"> |
133 | + <auto-complete | ||
134 | + ng-label="ESI.CONEXAO_BANCO" | ||
135 | + ng-find="findDataSource(value)" | ||
136 | + ng-acao-borracha="clearDataSourceAutoComplete()" | ||
137 | + ng-item="item.description" | ||
138 | + ng-id="report.dataSource.connection" | ||
139 | + ng-model="report.dataSource.connection" | ||
140 | + ng-set-result="setDataSource(item)" | ||
141 | + form="reportForm" | ||
142 | + ng-obrigatorio="true"> | ||
143 | + </auto-complete> | ||
144 | + </div> | ||
145 | + | ||
146 | + <div class='col-sm-6' ng-if="report.dataSource.type == 'DATAOBJECT'"> | ||
147 | + <auto-complete | ||
148 | + ng-label="ESI.DATAOBJECT" | ||
149 | + ng-find="findDataObject(value)" | ||
150 | + ng-acao-borracha="clearDataObjectAutoComplete()" | ||
151 | + ng-item="item.description" | ||
152 | + ng-id="report.dataSource.dataObject" | ||
153 | + ng-model="report.dataSource.dataObject" | ||
154 | + ng-set-result="setDataObject(item)" | ||
155 | + form="reportForm" | ||
156 | + ng-obrigatorio="true"> | ||
157 | + </auto-complete> | ||
158 | + </div> | ||
83 | 159 | ||
84 | - <div class="col-md-1"> | 160 | + <div class='col-sm-6' ng-if="report.dataSource.type == 'FLOW'"> |
161 | + <auto-complete | ||
162 | + ng-find="findFlow(value)" | ||
163 | + ng-acao-borracha="clearFlowAutoComplete()" | ||
164 | + ng-item="item.description" | ||
165 | + ng-id="report.dataSource.flow" | ||
166 | + ng-label="ESI.FLUXO" | ||
167 | + ng-model="report.dataSource.flow" | ||
168 | + ng-set-result="setFlow(item)" | ||
169 | + form="reportForm" | ||
170 | + ng-obrigatorio="true"> | ||
171 | + </auto-complete> | ||
172 | + </div> | ||
173 | + | ||
174 | + <div class='col-md-6' ng-if="report.dataSource.type == 'EXPRESSION'"> | ||
175 | + <label-select ng-id="report.dataSource.expression.expressionType" ng-model="report.dataSource.expression.expressionType" ng-label="LABEL.TIPO" | ||
176 | + ng-obrigatorio='false' ng-disabled="disabled" form="reportForm" ng-list="expressionTypeList | domainFilter" | ||
177 | + ng-custom-options="item.originalElement.chave as item.descricao for item"> | ||
178 | + </label-select> | ||
179 | + </div> | ||
180 | + | ||
181 | + </div> | ||
182 | + | ||
183 | + <div class="row"> | ||
184 | + <div class="col-md-6" ng-if="report.dataSource.type == 'DATAOBJECT' && report.dataSource.dataObject"> | ||
185 | + <label-select ng-id="report.dataSource.customSQL" ng-label="ESI.SQL" ng-model="report.dataSource.customSQL" ng-obrigatorio='false' form="reportForm" | ||
186 | + ng-list="report.dataSource.dataObject.sqls" ng-custom-options="sql.id as sql.description for sql" > | ||
187 | + </label-select> | ||
188 | + </div> | ||
189 | + <div class="col-md-6" ng-if="report.dataSource.type == 'FLOW' && report.dataSource.flow"> | ||
190 | + <label-input-identifier ng-id="report.dataSource.outputAttributeName" ng-label="ESI.VARIAVEL_SAIDA_FLUXO" ng-model="report.dataSource.outputAttributeName" | ||
191 | + form="reportForm" ng-obrigatorio="true" ng-disabled="!edit" ng-obrigatorio="true" /> | ||
192 | + </div><!-- .col --> | ||
193 | + </div> | ||
194 | + | ||
195 | + <div class='row' ng-if="report.dataSource.type == 'EXPRESSION' && report.dataSource.expression.expressionType == 'CONSTANT'"> | ||
196 | + <div class='col-md-12'> | ||
85 | <div class='form-group'> | 197 | <div class='form-group'> |
86 | - <label class='control-label'><translate>LABEL.VERSAO</translate> </label> | ||
87 | - <input type='text' class='form-control' ng-disabled='true' value='{{report.majorVersion}}.{{report.minorVersion}}'/> | 198 | + <label class='control-label'><translate>LABEL.VALOR</translate><span class='red'>*</span></label> |
199 | + <div ui-ace="{ useWrapMode: true, theme:'eclipse', mode: 'javascript' }" ng-model="report.dataSource.expression.constantValue"></div> | ||
88 | </div> | 200 | </div> |
89 | - </div> | ||
90 | - </div><!-- .row --> | ||
91 | - </fieldset> | ||
92 | - | ||
93 | - <fieldset> | ||
94 | - <legend><translate>ESI.CONTEUDO</translate></legend> | 201 | + </div> |
202 | + </div> | ||
203 | + | ||
204 | + <div class='row' ng-if="report.dataSource.expression.expressionType == 'SCRIPT'"> | ||
205 | + <div class='col-md-12'> | ||
206 | + <label-ui-ace ng-theme="eclipse" ng-mode="javascript" ng-model="report.dataSource.expression.scriptCode.script" ng-obrigatorio="true"/> | ||
207 | + </div> | ||
208 | + </div> | ||
209 | + | ||
210 | + </tab> | ||
211 | + | ||
212 | + <tab active="tabs[2].active" ng-click="setTabAtual(2)" select="setTabAtual(2)"> | ||
213 | + <tab-heading><i class="blue ace-icon fa fa-list"></i> <translate>ESI.PARAMETROS</translate></tab-heading> | ||
214 | + <div class="row"> | ||
215 | + </div> | ||
216 | + </tab> | ||
217 | + | ||
218 | + <tab active="tabs[3].active" ng-click="setTabAtual(3);setFormAttributes();" select="setTabAtual(3);setFormAttributes()"> | ||
219 | + <tab-heading><i class="blue ace-icon fa fa-file-code-o"></i> <translate>ESI.CONSTRUCAO_FORM</translate></tab-heading> | ||
220 | + <div class="row"> | ||
221 | + <div class="col-md-4"> | ||
222 | + <label-input ng-type="text" ng-id="report.formVersion.resource.name" ng-label="ESI.NOME_FORM" ng-obrigatorio="false" | ||
223 | + ng-disabled="!edit" ng-model="report.formVersion.resource.name" ng-custom-maxlength="100" form="reportForm"/> | ||
224 | + </div> | ||
225 | + | ||
226 | + <div class='col-sm-2'> | ||
227 | + <div class="form-group no-label"> | ||
228 | + <div class="checkbox-inline inline" > | ||
229 | + <label> | ||
230 | + <input type="checkbox" name="report.formVersion.showTabs" ng-model="report.formVersion.showTabs" ng-disabled="!edit"> | ||
231 | + <translate>ESI.EXIBE_ABAS</translate> | ||
232 | + </label> | ||
233 | + </div> | ||
234 | + </div> | ||
235 | + </div> | ||
236 | + | ||
237 | + <div class="col-md-6" > | ||
238 | + <label-input ng-id="report.formVersion.resource.description" ng-label="ESI.TITULO_FORM" ng-model="report.formVersion.resource.description" | ||
239 | + form="reportForm" ng-obrigatorio="false" ng-custom-maxlength="255" ng-disabled="!edit" /> | ||
240 | + </div><!-- .col --> | ||
241 | + </div> | ||
242 | + | ||
95 | <div class="row"> | 243 | <div class="row"> |
96 | - <div class="col-sm-6"> | ||
97 | - <div class="form-group"> | ||
98 | - <div nv-file-drop="" uploader="uploader" id="actionUploadFile" onclick="$('#uploadFile').click();"> | ||
99 | - <div nv-file-over="" uploader="uploader" over-class="another-file-over-class" class="well my-drop-zone"> | ||
100 | - <span ng-show="uploader.queue.length <= 0"><translate>MSG.ARRASTE_SOLTE_ARQUIVO<translate/></span> | ||
101 | - <span ng-show="uploader.queue.length > 0" >{{uploader.queue[0].file.name}}</span> | 244 | + <div class='col-md-6' > |
245 | + <auto-complete ng-find="findMenu(value)" | ||
246 | + ng-acao-borracha="limparAutoCompleteMenu()" | ||
247 | + ng-item="item.nome" | ||
248 | + ng-id="report.formVersion.menu" | ||
249 | + ng-label="ESI.MENU_ASSOCIADO" | ||
250 | + ng-model="report.formVersion.menu" | ||
251 | + ng-disabled="!edit" | ||
252 | + form="reportForm" | ||
253 | + ng-obrigatorio="false"> | ||
254 | + </auto-complete> | ||
255 | + </div><!-- .col-sm-4 --> | ||
256 | + | ||
257 | + <div class="col-md-6" ng-if="report.formVersion.menu"> | ||
258 | + <label-input ng-type="text" ng-id="report.formVersion.menuName" ng-label="ESI.NOME_MENU" ng-obrigatorio="false" | ||
259 | + ng-disabled="!edit" ng-model="report.formVersion.menuName" ng-custom-maxlength="100" form="reportForm"/> | ||
260 | + </div> | ||
261 | + </div> | ||
262 | + | ||
263 | + <div class="row" > | ||
264 | + <div class='col-sm-12'> | ||
265 | + <tabset class="tabbable tabs-left " vertical="true"> | ||
266 | + <tab > | ||
267 | + <tab-heading><i class="blue ace-icon fa fa-file-text"></i> <translate>ESI.INTERFACE_USUARIO.HTML</translate></tab-heading> | ||
268 | + <div class='row'> | ||
269 | + <div class='col-sm-12'> | ||
270 | + <div ui-ace="{ useWrapMode: true, theme:'eclipse', mode: 'html' }" ng-model="report.formVersion.defaultPage.pageCode"></div> | ||
271 | + </div> | ||
102 | </div> | 272 | </div> |
103 | - </div> | ||
104 | - <input id="uploadFile" type="file" nv-file-select="" uploader="uploader" ng-show="false" /> | ||
105 | - </div><!-- .form-group --> | ||
106 | - </div> | ||
107 | - <div class="col-sm-1"> | ||
108 | - <div class="form-group no-label"> | ||
109 | - <button ng-show="!newReport && uploader.queue.length > 0 && report.id" class="btn btn-clear" ng-click="view();"> | ||
110 | - <i class="fa fa-search blue"></i> | ||
111 | - <translate>LABEL.VISUALIZAR</translate> | ||
112 | - </button> | ||
113 | - </div> | ||
114 | - </div><!-- .col --> | ||
115 | - </div><!-- .row --> | ||
116 | - </fieldset> | 273 | + </tab> |
274 | + <tab > | ||
275 | + <tab-heading><i class="blue ace-icon fa fa-code"></i> Controller</tab-heading> | ||
276 | + <div class='row'> | ||
277 | + <div class='col-sm-12'> | ||
278 | + <div ui-ace="{ useWrapMode: true, theme:'eclipse', mode: 'javascript' }" ng-model="report.formVersion.defaultPage.controllerCode"></div> | ||
279 | + </div> | ||
280 | + </div> | ||
281 | + </tab> | ||
282 | + <tab > | ||
283 | + <tab-heading><i class="ace-icon fa fa-link blue"></i> <translate>ESI.INTERFACE_USUARIO.DEPENDENCIAS</translate></tab-heading> | ||
284 | + <div class='row'> | ||
285 | + <div class='col-sm-8'> | ||
286 | + <label class="control-label"><translate>ESI.INTERFACE_USUARIO.DEPENDENCIA</translate></label> | ||
287 | + <lista-string ng-lista-itens="report.formVersion.defaultPage.dependencies" ng-altura="200" max-length="255"></lista-string> | ||
288 | + </div> | ||
289 | + </div> | ||
290 | + </tab> | ||
291 | + </tabset> | ||
292 | + </div> | ||
293 | + </div> | ||
294 | + </tab> | ||
295 | + | ||
296 | + | ||
117 | </form> | 297 | </form> |
118 | 298 | ||
119 | <script type="text/ng-template" id="viewFile"> | 299 | <script type="text/ng-template" id="viewFile"> |