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