var Unibase;(function(n){let t;(function(t){let i;(function(i){let r;(function(r){class u extends t.Core.BaseComponent{constructor(){super();this.dashboardmanager=i.Managers.DashboardManager.Instance();this.navigationhelper=n.Platform.Helpers.NavigationHelper.Instance()}cssFiles(){return["libs/nestable/JqueryminMenu.css"]}jsFiles(){return["platform/dashboards/managers/dashboardmanager.js","platform/dashboards/components/import.js","platform/forms/components/formviewer/formviewer.js","libs/parsley/parsley.min.js","platform/core/infos/status.js","/platform/core/helpers/file/filehelper.js"]}html(n,t){var u=this,i="<\/br>";let r=document.getElementsByClassName("navbar-header");i=r.length!=0?' Dashboard <\/label> Dashboard Group<\/label> ':'Portlet<\/label> ';return``}loadEventBeforeFileUpload(n){let t=this;$("#preloader-it").css("display","block");setTimeout(function(){t.FileUpload(n)},100)}FileUpload(){var i=this,r="";let u=n.Platform.Forms.Components.FormViewer.Instance().requiredFieldValidation("import_File");if(u==!1)return MessageHelper.Instance().showError("Please Choose File","div_importmessage"),i.navigationHelper.hideLoading(),!1;i.navigationHelper.showLoading();this.importType=="dashboard"?r=_appsettings.server_url()+"/apis/v4/unibase/platform/portlets/importportlet/np":this.importType=="dashboardGroup"?r=_appsettings.server_url()+"/apis/v4/unibase/platform/apps/importdashboardportlets/np":this.importType=="portlet"?r=_appsettings.server_url()+"/apis/v4/unibase/platform/portlets/importportlet/np":(MessageHelper.Instance().showError("Please Select Import Type","div_importmessage"),i.navigationHelper.hideLoading());r!=""&&(i.navigationhelper.showLoading(),t.Helpers.FileHelper.Instance().upload(r,n.Platform.Dashboards.Components.Import.fileData).then(function(t){if(t.status==n.Data.Status.Error)MessageHelper.Instance().showError(t.message,"div_importmessage");else{MessageHelper.Instance().showSuccess("success","div_importmessage");let t=n.Platform.Helpers.NavigationHelper.ModalContainerIds[n.Platform.Helpers.NavigationHelper.ModalContainerIds.length-1];$("#"+t).modal("hide");$("#"+t).remove()}i.navigationHelper.hideLoading()}));$("#preloader-it").css("display","none")}load(t,i){var r=this;$("#btn_CloseImport").click(function(){$("#"+i).modal("hide");$("#"+i).remove()});$("#btn_Import").click(function(){$("#importexportsection").removeClass("hidden");$("#div_Import").removeClass("hidden")});$("#import_File").change(function(t){n.Platform.Dashboards.Components.Import.Instance().fileEvent(t)});$("#txt_Icon").focus(function(){$(".div_Icons").fadeIn();$("#icons").toggleClass("hidden");$(".div_Icons").removeClass("hidden")});$("#txt_Icon").focusout(function(){$(".div_Icons").fadeOut()})}ImportType(n){n==1?this.importType="dashboard":n==2?this.importType="dashboardGroup":n==3&&(this.importType="portlet")}fileEvent(t){const i=t.target.files[0];n.Platform.Dashboards.Components.Import.fileData=new FormData;n.Platform.Dashboards.Components.Import.fileData.append(i.name,i)}static Instance(){return this.instance===undefined&&(this.instance=new u),this.instance}}u.fileData=new FormData;r.Import=u})(r=i.Components||(i.Components={}))})(i=t.Dashboards||(t.Dashboards={}))})(t=n.Platform||(n.Platform={}))})(Unibase||(Unibase={}));