12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends n.Platform.Core.BaseComponent{constructor(){super(...arguments);this.layoutElement="#user-themes #menu-layouts .card-body .row.layout-row a";this.detailsViewElement="#user-themes #detail-list-view .card-body .row.detail-row a";this.backgroundImageElement="#user-themes #background-image-view .card-body .row a";this.displayModeElement="#user-themes #theme-switcher-colors .card-body .row a";this.currentUserTheme={LayoutId:0,DetailsViewId:0,DisplayModeId:0,BackgroundImageId:0,ThemeId:0,IsCompanyTheme:!1}}userTheme(t,i,r,u){let f=this;var e=n.Platform.Helpers.FileCacheHelper.Instance();n.Platform.Helpers.FileCacheHelper.Instance().loadCssFiles(["platform/layout/components/layoutbuilder/style.layoutbuilder.css"],function(){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["platform/core/infos/status.js","platform/layout/managers/themelayoutmanager.js"],function(){(i==undefined||i==""||i==null)&&(i=0);(r==undefined||r==""||r==null)&&(r=0);n.Platform.Layouts.Managers.ThemeLayoutManager.Instance().getLayoutBuilderInfo(i,r).then(function(i){$(".biz-wrapper").addClass("biz-settings-toggle");$(".hk-wrapper").addClass("biz-settings-toggle");/ Plain Html /;let o=n.Platform.Layouts.Components.LayoutBuilder_Template.Instance().getLeftHtml(),e="Unibase.Themes.Compact.Components.UserTheme.Instance().saveUserTheme()";(t||u)&&(e="Unibase.Themes.Compact.Components.UserTheme.Instance().saveCompanyTheme()");let s=`
- <div class="user-themes" id="user-themes">
- <div class="user-themes-header"></div>
- <div class="user-themes-body">
- ${o}
- </div>
- <div class="user-themes-footer">
- <a href="javascript:;" class="btn btn-theme px-4 w-100" type="button" onclick="`+e+`">Apply</a>
- </div>
- </div>`;$("#settings-panel-body").html(s);$("#settings-panel-head-title").html("Themes");let h=` <div class="card theme-switcher">
- <div class="card-header">
- <a href="javascript:;" class="no-collapse biz-primary-text-color-removed" > Theme Switcher </a>
- </div>
- <div class="title-devider biz-border-color-removed"> </div>
- <div id="theme-switcher-colors">
- <div class="card-body pb-0" >
- <div class="row dropdown-menu-scrollbar checkbox-container">
- </div>
- </div>
- </div>
- </div>`;$("#user-themes .background-change").before(h);i.result.LayoutInfo.forEach(n=>{let t=n,i=t.LayoutId;t.Thumbnail=t.Thumbnail.replace(".png",".svg");$("#user-themes #menu-layouts .layout-row").append(`<a href="javascript:;" class="col-6 p-0 pr-2 p-relative" data-id="${i}" data-index="${t.LayoutIndex}">
- <img src="${t.Thumbnail}" class="rounded w-100 h-100" data-dynamic="1" onerror="ReloadImage(event)" title="${t.LayoutName}" />
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(f.layoutElement).click(function(){$(f.layoutElement).removeClass("active");$(this).addClass("active");let n=Number($(this).attr("data-id"));f.currentUserTheme.LayoutId=n});i.result.DetailViewInfo.forEach(n=>{if(n.DetailsViewName!="Popup"){let t=n.DetailsViewId;$("#user-themes #detail-list-view .detail-row").append(`<a href="javascript:;" class="col-6 p-0 mb-2 pr-2 p-relative" data-id="${t}">
- <img src="${n.Thumbnail}" class="rounded w-100 h-100" data-dynamic="1" onerror="ReloadImage(event)" title="${n.DetailsViewName}" />
- <i class="zmdi zmdi-check"></i>
- </a>`)}});$(".isStructSettingsEnableChk").parent().siblings().remove();$('[for="isStructSettingsEnableChk"]').remove();$(f.detailsViewElement).click(function(){$(f.detailsViewElement).removeClass("active");$(this).addClass("active");let n=Number($(this).attr("data-id"));f.currentUserTheme.DetailsViewId=n});i.result.DisplayModesInfo.forEach(n=>{$("#user-themes #theme-switcher-colors .row").append(`<a href="javascript:;" class="p-relative mr-2 mb-2" data-id="${n.DisplayModeId}" title="${n.DisplayModeName}">
- <div class="p-relative color-box border biz-border-color-removed" style="background-color:${n.PrimaryColor}">
-
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(f.displayModeElement).click(function(){$(f.displayModeElement).removeClass("active");$(this).addClass("active");$(`${f.backgroundImageElement}.solid-color .color-box`).css("background-color",$(this).find(".color-box").css("background-color"));$(`${f.backgroundImageElement}.solid-color color-box`).addClass("active");let n=Number($(this).attr("data-id"));f.currentUserTheme.DisplayModeId=n});let c=`<a href="javascript:;" class="col-4 p-relative px-1 solid-color active" data-id="0">
- <div class="p-relative color-box border biz-border-color-removed" style="height:65px">
-
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`;$("#user-themes #background-image-view .row").append(c);i.result.BackgroundImages.forEach(n=>{let t=n.IsDefault?"default":"";$("#user-themes #background-image-view .row").append(`<a href="javascript:;" class="col-4 p-relative px-1 ${t}" data-url="${n.Thumbnail}" data-id="${n.BackgroundImageId}">
- <div class="p-relative">
- <img src="${n.Thumbnail}" class="rounded w-100" data-dynamic="1" onerror = "ReloadImage(event)" />
- <div class="delete" data-id="${n.BackgroundImageId}">
- <i class="fa fa-trash"></i>
- </div>
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(f.backgroundImageElement).click(function(){$(f.backgroundImageElement).removeClass("active");$(this).addClass("active");f.currentUserTheme.BackgroundImageId=Number($(this).attr("data-id"))});let r=n.Themes.Compact.Components.Index.Instance().currentTheme;if((t||u)&&(r=i.result.CompanyTheme,r===""&&(f.currentUserTheme.LayoutId=0,f.currentUserTheme.DetailsViewId=0,f.currentUserTheme.DisplayModeId=0,f.currentUserTheme.BackgroundImageId=0,f.currentUserTheme.ThemeId=0),u&&$(".hdn_themeid").length===0&&$("._bizgaze_popup_container").last().find(".section_Hidden").append(`<input type="hidden" class="hdn_themeid" value="0"><input type="hidden" class="hdn_displaymodeid" value="0">`),r===""&&$(".hdn_themeid").val()!="0")){f.bindSelectedUserThemeSettings();return}$(`${f.layoutElement}[data-id="${r.layoutId}"]`).click();$(`${f.detailsViewElement}[data-id="${r.detailsViewId}"]`).click();$(`${f.displayModeElement}[data-id="${r.displayModeId}"]`).click();$(`${f.backgroundImageElement}[data-id="${r.backgroundImageId}"]`).click();f.currentUserTheme.ThemeId=r.themeId;f.currentUserTheme.IsCompanyTheme=r.isCompanyTheme})})})}bindSelectedUserThemeSettings(){const n=this,t=JSON.parse($(".hdn_themeid").val().toString()),{LayoutId:i,DetailsViewId:r,DisplayModeId:u,BackgroundImageId:f}=t;$(`${n.layoutElement}[data-id="${i}"]`).trigger("click");$(`${n.detailsViewElement}[data-id="${r}"]`).trigger("click");$(`${n.displayModeElement}[data-id="${u}"]`).trigger("click");$(`${n.backgroundImageElement}[data-id="${f}"]`).trigger("click")}init(t,i){let r=this;var u=n.Platform.Helpers.FileCacheHelper.Instance();n.Platform.Helpers.FileCacheHelper.Instance().loadCssFiles(["platform/layout/components/layoutbuilder/style.layoutbuilder.css"],function(){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["platform/core/infos/status.js","platform/layout/managers/themelayoutmanager.js"],function(){(i==undefined||i==""||i==null)&&(i=0);n.Platform.Layouts.Managers.ThemeLayoutManager.Instance().getLayoutBuilderInfo(i,0).then(function(i){$(".biz-wrapper").addClass("biz-settings-toggle");$(".hk-wrapper").addClass("biz-settings-toggle");let e=n.Platform.Layouts.Components.LayoutBuilder_Template.Instance().getLeftHtml(),f="Unibase.Themes.Compact.Components.UserTheme.Instance().saveUserTheme()";t&&(f="Unibase.Themes.Compact.Components.UserTheme.Instance().saveCompanyTheme()");let o=`<div class="user-themes" id="user-themes">
- <div class="user-themes-header"></div>
- <div class="user-themes-body">
- ${e}
- </div>
- <div class="user-themes-footer">
- <a href="javascript:;" class="btn btn-theme px-4 w-100" type="button" onclick="`+f+`">Apply</a>
- </div>
- </div>`;$("#settings-panel-body").html(o);$("#settings-panel-head-title").html("Themes");let s=`<div class="card theme-switcher">
- <div class="card-header">
- <a href="javascript:;" class="no-collapse biz-primary-text-color-removed" > Theme Switcher </a>
- </div>
- <div class="title-devider biz-border-color-removed"> </div>
- <div id="theme-switcher-colors">
- <div class="card-body pb-0" >
- <div class="row dropdown-menu-scrollbar checkbox-container">
- </div>
- </div>
- </div>
- </div>`;$("#user-themes .background-change").before(s);i.result.LayoutInfo.forEach(n=>{let t=n,i=t.LayoutId;t.Thumbnail=t.Thumbnail.replace(".png",".svg");$("#user-themes #menu-layouts .layout-row").append(`<a href="javascript:;" class="col-6 p-0 pr-2 p-relative" data-id="${i}" data-index="${t.LayoutIndex}">
- <img src="${t.Thumbnail}" class="rounded w-100 h-100" data-dynamic="1" onerror="ReloadImage(event)" title="${t.LayoutName}" />
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(r.layoutElement).click(function(){$(r.layoutElement).removeClass("active");$(this).addClass("active");let n=Number($(this).attr("data-id"));r.currentUserTheme.LayoutId=n});i.result.DetailViewInfo.forEach(n=>{if(n.DetailsViewName!="Popup"){let t=n.DetailsViewId;$("#user-themes #detail-list-view .detail-row").append(`<a href="javascript:;" class="col-6 p-0 mb-2 pr-2 p-relative" data-id="${t}">
- <img src="${n.Thumbnail}" class="rounded w-100 h-100" data-dynamic="1" onerror="ReloadImage(event)" title="${n.DetailsViewName}" />
- <i class="zmdi zmdi-check"></i>
- </a>`)}});$(r.detailsViewElement).click(function(){$(r.detailsViewElement).removeClass("active");$(this).addClass("active");let n=Number($(this).attr("data-id"));r.currentUserTheme.DetailsViewId=n});i.result.DisplayModesInfo.forEach(n=>{$("#user-themes #theme-switcher-colors .row").append(`<a href="javascript:;" class="p-relative mr-2 mb-2" data-id="${n.DisplayModeId}" title="${n.DisplayModeName}">
- <div class="p-relative color-box border biz-border-color-removed" style="background-color:${n.PrimaryColor}">
-
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(r.displayModeElement).click(function(){$(r.displayModeElement).removeClass("active");$(this).addClass("active");$(`${r.backgroundImageElement}.solid-color .color-box`).css("background-color",$(this).find(".color-box").css("background-color"));$(`${r.backgroundImageElement}.solid-color color-box`).addClass("active");let n=Number($(this).attr("data-id"));r.currentUserTheme.DisplayModeId=n});let h=`<a href="javascript:;" class="col-4 p-relative px-1 solid-color active" data-id="0">
- <div class="p-relative color-box border biz-border-color-removed" style="height:65px">
-
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`;$("#user-themes #background-image-view .row").append(h);i.result.BackgroundImages.forEach(n=>{let t=n.IsDefault?"default":"";$("#user-themes #background-image-view .row").append(`<a href="javascript:;" class="col-4 p-relative px-1 ${t}" data-url="${n.Thumbnail}" data-id="${n.BackgroundImageId}">
- <div class="p-relative">
- <img src="${n.Thumbnail}" class="rounded w-100" data-dynamic="1" onerror = "ReloadImage(event)" />
- <div class="delete" data-id="${n.BackgroundImageId}">
- <i class="fa fa-trash"></i>
- </div>
- </div>
- <i class="zmdi zmdi-check"></i>
- </a>`)});$(r.backgroundImageElement).click(function(){$(r.backgroundImageElement).removeClass("active");$(this).addClass("active");r.currentUserTheme.BackgroundImageId=Number($(this).attr("data-id"))});let u=n.Themes.Compact.Components.Index.Instance().currentTheme;t&&(u=i.result.CompanyTheme);$(`${r.layoutElement}[data-id="${u.layoutId}"]`).click();$(`${r.detailsViewElement}[data-id="${u.detailsViewId}"]`).click();$(`${r.displayModeElement}[data-id="${u.displayModeId}"]`).click();$(`${r.backgroundImageElement}[data-id="${u.backgroundImageId}"]`).click();r.currentUserTheme.ThemeId=u.themeId;r.currentUserTheme.IsCompanyTheme=u.isCompanyTheme})})})}saveCompanyTheme(){let t=this,n={LayoutId:t.currentUserTheme.LayoutId,ThemeId:t.currentUserTheme.ThemeId||0,DetailsViewId:t.currentUserTheme.DetailsViewId,DisplayModeId:t.currentUserTheme.DisplayModeId,BackgroundImageId:t.currentUserTheme.BackgroundImageId};const i=$("._bizgaze_popup_container").last().find(".form-error-message").first().attr("id");if(!n.LayoutId&&!n.DetailsViewId&&!n.DisplayModeId){MessageHelper.Instance().showError("Select Theme.",i);return}if(n.LayoutId)if(n.DetailsViewId){if(!n.DisplayModeId){MessageHelper.Instance().showError("Select Theme Switcher.",i);return}}else{MessageHelper.Instance().showError("Select Preferred Details View in Theme.",i);return}else{MessageHelper.Instance().showError("Select Preferred Layout in Theme.",i);return}$(".hdn_themeid").val(JSON.stringify(n));$(".hdn_displaymodeid").val(t.currentUserTheme.DisplayModeId);$(".biz-wrapper,.hk-wrapper").removeClass("biz-settings-toggle")}saveUserTheme(){let t=this,i={LayoutId:t.currentUserTheme.LayoutId,ThemeId:t.currentUserTheme.IsCompanyTheme?0:t.currentUserTheme.ThemeId,DetailsViewId:t.currentUserTheme.DetailsViewId,DisplayModeId:t.currentUserTheme.DisplayModeId,BackgroundImageId:t.currentUserTheme.BackgroundImageId};n.Platform.Layouts.Managers.ThemeLayoutManager.Instance().saveUserTheme(i).then(function(t){t.status==n.Data.Status.Success&&(MessageHelper.Instance().showSuccess(t.message,""),n.Platform.Layouts.Components.LayoutBuilder.Instance().refrshLayout(t))})}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.UserTheme=i})(i=t.Components||(t.Components={}))})(i=t.Compact||(t.Compact={}))})(t=n.Themes||(n.Themes={}))})(Unibase||(Unibase={}));
|