import{_ as b,f as o,o as y,g as D,i as n,t as i,h as a,w as s,p as _}from"./app-81c86c8f.js";const $={data:()=>({cancelOrderID:null,dialog:!1,currentPage:1,lastPage:1,pendingDeliveries:[]}),computed:{headers(){return[{title:this.$i18n.t("code"),align:"start",sortable:!1,value:"code"},{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 getOnTheWayDeliveries(e){this.loading=!0;const t=await this.call_api("get",`delivery-boy/pending-deliveries?page=${e}`);t.status==200?(this.pendingDeliveries=t.data.data.data,this.lastPage=t.data.data.last_page,this.currentPage=t.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}})},async caneclRequest(){this.dialog=!1;const e=await this.call_api("post","delivery-boy/cancel-request",{order_id:this.cancelOrderID});this.snack({message:e.data.message,color:"green"}),this.getOnTheWayDeliveries()}},created(){let e=this.$route.query.page||this.currentPage;this.getOnTheWayDeliveries(e)}},k={class:"ps-lg-7 pt-4"},w={class:"fs-24 fw-700 opacity-80 mb-5 mt-3"},C={class:"d-block fw-600"},O=["onClick"],V=n("i",{class:"las la-times text-danger"},null,-1),P=[V],T=["onClick"],q=n("i",{class:"las la-bars"},null,-1),x=[q],W={class:"w-100 text-center mb-4"},B={class:"text-start"};function I(e,t,N,U,R,r){const c=o("v-btn"),g=o("v-card-title"),u=o("v-card-text"),p=o("v-card-actions"),v=o("v-card"),h=o("v-dialog"),m=o("v-data-table"),f=o("v-pagination");return y(),D("div",k,[n("h1",w,i(e.$t("pending_delivery")),1),n("div",null,[a(m,{headers:r.headers,items:e.pendingDeliveries,class:"border px-4 pt-3","hide-default-footer":"","item-class":"c-pointer"},{"item.code":s(({item:l})=>[a(c,{onClick:d=>r.openOrderDetails(l.combined_order),small:"",variant:"flat",class:"px-2 text-primary"},{default:s(()=>[_(i(l.combined_order.code),1)]),_:2},1032,["onClick"])]),"item.grand_total":s(({item:l})=>[n("span",C,i(e.format_price(l.grand_total)),1)]),"item.options":s(({item:l})=>[n("a",{onClick:d=>(e.dialog=!0,e.cancelOrderID=l.id),class:"btn btn-soft-danger btn-icon btn-circle btn-sm hov-svg-white mr-2"},P,8,O),n("a",{onClick:d=>r.openOrderDetails(l.combined_order),class:"px-2 btn btn-soft-info btn-icon btn-circle btn-sm hov-svg-white"},x,8,T),a(h,{modelValue:e.dialog,"onUpdate:modelValue":t[1]||(t[1]=d=>e.dialog=d),width:"auto"},{default:s(()=>[a(v,null,{default:s(()=>[a(g),a(u,null,{default:s(()=>[n("p",null,i(e.$t("are_you_sure_you_want_to_cancel_this_order")),1)]),_:1}),a(p,null,{default:s(()=>[n("div",W,[a(c,{class:"mx-1",color:"primary",variant:"text",onClick:r.caneclRequest},{default:s(()=>[_(i(e.$t("yes")),1)]),_:1},8,["onClick"]),a(c,{variant:"text",onClick:t[0]||(t[0]=d=>e.dialog=!1),class:"danger"},{default:s(()=>[_(i(e.$t("no")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:2},1032,["headers","items"])]),n("div",B,[a(f,{modelValue:e.currentPage,"onUpdate:modelValue":[t[2]||(t[2]=l=>e.currentPage=l),r.getOnTheWayDeliveries],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 S=b($,[["render",I]]);export{S as default};
