var Unibase;(function(Unibase){let Platform;(function(Platform){let AppGroups;(function(AppGroups){let Components;(function(Components){class CreateAppGroup extends Platform.Core.BaseComponent{constructor(){super();this._appGroupManager=AppGroups.Managers.AppGroupManager.Instance()}cssFiles(){return[]}jsFiles(){return["platform/appgroups/requests/appgroup.js"]}html(){return`
Create App Group
Details


Choose Apps
    `}load(){var instance=this,TotalGroups=$("li.RootGroup").length;$("#txt_DisplayIndex").val(TotalGroups+1);$("#btn_SaveAppGroup").click(function(){instance.saveAppGroup()});$("#btn_CloseAppGroup").click(function(){instance.navigationHelper.closePopUp()});instance.loadUngroupedApps()}saveAppGroup(){var instance=this,selectedapps=[];$("#UnGroupedAppItems li").each(function(){var cb=$(this).find(":checkbox"),AppId;cb.prop("checked")&&(AppId=cb.parent("li").attr("id"),selectedapps.push(Number(AppId)))});let reqObj=new Unibase.Platform.AppGroups.Requests.AppGroup;reqObj.AppGroupName=String($("#txt_AppGroupName").val());reqObj.DisplayIndex=Number($("#txt_DisplayIndex").val());reqObj.InstalledApps=selectedapps;reqObj.InstalledAppId=0;instance._appGroupManager.saveAppGroup(reqObj).then(function(response){response.errors==null?(instance.navigationHelper.closePopUp(),MessageHelper.Instance().showSuccess("App Group Saved Successfully",""),Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups()):MessageHelper.Instance().showError(response.errors[0],"Bizgaze_CreateAppGroupErrorMsgs")})}loadUngroupedApps(){var instance=this;instance._appGroupManager.getUngroupedApps().then(function(response){var ungroupeddashboards=response.result,i;let html="";if(ungroupeddashboards.length>0){for($("#div_ChooseApps").removeClass("hidden"),i=0;i'+ungroupeddashboards[i].AppTitle+"<\/span><\/li>";$("#UnGroupedAppItems").html(html)}else $("#div_ChooseApps").addClass("hidden")})}static Instance(){return new CreateAppGroup}}Components.CreateAppGroup=CreateAppGroup})(Components=AppGroups.Components||(AppGroups.Components={}))})(AppGroups=Platform.AppGroups||(Platform.AppGroups={}))})(Platform=Unibase.Platform||(Unibase.Platform={}))})(Unibase||(Unibase={})),function(Unibase){let Platform;(function(Platform){let AppGroups;(function(AppGroups){let Components;(function(Components){class EditAppGroup extends Platform.Core.BaseComponent{constructor(){super();this._appGroupManager=AppGroups.Managers.AppGroupManager.Instance()}cssFiles(){return[]}jsFiles(){return["platform/appgroups/requests/appgroup.js"]}html(){return`
    Edit App Group

    You can delete this Group if you do not want this Group to exists for any users across all the portals
    `}load(id){var instance=this;$("#div_EditAppGroupHeader").removeClass("pa-5");$("#btn_CloseAppGroup").click(function(){instance.navigationHelper.closePopUp()});instance._appGroupManager.getAppGroup(id).then(function(response){var groupData=response.result;$("#AppGroupId").val(groupData.AppGroupId);$("#txt_RenameGroup").val(groupData.AppGroupName);$("#txt_DisplayIndex").val(groupData.DisplayIndex)})}deleteGroup(){var instance=this,AppGroupId=Number($("#AppGroupId").val());instance._appGroupManager.getAppsByGroup(AppGroupId).then(function(response){for(var itmLength,Listhtml="",i=0;i'+response.result[i].AppTitle+"<\/li>";Listhtml!=""&&($("#UlMoveGroup").html(Listhtml),$("#GrpItemDiv").removeClass("hidden"));itmLength=$("#UlMoveGroup li").length;itmLength==0&&instance._appGroupManager.deleteAppGroup(AppGroupId).then(function(response){instance.navigationHelper.closePopUp();Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups();response.errors==null?MessageHelper.Instance().showSuccess("Group Deleted Successfully",""):MessageHelper.Instance().showError(response.errors[0],"Bizgaze_AppGroupErrorMessages")})})}UnGroupAllandDelete(){var instance=this,ToDeleteGroupId=$("#AppGroupId").val();instance._appGroupManager.deleteAppGroup(ToDeleteGroupId).then(function(response){instance.navigationHelper.closePopUp();Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups();response.errors==null?MessageHelper.Instance().showSuccess("Group Deleted Successfully",""):MessageHelper.Instance().showError(response.errors[0],"Bizgaze_AppGroupErrorMessages")})}renameGroup(){var instance=this,objreq=new Unibase.Platform.AppGroups.Requests.AppGroup;objreq.AppGroupId=Number($("#AppGroupId").val());objreq.DisplayIndex=Number($("#txt_DisplayIndex").val());objreq.AppGroupName=String($("#txt_RenameGroup").val());instance._appGroupManager.saveAppGroup(objreq).then(function(response){response.errors==null?(MessageHelper.Instance().showSuccess("App Group Saved Successfully",""),instance.navigationHelper.closePopUp(),Unibase.Platform.AppGroups.Components.ManageAppGroup.Instance().loadAppGroups()):MessageHelper.Instance().showError(response.errors[0],"Bizgaze_ErrorMessagesEditAppGroup")})}static Instance(){return new EditAppGroup}}Components.EditAppGroup=EditAppGroup})(Components=AppGroups.Components||(AppGroups.Components={}))})(AppGroups=Platform.AppGroups||(Platform.AppGroups={}))})(Platform=Unibase.Platform||(Unibase.Platform={}))}(Unibase||(Unibase={})),function(Unibase){let Platform;(function(Platform){let AppGroups;(function(AppGroups){let Components;(function(Components){class AppGroup_Template{AppGroups(){return`
  • {{AppGroupName}}
  • `}Apps(){return'
  • Drag<\/div>
     {{AppTitle}}<\/div><\/li>'}UnGroupedApps(){return'
  • Drag<\/div>
     {{AppTitle}}<\/div><\/li > '}static Instance(){return new AppGroup_Template}}Components.AppGroup_Template=AppGroup_Template})(Components=AppGroups.Components||(AppGroups.Components={}))})(AppGroups=Platform.AppGroups||(Platform.AppGroups={}))})(Platform=Unibase.Platform||(Unibase.Platform={}))}(Unibase||(Unibase={})),function(Unibase){let Platform;(function(Platform){let AppGroups;(function(AppGroups){let Requests;(function(Requests){class AppGroup{}Requests.AppGroup=AppGroup;class InstalledApp{}Requests.InstalledApp=InstalledApp;class AppGroupSettings{}Requests.AppGroupSettings=AppGroupSettings})(Requests=AppGroups.Requests||(AppGroups.Requests={}))})(AppGroups=Platform.AppGroups||(Platform.AppGroups={}))})(Platform=Unibase.Platform||(Unibase.Platform={}))}(Unibase||(Unibase={}));