Sfoglia il codice sorgente

fix gestione comuni in creazione pratica ospedaliera

feature/fix_soggetti
marcoalderighi 1 anno fa
parent
commit
c275d1a1bc
  1. 22
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java
  2. 42
      liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_modal_fascicolo.jsp

22
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/fe/portlet/FascicoloFePortlet.java

@ -154,20 +154,16 @@ public class FascicoloFePortlet extends MVCPortlet {
}
}
writeJSON(request, response, jsonArray);
} else if ("comuniOspedaliera".equals(id)) {
String provinciaId = ParamUtil.getString(request, "provinciaId");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();
if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) {
List<Long> comuni = TerritorioLocalServiceUtil.getActiveComuniByCodiceProvincia_Ospedaliera(provinciaId);
for (long comuneId : comuni) {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
Comune comune = ComuneLocalServiceUtil.getComune(comuneId);
jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject);
}
} else if ("ospedalieraEnabled".equals(id)) {
long comuneId = ParamUtil.getLong(request, "comuneId");
Comune comune = ComuneLocalServiceUtil.fetchComune(comuneId);
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
if(Validator.isNotNull(comune)){
jsonObject.put("ospedalieraEnabled", comune.getPraticaOspedali());
} else {
jsonObject.put("ospedalieraEnabled", false);
}
writeJSON(request, response, jsonArray);
writeJSON(request, response, jsonObject);
} else if ("zoneFasce".equals(id)) {
long comuneId = ParamUtil.getLong(request, "comuneId", 0L);
JSONArray jsonArray = JSONFactoryUtil.createJSONArray();

42
liferay-plugins-sdk-6.2/portlets/portos-fe-portlet/docroot/html/fascicolofe/edit_modal_fascicolo.jsp

@ -50,8 +50,8 @@
</div>
<liferay-portlet:resourceURL id="province" var="getProvinceURL" />
<liferay-portlet:resourceURL id="comuni" var="getComuniURL" />
<liferay-portlet:resourceURL id="comuniOspedaliera" var="getComuniOspedalieraURL" />
<liferay-portlet:resourceURL id="zoneFasce" var="getZoneFasceURL" />
<liferay-portlet:resourceURL id="ospedalieraEnabled" var="isOspedalieraEnabledURL" />
<aui:script use="aui-io-request,liferay-dynamic-select,aui-form-validator">
var defaultFormValidator = A.config.FormValidator;
var procedure = {};
@ -113,12 +113,8 @@
};
var getComuni = function(callback, provinciaId) {
var requestURL = '<%= getComuniURL %>';
if(isPraticaOspedaliera){
requestURL = '<%= getComuniOspedalieraURL %>';
}
A.io.request(
requestURL,
'<%= getComuniURL %>',
{
data: {
<portlet:namespace />provinciaId: provinciaId
@ -157,6 +153,39 @@
);
};
var evalAddOspedaliRadio = function() {
var comuneId = $('.add-new-project__comune select').val();
A.io.request(
'<%= isOspedalieraEnabledURL %>',
{
data: {
<portlet:namespace />comuneId: comuneId
},
dataType: 'json',
on: {
success: function() {
var rd = this.get('responseData');
var ospedalieraRadio = $('.add-new-project__procedura input[value="<%= Constants.PROCEDURA_H %>"]');
var ospedalieraId = ospedalieraRadio.attr("id");
var ospedalieraLabel = ospedalieraRadio.closest('label[for="' + ospedalieraId + '"]');
if(!rd.ospedalieraEnabled){
ospedalieraRadio.prop('disabled', 'disabled').prop('checked', false);
if(!ospedalieraLabel.hasClass('hidden')){
ospedalieraLabel.addClass('hidden');
}
} else {
ospedalieraRadio.prop('disabled', false).removeClass('disabled');
if(ospedalieraLabel.hasClass('hidden')){
ospedalieraLabel.removeClass('hidden');
}
}
}
}
}
);
}
new Liferay.DynamicSelect([
{
select: '<portlet:namespace />provincia',
@ -213,6 +242,7 @@
$('.add-new-project__procedura div').removeClass('success');
}else if(val !== 0) {
$('.add-new-project__procedura input').prop('disabled', false).removeClass('disabled').parent().css('display', 'block');
evalAddOspedaliRadio();
}
});
</aui:script>
Caricamento…
Annulla
Salva