1"use strict";(self["webpackChunkclient"]=self["webpackChunkclient"]||[]).push([[2725],{12212:function(e,t,o){o.d(t,{A:function(){return $}});var s=o(20641),r=o(53751),n=o(90033);const a={class:"card p-5 mb-5"},l={class:"mb-5 has-text-weight-semibold"},i={key:0,class:"card p-5"},d={class:"has-text-weight-semibold mb-5"},u={key:0,class:"is-size-7 has-text-grey mb-3 mt-3"},p={class:"is-size-7 has-text-grey mb-3"},c={class:"is-size-7 has-text-grey mb-3"},h={key:1,class:"mt-5"},g={class:"field has-addons"},m={class:"control is-expanded"},v={class:"control"},y={class:"field has-addons"},f={class:"control is-expanded"},C={class:"control"},L={key:5,class:"help"};function k(e,t,o,k,b,E){const G=(0,s.g2)("b-input"),T=(0,s.g2)("b-field"),D=(0,s.g2)("b-radio"),F=(0,s.g2)("b-checkbox"),x=(0,s.g2)("b-switch"),$=(0,s.g2)("b-colorpicker");return(0,s.uX)(),(0,s.CE)("section",null,[(0,s.Lk)("form",{onSubmit:t[18]||(t[18]=(0,r.D$)((...e)=>o.save&&o.save(...e),["prevent"]))},[(0,s.bF)(T,{label:e.$t("title"),class:"mb-5"},{default:(0,s.k6)(()=>[(0,s.bF)(G,{modelValue:o.item.name,"onUpdate:modelValue":[t[0]||(t[0]=e=>o.item.name=e),t[1]||(t[1]=e=>o.item.namePlural=o.item.name)],required:""},null,8,["modelValue"])]),_:1},8,["label"]),(0,s.bF)(T,{label:e.$t("Plural title"),class:"mb-5"},{default:(0,s.k6)(()=>[(0,s.bF)(G,{modelValue:o.item.namePlural,"onUpdate:modelValue":t[2]||(t[2]=e=>o.item.namePlural=e),required:""},null,8,["modelValue"])]),_:1},8,["label"]),(0,s.Lk)("div",a,[(0,s.Lk)("p",l,(0,n.v_)(e.$t("level")),1),(0,s.bF)(T,null,{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[3]||(t[3]=e=>b.level=e),E.applyLevel],"native-value":null},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("None")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1}),e.tenant.settingFeatures.users.hasUserTypes?((0,s.uX)(),(0,s.Wv)(T,{key:0},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[4]||(t[4]=e=>b.level=e),E.applyLevel],"native-value":"isUserType"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("userType")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1})):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive?((0,s.uX)(),(0,s.Wv)(T,{key:1},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[5]||(t[5]=e=>b.level=e),E.applyLevel],"native-value":"isLocalCenter"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("Chapter")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1})):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive&&e.tenant.settingFeatures.localCenter.hasParent?((0,s.uX)(),(0,s.Wv)(T,{key:2},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[6]||(t[6]=e=>b.level=e),E.applyLevel],"native-value":"isLocalCenterParent"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("Parent chapter")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1})):(0,s.Q3)("",!0),(0,s.bF)(T,null,{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[7]||(t[7]=e=>b.level=e),E.applyLevel],"native-value":"isNational"},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("organization")),1)]),_:1},8,["modelValue","onUpdate:modelValue"])]),_:1}),e.tenant.settingFeatures.group.hasUnits&&b.unitTypes?((0,s.uX)(!0),(0,s.CE)(s.FK,{key:3},(0,s.pI)(b.unitTypes,e=>((0,s.uX)(),(0,s.CE)(s.FK,{key:e.id},[e&&!["group","role"].includes(e.discriminator)?((0,s.uX)(),(0,s.Wv)(T,{key:0},{default:(0,s.k6)(()=>[(0,s.bF)(D,{modelValue:b.level,"onUpdate:modelValue":[t[8]||(t[8]=e=>b.level=e),E.applyLevel],"native-value":e["@id"]},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.name),1)]),_:2},1032,["modelValue","native-value","onUpdate:modelValue"])]),_:2},1024)):(0,s.Q3)("",!0)],64))),128)):(0,s.Q3)("",!0)]),o.item.isUserType?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",i,[(0,s.Lk)("p",d,(0,n.v_)(e.$t("Permissions")),1),E.tenantPermissions.length>0?((0,s.uX)(),(0,s.CE)(s.FK,{key:0},[e.tenant.settingFeatures.localCenter.isActive?((0,s.uX)(),(0,s.CE)("p",u,(0,n.v_)(e.$t("Organization level")),1)):(0,s.Q3)("",!0),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(E.tenantPermissions,r=>((0,s.uX)(),(0,s.Wv)(T,{key:r},{default:(0,s.k6)(()=>[(0,s.bF)(F,{modelValue:o.item.permissions,"onUpdate:modelValue":t[9]||(t[9]=e=>o.item.permissions=e),"native-value":r},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t(r)),1)]),_:2},1032,["modelValue","native-value"])]),_:2},1024))),128))],64)):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive&&E.localPermissions.length>0?((0,s.uX)(),(0,s.CE)(s.FK,{key:1},[t[19]||(t[19]=(0,s.Lk)("hr",{class:"my-4"},null,-1)),(0,s.Lk)("p",p,(0,n.v_)(e.$t("Local group level")),1),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(E.localPermissions,r=>((0,s.uX)(),(0,s.Wv)(T,{key:r},{default:(0,s.k6)(()=>[(0,s.bF)(F,{modelValue:o.item.permissions,"onUpdate:modelValue":t[10]||(t[10]=e=>o.item.permissions=e),"native-value":r},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t(r)),1)]),_:2},1032,["modelValue","native-value"])]),_:2},1024))),128))],64)):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive&&e.tenant.settingFeatures.localCenter.hasParent&&E.parentLocalPermissions.length>0?((0,s.uX)(),(0,s.CE)(s.FK,{key:2},[t[20]||(t[20]=(0,s.Lk)("hr",{class:"my-4"},null,-1)),(0,s.Lk)("p",c,(0,n.v_)(e.$t("Parent local center level")),1),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(E.parentLocalPermissions,r=>((0,s.uX)(),(0,s.Wv)(T,{key:r},{default:(0,s.k6)(()=>[(0,s.bF)(F,{modelValue:o.item.permissions,"onUpdate:modelValue":t[11]||(t[11]=e=>o.item.permissions=e),"native-value":r},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t(r)),1)]),_:2},1032,["modelValue","native-value"])]),_:2},1024))),128))],64)):(0,s.Q3)("",!0)])),o.item.isUserType?((0,s.uX)(),(0,s.CE)("div",h,[(0,s.bF)(T,null,{default:(0,s.k6)(()=>[(0,s.bF)(x,{modelValue:o.item.isNotEligibleForFee,"onUpdate:modelValue":t[12]||(t[12]=e=>o.item.isNotEligibleForFee=e),size:"is-small","native-value":!0},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("Not eligible for fee")),1)]),_:1},8,["modelValue"])]),_:1}),e.tenant.settingFeatures.users.hasFamilyMembers?((0,s.uX)(),(0,s.Wv)(T,{key:0},{default:(0,s.k6)(()=>[(0,s.bF)(x,{modelValue:o.item.isParent,"onUpdate:modelValue":t[13]||(t[13]=e=>o.item.isParent=e),size:"is-small","native-value":!0},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("Parent")),1)]),_:1},8,["modelValue"])]),_:1})):(0,s.Q3)("",!0),e.tenant.settingFeatures.users.hasVolunteerRoles?((0,s.uX)(),(0,s.Wv)(T,{key:1},{default:(0,s.k6)(()=>[(0,s.bF)(x,{modelValue:o.item.isVolunteer,"onUpdate:modelValue":t[14]||(t[14]=e=>o.item.isVolunteer=e),size:"is-small","native-value":!0},{default:(0,s.k6)(()=>[(0,s.eW)((0,n.v_)(e.$t("Volunteer")),1)]),_:1},8,["modelValue"])]),_:1})):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0),o.item.isUserType?((0,s.uX)(),(0,s.Wv)(T,{key:2,label:e.$t("Select a font color"),class:"mt-5"},{default:(0,s.k6)(()=>[(0,s.Lk)("div",g,[(0,s.Lk)("div",m,[(0,s.bF)(G,{modelValue:o.item.options.color,"onUpdate:modelValue":t[15]||(t[15]=e=>o.item.options.color=e),value:o.item.options.color||"#3372e6",placeholder:"#3372e6"},null,8,["modelValue","value"])]),(0,s.Lk)("div",v,[(0,s.bF)($,{representation:"square",position:"is-top-left","native-value":o.item.options.color||"#3372e6","onUpdate:modelValue":E.updateColorSelection},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button",style:(0,n.Tr)({backgroundColor:o.item.options.color||"#3372e6",width:"40px",height:"40px",border:"1px solid var(--orgo-border-medium),"})},null,4)]),_:1},8,["native-value","onUpdate:modelValue"])])])]),_:1},8,["label"])):(0,s.Q3)("",!0),o.item.isUserType?((0,s.uX)(),(0,s.Wv)(T,{key:3,label:e.$t("Select a background color"),class:"mt-5"},{default:(0,s.k6)(()=>[(0,s.Lk)("div",y,[(0,s.Lk)("div",f,[(0,s.bF)(G,{modelValue:o.item.options.bgcolor,"onUpdate:modelValue":t[16]||(t[16]=e=>o.item.options.bgcolor=e),value:o.item.options.bgcolor||"#3372e6",placeholder:"#3372e6"},null,8,["modelValue","value"])]),(0,s.Lk)("div",C,[(0,s.bF)($,{representation:"square",position:"is-top-left","native-value":o.item.options.bgcolor||"#3372e6","onUpdate:modelValue":E.updateBgColorSelection},{trigger:(0,s.k6)(()=>[(0,s.Lk)("button",{type:"button",class:"button",style:(0,n.Tr)({backgroundColor:o.item.options.bgcolor||"#3372e6",width:"40px",height:"40px",border:"1px solid var(--orgo-border-medium),"})},null,4)]),_:1},8,["native-value","onUpdate:modelValue"])])])]),_:1},8,["label"])):(0,s.Q3)("",!0),o.item.isUserType?((0,s.uX)(),(0,s.Wv)(T,{key:4,label:e.$t("URL Slug"),class:"mt-5"},{default:(0,s.k6)(()=>[(0,s.bF)(G,{modelValue:o.item.slug,"onUpdate:modelValue":t[17]||(t[17]=e=>o.item.slug=e),placeholder:e.$t("e.g. volunteer, parent, member")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):(0,s.Q3)("",!0),o.item.isUserType?((0,s.uX)(),(0,s.CE)("p",L,(0,n.v_)(e.$t("Used for the registration URL: /join/[slug]")),1)):(0,s.Q3)("",!0)],32)])}o(18111),o(22489);var b=o(40834),E=o(80926),G=o(78048),T=o(68866),D={mixins:[T.A],props:["item","save","onDelete"],data(){return{unitTypes:null,optionsObject:{},level:null}},created(){if(this.item){if(this.level=this.getInitialLevel(),this.$http.plain.get("/unit_types").then(e=>{this.unitTypes=e.data["hydra:member"]}).catch(e=>{console.error(e)}),this.item.options)try{"string"===typeof this.item.options?this.optionsObject=JSON.parse(this.item.options):this.optionsObject=this.item.options||{}}catch(e){console.error("Failed to parse options:",e),this.optionsObject={}}this.optionsObject&&"object"===typeof this.optionsObject&&!Array.isArray(this.optionsObject)||(this.optionsObject={}),this.item.options=this.optionsObject}},methods:{left:E.left,getInitialLevel(){return this.item.isUserType?"isUserType":this.item.isLocalCenter?"isLocalCenter":this.item.isLocalCenterParent?"isLocalCenterParent":this.item.isNational?"isNational":this.item.unitType||null},applyLevel(e){const t=["isUserType","isLocalCenter","isLocalCenterParent","isNational"];for(const o of t)this.item[o]=e===o;this.item.unitType=e&&!t.includes(e)?e:null,"isUserType"===e&&(this.item.permissions=[])},updateBgColorSelection(e){this.item.options.bgcolor=e.toString("hex")},updateColorSelection(e){this.item.options.color=e.toString("hex")}},computed:{...(0,b.L8)(["tenant","tenantLanguages","user","isGranted"]),tenantPermissions(){return this.permissionsAvailable.filter(e=>e.includes("_TENANT"))},localPermissions(){return this.permissionsAvailable.filter(e=>e.includes("_LOCAL")&&!e.includes("_PARENT_LOCAL"))},parentLocalPermissions(){return this.permissionsAvailable.filter(e=>e.includes("_PARENT_LOCAL"))}},components:{BSwitch:G.Lf}},F=o(66262);const x=(0,F.A)(D,[["render",k]]);var $=x},42725:function(e,t,o){o.r(t),o.d(t,{default:function(){return At}});var s=o(20641),r=o(90033),n=o(53751);const a={class:"o-minwidth org-chart"},l={class:"modal-card"}
1,i={class:"h-stack spaced w-100 chart-modal-head-stack"},d={key:0},u={class:"has-text-weight-semibold is-size-5 has-text-centered mb-0"},p={class:"chart-local-center-label"},c={class:"is-small ml-2"},h={class:"dropdown-item-search"},g={key:0},m={key:0,class:"orgo-table-wrap"},v={class:"mb-6 mt-3 chart-container"},y={class:"chart-header level mb-4 is-fullwidth"},f={class:"level-left",style:{"z-index":"10"}},C={key:0,class:"level-item"},L={class:"is-small"},k={class:"ml-1"},b={class:"level-item"},E={class:"page-title"},G={class:"level-right",style:{"z-index":"10"}},T={class:"ml-1"},D={class:"tree tree--central"},F={class:"section-title level is-fullwidth mb-0"},x={class:"level-left"},$={class:"is-small"},I={class:"ml-1"},R={class:"level-item"},M={class:"section-label"},P={class:"tree-content"},w=["id","draggable","onDragstart","onDragover","onDrop","onDragenter","onDragleave"],O=["onClick"],_={key:1,class:"empty-group-message"},N={class:"has-text-grey-light"},U={key:2,class:"add-button-left"},X=["onClick"],A={key:3,class:"tree-connector tree-connector--inner","aria-hidden":"true"},S={class:"px-4 is-flex is-justify-content-center is-flex-wrap-wrap"},V=["draggable","onDragstart","onDragover","onDrop","onClick"],Q=["onClick"],W={class:"is-flex is-flex-direction-row is-align-items-center"},H={key:0,class:"icon is-small mr-2"},B={class:"role-tag"},K={key:0,class:"role-info"},j={key:0,class:"user-thumbnails"},z={key:1,class:"role-count"},q={key:2,class:"role-count"},J={key:4,class:"group-drag-handle"},Y={key:0,class:"tree-connector","aria-hidden":"true"},Z={key:1,class:"tree tree--parent"},ee={class:"section-title level is-fullwidth mb-0"},te={class:"level-left"},oe={class:"is-small"},se={class:"ml-1"},re={class:"level-item"},ne={class:"section-label"},ae={class:"tree-content"},le=["id","draggable","onDragstart","onDragover","onDrop","onDragenter","onDragleave"],ie=["onClick"],de={key:1,class:"empty-group-message"},ue={class:"has-text-grey-light"},pe={key:2,class:"add-button-left"},ce=["onClick"],he={key:3,class:"tree-connector tree-connector--inner","aria-hidden":"true"},ge={class:"px-4 is-flex is-justify-content-center is-flex-wrap-wrap"},me=["draggable","onDragstart","onDragover","onDrop","onClick"],ve=["onClick"],ye={class:"is-flex is-flex-direction-row is-align-items-center"},fe={key:0,class:"icon is-small mr-2"},Ce={class:"role-tag"},Le={key:0,class:"role-info"},ke={class:"role-count"},be={key:4,class:"group-drag-handle"},Ee={key:2,class:"tree-connector","aria-hidden":"true"},Ge={key:3,class:"tree tree--local"},Te={class:"section-title level is-fullwidth mb-0"},De={class:"level-left"},Fe={class:"is-small"},xe={class:"ml-1"},$e={class:"level-item"},Ie={class:"section-label"},Re={class:"tree-content"},Me=["id","draggable","onDragstart","onDragover","onDrop","onDragenter","onDragleave"],Pe=["onClick"],we={key:1,class:"empty-group-message"},Oe={class:"has-text-grey-light"},_e={key:2,class:"add-button-left"},Ne=["onClick"],Ue={key:3,class:"tree-connector tree-connector--inner","aria-hidden":"true"},Xe={class:"px-4 is-flex is-justify-content-center is-flex-wrap-wrap"},Ae=["draggable","onDragstart","onDragover","onDrop","onClick"],Se=["onClick"],Ve={class:"is-flex is-flex-direction-row is-align-items-center"},Qe={key:0,class:"icon is-small mr-2"},We={class:"role-tag"},He={key:0,class:"role-info"},Be={class:"role-count"},Ke={key:4,class:"group-drag-handle"},je={class:"tree-connector","aria-hidden":"true"},ze={class:"tree tree--unit"},qe={class:"section-title level is-fullwidth mb-0"},Je={class:"level-left"},Ye=["onClick"],Ze={class:"is-small"},et={class:"ml-1"},tt={class:"level-item"},ot={class:"section-label"},st={class:"tree-content"},rt=["id","draggable","onDragstart","onDragover","onDrop","onDragenter","onDragleave"],nt=["onClick"],at={key:1,class:"empty-group-message"},lt={class:"has-text-grey-light"},it={key:2,class:"add-button-left"},dt=["onClick"],ut={key:3,class:"tree-connector tree-connector--inner","aria-hidden":"true"},pt={class:"px-4 is-flex is-justify-content-center is-flex-wrap-wrap"},ct=["draggable","onDragstart","onDragover","onDrop","onClick"],ht=["onClick"],gt={class:"is-flex is-flex-direction-row is-align-items-center"},mt={key:0,class:"icon is-small mr-2"},vt={class:"role-tag"},yt={key:0,class:"role-info"},ft={class:"role-count"},Ct={key:4,class:"group-drag-handle"},Lt={class:"role-form-modal-container"},kt={class:"role-form-modal-header"},bt={class:"title is-4"},Et={class:"field is-grouped"},Gt={class:"control"},Tt={key:0,class:"control"},Dt={class:"role-form-modal-body"};function Ft(e,t,o,Ft,xt,$t){const It=(0,s.g2)("b-loading"),Rt=(0,s.g2)("MobileViewHeader"),Mt=(0,s.g2)("font-awesome-icon"),Pt=(0,s.g2)("b-button"),wt=(0,s.g2)("b-input"),Ot=(0,s.g2)("b-dropdown-item"),_t=(0,s.g2)("b-dropdown"),Nt=(0,s.g2)("b-field"),Ut=(0,s.g2)("LogoThumbnail"),Xt=(0,s.g2)("router-link"),At=(0,s.g2)("b-table-column"),St=(0,s.g2)("b-table"),Vt=(0,s.g2)("b-modal"),Qt=(0,s.g2)("RoleForm");return(0,s.uX)(),(0,s.CE)(s.FK,null,[(0,s.Lk)("div",a,[(0,s.bF)(It,{modelValue:xt.isLoading,"onUpdate:modelValue":t[0]||(t[0]=e=>xt.isLoading=e),"is-full-page":!1},null,8,["modelValue"]),(0,s.bF)(Vt,{modelValue:xt.showModal,"onUpdate:modelValue":t[4]||(t[4]=e=>xt.showModal=e),"can-cancel":"","has-modal-card":"","full-screen":e.$isMobile(),onClose:$t.closeModal},{default:(0,s.k6)(()=>[(0,s.Lk)("div",l,[xt.role?((0,s.uX)(),(0,s.Wv)(Rt,{key:0,title:(xt.role.chartName?xt.role.chartName:xt.role.
1name)+" ("+$t.totalShow(xt.role.id)+")","background-color":"var(--orgo-modal-card-bg)","show-back-button":!0,"is-overlay":!0,"emit-only":!0,onBack:$t.closeModal},null,8,["title","onBack"])):(0,s.Q3)("",!0),!e.$isMobile()||xt.role&&(xt.role.isLocalCenterParent||xt.role.isLocalCenter)?((0,s.uX)(),(0,s.CE)("header",{key:1,class:(0,r.C4)(["modal-card-head",e.$isMobile()?"p-4":"pt-5 pb-3"])},[(0,s.Lk)("div",i,[xt.role&&!e.$isMobile()?((0,s.uX)(),(0,s.CE)("div",d,[(0,s.Lk)("p",u,[(0,s.eW)((0,r.v_)(xt.role.chartName?xt.role.chartName:xt.role.name)+" ",1),(0,s.Lk)("span",null,"("+(0,r.v_)($t.totalShow(xt.role.id))+")",1)])])):(0,s.Q3)("",!0),xt.role&&(xt.role.isLocalCenterParent||xt.role.isLocalCenter)?((0,s.uX)(),(0,s.Wv)(Nt,{key:1,class:"chart-local-center is-flex-grow-1 m-0"},{default:(0,s.k6)(()=>[(0,s.bF)(_t,{"aria-role":"list",expanded:"",class:"chart-local-center-dropdown",onActiveChange:$t.onLocalCenterDropdownToggle},{trigger:(0,s.k6)(()=>[(0,s.bF)(Pt,{expanded:"",class:"is-rounded chart-local-center-trigger"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",p,(0,r.v_)($t.getSelectedLocalCenterName()||e.$t(xt.role.isLocalCenterParent?"Parent chapter":"Chapter")+"..."),1),(0,s.Lk)("span",c,[(0,s.bF)(Mt,{icon:"fa-light fa-chevron-down"})])]),_:1})]),default:(0,s.k6)(()=>[(0,s.Lk)("div",h,[(0,s.bF)(wt,{ref:"localCenterSearchInput",modelValue:xt.localCenterSearch,"onUpdate:modelValue":t[1]||(t[1]=e=>xt.localCenterSearch=e),placeholder:e.$t("Search")+"...",size:"is-small",icon:"magnifying-glass","icon-pack":"fa-light"},null,8,["modelValue","placeholder"])]),(0,s.bF)(Ot,{value:null,"aria-role":"listitem",class:(0,r.C4)({"is-active":null===xt.localCenter}),onClick:t[2]||(t[2]=e=>$t.selectLocalCenter(null))},{default:(0,s.k6)(()=>[(0,s.eW)((0,r.v_)(e.$t("All")),1)]),_:1},8,["class"]),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($t.filteredLocalCenters,t=>((0,s.uX)(),(0,s.Wv)(Ot,{key:t["@id"],value:t.id,"aria-role":"listitem",class:(0,r.C4)({"is-active":xt.localCenter===t.id}),onClick:e=>$t.selectLocalCenter(t)},{default:(0,s.k6)(()=>[e.tenant.settingFeatures.localCenter.hasParent&&t.parent?((0,s.uX)(),(0,s.CE)("span",g,"    â ")):(0,s.Q3)("",!0),(0,s.eW)(" "+(0,r.v_)($t.localCenterNameSelector(t,e.tenant)),1)]),_:2},1032,["value","class","onClick"]))),128))]),_:1},8,["onActiveChange"])]),_:1})):(0,s.Q3)("",!0)])],2)):(0,s.Q3)("",!0),(0,s.Lk)("section",{class:(0,r.C4)(["modal-card-body py-0",e.$isMobile()?"p-4":"pr-4"])},[xt.role?((0,s.uX)(),(0,s.CE)("div",m,[(0,s.bF)(St,{"current-page":xt.itemsPageCurrent,"onUpdate:currentPage":t[3]||(t[3]=e=>xt.itemsPageCurrent=e),data:xt.users,narrowed:!1,hoverable:!0,paginated:$t.isMoreThanOnePage,"backend-pagination":"",total:xt.itemsTotal,"per-page":xt.itemsPerPage,"mobile-cards":!1,scrollable:"","sticky-header":"",height:e.$isMobile()?"auto":"60vh",onPageChange:$t.changeListPage},{default:(0,s.k6)(()=>[(0,s.bF)(At,{label:e.$t("member"),field:"user.lastName",sortable:""},{default:(0,s.k6)(e=>[(0,s.bF)(Xt,{class:"icon-text",to:{name:"UserShow",params:{item:e.row.user.id}}},{default:(0,s.k6)(()=>[((0,s.uX)(),(0,s.Wv)(Ut,{key:e.row.user.id,item:e.row.user,"is-type":"roundXSmall"},null,8,["item"])),(0,s.Lk)("span",null,(0,r.v_)(e.row.user.fullName),1)]),_:2},1032,["to"])]),_:1},8,["label"]),xt.role.isNational?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.Wv)(At,{key:0,label:e.$t("group"),sortable:"",field:"unit"},{default:(0,s.k6)(t=>[(0,s.eW)((0,r.v_)(e.$t(t.row.unit.isParent?"Parent chapter":"Chapter"))+" "+(0,r.v_)(t.row.unit.name),1)]),_:1},8,["label"])),(0,s.bF)(At,{width:"1%","cell-class":"nowrap",label:e.$t("date"),sortable:"",field:"dateCreated"},{default:(0,s.k6)(t=>[(0,s.eW)((0,r.v_)(e.$filters.formatDateOnly(t.row.dateCreated)),1)]),_:1},8,["label"])]),_:1},8,["current-page","data","paginated","total","per-page","height","onPageChange"])])):(0,s.Q3)("",!0)],2)])]),_:1},8,["modelValue","full-screen","onClose"]),(0,s.Lk)("div",v,[(0,s.Lk)("div",y,[(0,s.Lk)("div",f,[xt.canEditRoles?((0,s.uX)(),(0,s.CE)("div",C,[(0,s.Lk)("button",{class:(0,r.C4)(["button is-rounded is-small",xt.isEditMode?"is-success":"is-primary"]),onClick:t[5]||(t[5]=(...e)=>$t.toggleEditMode&&$t.toggleEditMode(...e))},[(0,s.Lk)("span",L,[(0,s.bF)(Mt,{icon:xt.isEditMode?"fa-light fa-check":"fa-light fa-pencil"},null,8,["icon"])]),(0,s.Lk)("span",k,(0,r.v_)(xt.isEditMode?e.$t("Done Editing"):e.$t("Edit Positions")),1)],2)])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",b,[(0,s.Lk)("h2",E,(0,r.v_)(e.$t("Organisational Chart")),1)]),(0,s.Lk)("div",G,[xt.canEditRoles?((0,s.uX)(),(0,s.Wv)(Xt,{key:0,to:{name:"RoleList"},class:"button is-primary is-rounded is-small"},{default:(0,s.k6)(()=>[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{icon:"fa-light fa-list"})]),(0,s.Lk)("span",T,(0,r.v_)(e.$t("roles")),1)]),_:1})):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",D,[(0,s.Lk)("div",F,[(0,s.Lk)("div",x,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-rounded is-small is-success",onClick:t[6]||(t[6]=e=>$t.addNewGroup("central"))},[(0,s.Lk)("span",$,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"}),(0,s.Lk)("span",I,(0,r.v_)(e.$t("Add level")),1)])])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",R,[(0,s.Lk)("span",M,
1(0,r.v_)(e.$t("Central")),1)]),t[24]||(t[24]=(0,s.Lk)("div",{class:"level-right"},null,-1))]),(0,s.Lk)("div",P,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($t.centralRolesGrouped,(o,a)=>((0,s.uX)(),(0,s.CE)("div",{id:`group-central-${o.positionIndex}`,key:`central-group-${o.positionIndex}`,class:(0,r.C4)([{"tree-level-container":o.roles.length>2||xt.isEditMode,"drag-over":xt.dragOverGroupIndex===o.positionIndex&&"central"===xt.dragOverGroupLevel,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex&&"central"===xt.dragOverGroupContainerLevel},"tree-level is-flex is-flex-direction-column"]),draggable:xt.isEditMode,onDragstart:e=>$t.handleContainerDragStart(e,o,"central"),onDragend:t[9]||(t[9]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(e=>xt.draggedGroup?$t.handleGroupDragOver(e,o,"central"):$t.handleDragOverGroup(e,o.roles),["prevent"]),onDrop:e=>xt.draggedGroup?$t.handleGroupDrop(e,o,"central"):$t.handleDropOnGroup(e,o.roles,"central"),onDragenter:e=>xt.draggedGroup?$t.handleGroupDragEnter(e,o,"central"):$t.handleDragEnter(e,o.roles,"central"),onDragleave:e=>xt.draggedGroup?$t.handleGroupDragLeave(e,o):$t.handleDragLeave(e,o.roles)},[0===o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button empty-group-placeholder",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"})])],8,O)):(0,s.Q3)("",!0),0!==o.roles.length||xt.isEditMode?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",_,[(0,s.Lk)("span",N,(0,r.v_)(e.$t("No roles yet")),1)])),0!==o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",U,[(0,s.Lk)("button",{class:"button is-rounded is-small ml-5 pb-1",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{class:"icon is-small is-rounded",icon:"fa-light fa-plus"})])],8,X)])):(0,s.Q3)("",!0),a>0?((0,s.uX)(),(0,s.CE)("div",A,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),(0,s.Lk)("div",S,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.roles,(e,a)=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"tree-node",draggable:xt.isEditMode,onDragstart:t=>$t.handleDragStart(t,e,o.roles,"central"),onDragend:t[7]||(t[7]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(t=>xt.isEditMode?$t.handleDragOverRole(t,e):null,["prevent"]),onDragleave:t[8]||(t[8]=e=>xt.dragOverRole=null),onDrop:t=>xt.isEditMode?$t.handleTreeNodeDrop(t,e,o.roles,"central"):null,onClick:t=>!xt.isEditMode&&$t.totalShow(e.id)?$t.loadUsers(e):null},[(0,s.Lk)("div",{style:(0,r.Tr)(xt.isEditMode?"cursor: pointer":""),onClick:t=>xt.isEditMode?$t.openRoleUpdateModal(e.id):null},[(0,s.Lk)("div",{class:(0,r.C4)(["tag-container",{"has-users":$t.totalShow(e.id),"no-users":!$t.totalShow(e.id),dragging:xt.draggedRole&&xt.draggedRole.id===e.id,"drag-over":xt.dragOverGroupIndex===o.positionIndex,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex,"swap-target":xt.dragOverRole&&xt.dragOverRole.id===e.id,"edit-mode":xt.isEditMode}])},[(0,s.Lk)("div",W,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("span",H,[(0,s.bF)(Mt,{icon:"fa-light fa-pencil"})])):(0,s.Q3)("",!0),(0,s.Lk)("span",B,(0,r.v_)(e.chartName?e.chart
1Name:e.name),1)]),$t.totalShow(e.id)?((0,s.uX)(),(0,s.CE)("div",K,[xt.nationalUsers[e.id]&&xt.nationalUsers[e.id].length>0?((0,s.uX)(),(0,s.CE)("div",j,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(xt.nationalUsers[e.id].slice(0,3),(e,t)=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"thumbnail-wrapper",style:(0,r.Tr)({zIndex:3-t,marginLeft:t>0?"-8px":"0"})},[(0,s.bF)(Xt,{to:{name:"UserShow",params:{item:e.id}}},{default:(0,s.k6)(()=>[(0,s.bF)(Ut,{item:e,"is-type":"roundXSmall"},null,8,["item"])]),_:2},1032,["to"])],4))),128))])):(0,s.Q3)("",!0),$t.shouldShowCountOnly(e.id)?((0,s.uX)(),(0,s.CE)("span",z,(0,r.v_)($t.totalShow(e.id)),1)):$t.totalShow(e.id)>3?((0,s.uX)(),(0,s.CE)("span",q," +"+(0,r.v_)($t.totalShow(e.id)-3),1)):(0,s.Q3)("",!0)])):(0,s.Q3)("",!0)],2)],12,Q)],40,V))),128))]),xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",J,[(0,s.bF)(Mt,{icon:"fa-light fa-grip-dots-vertical",class:"has-text-grey"})])):(0,s.Q3)("",!0)],42,w))),128))])]),e.tenant.settingFeatures.localCenter.isActive&&e.tenant.settingFeatures.localCenter.hasParent?((0,s.uX)(),(0,s.CE)("div",Y,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive&&e.tenant.settingFeatures.localCenter.hasParent?((0,s.uX)(),(0,s.CE)("div",Z,[(0,s.Lk)("div",ee,[(0,s.Lk)("div",te,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-rounded is-small is-success",onClick:t[10]||(t[10]=e=>$t.addNewGroup("parentLocalCenter"))},[(0,s.Lk)("span",oe,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"}),(0,s.Lk)("span",se,(0,r.v_)(e.$t("Add level")),1)])])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",re,[(0,s.Lk)("span",ne,(0,r.v_)(e.$t("Parent local centers")),1)]),t[25]||(t[25]=(0,s.Lk)("div",{class:"level-right"},null,-1))]),(0,s.Lk)("div",ae,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($t.parentLocalCenterRolesGrouped,(o,a)=>((0,s.uX)(),(0,s.CE)("div",{id:`group-parentLocalCenter-${o.positionIndex}`,key:`parent-group-${o.positionIndex}`,class:(0,r.C4)([{"tree-level-container":o.roles.length>2||xt.isEditMode,"drag-over":xt.dragOverGroupIndex===o.positionIndex&&"parentLocalCenter"===xt.dragOverGroupLevel,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex&&"parentLocalCenter"===xt.dragOverGroupContainerLevel},"tree-level is-flex is-flex-direction-column"]),draggable:xt.isEditMode,onDragstart:e=>$t.handleContainerDragStart(e,o,"parentLocalCenter"),onDragend:t[13]||(t[13]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(e=>xt.draggedGroup?$t.handleGroupDragOver(e,o,"parentLocalCenter"):$t.handleDragOverGroup(e,o.roles),["prevent"]),onDrop:e=>xt.draggedGroup?$t.handleGroupDrop(e,o,"parentLocalCenter"):$t.handleDropOnGroup(e,o.roles,"parentLocalCenter"),onDragenter:e=>xt.draggedGroup?$t.handleGroupDragEnter(e,o,"parentLocalCenter"):$t.handleDragEnter(e,o.roles,"parentLocalCenter"),onDragleave:e=>xt.draggedGroup?$t.handleGroupDragLeave(e,o):$t.handleDragLeave(e,o.roles)},[0===o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button empty-group-placeholder",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"})])],8,ie)):(0,s.Q3)("",!0),0!==o.roles.length||xt.isEditMode?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",de,[(0,s.Lk)("span",ue,(0,r.v_)(e.$t("No roles yet")),1)])),0!==o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",pe,[(0,s.Lk)("button",{class:"button is-rounded is-small ml-1 pb-1",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{class:"icon is-small is-rounded",icon:"fa-light fa-plus"})])],8,ce)])):(0,s.Q3)("",!0),a>0?((0,s.uX)(),(0,s.CE)("div",he,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),(0,s.Lk)("div",ge,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.roles,(e,a)=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"tree-node",draggable:xt.isEditMode,onDragstart:t=>$t.handleDragStart(t,e,o.roles,"parentLocalCenter"),onDragend:t[11]||(t[11]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(t=>
1xt.isEditMode?$t.handleDragOverRole(t,e):null,["prevent"]),onDragleave:t[12]||(t[12]=e=>xt.dragOverRole=null),onDrop:t=>xt.isEditMode?$t.handleTreeNodeDrop(t,e,o.roles,"parentLocalCenter"):null,onClick:t=>!xt.isEditMode&&$t.totalShow(e.id)?$t.loadUsers(e):null},[(0,s.Lk)("div",{style:(0,r.Tr)(xt.isEditMode?"cursor: pointer":""),onClick:t=>xt.isEditMode?$t.openRoleUpdateModal(e.id):null},[(0,s.Lk)("div",{class:(0,r.C4)(["tag-container",{"has-users":$t.totalShow(e.id),"no-users ":!$t.totalShow(e.id),dragging:xt.draggedRole&&xt.draggedRole.id===e.id,"drag-over":xt.dragOverGroupIndex===o.positionIndex,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex,"swap-target":xt.dragOverRole&&xt.dragOverRole.id===e.id,"edit-mode":xt.isEditMode}])},[(0,s.Lk)("div",ye,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("span",fe,[(0,s.bF)(Mt,{icon:"fa-light fa-pencil"})])):(0,s.Q3)("",!0),(0,s.Lk)("span",Ce,(0,r.v_)(e.chartName?e.chartName:e.name),1)]),$t.totalShow(e.id)?((0,s.uX)(),(0,s.CE)("div",Le,[(0,s.Lk)("span",ke,(0,r.v_)($t.totalShow(e.id)),1)])):(0,s.Q3)("",!0)],2)],12,ve)],40,me))),128))]),xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",be,[(0,s.bF)(Mt,{icon:"fa-light fa-grip-dots-vertical",class:"has-text-grey"})])):(0,s.Q3)("",!0)],42,le))),128))])])):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive?((0,s.uX)(),(0,s.CE)("div",Ee,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),e.tenant.settingFeatures.localCenter.isActive?((0,s.uX)(),(0,s.CE)("div",Ge,[(0,s.Lk)("div",Te,[(0,s.Lk)("div",De,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-rounded is-small is-success",onClick:t[14]||(t[14]=e=>$t.addNewGroup("localCenter"))},[(0,s.Lk)("span",Fe,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"}),(0,s.Lk)("span",xe,(0,r.v_)(e.$t("Add level")),1)])])):(0,s.Q3)("",!0)]),(0,s.Lk)("div",$e,[(0,s.Lk)("span",Ie,(0,r.v_)(e.$t(e.tenant.settingFeatures.localCenter.hasParent?"Chapters":"localCenters")),1)]),t[26]||(t[26]=(0,s.Lk)("div",{class:"level-right"},null,-1))]),(0,s.Lk)("div",Re,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($t.localCenterRolesGrouped,(o,a)=>((0,s.uX)(),(0,s.CE)("div",{id:`group-localCenter-${o.positionIndex}`,key:`local-group-${o.positionIndex}`,class:(0,r.C4)([{"tree-level-container":o.roles.length>2||xt.isEditMode,"drag-over":xt.dragOverGroupIndex===o.positionIndex&&"localCenter"===xt.dragOverGroupLevel,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex&&"localCenter"===xt.dragOverGroupContainerLevel},"tree-level is-flex is-flex-direction-column"]),draggable:xt.isEditMode,onDragstart:e=>$t.handleContainerDragStart(e,o,"localCenter"),onDragend:t[17]||(t[17]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(e=>xt.draggedGroup?$t.handleGroupDragOver(e,o,"localCenter"):$t.handleDragOverGroup(e,o.roles),["prevent"]),onDrop:e=>xt.draggedGroup?$t.handleGroupDrop(e,o,"localCenter"):$t.handleDropOnGroup(e,o.roles,"localCenter"),onDragenter:e=>xt.draggedGroup?$t.handleGroupDragEnter(e,o,"localCenter"):$t.handleDragEnter(e,o.roles,"localCenter"),onDragleave:e=>xt.draggedGroup?$t.handleGroupDragLeave(e,o):$t.handleDragLeave(e,o.roles)},[0===o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button empty-group-placeholder",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"})])],8,Pe)):(0,s.Q3)("",!0),0!==o.roles.length||xt.isEditMode?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",we,[(0,s.Lk)("span",Oe,(0,r.v_)(e.$t("No roles yet")),1)])),0!==o.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",_e,[(0,s.Lk)("button",{class:"button is-rounded is-small ml-1 pb-1",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(o),type:o.type})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{class:"icon is-small is-rounded",icon:"fa-light fa-plus"})])],8,Ne)])):(0,s.Q3)("",!0),a>0?((0,s.uX)(),(0,s.CE)("div",Ue,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),(0,s.Lk)("div",Xe,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.roles,(e,a)=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"tree-node",draggable:xt.isEditMode,onDragstart:t=>$t.handleDragStart(t,e,o.roles,"localCenter"),onDragend:t[15]||(t[15]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(t=>
1xt.isEditMode?$t.handleDragOverRole(t,e):null,["prevent"]),onDragleave:t[16]||(t[16]=e=>xt.dragOverRole=null),onDrop:t=>xt.isEditMode?$t.handleTreeNodeDrop(t,e,o.roles,"localCenter"):null,onClick:t=>!xt.isEditMode&&$t.totalShow(e.id)?$t.loadUsers(e):null},[(0,s.Lk)("div",{style:(0,r.Tr)(xt.isEditMode?"cursor: pointer":""),onClick:t=>xt.isEditMode?$t.openRoleUpdateModal(e.id):null},[(0,s.Lk)("div",{class:(0,r.C4)(["tag-container",{"has-users":$t.totalShow(e.id),"no-users ":!$t.totalShow(e.id),dragging:xt.draggedRole&&xt.draggedRole.id===e.id,"drag-over":xt.dragOverGroupIndex===o.positionIndex,"group-drag-over":xt.dragOverGroupContainerIndex===o.positionIndex,"swap-target":xt.dragOverRole&&xt.dragOverRole.id===e.id,"edit-mode":xt.isEditMode}])},[(0,s.Lk)("div",Ve,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("span",Qe,[(0,s.bF)(Mt,{icon:"fa-light fa-pencil"})])):(0,s.Q3)("",!0),(0,s.Lk)("span",We,(0,r.v_)(e.chartName?e.chartName:e.name),1)]),$t.totalShow(e.id)?((0,s.uX)(),(0,s.CE)("div",He,[(0,s.Lk)("span",Be,(0,r.v_)($t.totalShow(e.id)),1)])):(0,s.Q3)("",!0)],2)],12,Se)],40,Ae))),128))]),xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",Ke,[(0,s.bF)(Mt,{icon:"fa-light fa-grip-dots-vertical",class:"has-text-grey"})])):(0,s.Q3)("",!0)],42,Me))),128))])])):(0,s.Q3)("",!0),((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)($t.unitTypeRolesGrouped,(o,a)=>((0,s.uX)(),(0,s.CE)("div",{key:"unit-type-"+a,class:"is-fullwidth"},[(0,s.Lk)("div",je,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})]),(0,s.Lk)("div",ze,[(0,s.Lk)("div",qe,[(0,s.Lk)("div",Je,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button is-rounded is-small is-success",onClick:e=>$t.addNewGroup("unitType",o.unitType)},[(0,s.Lk)("span",Ze,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"}),(0,s.Lk)("span",et,(0,r.v_)(e.$t("Add level")),1)])],8,Ye)):(0,s.Q3)("",!0)]),(0,s.Lk)("div",tt,[(0,s.Lk)("span",ot,(0,r.v_)(o.unitType.name),1)]),t[27]||(t[27]=(0,s.Lk)("div",{class:"level-right"},null,-1))]),(0,s.Lk)("div",st,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(o.groups,(a,l)=>((0,s.uX)(),(0,s.CE)("div",{id:`group-unitType-${o.unitType["@id"]}-${a.positionIndex}`,key:`other-group-${a.positionIndex}`,class:(0,r.C4)([{"tree-level-container":a.roles.length>2||xt.isEditMode,"drag-over":xt.dragOverGroupIndex===a.positionIndex&&xt.dragOverGroupLevel===("unitType"===a.type?`unitType-${o.unitType.id}`:a.type),"group-drag-over":xt.dragOverGroupContainerIndex===a.positionIndex&&xt.dragOverGroupContainerLevel===("unitType"===a.type?`unitType-${o.unitType.id}`:a.type)},"tree-level is-flex is-flex-direction-column"]),draggable:xt.isEditMode,onDragstart:e=>$t.handleContainerDragStart(e,a,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type),onDragend:t[20]||(t[20]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(e=>xt.draggedGroup?$t.handleGroupDragOver(e,a,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type):$t.handleDragOverGroup(e,a.roles),["prevent"]),onDrop:e=>xt.draggedGroup?$t.handleGroupDrop(e,a,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type):$t.handleDropOnGroup(e,a.roles,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type),onDragenter:e=>xt.draggedGroup?$t.handleGroupDragEnter(e,a,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type):$t.handleDragEnter(e,a.roles,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type),onDragleave:e=>xt.draggedGroup?$t.handleGroupDragLeave(e,a):$t.handleDragLeave(e,a.roles)},[0===a.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("button",{key:0,class:"button empty-group-placeholder",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(a),type:a.type,unitType:o.unitType.id})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{icon:"fa-light fa-plus"})])],8,nt)):(0,s.Q3)("",!0),0!==a.roles.length||xt.isEditMode?(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",at,[(0,s.Lk)("span",lt,(0,r.v_)(e.$t("No roles yet")),1)])),0!==a.roles.length&&xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",it,[(0,s.Lk)("button",{class:"button is-rounded is-small ml-1 pb-1",onClick:e=>$t.openRoleCreateModal({position:$t.getLastGroupPosition(a),type:a.type,unitType:o.unitType.id})},[(0,s.Lk)("span",null,[(0,s.bF)(Mt,{class:"icon is-small is-rounded",icon:"fa-light fa-plus"})])],8,dt)])):(0,s.Q3)("",!0),l>0?((0,s.uX)(),(0,s.CE)("div",ut,[(0,s.bF)(Mt,{icon:"fa-light fa-arrow-down"})])):(0,s.Q3)("",!0),(0,s.Lk)("div",pt,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(a.roles,(e,l)=>((0,s.uX)(),(0,s.CE)("div",{key:e.id,class:"tree-node",draggable:xt.isEditMode,onDragstart:t=>$t.handleDragStart(t,e,a.roles,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type),onDragend:t[18]||(t[18]=(...e)=>$t.handleDragEnd&&$t.handleDragEnd(...e)),onDragover:(0,n.D$)(t=>
1xt.isEditMode?$t.handleDragOverRole(t,e):null,["prevent"]),onDragleave:t[19]||(t[19]=e=>xt.dragOverRole=null),onDrop:t=>xt.isEditMode?$t.handleTreeNodeDrop(t,e,a.roles,"unitType"===a.type?`unitType-${o.unitType.id}`:a.type):null,onClick:t=>!xt.isEditMode&&$t.totalShow(e.id)?$t.loadUsers(e):null},[(0,s.Lk)("div",{style:(0,r.Tr)(xt.isEditMode?"cursor: pointer":""),onClick:t=>xt.isEditMode?$t.openRoleUpdateModal(e.id):null},[(0,s.Lk)("div",{class:(0,r.C4)(["tag-container",{"has-users":$t.totalShow(e.id),"no-users":!$t.totalShow(e.id),dragging:xt.draggedRole&&xt.draggedRole.id===e.id,"drag-over":xt.dragOverGroupIndex===a.positionIndex,"group-drag-over":xt.dragOverGroupContainerIndex===a.positionIndex,"swap-target":xt.dragOverRole&&xt.dragOverRole.id===e.id,"edit-mode":xt.isEditMode}])},[(0,s.Lk)("div",gt,[xt.isEditMode?((0,s.uX)(),(0,s.CE)("span",mt,[(0,s.bF)(Mt,{icon:"fa-light fa-pencil"})])):(0,s.Q3)("",!0),(0,s.Lk)("span",vt,(0,r.v_)(e.chartName?e.chartName:e.name),1)]),$t.totalShow(e.id)?((0,s.uX)(),(0,s.CE)("div",yt,[(0,s.Lk)("span",ft,(0,r.v_)($t.totalShow(e.id)),1)])):(0,s.Q3)("",!0)],2)],12,ht)],40,ct))),128))]),xt.isEditMode?((0,s.uX)(),(0,s.CE)("div",Ct,[(0,s.bF)(Mt,{icon:"fa-light fa-grip-dots-vertical",class:"has-text-grey"})])):(0,s.Q3)("",!0)],42,rt))),128))])])]))),128))])]),(0,s.bF)(n.eB,{name:"slide-right"},{default:(0,s.k6)(()=>[xt.showRoleFormModal?((0,s.uX)(),(0,s.CE)("div",{key:0,class:"role-form-modal-overlay",onClick:t[23]||(t[23]=(0,n.D$)((...e)=>$t.closeRoleFormModal&&$t.closeRoleFormModal(...e),["self"]))},[(0,s.Lk)("div",Lt,[(0,s.Lk)("div",kt,[(0,s.Lk)("h2",bt,(0,r.v_)("create"===xt.roleFormMode?e.$t("Add Role"):e.$t("Edit Role")),1),(0,s.Lk)("div",Et,[(0,s.Lk)("div",Gt,[(0,s.Lk)("button",{class:(0,r.C4)(["button is-primary is-rounded",{"is-loading":xt.isLoadingButton}]),onClick:t[21]||(t[21]=(...e)=>$t.handleRoleSave&&$t.handleRoleSave(...e))},(0,r.v_)(e.$t("save")),3)]),"update"===xt.roleFormMode&&xt.roleFormData&&xt.roleFormData.id?((0,s.uX)(),(0,s.CE)("div",Tt,[(0,s.Lk)("button",{type:"button",class:"button is-danger is-rounded is-outlined",onClick:t[22]||(t[22]=(...e)=>$t.handleRoleDelete&&$t.handleRoleDelete(...e))},[(0,s.Lk)("span",null,(0,r.v_)(e.$t("remove")),1)])])):(0,s.Q3)("",!0)])]),(0,s.Lk)("div",Dt,[xt.roleFormData?((0,s.uX)(),(0,s.Wv)(Qt,{key:0,item:xt.roleFormData,save:$t.handleRoleSave,"on-delete":"update"===xt.roleFormMode?$t.handleRoleDelete:null},null,8,["item","save","on-delete"])):(0,s.Q3)("",!0)])])])):(0,s.Q3)("",!0)]),_:1})],64)}o(44114),o(18111),o(22489),o(20116),o(7588),o(61701);var xt=o(40834),$t=o(95093),It=o.n($t),Rt=o(31823),Mt=o(81084),Pt=o(12212),wt=o(95256),Ot=o(61273),_t=o(78048),Nt={data(){return{totals:null,users:[],nationalUsers:{},itemsTotal:null,noResults:null,localCenter:null,localCenters:[],localCenterSearch:"",unitTypes:[],isLoading:!1,itemsPerPage:null,isPaginated:!1,itemsPageCurrent:1,role:null,showModal:!1,isClosingModal:!1,draggedRole:null,draggedFromGroup:null,draggedFromLevel:null,dragOverGroup:null,dragOverGroupIndex:null,dragOverGroupLevel:null,isDragging:!1,canEditRoles:!1,isEditMode:!1,manualCentralGroups:[],manualParentLocalCenterGroups:[],manualLocalCenterGroups:[],manualUserTypeGroups:[],manualOtherGroups:[],manualUnitTypeGroups:{},draggedGroup:null,draggedGroupLevel:null,dragOverGroupContainer:null,dragOverGroupContainerIndex:null,dragOverGroupContainerLevel:null,dragOverRole:null,draggedFromGroupIndex:null,showRoleFormModal:!1,roleFormMode:"create",roleFormData:null,roleFormQuery:null,isLoadingButton:!1}},watch:{"tenant.roles":{handler(e){this.isEditMode||(this.manualCentralGroups=[],this.manualParentLocalCenterGroups=[],this.manualLocalCenterGroups=[],this.manualUserTypeGroups=[],this.manualOtherGroups=[])},deep:!0}},created(){this.retrieve(),this.loadUnitTypes(),this.canEditRoles=this.isGranted("ADMIN_TENANT")},methods:{getRolePermissions(e){return e&&e.permissions&&Array.isArray(e.permissions)?e.permissions:[]},getPermissionLabel(e){const t={ADMIN_TENANT:"Admin",HR_TENANT:"HR",FINANCIAL_TENANT:"Finance",HR_ASSISTANT_TENANT:"HR Assist",COMMUNICATION_TENANT:"Comm",EVENT_TENANT:"Events",ADMIN_PARENT_LOCAL:"Admin PL",HR_PARENT_LOCAL:"HR PL",FINANCIAL_PARENT_LOCAL:"Finance PL",HR_ASSISTANT_PARENT_LOCAL:"HR Assist PL",EVENT_PARENT_LOCAL:"Events PL",COMMUNICATION_PARENT_LOCAL:"Comm PL",ADMIN_LOCAL:"Admin LC",HR_LOCAL:"HR LC",FINANCIAL_LOCAL:"Finance LC",HR_ASSISTANT_LOCAL:"HR Assist LC",EVENT_LOCAL:"Events LC",COMMUNICATION_LOCAL:"Comm LC"};return t[e]||e},getVisiblePermissions(e){return this.getRolePermissions(e).slice(0,2)},getHiddenPermissions(e){return this.getRolePermissions(e).slice(2)},getHiddenPermissionsTooltip(e){return this.getHiddenPermissions(e).map(e=>this.getPermissionLabel(e)).join(", ")},openRoleCreateModal(e){this.roleFormMode="create";const t={name:null,namePlural:null,permissions:[],isUserType:!1,isLocalCenter:!1,isLocalCenterParent:!1,isNational:!1,isNotEligibleForFee:!1,isParent:!1,isVolunteer:!1,unitType:null,options:null,position:parseInt(e.position,10)||0};if(e.unitType&&(t.unitType=e.unitType),e.type)switch(e.type){case"central"
1:t.isNational=!0;break;case"parentLocalCenter":t.isLocalCenterParent=!0;break;case"localCenter":t.isLocalCenter=!0;break;case"userType":t.isUserType=!0;break;case"unitType":e.unitType&&(t.unitType=e.unitType);break;default:break}this.roleFormData=t,this.roleFormQuery=e,this.showRoleFormModal=!0},openRoleUpdateModal(e){const t=this.tenant.roles?this.tenant.roles.find(t=>t.id===e):null;if(t)return this.roleFormMode="update",this.roleFormData={...t,permissions:t.permissions||[],options:"string"===typeof t.options?t.options:JSON.stringify(t.options||{})},this.roleFormQuery=null,void(this.showRoleFormModal=!0);this.$http.plain.get(`/roles/${e}`).then(e=>{const t=e.data;t&&(this.roleFormMode="update",this.roleFormData={...t,permissions:t.permissions||[],options:"string"===typeof t.options?t.options:JSON.stringify(t.options||{})},this.roleFormQuery=null,this.showRoleFormModal=!0)}).catch(e=>{console.error("Failed to load role:",e),this.$buefy.toast.open({message:this.$t("Failed to load role"),type:"is-danger"})})},closeRoleFormModal(){this.showRoleFormModal=!1,setTimeout(()=>{this.roleFormData=null,this.roleFormQuery=null},300)},handleRoleDelete(){this.$buefy.dialog.confirm({title:this.$t("Delete Role"),message:this.$t("Are you sure you want to delete this role? This action cannot be undone."),confirmText:this.$t("delete"),cancelText:this.$t("cancel"),type:"is-danger",onConfirm:()=>{this.isLoadingButton=!0;const e=this.roleFormData.id,t=this.tenant.roles.find(t=>t.id===e);if(this.isEditMode&&t){const o=null!==t.position?Math.floor(t.position/100):null,s=t.isNational?"central":t.isLocalCenterParent?"parentLocalCenter":t.isLocalCenter?"localCenter":t.isUserType?"userType":null;if(s&&null!==o){const t=this.tenant.roles.filter(t=>{if(t.id===e)return!1;const r=t.isNational?"central":t.isLocalCenterParent?"parentLocalCenter":t.isLocalCenter?"localCenter":t.isUserType?"userType":null;return r===s&&null!==t.position&&Math.floor(t.position/100)===o});0===t.length&&this.preserveEmptyGroup(s,o)}}return this.$http.plain.delete(`/roles/${e}`).then(()=>this.$http.plain.get("/roles?order[position]=asc")).then(e=>{if(e.data&&e.data["hydra:member"]){const t=e.data["hydra:member"],o=this.$store.state.spaces[this.tenant.slug];o?.tenant&&(o.tenant.roles=t,o.tenant={...o.tenant});const s={...this.$store.state.tenant,roles:t};this.$store.commit("setTenant",s)}this.$buefy.snackbar.open({message:this.$t("Role deleted successfully"),type:"is-success"}),this.closeRoleFormModal()}).catch(e=>{console.error("Delete error:",e);let t=this.$t("An error occurred while deleting the role");409===e?.response?.status||e?.response?.data?.["hydra:description"]?.includes("users")?t=this.$t("Cannot delete role because it has users assigned to it"):e?.response?.data?.["hydra:description"]&&(t=e.response.data["hydra:description"]),this.$buefy.toast.open({message:t,type:"is-danger",duration:5e3})}).finally(()=>{this.isLoadingButton=!1})}})},handleRoleSave(){if(!this.roleFormData.name)return void this.$buefy.toast.open({message:this.$t("Name is required"),type:"is-danger"});this.isLoadingButton=!0;const e={...this.roleFormData};if(e.options){if("string"===typeof e.options)try{e.options=JSON.parse(e.options)}catch(o){e.options={}}}else e.options={};const t="create"===this.roleFormMode?(()=>(e.position=this.roleFormData.position??0,this.$http.plain.post("/roles",e)))():(()=>{const t=e.id;return this.$http.plain.patch(`/roles/${t}`,e)})();t.then(()=>this.$http.plain.get("/roles?order[position]=asc")).then(e=>{if(e.data&&e.data["hydra:member"]){const t=e.data["hydra:member"],o=this.$store.state.spaces[this.tenant.slug];o&&o.tenant&&(o.tenant.roles=t,o.tenant={...o.tenant});const s={...this.$store.state.tenant,roles:t};this.$store.commit("setTenant",s)}this.$buefy.snackbar.open({message:this.$t("create"===this.roleFormMode?"createdSuccessfully":"updatedSuccessfully")}),this.closeRoleFormModal()}).catch(e=>{console.error("Save error:",e),this.$buefy.toast.open({message:e?.response?.data?.["hydra:description"]||this.$t("An error occurred while saving the role"),type:"is-danger",duration:5e3})}).finally(()=>{this.isLoadingButton=!1})},localCenterNameSelector:wt.Hc,sortLocalCenters:wt.KN,moment:It(),mediaSrc:wt.F9,retrieve(){return this.isLoading=!0,this.$http.plain.get("/user-roles-totals/0").then(e=>{if(this.totals=e.data,this.tenant.settingFeatures.localCenter.isActive)return this.loadLocalCenters()}).then(()=>this.loadNationalUsers()).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},loadLocalCenters(){return this.$http.plain.get("/local-centers-public?isActive=1&tenantSlug="+this.tenant.slug).then(e=>{this.localCenters=(0,wt.KN)(e.data["hydra:member"],this.tenant)}).catch(e=>console.error(e))},loadUnitTypes(){return this.$http.plain.get("/unit_types?discriminator=unit").then(e=>{this.unitTypes=e.data["hydra:member"]}).catch(e=>console.error(e))},loadNationalUsers(){return this.isLoading=!0,this.loadAllNationalUsersPages("/chart-members?exists[dateEnded
1]=false&exists[role.isNational]=true&user.status=ACTIVE&itemsPerPage=100&page=1")},loadAllNationalUsersPages(e,t=[]){return this.$http.plain.get(e).then(e=>{const o=e.data["hydra:member"],s=[...t,...o],r=this.getNextPageUrl(e);if(r)return this.loadAllNationalUsersPages(r,s);{const e={};return s.forEach(t=>{if(t.role?.id){const o=t.role.id;e[o]||(e[o]=[]),e[o].push(t.user)}else console.warn("Found userRole without valid role:",t)}),this.nationalUsers=e,this.totals&&this.totals.forEach(t=>{!e[t.rid]&&t.total>0&&(e[t.rid]=[])}),this.isLoading=!1,e}}).catch(e=>{console.error(e),this.isLoading=!1})},getNextPageUrl(e){const t=e.data["hydra:totalItems"]||0,o=e.data["hydra:member"]||[];if(0===o.length||o.length>=t)return null;const s=e.config.url,r=e=>{const t=e.match(/[\?&]page=(\d+)/);return t?parseInt(t[1],10):1},n=r(s),a=n+1;let l;if(s.includes("page="))l=s.replace(/page=\d+/,`page=${a}`);else{const e=s.includes("?")?"&":"?";l=`${s}${e}page=${a}`}if(!l.includes("itemsPerPage=")&&s.includes("itemsPerPage=")){const e=s.match(/itemsPerPage=(\d+)/);if(e){const t=e[1],o=l.includes("?")?"&":"?";l=`${l}${o}itemsPerPage=${t}`}}return l.includes("/api/v1/api/v1/")&&(l=l.replace("/api/v1/api/v1/","/api/v1/")),l}
1,loadUsers(e){this.role&&this.role.id===e.id||(this.itemsPageCurrent=1,this.localCenter=null,this.itemsTotal=null,this.users=[]),this.role=e;let t="&exists[dateEnded]=false&user.status=ACTIVE&role="+e.id;t+="&page="+this.itemsPageCurrent,this.localCenter&&(t+="&unit="+this.localCenter),this.isLoading=!0,this.$http.plain.get("/chart-members?order[dateCreated]=asc"+t).then(e=>{this.users=e.data["hydra:member"],this.itemsTotal=e.data["hydra:totalItems"],1===this.itemsPageCurrent&&(this.itemsTotal=e.data["hydra:totalItems"],this.itemsPerPage=100),this.users.length?this.isClosingModal||(this.showModal=!0):this.noResults=!0}).catch(e=>console.error(e)).finally(()=>{this.isLoading=!1})},getSelectedLocalCenterName(){if(!this.localCenter)return null;const e=this.localCenters.find(e=>e&&e.id===this.localCenter);return e?(0,wt.Hc)(e,this.tenant):null},onLocalCenterDropdownToggle(e){e?this.$nextTick(()=>{this.$refs.localCenterSearchInput&&this.$refs.localCenterSearchInput.focus()}):this.localCenterSearch=""},selectLocalCenter(e){this.localCenter=e?e.id:null,this.localCenterSearch="",this.loadUsers(this.role)},changeListPage(e){this.itemsPageCurrent=e,this.$route.query.itemsPageCurrent=e,this.loadUsers(this.role)},getLastGroupPosition(e){return e.roles?.length>0?e.roles[e.roles.length-1].position+1:100*e.positionIndex},totalShow(e){if(!this.totals)return null;let t=this.totals.find(t=>t.rid===e);return t?t.total:null},groupRolesByPositionHundreds(e,t){const o=[],s=e.filter(e=>null!=e.position),r=e.filter(e=>null==e.position),n={};if(s.forEach(e=>{const t=Math.floor(e.position/100);n[t]||(n[t]=[]),n[t].push(e)}),Object.keys(n).sort((e,t)=>Number(e)-Number(t)).forEach(e=>{const s=Number(e);n[e].sort((e,t)=>e.position-t.position),o.push({roles:n[e],type:t,positionIndex:s,hundredRange:`${100*s}-${100*s+99}`})}),r.length>0){const e=o.length>0?Math.max(...o.map(e=>e.positionIndex))+1:0;o.push({roles:r,type:t,positionIndex:e,hundredRange:`${100*e}-${100*e+99}`})}return o},hasUsersForRole(e){return this.totalShow(e)>0},getUserThumbnailsForRole(e){return this.nationalUsers[e]&&this.nationalUsers[e].length>0?this.nationalUsers[e].slice(0,3):[]},shouldShowCountOnly(e){return this.totalShow(e)>0&&(!this.nationalUsers[e]||0===this.nationalUsers[e].length)},closeModal(){this.showModal=!1,this.role=null},toggleEditMode(){this.isEditMode=!this.isEditMode,this.isEditMode||(this.draggedRole=null,this.draggedFromGroup=null,this.draggedFromGroupIndex=null,this.dragOverGroup=null,this.dragOverGroupIndex=null,this.dragOverGroupContainerIndex=null,this.dragOverRole=null,this.isDragging=!1,this.manualCentralGroups=this.manualCentralGroups.filter(e=>e.roles.length>0),this.manualParentLocalCenterGroups=this.manualParentLocalCenterGroups.filter(e=>e.roles.length>0),this.manualLocalCenterGroups=this.manualLocalCenterGroups.filter(e=>e.roles.length>0),this.manualUserTypeGroups=this.manualUserTypeGroups.filter(e=>e.roles.length>0),this.manualOtherGroups=this.manualOtherGroups.filter(e=>e.roles.length>0))},handleDragStart(e,t,o,s){if(!this.isEditMode)return;this.draggedRole=t,this.draggedFromGroup=o,this.draggedFromLevel=s,this.isDragging=!0;const r=this.getGroupsForType(s),n=r.find(e=>e.roles===o);this.draggedFromGroupIndex=n?n.positionIndex:null,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",t.id),e.target&&e.target.style?e.target.style.opacity="0.5":e.currentTarget&&e.currentTarget.style&&(e.currentTarget.style.opacity="0.5")},handleDragEnd(e){if(this.isDragging=!1,this.draggedRole=null,this.draggedFromGroup=null,this.draggedFromLevel=null,this.draggedFromGroupIndex=null,this.dragOverGroup=null,this.dragOverGroupIndex=null,this.dragOverGroupLevel=null,this.draggedGroup=null,this.draggedGroupLevel=null,this.dragOverGroupContainer=null,this.dragOverGroupContainerIndex=null,this.dragOverGroupContainerLevel=null,this.dragOverRole=null,e&&e.target&&e.target.style&&(e.target.style.opacity=""),e&&e.currentTarget&&e.currentTarget.style&&(e.currentTarget.style.opacity=""),e&&e.target&&"function"===typeof e.target.closest){const t=e.target.closest(".tree-level-container");t&&(t.style.opacity="")}
1document.querySelectorAll(".tree-level-container").forEach(e=>{e.style.opacity=""})},handleContainerDragStart(e,t,o){if(this.isEditMode){if(e.target&&"function"===typeof e.target.closest){const t=e.target.closest(".tree-node");if(t)return}e.stopPropagation(),this.draggedGroup=t,this.draggedGroupLevel=o,this.isDragging=!0,e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain","group"),e.currentTarget&&e.currentTarget.style&&(e.currentTarget.style.opacity="0.5")}},handleGroupDragOver(e,t,o){this.isEditMode&&this.draggedGroup&&this.draggedGroupLevel===o&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},handleGroupDragEnter(e,t,o){this.isEditMode&&this.draggedGroup&&(e.preventDefault(),e.stopPropagation(),this.draggedGroupLevel===o&&t!==this.draggedGroup&&(this.dragOverGroup=null,this.dragOverGroupIndex=null,this.dragOverGroupLevel=null,this.dragOverGroupContainer=t,this.dragOverGroupContainerIndex=t.positionIndex,this.dragOverGroupContainerLevel=o))},handleGroupDragLeave(e,t){e.currentTarget.contains(e.relatedTarget)||this.dragOverGroupContainer===t&&(this.dragOverGroupContainer=null,this.dragOverGroupContainerIndex=null,this.dragOverGroupContainerLevel=null)},handleGroupDrop(e,t,o){if(e.preventDefault(),e.stopPropagation(),!this.isEditMode||!this.draggedGroup)return;if(t===this.draggedGroup||this.draggedGroupLevel!==o)return void this.handleDragEnd(e);this.isLoading=!0;const s=this.draggedGroup.positionIndex,r=t.positionIndex;this.draggedGroup.positionIndex=r,t.positionIndex=s,this.draggedGroup.hundredRange=`${100*r}-${100*r+99}`,t.hundredRange=`${100*s}-${100*s+99}`;const n=[];this.draggedGroup.roles&&this.draggedGroup.roles.length>0&&n.push(this.batchUpdateGroupRoles(this.draggedGroup,100*r)),t.roles&&t.roles.length>0&&n.push(this.batchUpdateGroupRoles(t,100*s)),Promise.all(n).then(()=>{this.cleanupStaleManualGroups(o),this.$buefy.toast.open({message:this.$t("Groups reordered successfully"),type:"is-success"})}).catch(e=>{console.error("Error updating group positions:",e),this.$buefy.toast.open({message:this.$t("Error reordering groups"),type:"is-danger"})}).finally(()=>{this.isLoading=!1,this.handleDragEnd(e)})},batchUpdateGroupRoles(e,t){if(!e.roles||0===e.roles.length)return;const o=[];for(let r=0;r<e.roles.length;r++){const s=e.roles[r],n=t+r,a=this.tenant.roles.find(e=>e.id===s.id);a&&(a.position=n),s.position=n,o.push({id:s.id,position:n})}const s=o.map(e=>this.$http.plain.patch("/roles/"+e.id,{position:e.position}));return Promise.all(s)},handleDragOverGroup(e,t){this.isEditMode&&this.draggedRole&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},handleDragEnter(e,t,o){if(this.isEditMode&&this.draggedRole&&(e.preventDefault(),e.stopPropagation(),t!==this.draggedFromGroup&&this.draggedFromLevel===o)){this.dragOverGroupContainer=null,this.dragOverGroupContainerIndex=null,this.dragOverGroupLevel=null,this.dragOverGroup=t;const e=this.getGroupsForType(o),s=e.find(e=>e.roles===t);this.dragOverGroupIndex=s?s.positionIndex:null,this.dragOverGroupLevel=o}},handleDragLeave(e,t){e.currentTarget.contains(e.relatedTarget)||this.dragOverGroup===t&&(this.dragOverGroup=null,this.dragOverGroupIndex=null)},handleDropOnGroup(e,t,o){if(e.preventDefault(),e.stopPropagation(),!this.isEditMode||!this.draggedRole)return;if(this.draggedFromLevel!==o)return this.$buefy.toast.open({message:this.$t("Cannot move roles between different levels"),type:"is-warning"}),void this.handleDragEnd(e);const s=this.tenant.roles.find(e=>e.id===this.draggedRole.id);if(!s)return console.error("Role not found in tenant.roles"),void this.handleDragEnd(e);const r=this.getGroupsForType(o),n=r.find(e=>e.roles===t);let a;if(n&&null!==n.positionIndex&&void 0!==n.positionIndex)a=100*n.positionIndex;else if(0===t.length){const e=this.getGroupHundredRange(o,t);a=100*e}else a=100*Math.floor(t[0].position/100);const l=t.map(e=>e.position).filter(e=>e>=a&&e<a+100);let i=a;while(l.includes(i)&&i<a+99)i++;const d=this.draggedFromGroup,u=1===d.length&&d.includes(this.draggedRole),p=this.draggedFromGroupIndex,c=this.draggedFromLevel;u&&null!==p&&this.preserveEmptyGroup(c,p),s.position=i,this.updateRolePosition(this.draggedRole.id,i),this.handleDragEnd(e)},preserveEmptyGroup(e,t){if(null===t||void 0===t)return;const o={roles:[],type:e,positionIndex:t,hundredRange:`${100*t}-${100*t+99}`};
1switch(e){case"central":this.manualCentralGroups=[...this.manualCentralGroups.filter(e=>e.positionIndex!==t),o];break;case"parentLocalCenter":this.manualParentLocalCenterGroups=[...this.manualParentLocalCenterGroups.filter(e=>e.positionIndex!==t),o];break;case"localCenter":this.manualLocalCenterGroups=[...this.manualLocalCenterGroups.filter(e=>e.positionIndex!==t),o];break;case"userType":this.manualUserTypeGroups=[...this.manualUserTypeGroups.filter(e=>e.positionIndex!==t),o];break;default:break}},cleanupStaleManualGroups(e){const t=e=>{switch(e){case"central":return this.tenant.roles.filter(e=>e.isNational);case"parentLocalCenter":return this.tenant.roles.filter(e=>e.isLocalCenterParent);case"localCenter":return this.tenant.roles.filter(e=>e.isLocalCenter);case"userType":return this.tenant.roles.filter(e=>!0===e.isUserType&&!e.isNational&&!e.isLocalCenterParent&&!e.isLocalCenter);default:return[]}};if(e&&e.startsWith("unitType-")){const t=e.replace("unitType-",""),o=this.tenant.roles.filter(e=>e.unitType&&e.unitType["@id"]===t),s=this.groupRolesByPositionHundreds(o,"unitType"),r=s.map(e=>e.positionIndex),n=this.manualUnitTypeGroups[t]||[],a=n.filter(e=>!r.includes(e.positionIndex));return void(a.length!==n.length&&(this.manualUnitTypeGroups={...this.manualUnitTypeGroups,[t]:a}))}const o=t(e),s=this.groupRolesByPositionHundreds(o,e),r=s.map(e=>e.positionIndex);switch(e){case"central":this.manualCentralGroups=this.manualCentralGroups.filter(e=>!r.includes(e.positionIndex));break;case"parentLocalCenter":this.manualParentLocalCenterGroups=this.manualParentLocalCenterGroups.filter(e=>!r.includes(e.positionIndex));break;case"localCenter":this.manualLocalCenterGroups=this.manualLocalCenterGroups.filter(e=>!r.includes(e.positionIndex));break;case"userType":this.manualUserTypeGroups=this.manualUserTypeGroups.filter(e=>!r.includes(e.positionIndex));break}},getGroupHundredRange(e,t){if(t.length>0&&t[0]&&void 0!==t[0].position)return Math.floor(t[0].position/100-1);switch(e){case"central":return 0;case"parentLocalCenter":return 1;case"localCenter":return 2;case"userType":return 3;case"other":return 4;default:return 0}},getGroupsForType(e){if(e&&e.startsWith("unitType-")){const t=e.replace("unitType-","");return this.unitTypeRolesGrouped[t]?.groups||[]}switch(e){case"central":return this.centralRolesGrouped;case"parentLocalCenter":return this.parentLocalCenterRolesGrouped;case"localCenter":return this.localCenterRolesGrouped;case"userType":return this.userTypeRolesGrouped;default:return[]}},addNewGroup(e,t=null){if("unitType"===e&&t){const e=t["@id"];this.manualUnitTypeGroups[e]||(this.manualUnitTypeGroups[e]=[]);const o=this.tenant.roles.filter(t=>{const o=t.unitType&&t.unitType["@id"];return o===e}),s=this.groupRolesByPositionHundreds(o,"unitType"),r=this.manualUnitTypeGroups[e]||[],n=[...s,...r];let a=5;if(n.length>0){const e=Math.min(...n.map(e=>e.positionIndex).filter(e=>null!==e));a=e-1}const l={roles:[],type:"unitType",unitTypeId:e,positionIndex:a,hundredRange:`${100*a}-${100*a+99}`};this.manualUnitTypeGroups[e].unshift(l),this.manualUnitTypeGroups={...this.manualUnitTypeGroups},this.$nextTick(()=>{const t=`group-unitType-${e}-${a}`,o=document.getElementById(t);o&&o.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})}else{const t=this.getGroupsForType(e);let o=0;if(t.length>0){const e=Math.min(...t.map(e=>e.positionIndex).filter(e=>null!==e));o=e-1}const s={roles:[],type:e,positionIndex:o,hundredRange:`${100*o}-${100*o+99}`};switch(e){case"central":this.manualCentralGroups.unshift(s);break;case"parentLocalCenter":this.manualParentLocalCenterGroups.unshift(s);break;case"localCenter":this.manualLocalCenterGroups.unshift(s);break;case"userType":this.manualUserTypeGroups.unshift(s);break;default:break}this.$nextTick(()=>{const t=`group-${e}-${o}`,s=document.getElementById(t);s&&s.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})})}this.$buefy.toast.open({message:this.$t("New group created. You can now drag roles into it."),type:"is-success"})},handleTreeNodeDrop(e,t,o,s){this.draggedRole&&(e.stopPropagation(),this.handleDropOnRole(e,t,o,s))},handleDragOverRole(e,t){this.isEditMode&&this.draggedRole&&(t.id!==this.draggedRole.id&&(this.dragOverRole=t),e.preventDefault(),e.dataTransfer.dropEffect="move")},handleDropOnRole(e,t,o,s){if(e.preventDefault(),e.stopPropagation(),!this.isEditMode||!this.draggedRole)return;if(t.id===this.draggedRole.id)return void this.handleDragEnd(e);
1if(this.draggedFromLevel!==s)return this.$buefy.toast.open({message:this.$t("Cannot move roles between different levels"),type:"is-warning"}),void this.handleDragEnd(e);const r=this.tenant.roles.find(e=>e.id===this.draggedRole.id),n=this.tenant.roles.find(e=>e.id===t.id);if(!r||!n)return console.error("One or both roles not found in tenant.roles"),void this.handleDragEnd(e);const a=this.getGroupsForType(s),l=a.find(e=>e.roles===o),i=l?l.positionIndex:null,d=i===this.draggedFromGroupIndex&&this.draggedFromLevel===s;if(d){const t=r.position,s=n.position;if(t===s)return void this.handleDragEnd(e);const a=[];if(t<s){const e=s;o.forEach(e=>{const o=this.tenant.roles.find(t=>t.id===e.id);if(o&&o.id!==r.id&&o.position>t&&o.position<=s){const e=o.position-1;o.position=e,a.push(this.$http.plain.patch("/roles/"+o.id,{position:e}))}}),r.position=e}else{const e=s;o.forEach(e=>{const o=this.tenant.roles.find(t=>t.id===e.id);if(o&&o.id!==r.id&&o.position>=s&&o.position<t){const e=o.position+1;o.position=e,a.push(this.$http.plain.patch("/roles/"+o.id,{position:e}))}}),r.position=e}a.push(this.$http.plain.patch("/roles/"+r.id,{position:r.position})),this.isLoading=!0,Promise.all(a).then(()=>{this.$buefy.toast.open({message:this.$t("Role moved successfully"),type:"is-success"})}).catch(e=>{console.error("Error moving role:",e),t<s?o.forEach(e=>{const o=this.tenant.roles.find(t=>t.id===e.id);o&&o.position>=t&&o.position<s&&(o.position+=1)}):o.forEach(e=>{const o=this.tenant.roles.find(t=>t.id===e.id);o&&o.position>s&&o.position<=t&&(o.position-=1)}),r.position=t,this.$buefy.toast.open({message:this.$t("Error moving role"),type:"is-danger"})})}else{const e=n.position,t=r.position,a=this.getGroupsForType(s),l=a.find(e=>e.roles===o),i=l?100*l.positionIndex:100*Math.floor(e/100),d=i+99,u=o.filter(t=>t.position>=e&&t.position<=d&&t.id!==this.draggedRole.id),p=1===this.draggedFromGroup.length&&this.draggedFromGroup.includes(this.draggedRole),c=this.draggedFromGroupIndex,h=this.draggedFromLevel;p&&null!==c&&this.preserveEmptyGroup(h,c),r.position=e;const g=[this.$http.plain.patch("/roles/"+r.id,{position:e})];u.forEach(e=>{const t=this.tenant.roles.find(t=>t.id===e.id);t&&t.position<d&&(t.position+=1,g.push(this.$http.plain.patch("/roles/"+t.id,{position:t.position})))}),this.isLoading=!0,Promise.all(g).then(()=>{this.$buefy.toast.open({message:this.$t("Role moved successfully"),type:"is-success"})}).catch(e=>{console.error("Error moving role:",e),r.position=t,u.forEach(e=>{const t=this.tenant.roles.find(t=>t.id===e.id);t&&(t.position-=1)}),this.$buefy.toast.open({message:this.$t("Error moving role"),type:"is-danger"})})}this.isLoading=!1,this.dragOverRole=null,this.handleDragEnd(e)},updateRolePosition(e,t,o=!0){o&&(this.isLoading=!0);const s={position:t};this.$http.plain.patch("/roles/"+e,s).then(()=>{const s=this.tenant.roles.find(t=>t.id===e);s&&(s.position=t),o&&this.$buefy.toast.open({message:this.$t("Role position updated successfully"),type:"is-success"})}).catch(e=>{console.error("Error updating role position:",e),this.$buefy.toast.open({message:this.$t("Error updating role position"),type:"is-danger"})}).finally(()=>{o&&(this.isLoading=!1)})}},computed:{...(0,xt.L8)(["tenant","isGranted","user"]),filteredLocalCenters(){const e=this.localCenters.filter(Boolean);if(!this.localCenterSearch)return e;const t=this.localCenterSearch.toLowerCase();return e.filter(e=>(0,wt.Hc)(e,this.tenant).toLowerCase().includes(t))},centralRolesGrouped(){const e=this.groupRolesByPositionHundreds(this.tenant.roles.filter(e=>e.isNational),"central"),t=e.map(e=>e.positionIndex),o=this.manualCentralGroups.filter(e=>!t.includes(e.positionIndex));let s=[...e,...o];s.sort((e,t)=>e.positionIndex-t.positionIndex);const r=s.filter(e=>e.roles.length>0);return 0===r.length&&0===s.length&&s.push({positionIndex:0,hundredRange:"0-99",type:"central",roles:[]}),this.isEditMode?s:r.length>0?r:s},parentLocalCenterRolesGrouped(){const e=this.groupRolesByPositionHundreds(this.tenant.roles.filter(e=>e.isLocalCenterParent),"parentLocalCenter"),t=e.map(e=>e.positionIndex),o=this.manualParentLocalCenterGroups.filter(e=>!t.includes(e.positionIndex));let s=[...e,...o];s.sort((e,t)=>
1e.positionIndex-t.positionIndex);const r=s.filter(e=>e.roles.length>0);return 0===r.length&&0===s.length&&s.push({positionIndex:1,hundredRange:"100-199",type:"parentLocalCenter",roles:[]}),this.isEditMode?s:r.length>0?r:s},localCenterRolesGrouped(){const e=this.groupRolesByPositionHundreds(this.tenant.roles.filter(e=>e.isLocalCenter),"localCenter"),t=e.map(e=>e.positionIndex),o=this.manualLocalCenterGroups.filter(e=>!t.includes(e.positionIndex));let s=[...e,...o];s.sort((e,t)=>e.positionIndex-t.positionIndex);const r=s.filter(e=>e.roles.length>0);return 0===r.length&&0===s.length&&s.push({positionIndex:2,hundredRange:"200-299",type:"localCenter",roles:[]}),this.isEditMode?s:r.length>0?r:s},userTypeRolesGrouped(){const e=this.groupRolesByPositionHundreds(this.tenant.roles.filter(e=>!0===e.isUserType&&!e.isNational&&!e.isLocalCenterParent&&!e.isLocalCenter),"userType"),t=e.map(e=>e.positionIndex),o=this.manualUserTypeGroups.filter(e=>!t.includes(e.positionIndex));let s=[...e,...o];s.sort((e,t)=>e.positionIndex-t.positionIndex);const r=s.filter(e=>e.roles.length>0);return 0===r.length&&0===s.length&&s.push({positionIndex:3,hundredRange:"300-399",type:"userType",roles:[]}),this.isEditMode?s:r.length>0?r:s},unitTypeRolesGrouped(){const e={};return this.unitTypes.forEach(t=>{const o=t["@id"];e[o]={unitType:t,groups:[]}}),Object.keys(e).forEach(t=>{const o=this.tenant.roles.filter(e=>{const o=e.unitType&&e.unitType["@id"];return o===t}),s=this.groupRolesByPositionHundreds(o,"unitType"),r=this.manualUnitTypeGroups[t]||[],n=s.map(e=>e.positionIndex),a=r.filter(e=>!n.includes(e.positionIndex));let l=[...s,...a];l.sort((e,t)=>e.positionIndex-t.positionIndex);const i=l.filter(e=>e.roles.length>0);0===i.length&&0===l.length&&l.push({positionIndex:5,hundredRange:"500-599",type:"unitType",unitTypeId:t,roles:[]}),e[t].groups=l}),e},isMoreThanOnePage(){return!!(this.itemsTotal>this.itemsPerPage&&this.itemsPerPage)}},components:{BDropdownItem:_t.H_,FontAwesomeIcon:Ot.gc,LogoThumbnail:Rt.A,MobileViewHeader:Mt.A,RoleForm:Pt.A}},Ut=o(66262);const Xt=(0,Ut.A)(Nt,[["render",Ft],["__scopeId","data-v-0bb5b6e2"]]);var At=Xt},80926:function(e,t,o){var s=o(79306),r=o(48981),n=o(47055),a=o(26198),l=TypeError,i="Reduce of empty array with no initial value",d=function(e){return function(t,o,d,u){var p=r(t),c=n(p),h=a(p);if(s(o),0===h&&d<2)throw new l(i);var g=e?h-1:0,m=e?-1:1;if(d<2)while(1){if(g in c){u=c[g],g+=m;break}if(g+=m,e?g<0:h<=g)throw new l(i)}for(;e?g>=0:h>g;g+=m)g in c&&(u=o(u,c[g],g,p));return u}};e.exports={left:d(!1),right:d(!0)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.