import{_ as y,f as n,o as k,g as D,i,t as d,h as s,w as l,p as _}from"./app-e7b909c6.js";const $={data:()=>({cancelOrderID:null,dialog:!1,currentPage:1,lastPage:1,assignedDeliveries:[]}),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("pickup"),sortable:!1,align:"center",value:"pickup"},{title:this.$i18n.t("options"),sortable:!1,align:"center",value:"options"}]}},methods:{async getAssignedDeliveries(e){this.loading=!0;const t=await this.call_api("get",`delivery-boy/assigned-deliveries?page=${e}`);t.status==200?(this.assignedDeliveries=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:"picked_up",order_id:e});this.snack({message:t.data.message,color:"green"}),this.getAssignedDeliveries()},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.getAssignedDeliveries()}},created(){let e=this.$route.query.page||this.currentPage;this.getAssignedDeliveries(e)}},w={class:"ps-lg-7 pt-4"},C={class:"fs-21 fw-700 opacity-80 mb-5"},V={class:"d-block fw-600"},O=["onClick"],P=i("i",{class:"las la-times text-danger"},null,-1),A=[P],x=["onClick"],q=i("i",{class:"las la-bars"},null,-1),B=[q],I={class:"w-100 text-center mb-4"},N={class:"text-start"};function S(e,t,U,R,E,o){const c=n("v-btn"),u=n("v-switch"),g=n("v-card-title"),p=n("v-card-text"),v=n("v-card-actions"),m=n("v-card"),h=n("v-dialog"),f=n("v-data-table"),b=n("v-pagination");return k(),D("div",w,[i("h1",C,d(e.$t("assigned_delivery")),1),i("div",null,[s(f,{"loading-text":e.$t("loading_please_wait"),headers:o.headers,items:e.assignedDeliveries,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",V,d(e.format_price(a.grand_total)),1)]),"item.pickup":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"},A,8,O),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(h,{modelValue:e.dialog,"onUpdate:modelValue":t[1]||(t[1]=r=>e.dialog=r),width:"auto"},{default:l(()=>[s(m,null,{default:l(()=>[s(g),s(p,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,["loading-text","headers","items"])]),i("div",N,[s(b,{modelValue:e.currentPage,"onUpdate:modelValue":[t[2]||(t[2]=a=>e.currentPage=a),o.getAssignedDeliveries],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 j=y($,[["render",S]]);export{j as default};
