import{_ as g,ax as w,M as y,c as m,a as s,w as r,Z as _,ay as k,R as v,H as C,r as L,o as n,$ as l,K as u,I as c,a3 as $,aj as Q,N as b,Q as h,a1 as E}from"./app-DzAYC6xy.js";import{Q as I,a as p}from"./QTable-98FMMxUQ.js";import{Q as R}from"./QTr-BZRxhYsi.js";import{d as N}from"./utils-wZ-HUk39.js";import"./externalHosting.js";import"./QList-ClLOsgaS.js";import"./QMarkupTable-z27wCkH-.js";import"./QSelect-CKpWbBmC.js";import"./QChip-BlQVc6fr.js";import"./QItemLabel-DrLwH6Mx.js";import"./position-engine-BoHh6ymb.js";import"./selection-vu7NfHfB.js";import"./rtl-DFPa-2ov.js";import"./use-fullscreen-Bv2HJD5x.js";const U={name:"UserList",data(){return{ACTION:C,RESOURCE:v,columns:[{name:"name",align:"left",label:this.$i18n.t("components.userList.headers.name"),field:e=>e.name,format:e=>`${e}`,sortable:!0},{name:"role",align:"left",label:this.$i18n.t("components.userList.headers.role"),field:e=>e.roleId,format:e=>`${e}`,sortable:!0},{name:"master",align:"center",label:this.$i18n.t("components.userList.headers.master"),field:e=>e.isMaster,format:e=>`${e}`,sortable:!0}],users:[],loading:!0,pagination:{page:1,rowsPerPage:10,rowsNumber:0}}},methods:{can:N,onRowClick(e){this.$router.push({name:"web-user-detail",params:{userId:e.name}})},getPaginationLabel(e,t,d){return this.$i18n.t("components.userList.paginationLabel",{from:e,to:t,total:d})}},computed:{...w(k,["searchFilter"])},mounted(){this.$route.name==="web-user-list"&&this.$axios.get("/api/users").then(e=>{this.users=e.data.users,this.loading=!1})}},x={key:0,class:"row q-pa-sm"},B={class:"row"},S={class:"col-12"},T={class:"q-mx-md q-my-sm row flex-center"},V={class:"text-caption text-sub"},q={class:"q-ml-auto"};function F(e,t,d,O,o,i){const f=L("router-view");return e.$route.name==="web-user-list"?(n(),y("div",x,[s(_,{class:"user-list-card full-width"},{default:r(()=>[l("div",B,[l("div",S,[l("div",T,[l("div",V,u(e.$t("components.userList.subheader")),1),l("div",q,[i.can(o.ACTION.WEB.USER.CREATE,o.RESOURCE.WEB)?(n(),m($,{key:0,"text-color":"main",color:"primary",onClick:t[0]||(t[0]=a=>e.$router.push({name:"web-user-create"})),label:e.$t("components.userList.createUser"),class:"q-ma-sm"},null,8,["label"])):c("",!0)])]),s(Q),s(I,{color:"primary","card-class":"user-list-card text-main","table-class":"user-list-table text-main","table-header-class":"user-list-table-header text-primary",flat:"",style:{"max-height":"70vh","overflow-y":"auto"},pagination:o.pagination,"onUpdate:pagination":t[2]||(t[2]=a=>o.pagination=a),rows:o.users,columns:o.columns,"row-key":"name","no-results-label":e.$t("components.userList.noData"),"loading-label":e.$t("components.userList.loadData"),loading:o.loading,filter:e.searchFilter,"rows-per-page-options":[5,10,25,50,100],"pagination-label":i.getPaginationLabel},{"top-right":r(()=>[s(E,{"input-style":{color:"var(--q-main)"},borderless:"",dense:"",debounce:"300",modelValue:e.searchFilter,"onUpdate:modelValue":t[1]||(t[1]=a=>e.searchFilter=a),placeholder:e.$t("general.search")},{append:r(()=>[s(h,{class:"text-main",name:"search"})]),_:1},8,["modelValue","placeholder"])]),body:r(a=>[s(R,{props:a,onClick:P=>i.onRowClick(a.row),class:"cursor-pointer"},{default:r(()=>[s(p,{key:"name",props:a},{default:r(()=>[b(u(a.row.name),1)]),_:2},1032,["props"]),s(p,{key:"role",props:a},{default:r(()=>[b(u(a.row.roleId),1)]),_:2},1032,["props"]),s(p,{key:"master",props:a},{default:r(()=>[a.row.isMaster?(n(),m(h,{key:0,name:"fa fa-crown",color:"amber"})):c("",!0)]),_:2},1032,["props"])]),_:2},1032,["props","onClick"])]),_:1},8,["pagination","rows","columns","no-results-label","loading-label","loading","filter","pagination-label"])])])]),_:1})])):(n(),m(f,{key:1}))}const ae=g(U,[["render",F],["__scopeId","data-v-2638bba6"]]);export{ae as default};
