芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/public_html/invoicer.pulsehost.co.uk/public/build/assets/estimate-D8Gf8sYF.js
import{s as n,u as h}from"./main-WS8l16KQ.js";import{h as r}from"./auth-BcagBUX6.js";const{defineStore:u}=window.pinia,f=u({id:"customerEstimateStore",state:()=>({estimates:[],totalEstimates:0,selectedViewEstimate:[]}),actions:{fetchEstimate(s,e){return new Promise((i,a)=>{n.get(`/api/v1/${e}/customer/estimates`,{params:s}).then(t=>{this.estimates=t.data.data,this.totalEstimates=t.data.meta.estimateTotalCount,i(t)}).catch(t=>{r(t),a(t)})})},fetchViewEstimate(s,e){return new Promise((i,a)=>{n.get(`/api/v1/${e}/customer/estimates/${s.id}`,{params:s}).then(t=>{this.selectedViewEstimate=t.data.data,i(t)}).catch(t=>{r(t),a(t)})})},searchEstimate(s,e){return new Promise((i,a)=>{n.get(`/api/v1/${e}/customer/estimates`,{params:s}).then(t=>{this.estimates=t.data,i(t)}).catch(t=>{r(t),a(t)})})},acceptEstimate({slug:s,id:e,status:i}){return new Promise((a,t)=>{n.post(`/api/v1/${s}/customer/estimate/${e}/status`,{status:i}).then(o=>{let m=this.estimates.findIndex(c=>c.id===e);this.estimates[m]&&(this.estimates[m].status="ACCEPTED",h(!0).showNotification({type:"success",message:global.t("estimates.marked_as_accepted_message")})),a(o)}).catch(o=>{r(o),t(o)})})},rejectEstimate({slug:s,id:e,status:i}){return new Promise((a,t)=>{n.post(`/api/v1/${s}/customer/estimate/${e}/status`,{status:i}).then(o=>{let m=this.estimates.findIndex(c=>c.id===e);this.estimates[m]&&(this.estimates[m].status="REJECTED",h(!0).showNotification({type:"success",message:global.t("estimates.marked_as_rejected_message")})),a(o)}).catch(o=>{r(o),t(o)})})}}});export{f as u};