import{r as g,o as h,a as r,b as a,d as e,f as m,g as k,w,h as D,t as l,F as I,j,y as _,m as i,k as B,D as O}from"./app-kAt5lVqd.js";const T={class:"min-h-screen bg-gray-50"},C={class:"bg-white shadow"},L={class:"max-w-7xl mx-auto px-4 py-4"},N={key:0,class:"text-center py-12"},V={key:1,class:"max-w-4xl mx-auto px-4 py-8"},E={class:"text-3xl font-bold mb-8"},P={class:"bg-white rounded-lg shadow p-6 mb-6"},S={class:"flex items-center justify-between mb-8"},A={class:"flex items-center"},F={class:"text-sm mt-2 text-center"},R={class:"border-t pt-6"},z={class:"space-y-2 text-sm"},M={class:"text-green-600"},U={key:0},W={class:"bg-white rounded-lg shadow p-6"},$={class:"space-y-3"},q={class:"flex items-start gap-3"},G={class:"text-sm text-gray-600"},H={class:"flex items-start gap-3"},J={class:"text-sm text-gray-600"},X={__name:"OrderTracking",setup(K){const b=O(),s=g(null),p=g(!0),u=[{label:"Order Placed",status:"pending"},{label:"Accepted",status:"accepted"},{label:"Picked Up",status:"picked_up"},{label:"On the Way",status:"on_the_way"},{label:"Delivered",status:"delivered"}],f=async()=>{try{const o=await B.get(`/orders/${b.params.id}/track`);s.value=o.data}catch(o){console.error("Error:",o)}finally{p.value=!1}},x=o=>{const t=u.findIndex(n=>{var d;return n.status===((d=s.value)==null?void 0:d.status)});return u.findIndex(n=>n.status===o.status)<=t};return h(f),(o,t)=>{var n,d;const y=D("router-link");return a(),r("div",T,[e("nav",C,[e("div",L,[k(y,{to:"/orders",class:"text-red-600 hover:underline"},{default:w(()=>[...t[0]||(t[0]=[i("← Back to Orders",-1)])]),_:1})])]),p.value?(a(),r("div",N,"Loading...")):s.value?(a(),r("div",V,[e("h1",E,"Track Order #"+l((n=s.value.order)==null?void 0:n.order_number),1),e("div",P,[e("div",S,[(a(),r(I,null,j(u,(c,v)=>e("div",{key:v,class:"flex-1"},[e("div",A,[e("div",{class:_([x(c)?"bg-green-500":"bg-gray-300","w-10 h-10 rounded-full flex items-center justify-center text-white font-bold"])},l(v+1),3),v<u.length-1?(a(),r("div",{key:0,class:_([x(c)?"bg-green-500":"bg-gray-300","flex-1 h-1 mx-2"])},null,2)):m("",!0)]),e("div",F,l(c.label),1)])),64))]),e("div",R,[t[6]||(t[6]=e("h3",{class:"font-bold mb-4"},"Delivery Information",-1)),e("div",z,[e("p",null,[t[1]||(t[1]=e("strong",null,"Status:",-1)),t[2]||(t[2]=i()),e("span",M,l(s.value.status),1)]),e("p",null,[t[3]||(t[3]=e("strong",null,"Distance:",-1)),i(" "+l(s.value.distance_km)+" km",1)]),e("p",null,[t[4]||(t[4]=e("strong",null,"Estimated Time:",-1)),i(" "+l(s.value.estimated_time)+" minutes",1)]),s.value.delivery_boy?(a(),r("p",U,[t[5]||(t[5]=e("strong",null,"Delivery Boy:",-1)),i(" "+l((d=s.value.delivery_boy.user)==null?void 0:d.name),1)])):m("",!0)])])]),e("div",W,[t[12]||(t[12]=e("h3",{class:"font-bold mb-4"},"Delivery Route",-1)),e("div",$,[e("div",q,[t[8]||(t[8]=e("div",{class:"w-8 h-8 bg-blue-500 rounded-full flex items-center justify-center text-white"},"📍",-1)),e("div",null,[t[7]||(t[7]=e("div",{class:"font-medium"},"Pickup Location",-1)),e("div",G,l(s.value.pickup_address),1)])]),t[11]||(t[11]=e("div",{class:"ml-4 border-l-2 border-dashed h-8"},null,-1)),e("div",H,[t[10]||(t[10]=e("div",{class:"w-8 h-8 bg-red-500 rounded-full flex items-center justify-center text-white"},"🏠",-1)),e("div",null,[t[9]||(t[9]=e("div",{class:"font-medium"},"Delivery Location",-1)),e("div",J,l(s.value.delivery_address),1)])])])])])):m("",!0)])}}};export{X as default};
