import{_ as b,ax as h,M as f,c as u,a,w as t,Z as w,ay as y,R as _,H as $,r as L,o as d,$ as l,K as n,I as k,a3 as v,aj as C,N as i,a1 as Q,Q as R}from"./app-Cox3Klmm.js";import{Q as E,a as m}from"./QTable-Bcm4QxKC.js";import{Q as B}from"./QBadge-D5J3-kIy.js";import{Q as q}from"./QTr-DpZRq2Qw.js";import{d as I}from"./utils-B-Rlv8Ts.js";import"./externalHosting.js";import"./QList-DOsz8eIb.js";import"./QMarkupTable-DkBRsZwQ.js";import"./QSelect-SR9QxmCO.js";import"./QChip-ubeLtWhp.js";import"./QItemLabel-BhKjsO0f.js";import"./position-engine-Dz9uviBh.js";import"./selection-DztvFjhq.js";import"./rtl-DFPa-2ov.js";import"./use-fullscreen-BlRyF2qr.js";const N={name:"RoleList",data(){return{ACTION:$,RESOURCE:_,columns:[{name:"name",align:"left",label:this.$i18n.t("components.roleList.headers.name"),field:e=>e.name,format:e=>`${e}`,sortable:!0},{name:"desc",align:"left",label:this.$i18n.t("components.roleList.headers.desc"),field:e=>e.desc,format:e=>`${e}`,sortable:!0},{name:"permissions",align:"center",label:this.$i18n.t("components.roleList.headers.permissions"),field:e=>e.permissions,format:e=>`${e}`,sortable:!0},{name:"color",align:"center",label:this.$i18n.t("components.roleList.headers.color"),field:e=>e.color,format:e=>`${e}`,sortable:!0}],roles:[],pagination:{sortBy:"name",descending:!1,page:1,rowsPerPage:25},loading:!0}},methods:{can:I,onRowClick(e){this.$router.push({name:"web-role-detail",params:{roleId:e.name}})},getPaginationLabel(e,s,p){return this.$i18n.t("components.roleList.paginationLabel",{from:e,to:s,total:p})}},computed:{...h(y,["searchFilter"])},mounted(){this.$route.name==="web-role-list"&&this.$axios.get("/api/roles").then(e=>{this.roles=e.data.roles,this.loading=!1})}},T={key:0,class:"row q-pa-sm"},V={class:"row"},P={class:"col-12"},S={class:"q-mx-md q-my-sm row flex-center"},x={class:"text-caption text-sub"},O={class:"q-ml-auto"};function F(e,s,p,U,r,c){const g=L("router-view");return e.$route.name==="web-role-list"?(d(),f("div",T,[a(w,{class:"role-list-card full-width"},{default:t(()=>[l("div",V,[l("div",P,[l("div",S,[l("div",x,n(e.$t("components.roleList.subheader")),1),l("div",O,[c.can(r.ACTION.WEB.ROLE.CREATE,r.RESOURCE.WEB)?(d(),u(v,{key:0,"text-color":"main",color:"primary",onClick:s[0]||(s[0]=o=>e.$router.push({name:"web-role-create"})),label:e.$t("components.roleList.createRole"),class:"q-ma-sm"},null,8,["label"])):k("",!0)])]),a(C),a(E,{color:"primary","card-class":"role-list-card text-main","table-class":"role-list-table","table-header-class":"role-list-table-header text-main",flat:"",square:"",separator:"none",style:{"max-height":"70vh"},rows:r.roles,columns:r.columns,"row-key":"name",pagination:r.pagination,"onUpdate:pagination":s[2]||(s[2]=o=>r.pagination=o),"rows-per-page-options":[0,25,50,100],"no-results-label":e.$t("components.roleList.noData"),"loading-label":e.$t("components.roleList.loadData"),loading:r.loading,filter:e.searchFilter,"binary-state-sort":"","pagination-label":c.getPaginationLabel,"rows-per-page-label":`${e.$t("components.roleList.recordsPerPage")}:`},{"top-right":t(()=>[a(Q,{"input-style":{color:"var(--q-main)"},borderless:"",dense:"",debounce:"300",modelValue:e.searchFilter,"onUpdate:modelValue":s[1]||(s[1]=o=>e.searchFilter=o),placeholder:e.$t("general.search")},{append:t(()=>[a(R,{class:"text-main",name:"search"})]),_:1},8,["modelValue","placeholder"])]),body:t(o=>[a(q,{props:o,onClick:A=>c.onRowClick(o.row),class:"cursor-pointer"},{default:t(()=>[a(m,{key:"name",props:o},{default:t(()=>[i(n(o.row.name),1)]),_:2},1032,["props"]),a(m,{key:"desc",props:o},{default:t(()=>[i(n(o.row.desc),1)]),_:2},1032,["props"]),a(m,{key:"permissions",props:o},{default:t(()=>[i(n(o.row.permissions.length),1)]),_:2},1032,["props"]),a(m,{key:"color",props:o},{default:t(()=>[a(B,{color:o.row.color},{default:t(()=>[i(n(o.row.color),1)]),_:2},1032,["color"])]),_:2},1032,["props"])]),_:2},1032,["props","onClick"])]),_:1},8,["rows","columns","pagination","no-results-label","loading-label","loading","filter","pagination-label","rows-per-page-label"])])])]),_:1})])):(d(),u(g,{key:1}))}const te=b(N,[["render",F],["__scopeId","data-v-493e8188"]]);export{te as default};
