/home/ivoiecob/email.hirewise-va.com/adminpanel/js/7734.d82010d3.js
"use strict";(globalThis["webpackChunkadmin_panel_vue_webclient"]=globalThis["webpackChunkadmin_panel_vue_webclient"]||[]).push([[7734],{92459:(e,t,s)=>{s.r(t),s.d(t,{default:()=>$});var o=s(61758),r=s(58790);const i={class:"flex column full-height"};function a(e,t,s,a,l,u){const n=(0,o.g2)("IconTrash"),h=(0,o.g2)("q-tooltip"),d=(0,o.g2)("q-btn"),p=(0,o.g2)("IconAdd"),c=(0,o.g2)("q-toolbar"),g=(0,o.g2)("IconTeamGroup"),I=(0,o.g2)("q-item-section"),m=(0,o.g2)("standard-list"),E=(0,o.g2)("router-view"),C=(0,o.g2)("ConfirmDialog"),G=(0,o.g2)("q-splitter"),_=(0,o.g2)("main-layout");return(0,o.uX)(),(0,o.Wv)(_,null,{default:(0,o.k6)((()=>[(0,o.bF)(G,{"after-class":"q-splitter__right-panel",class:"full-height full-width",modelValue:l.listSplitterWidth,"onUpdate:modelValue":t[0]||(t[0]=e=>l.listSplitterWidth=e),limits:[10,30]},{before:(0,o.k6)((()=>[(0,o.Lk)("div",i,[(0,o.bF)(c,{class:"col-auto q-py-sm list-border"},{default:(0,o.k6)((()=>[(0,o.bF)(d,{flat:"",color:"grey-8",size:"mg","no-wrap":"",disable:0===l.checkedIds.length,onClick:u.askDeleteCheckedGroups},{default:(0,o.k6)((()=>[(0,o.bF)(n),(0,o.Lk)("span",null,(0,r.v_)(u.countLabel),1),(0,o.bF)(h,null,{default:(0,o.k6)((()=>[(0,o.eW)((0,r.v_)(e.$t("COREWEBCLIENT.ACTION_DELETE")),1)])),_:1})])),_:1},8,["disable","onClick"]),(0,o.bF)(d,{flat:"",color:"grey-8",size:"mg",onClick:u.routeCreateGroup},{default:(0,o.k6)((()=>[(0,o.bF)(p),(0,o.bF)(h,null,{default:(0,o.k6)((()=>[(0,o.eW)((0,r.v_)(e.$t("ADMINPANELWEBCLIENT.ACTION_CREATE_ENTITY_GROUP")),1)])),_:1})])),_:1},8,["onClick"])])),_:1}),(0,o.bF)(m,{class:"col-grow list-border",items:l.groupItems,selectedItem:l.selectedGroupId,loading:l.loadingGroups,search:l.search,page:l.page,pagesCount:u.pagesCount,noItemsText:"ADMINPANELWEBCLIENT.INFO_NO_ENTITIES_GROUP",noItemsFoundText:"ADMINPANELWEBCLIENT.INFO_NO_ENTITIES_FOUND_GROUP",ref:"groupList",onRoute:u.route,onCheck:u.afterCheck},{"right-icon":(0,o.k6)((e=>[(0,o.bF)(I,{side:""},{default:(0,o.k6)((()=>[(0,o.bF)(g,{size:24,color:e.color},null,8,["color"])])),_:2},1024)])),_:1},8,["items","selectedItem","loading","search","page","pagesCount","noItemsText","noItemsFoundText","onRoute","onCheck"])])])),after:(0,o.k6)((()=>[(0,o.bF)(E,{onGroupCreated:u.handleCreateGroup,onCancelCreate:u.route,onDeleteGroup:u.askDeleteGroup,deletingIds:l.deletingIds},null,8,["onGroupCreated","onCancelCreate","onDeleteGroup","deletingIds"])])),default:(0,o.k6)((()=>[(0,o.bF)(C,{ref:"confirmDialog"},null,512)])),_:1},8,["modelValue"])])),_:1})}s(63150),s(43218),s(26003),s(28268);var l=s(43436),u=s.n(l),n=s(36720),h=s(38176),d=s(35118),p=s(79134),c=s(59368),g=s(4800),I=s(63757),m=s(91423),E=s(19394),C=s(38755),G=s(34990);const _={name:"Groups",components:{MainLayout:g.A,ConfirmDialog:I.A,StandardList:m.A,IconAdd:E.A,IconTeamGroup:C.A,IconTrash:G.A},data(){return{groups:[],selectedGroupId:0,loadingGroups:!1,totalCount:0,search:"",page:1,limit:c.A.getEntitiesPerPage(),groupItems:[],checkedIds:[],justCreatedId:0,deletingIds:[],listSplitterWidth:d.A.pInt(localStorage.getItem("aurora_admin_groups_splitter-width"),20)}},computed:{currentTenantId(){return this.$store.getters["tenants/getCurrentTenantId"]},allGroups(){const e=this.$store.getters["groups/getGroups"];return d.A.pArray(e[this.currentTenantId])},pagesCount(){return Math.ceil(this.totalCount/this.limit)},countLabel(){const e=this.checkedIds.length;return e>0?e:""}},watch:{$route(e,t){this.parseRoute()},currentTenantId(){"/groups"!==this.$route.path&&this.$router.push("/groups"),this.requestGroups()},allGroups(){this.populate(),this.justCreatedId&&this.allGroups.find((e=>e.id===this.justCreatedId))&&(this.groups.find((e=>e.id===this.justCreatedId))&&this.route(this.justCreatedId),this.justCreatedId=0)},groups(){this.groups?this.groupItems=this.groups.map((e=>({id:e.id,title:e.name,checked:!1,disableCheck:e.isTeam,showRightIcon:e.isTeam}))):this.groupItems=[]},listSplitterWidth(){localStorage.setItem("aurora_admin_groups_splitter-width",this.listSplitterWidth)}},mounted(){this.requestGroups(),this.parseRoute(),this.populate()},methods:{requestGroups(){this.$store.dispatch("groups/requestGroups",{tenantId:this.currentTenantId})},parseRoute(){if("/groups/create"===this.$route.path)this.selectedGroupId=0;else{const e=d.A.pString(this.$route?.params?.search),t=d.A.pPositiveInt(this.$route?.params?.page);this.search===e&&this.page===t&&0===this.justCreatedId||(this.search=e,this.page=t,this.populate());const s=d.A.pNonNegativeInt(this.$route?.params?.id);this.selectedGroupId!==s&&(this.selectedGroupId=s)}},populate(){const e=this.search.toLowerCase(),t=""===e?this.allGroups:this.allGroups.filter((t=>-1!==t.name.toLowerCase().indexOf(e)));this.totalCount=t.length;const s=this.limit*(this.page-1);this.groups=t.slice(s,s+this.limit)},route(e=0){const t=this.$refs?.groupList?.enteredSearch||"",s=""!==t?`/search/${t}`:"";let o=this.$refs?.groupList?.selectedPage||1;this.search!==t&&(o=1);const r=o>1?`/page/${o}`:"",i=e>0?`/id/${e}`:"",a="/groups"+s+r+i;a!==this.$route.path&&this.$router.push(a)},routeCreateGroup(){this.$router.push("/groups/create")},handleCreateGroup(e){this.justCreatedId=e,this.route(),this.requestGroups()},afterCheck(e){this.checkedIds=e},askDeleteGroup(e){this.askDeleteGroups([e])},askDeleteCheckedGroups(){this.askDeleteGroups(this.checkedIds)},askDeleteGroups(e){if(u().isFunction(this?.$refs?.confirmDialog?.openDialog)){const t=1===e.length?this.groups.find((t=>t.id===e[0])):null,s=t?t.name:"";this.$refs.confirmDialog.openDialog({title:s,message:this.$tc("ADMINPANELWEBCLIENT.CONFIRM_DELETE_GROUP_PLURAL",e.length),okHandler:this.deleteGroups.bind(this,e)})}},deleteGroups(e){this.deletingIds=e,this.loadingGroups=!0,p.A.sendRequest({moduleName:"Core",methodName:"DeleteGroups",parameters:{IdList:e,Type:"Group"}}).then((t=>{if(this.deletingIds=[],this.loadingGroups=!1,!0===t){h.A.showReport(this.$tc("ADMINPANELWEBCLIENT.REPORT_DELETE_ENTITIES_GROUP_PLURAL",e.length));const t=-1!==e.indexOf(this.selectedGroupId),s=this.$refs?.groupList?.selectedPage||1,o=this.groups.length===e.length&&s>1;o&&u().isFunction(this.$refs?.groupList?.decreasePage)?this.$refs.groupList.decreasePage():t?(this.route(),this.populate()):this.populate()}else h.A.showError(this.$tc("ADMINPANELWEBCLIENT.ERROR_DELETE_ENTITIES_GROUP_PLURAL",e.length));this.requestGroups()}),(t=>{this.deletingIds=[],this.loadingGroups=!1,h.A.showError(n.A.getTextFromResponse(t,this.$tc("ADMINPANELWEBCLIENT.ERROR_DELETE_ENTITIES_GROUP_PLURAL",e.length))),this.requestGroups()}))}}};var T=s(12807),A=s(98072),f=s(36914),L=s(56384),k=s(97410),N=s(25173),b=s(98582),R=s.n(b);const D=(0,T.A)(_,[["render",a]]),$=D;R()(_,"components",{QSplitter:A.A,QToolbar:f.A,QBtn:L.A,QTooltip:k.A,QItemSection:N.A})}}]);