import{q as n,s as o}from"./index-BvsGCd9b.js";const c=n("data",{state:()=>({home:null,vehicles:null,orders:null,estimates:null,invoices:null,loading:!1,error:""}),actions:{async loadHome(){var s,t;this.error="";try{const{data:e}=await o.get("/owner/home");this.home=e}catch(e){this.error=((t=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:t.message)??"Could not load your dashboard."}},async loadVehicles(){var s,t;try{const{data:e}=await o.get("/owner/vehicles");this.vehicles=e.vehicles}catch(e){this.error=((t=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:t.message)??"Could not load vehicles."}},async loadVehicle(s){var t,e;try{const{data:a}=await o.get(`/owner/vehicles/${s}`);return a}catch(a){return this.error=((e=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:e.message)??"Could not load this vehicle.",null}},async loadOrders(){var s,t;try{const{data:e}=await o.get("/owner/orders");this.orders=e.orders}catch(e){this.error=((t=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:t.message)??"Could not load repair orders."}},async loadOrder(s){var t,e;try{const{data:a}=await o.get(`/owner/orders/${s}`);return a.order}catch(a){return this.error=((e=(t=a==null?void 0:a.response)==null?void 0:t.data)==null?void 0:e.message)??"Could not load this repair order.",null}},async loadEstimates(){var s,t;try{const{data:e}=await o.get("/owner/estimates");this.estimates=e.estimates}catch(e){this.error=((t=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:t.message)??"Could not load estimates."}},async decideEstimate(s,t){var r;const{data:e}=await o.post(`/owner/estimates/${s}/${t}`),a=(r=this.estimates)==null?void 0:r.find(i=>i.id===s);return a&&(a.status=e.status,a.can_decide=!1),e},async loadInvoices(){var s,t;try{const{data:e}=await o.get("/owner/invoices");this.invoices=e.invoices}catch(e){this.error=((t=(s=e==null?void 0:e.response)==null?void 0:s.data)==null?void 0:t.message)??"Could not load invoices."}}}});export{c as u};
//# sourceMappingURL=data-C_m0Mceb.js.map
