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