import{_ as h,ax as b,M as f,c as p,a as s,w as t,Z as v,ay as _,R as w,H as y,r as k,o as d,$ as o,K as l,I as $,a3 as L,aj as C,N as m,a1 as Q,Q as E}from"./app-DzAYC6xy.js";import{Q as S,a as c}from"./QTable-98FMMxUQ.js";import{Q as V}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 R={name:"GangList",data(){return{ACTION:y,RESOURCE:w,gangs:[],columns:[{name:"name",align:"left",label:this.$i18n.t("components.gangList.headers.name"),field:a=>a.name,format:a=>`${a}`,sortable:!0},{name:"label",align:"left",label:this.$i18n.t("components.gangList.headers.label"),field:a=>a.label,format:a=>`${a}`,sortable:!0},{name:"grades",align:"center",label:this.$i18n.t("components.gangList.headers.grades"),field:a=>a.grades,format:a=>`${a}`,sortable:!0}],pagination:{sortBy:"desc",descending:!1,page:1,rowsPerPage:0},loading:!0}},computed:{...b(_,["searchFilter","paginationSave"])},methods:{can:N,onRowClick(a){this.$router.push({name:"dev-gang-detail",params:{gangId:a.name}})},getPaginationLabel(a,n,r){return this.$i18n.t("components.gangList.paginationLabel",{from:a,to:n,total:r})},updatePagination(a){this.loading||(this.paginationSave=a,this.pagination=a)}},mounted(){this.$axios.get("/api/gangs").then(a=>{for(const[n,r]of Object.entries(a.data.gangs))this.gangs.push({name:n,...r});this.loading=!1,this.pagination={...this.paginationSave}})}},D={key:0,class:"row q-pa-sm"},I={class:"row"},T={class:"col-12"},q={class:"q-mx-md q-my-sm row flex-center"},B={class:"text-caption text-sub"},O={class:"q-ml-auto"},x={class:"text-main"},G={class:"text-main"};function P(a,n,r,U,i,g){const u=k("router-view");return a.$route.name==="dev-gang-list"?(d(),f("div",D,[s(v,{class:"gang-list-card full-width"},{default:t(()=>[o("div",I,[o("div",T,[o("div",q,[o("div",B,l(a.$t("components.gangList.subheader")),1),o("div",O,[g.can(i.ACTION.DEV.GANG.CREATE,i.RESOURCE.DEV)?(d(),p(L,{key:0,color:"primary",onClick:n[0]||(n[0]=e=>a.$router.push({name:"dev-gang-create"})),label:a.$t("components.gangList.createGang"),class:"q-ma-sm",icon:"add"},null,8,["label"])):$("",!0)])]),s(C),s(S,{color:"primary","card-class":"gang-list-card text-main","table-class":"gang-list-table","table-header-class":"gang-list-table-header text-main",flat:"",style:{"max-height":"70vh"},"hide-bottom":"",rows:i.gangs,columns:i.columns,"row-key":"name",pagination:i.pagination,"no-results-label":a.$t("components.gangList.noData"),"loading-label":a.$t("components.gangList.loadData"),loading:i.loading,filter:a.searchFilter,"onUpdate:pagination":g.updatePagination},{"top-right":t(()=>[s(Q,{"input-style":{color:"var(--q-main)"},borderless:"",dense:"",debounce:"300",modelValue:a.searchFilter,"onUpdate:modelValue":n[1]||(n[1]=e=>a.searchFilter=e),placeholder:a.$t("general.search")},{append:t(()=>[s(E,{class:"text-white search-icon",name:"search"})]),_:1},8,["modelValue","placeholder"])]),body:t(e=>[s(V,{props:e,onClick:A=>g.onRowClick(e.row),class:"cursor-pointer"},{default:t(()=>[s(c,{key:"name",props:e},{default:t(()=>[m(l(e.row.name),1)]),_:2},1032,["props"]),s(c,{key:"label",props:e},{default:t(()=>[m(l(e.row.label),1)]),_:2},1032,["props"]),s(c,{key:"grades",props:e},{default:t(()=>[m(l(Object.keys(e.row.grades).length),1)]),_:2},1032,["props"])]),_:2},1032,["props","onClick"])]),"no-data":t(()=>[o("div",x,l(a.$t("components.gangList.noData")),1)]),loading:t(()=>[o("div",G,l(a.$t("components.gangList.loadData")),1)]),_:1},8,["rows","columns","pagination","no-results-label","loading-label","loading","filter","onUpdate:pagination"])])])]),_:1})])):(d(),p(u,{key:1}))}const sa=h(R,[["render",P],["__scopeId","data-v-e4215163"]]);export{sa as default};
