(function($){$(function(){if(window.location.href.indexOf("bizottsagok-elozo-ciklusbeli-adatai")!=-1){$("select.P_BIZ option").each(function(){if($(this).val()!==""){$(this).attr("selected","selected");return false}});$("select.P_BIZ").each(function(){$(this).selectpicker("refresh")})}if(window.FormStuff&&$.isFunction(FormStuff.showDomain))$("select[id$\x3d'P_FOTIP']").on("change",function(){if($("select[id$\x3d'P_TIP']").data("selectpicker"))$("select[id$\x3d'P_TIP']").selectpicker("refresh")})})})(jQuery);
Liferay.on("allPortletsReady",function(){jQuery(".pair-content form").attr("onsubmit","saveFormData()");generateButtons();resetForm();checkNavigationType()});
function checkNavigationType(){if(!jQuery(".pair-content form").length)return;if(navigator.userAgent.indexOf("Safari")!=-1)if(performance.navigation.type==2)loadFormData();else sessionStorage.clear();let perfEntries=performance.getEntriesByType("navigation");for(let i=0;i<perfEntries.length;i++)if(perfEntries[i].type==="back_forward")loadFormData();else sessionStorage.clear()}
function generateButtons(){let currentDropdowns=jQuery("table tr .bootstrap-select").not(".P_RENDEZ");let divToAppend='\x3cbutton class\x3d"btn btn-primary btn-reset reset-current" type\x3d"button"\x3e T\u00f6rl\u00e9s \x3c/button\x3e';currentDropdowns.closest("tr td").append(divToAppend);$("tr:has('.date-picker')").find("td:last-child").append(divToAppend)}
function resetForm(){let currentButton=jQuery(".btn-reset");currentButton.on("click",function(){let currentRow=jQuery(this).closest("tr");let currentSelect=currentRow.find("select");let currentOptions=currentRow.find(".bootstrap-select li");currentSelect.val("");currentOptions.each(function(){jQuery(this).removeClass("active selected")});currentSelect.selectpicker("refresh");let currentDates=currentRow.find(".date-picker");currentDates.val("")})}
function saveFormData(){let checkboxArr=jQuery('.pair-content input[type\x3d"checkbox"]').map(function(){return this.checked}).get();sessionStorage.setItem("checked",JSON.stringify(checkboxArr));let textValues=[];let textInputs=jQuery('.pair-content input[type\x3d"text"]:not([type\x3dhidden]):not(".bs-searchbox input"):not(".date-picker")');textInputs.each(function(){textValues.push(jQuery(this).val())});sessionStorage.setItem("textVals",JSON.stringify(textValues));let selectValues=[];let selectElements=
jQuery(".pair-content select");selectElements.each(function(){selectValues.push(jQuery(this).val())});sessionStorage.setItem("selectedVals",JSON.stringify(selectValues));let dateValues=[];let dateInputs=jQuery(".pair-content input.date-picker");dateInputs.each(function(){dateValues.push(jQuery(this).val())});sessionStorage.setItem("dateVals",JSON.stringify(dateValues));let radioValues=[];let radioButtons=jQuery('.pair-content input[type\x3d"radio"]');radioButtons.each(function(){radioValues.push(jQuery(this).is(":checked"))});
sessionStorage.setItem("radioVals",JSON.stringify(radioValues));let currentFormURL=location.href.substring(location.href.indexOf("p_modul"));sessionStorage.setItem("sessionFormURL",currentFormURL)}
function loadFormData(){let currentFormURL=location.href.substring(location.href.indexOf("p_modul"));let savedUrl=sessionStorage.getItem("sessionFormURL");if(currentFormURL!==savedUrl)sessionStorage.clear();else{let checkboxArr=JSON.parse(sessionStorage.getItem("checked"))||[];checkboxArr.forEach(function(isChecked,i){jQuery('.pair-content input[type\x3d"checkbox"]').eq(i).prop("checked",isChecked)});let textArr=JSON.parse(sessionStorage.getItem("textVals"))||[];let textInputs=jQuery('.pair-content input[type\x3d"text"]:not([type\x3dhidden]):not(".bs-searchbox input"):not(".date-picker")');
textInputs.each(function(item){jQuery(this).val(textArr[item])});let selectArr=JSON.parse(sessionStorage.getItem("selectedVals"))||[];let selectElements=jQuery(".pair-content select");selectElements.each(function(item){jQuery(this).selectpicker("val",selectArr[item])});jQuery(".pair-content select").selectpicker("render");let dateArr=JSON.parse(sessionStorage.getItem("dateVals"))||[];let dateInputs=jQuery(".pair-content input.date-picker");dateInputs.each(function(item){jQuery(this).val(dateArr[item])});
let radioArr=JSON.parse(sessionStorage.getItem("radioVals"))||[];radioArr.forEach(function(isChecked,i){jQuery('.pair-content input[type\x3d"radio"]').eq(i).prop("checked",isChecked)})}};
