Skip to content
Snippets Groups Projects
Commit f511b0aa authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

Disable Estado-Municipios options [Fix bugs]

Disable Estado-Municipios options [Fix bugs]
parent 75416ac3
No related branches found
No related tags found
No related merge requests found
......@@ -214,12 +214,12 @@ public class OcorrenciaMunicipalController {
OcorrenciaMunicipal ocorrenciaMunicipal = OcorrenciaMunicipal.findOcorrenciaMunicipal(id);
uiModel.addAttribute("ocorrenciamunicipal", ocorrenciaMunicipal);
uiModel.addAttribute("itemId", id);
if (ocorrenciaMunicipal.getStatus() == TipoStatus.Candidato)
if (SecurityContextHolder.getContext().getAuthentication().getAuthorities().toArray()[0].toString().equals("Usuario") && ocorrenciaMunicipal.getUsuario().getLogin().equals(SecurityContextHolder.getContext().getAuthentication().getName())) {
return "ocorrenciamunicipais/myshow";
}
else
return "ocorrenciamunicipais/showcandidatos";
// if (ocorrenciaMunicipal.getStatus() == TipoStatus.Candidato)
// if (SecurityContextHolder.getContext().getAuthentication().getAuthorities().toArray()[0].toString().equals("Usuario") && ocorrenciaMunicipal.getUsuario().getLogin().equals(SecurityContextHolder.getContext().getAuthentication().getName())) {
// return "ocorrenciamunicipais/myshow";
// }
// else
// return "ocorrenciamunicipais/showcandidatos";
return "ocorrenciamunicipais/show";
}
......@@ -311,17 +311,6 @@ public class OcorrenciaMunicipalController {
return "redirect:/ocorrenciamunicipais/"+str;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = "text/html")
public String get(@PathVariable(value = "id") String uf, @Valid OcorrenciaMunicipal ocorrenciamunicipal, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
repopulateMunicipios(uf, uiModel, ocorrenciamunicipal);
return "ocorrenciamunicipais/selectmunicipios";
}
void repopulateMunicipios(String uf, Model uiModel, OcorrenciaMunicipal ocorrenciamunicipal) {
List<Municipio> lm = Municipio.findAllMunicipiosByUf(uf);
uiModel.addAttribute("municipios", lm);
}
void populateEditForm(Model uiModel, OcorrenciaMunicipal ocorrenciaMunicipal) {
uiModel.addAttribute("ocorrenciaMunicipal", ocorrenciaMunicipal);
addDateTimeFormatPatterns(uiModel);
......@@ -334,10 +323,10 @@ public class OcorrenciaMunicipalController {
// uiModel.addAttribute("estadoes", le);
List<Municipio> lm = Municipio.findAllMunicipios();
Municipio m = new Municipio();
m.setId((long) 0);
m.setNome("");
lm.add(0, m);
// Municipio m = new Municipio();
// m.setId((long) 0);
// m.setNome("");
// lm.add(0, m);
uiModel.addAttribute("municipios", lm);
if (ocorrenciaMunicipal.getOrgaosExecutores() != null)
......
......@@ -18,43 +18,9 @@
<field:select field="situacao" id="c_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal_situacao" items="${situacaos}" path="situacaos" widthcss="60px" z="user-managed"/>
<field:textarea field="observacao" id="c_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal_observacao" z="user-managed"/>
<!-- <field:select field="uf" id="c_br_ufpr_c3sl_estacaojuventude_Municipio_uf" itemValue="id" items="${estadoes}" path="/estados" z="user-managed" disableFormBinding="true" /> -->
<field:select field="municipios" id="c_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal_municipios" itemValue="id" items="${municipios}" multiple="true" path="/municipios" z="BD05YnRdtdU25XgKJrSAq3Mc+f4="/>
</form:create>
<form:dependency dependencies="${dependencies}" id="d_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal" render="${not empty dependencies}" z="ame9911g+go04TVYVVTrRJK0UOs="/>
<!-- <script type="text/javascript"> -->
// Spring.addDecoration(new Spring.ElementDecoration({
// elementId : '_uf_id',
// widgetType : "dijit.form.FilteringSelect",
// widgetAttrs : {
// onChange : function() {
// //ID of the chosen "estado"
// uf=document.getElementsByName("uf")[0].value;
// //Create and send to server a request of
// //the list of "Municipios" that belongs to the "Estado" chosen
// xmlhttp = new XMLHttpRequest();
// xmlhttp.open("GET", "ocorrenciamunicipais/"+uf ,false);
// xmlhttp.send();
// //Create a temporary html document to store the html code
// //sent by the server containing the list of "Municipios"
// var responseDoc = document.implementation.createHTMLDocument("XMLHttpResponse");
// responseDoc.documentElement.innerHTML = xmlhttp.responseText;
// //Copy the list of the response to the real page
// var PageElem = document.getElementById("_c_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal_municipios_id");
// var RespElem = responseDoc.getElementById("_c_br_ufpr_c3sl_estacaojuventude_OcorrenciaMunicipal_municipios_id");
// PageElem.innerHTML = RespElem.innerHTML;
// }
// }
// }));
<!-- </script> -->
</div>
......@@ -26,9 +26,9 @@
<put-attribute name="body" value="/WEB-INF/views/ocorrenciamunicipais/myshow.jspx"/>
</definition>
<definition extends="popup" name="ocorrenciamunicipais/select">
<put-attribute name="body" value="/WEB-INF/views/ocorrenciamunicipais/select.jspx"/>
</definition>
<!-- <definition extends="popup" name="ocorrenciamunicipais/select"> -->
<!-- <put-attribute name="body" value="/WEB-INF/views/ocorrenciamunicipais/select.jspx"/> -->
<!-- </definition> -->
<definition extends="default" name="ocorrenciamunicipais/selectmunicipios">
<put-attribute name="body" value="/WEB-INF/views/ocorrenciamunicipais/selectmunicipios.jspx"/>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment