import{_ as m,f as i,o as g,g as h,i as s,t as n,h as r,w as o,p as u}from"./app-81c86c8f.js";const v={data:()=>({currentPage:1,lastPage:1,completedDeliveries:[]}),computed:{headers(){return[{title:this.$i18n.t("code"),align:"start",sortable:!1,value:"combined_order.code"},{title:this.$i18n.t("date"),sortable:!1,align:"start",value:"created_at"},{title:this.$i18n.t("amount"),sortable:!1,align:"start",value:"grand_total"},{title:this.$i18n.t("delivery_status"),sortable:!1,align:"start",value:"delivery_status"},{title:this.$i18n.t("payment_status"),sortable:!1,align:"start",value:"payment_status"},{title:this.$i18n.t("options"),sortable:!1,align:"center",value:"options"}]}},methods:{async getCompletedDeliveries(e){this.loading=!0;const a=await this.call_api("get",`delivery-boy/completed-deliveries?page=${e}`);a.status==200?(this.completedDeliveries=a.data.data.data,this.lastPage=a.data.data.last_page,this.currentPage=a.data.data.current_page):this.snack({message:this.$i18n.t("something_went_wrong"),color:"red"}),this.loading=!1},openOrderDetails(e){this.$router.push({name:"DeliveryboyOrderDetails",params:{code:e.code}})}},created(){let e=this.$route.query.page||this.currentPage;this.getCompletedDeliveries(e)}},b={class:"ps-lg-7 pt-4"},f={class:"fs-24 fw-700 opacity-80 mb-5 mt-3"},y={class:"d-block fw-600"},D=["onClick"],$=s("i",{class:"las la-bars"},null,-1),C=[$],k={class:"text-start"};function w(e,a,P,V,x,l){const d=i("v-btn"),c=i("v-data-table"),p=i("v-pagination");return g(),h("div",b,[s("h1",f,n(e.$t("completed_delivery")),1),s("div",null,[r(c,{headers:l.headers,items:e.completedDeliveries,class:"border px-4 pt-3","hide-default-footer":"","item-class":"c-pointer"},{"item.combined_order.code":o(({item:t})=>[r(d,{onClick:_=>l.openOrderDetails(t.combined_order),variant:"flat",class:"px-2 text-primary"},{default:o(()=>[u(n(t.combined_order.code),1)]),_:2},1032,["onClick"])]),"item.grand_total":o(({item:t})=>[s("span",y,n(e.format_price(t.grand_total)),1)]),"item.options":o(({item:t})=>[s("a",{onClick:_=>l.openOrderDetails(t.combined_order),class:"px-2 btn btn-soft-info btn-icon btn-circle btn-sm hov-svg-white"},C,8,D)]),_:2},1032,["headers","items"])]),s("div",k,[r(p,{modelValue:e.currentPage,"onUpdate:modelValue":[a[0]||(a[0]=t=>e.currentPage=t),l.getCompletedDeliveries],length:e.lastPage,"prev-icon":"las la-angle-left","next-icon":"las la-angle-right","total-visible":7,elevation:"0",class:"my-4"},null,8,["modelValue","onUpdate:modelValue","length"])])])}const B=m(v,[["render",w]]);export{B as default};
