window.onload = function() {

	$("#_com_liferay_layout_admin_web_portlet_GroupPagesPortlet_typeOptions .layout-type .lfr-page-layouts").prepend("<div class='liferay-default-layouts'><h4 class='mb-4'>Haz clic para desplegar los layouts por defecto de Liferay <i class='icon-caret-down'></i></h5><div class='list-default-layouts'><ul class='card-page mb-4 layouts_liferay'></ul></div></div>");
	$(".list-default-layouts ul").append($("#_com_liferay_layout_admin_web_portlet_GroupPagesPortlet_typeOptions .layout-type .lfr-page-layouts ul li:nth-child(-n+14)"));
	$(".liferay-default-layouts > h4").click(function(){
	    $(this).next().slideToggle();
	    $(this).find("i").toggleClass('icon-caret-down icon-caret-up');
	})
	
	let idInstancia = "4249355;4230117;5895770";
	let getCompanyId = Liferay.ThemeDisplay.getCompanyId();
	let result = idInstancia.includes(getCompanyId);
	let panelControl = $(".cadmin.control-menu-container .user-control-group .control-menu-nav-item > button.dropdown-toggle .lexicon-icon-grid").length;
	console.log("hay controles en panel: " +panelControl);
	if (result && panelControl == 0) {
		$("head").prepend("<style></style>");
		$("head style").first().prepend("#portlet_com_liferay_my_account_web_portlet_MyAccountPortlet .portlet-body .container-fluid .menubar .menubar-collapse .nav.nav-nested {display: none;}");
		$("head style").first().prepend("div:has(> label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_screenName'] ) {cursor: not-allowed;}");
		$("head style").first().prepend("div:has(> label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_firstName'] ) {cursor: not-allowed;}");
		$("head style").first().prepend("div:has(> label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_lastName'] ) {cursor: not-allowed;}");
		
		$("label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_screenName'] + input").attr("disabled", "disabled");
		$("label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_firstName'] + input").attr("disabled", "disabled");
		$("label[for='_com_liferay_my_account_web_portlet_MyAccountPortlet_lastName'] + input").attr("disabled", "disabled");
	}
	
	
	
	/*$("ul.layouts_liferay li:nth-of-type(3) .checkbox-card > label > input").removeAttr("checked");
	$("ul.layouts_liferay li:nth-of-type(3) .checkbox-card > label > .card").removeClass("active");
	
	$(".lfr-page-layouts > ul.card-page > li:nth-of-type(2) .checkbox-card > label > input").attr("checked","true");
	$(".lfr-page-layouts > ul.card-page > li:nth-of-type(2) .checkbox-card > label > .card").addClass("active");*/
};

