import{_ as v,ax as y,M as b,c as m,a as o,w as a,Z as k,ay as _,R as S,H as w,r as C,o as p,$ as n,K as i,I as h,a3 as $,aj as L,N as r,a1 as x,Q}from"./app-DzAYC6xy.js";import{Q as E,a as d}from"./QTable-98FMMxUQ.js";import{Q as g}from"./QBadge-D_snenZB.js";import{Q as V}from"./QTr-BZRxhYsi.js";import{d as R}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 q={name:"ShopList",data(){return{ACTION:w,RESOURCE:S,shops:[],columns:[{name:"key",align:"left",label:this.$i18n.t("components.devShopList.headers.key"),field:e=>e.key,sortable:!0},{name:"name",align:"left",label:this.$i18n.t("components.devShopList.headers.name"),field:e=>e.name||"",sortable:!0},{name:"inv",align:"right",label:this.$i18n.t("components.devShopList.headers.inventory"),field:e=>e.inventoryCount||0,sortable:!0},{name:"locs",align:"right",label:this.$i18n.t("components.devShopList.headers.locations"),field:e=>e.locationsCount||0,sortable:!0},{name:"targs",align:"right",label:this.$i18n.t("components.devShopList.headers.targets"),field:e=>e.targetsCount||0,sortable:!0},{name:"flags",align:"left",label:this.$i18n.t("components.devShopList.headers.flags"),field:e=>e}],pagination:{sortBy:"key",descending:!1,page:1,rowsPerPage:0},loading:!0}},computed:{...y(_,["searchFilter","paginationSave"])},methods:{can:R,onRowClick(e){this.$router.push({name:"dev-shop-detail",params:{shopKey:e.key}})},getPaginationLabel(e,s,u){return this.$i18n.t("components.devShopList.paginationLabel",{from:e,to:s,total:u})},updatePagination(e){this.loading||(this.paginationSave=e,this.pagination=e)}},mounted(){this.$axios.get("/api/dev/shops").then(e=>{this.shops=e.data.shops||[],this.loading=!1,this.pagination={...this.paginationSave}}).catch(e=>{this.loading=!1,this.$q.notify({message:this.$i18n.t("general.error"),position:"top",color:"red",icon:"fas fa-exclamation-triangle",caption:this.$i18n.t("general.timeout")})})}},B={key:0,class:"row q-pa-sm"},N={class:"row"},T={class:"col-12"},I={class:"q-mx-md q-my-sm row flex-center"},P={class:"text-caption text-sub"},D={class:"q-ml-auto"},O={class:"text-main"},U={class:"text-main"};function F(e,s,u,A,l,c){const f=C("router-view");return e.$route.name==="dev-shop-list"?(p(),b("div",B,[o(k,{class:"shop-list-card full-width"},{default:a(()=>[n("div",N,[n("div",T,[n("div",I,[n("div",P,i(e.$t("components.devShopList.subheader")),1),n("div",D,[c.can(l.ACTION.DEV.SHOP.CREATE,l.RESOURCE.DEV)?(p(),m($,{key:0,color:"primary",onClick:s[0]||(s[0]=t=>e.$router.push({name:"dev-shop-create"})),label:e.$t("components.devShopList.createShop"),class:"q-ma-sm",icon:"add"},null,8,["label"])):h("",!0)])]),o(L),o(E,{color:"primary","card-class":"shop-list-card text-main","table-class":"shop-list-table","table-header-class":"shop-list-table-header text-main",flat:"",style:{"max-height":"70vh"},rows:l.shops,columns:l.columns,"row-key":"key",pagination:l.pagination,"hide-bottom":"",loading:l.loading,filter:e.searchFilter,"onUpdate:pagination":c.updatePagination},{"top-right":a(()=>[o(x,{borderless:"",dense:"",debounce:"300",modelValue:e.searchFilter,"onUpdate:modelValue":s[1]||(s[1]=t=>e.searchFilter=t),placeholder:e.$t("general.search"),"input-class":"text-main"},{append:a(()=>[o(Q,{class:"text-white search-icon",name:"search"})]),_:1},8,["modelValue","placeholder"])]),body:a(t=>[o(V,{props:t,onClick:M=>c.onRowClick(t.row),class:"cursor-pointer"},{default:a(()=>[o(d,{key:"key",props:t},{default:a(()=>[r(i(t.row.key),1)]),_:2},1032,["props"]),o(d,{key:"name",props:t},{default:a(()=>[r(i(t.row.name),1)]),_:2},1032,["props"]),o(d,{key:"inv",props:t,class:"text-right"},{default:a(()=>[r(i(t.row.inventoryCount),1)]),_:2},1032,["props"]),o(d,{key:"locs",props:t,class:"text-right"},{default:a(()=>[r(i(t.row.locationsCount),1)]),_:2},1032,["props"]),o(d,{key:"targs",props:t,class:"text-right"},{default:a(()=>[r(i(t.row.targetsCount),1)]),_:2},1032,["props"]),o(d,{key:"flags",props:t},{default:a(()=>[t.row.hasGroups?(p(),m(g,{key:0,color:"accent",class:"q-mr-xs"},{default:a(()=>s[2]||(s[2]=[r("G",-1)])),_:1,__:[2]})):h("",!0),t.row.hasModel?(p(),m(g,{key:1,color:"primary"},{default:a(()=>s[3]||(s[3]=[r("M",-1)])),_:1,__:[3]})):h("",!0)]),_:2},1032,["props"])]),_:2},1032,["props","onClick"])]),"no-data":a(()=>[n("div",O,i(e.$t("components.devShopList.noData")),1)]),loading:a(()=>[n("div",U,i(e.$t("components.devShopList.loadData")),1)]),_:1},8,["rows","columns","pagination","loading","filter","onUpdate:pagination"])])])]),_:1})])):(p(),m(f,{key:1}))}const ie=v(q,[["render",F],["__scopeId","data-v-1f8037b4"]]);export{ie as default};
