Sfoglia il codice sorgente

fix gestione comuni in creazione pratica ospedaliera

feature/fix_soggetti
marcoalderighi 2 anni 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); writeJSON(request, response, jsonArray);
} else if ("comuniOspedaliera".equals(id)) { } else if ("ospedalieraEnabled".equals(id)) {
String provinciaId = ParamUtil.getString(request, "provinciaId"); long comuneId = ParamUtil.getLong(request, "comuneId");
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); Comune comune = ComuneLocalServiceUtil.fetchComune(comuneId);
if (Validator.isNotNull(provinciaId) && !provinciaId.equals("0")) { JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
List<Long> comuni = TerritorioLocalServiceUtil.getActiveComuniByCodiceProvincia_Ospedaliera(provinciaId); if(Validator.isNotNull(comune)){
for (long comuneId : comuni) { jsonObject.put("ospedalieraEnabled", comune.getPraticaOspedali());
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(); } else {
Comune comune = ComuneLocalServiceUtil.getComune(comuneId); jsonObject.put("ospedalieraEnabled", false);
jsonObject.put("comuneId", comune.getComuneId());
jsonObject.put("descLong", comune.getDenominazione());
jsonArray.put(jsonObject);
}
} }
writeJSON(request, response, jsonArray); writeJSON(request, response, jsonObject);
} else if ("zoneFasce".equals(id)) { } else if ("zoneFasce".equals(id)) {
long comuneId = ParamUtil.getLong(request, "comuneId", 0L); long comuneId = ParamUtil.getLong(request, "comuneId", 0L);
JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); 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> </div>
<liferay-portlet:resourceURL id="province" var="getProvinceURL" /> <liferay-portlet:resourceURL id="province" var="getProvinceURL" />
<liferay-portlet:resourceURL id="comuni" var="getComuniURL" /> <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="zoneFasce" var="getZoneFasceURL" />
<liferay-portlet:resourceURL id="ospedalieraEnabled" var="isOspedalieraEnabledURL" />
<aui:script use="aui-io-request,liferay-dynamic-select,aui-form-validator"> <aui:script use="aui-io-request,liferay-dynamic-select,aui-form-validator">
var defaultFormValidator = A.config.FormValidator; var defaultFormValidator = A.config.FormValidator;
var procedure = {}; var procedure = {};
@ -113,12 +113,8 @@
}; };
var getComuni = function(callback, provinciaId) { var getComuni = function(callback, provinciaId) {
var requestURL = '<%= getComuniURL %>';
if(isPraticaOspedaliera){
requestURL = '<%= getComuniOspedalieraURL %>';
}
A.io.request( A.io.request(
requestURL, '<%= getComuniURL %>',
{ {
data: { data: {
<portlet:namespace />provinciaId: provinciaId <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([ new Liferay.DynamicSelect([
{ {
select: '<portlet:namespace />provincia', select: '<portlet:namespace />provincia',
@ -213,6 +242,7 @@
$('.add-new-project__procedura div').removeClass('success'); $('.add-new-project__procedura div').removeClass('success');
}else if(val !== 0) { }else if(val !== 0) {
$('.add-new-project__procedura input').prop('disabled', false).removeClass('disabled').parent().css('display', 'block'); $('.add-new-project__procedura input').prop('disabled', false).removeClass('disabled').parent().css('display', 'block');
evalAddOspedaliRadio();
} }
}); });
</aui:script> </aui:script>
Caricamento…
Annulla
Salva