File manager - Edit - /home/webapp69.cm.in.th/u69319090023/Shop23/_next/static/chunks/3cq_aklv84kmc.js
Back
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,89664,e=>{"use strict";let t=(0,e.i(56420).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",0,t],89664)},99738,e=>{"use strict";let t=(0,e.i(56420).default)("shopping-cart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);e.s(["ShoppingCart",0,t],99738)},59544,e=>{"use strict";var t=e.i(43476);e.s(["default",0,({children:e,variant:s="primary",size:a="md",isLoading:r=!1,className:l="",disabled:i,...n})=>(0,t.jsxs)("button",{className:`inline-flex items-center justify-center font-semibold rounded-full transition-all duration-300 active:scale-95 focus:outline-none focus:ring-2 focus:ring-accent focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none disabled:active:scale-100 ${{primary:"bg-gradient-to-r from-primary to-secondary text-text-primary hover:from-accent hover:to-highlight shadow-luxury hover:shadow-luxury-glow hover:-translate-y-[2px]",secondary:"bg-white text-primary border border-gray-100 hover:bg-gray-50 shadow-card-soft",outline:"bg-transparent text-white border-2 border-white/20 hover:border-white hover:bg-white/10",glass:"glassmorphism text-white hover:bg-white/15 border border-white/10",danger:"bg-red-600 text-white hover:bg-red-700 shadow-sm"}[s]} ${{sm:"text-sm px-4 py-2",md:"text-base px-6 py-3",lg:"text-lg px-8 py-4"}[a]} ${l}`,disabled:i||r,...n,children:[r&&(0,t.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-current",fill:"none",viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,t.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),e]})])},39964,e=>{"use strict";var t=e.i(43476);e.s(["default",0,({variant:e="white",children:s,className:a="",...r})=>(0,t.jsx)("div",{className:`${(()=>{switch(e){case"white":return"bg-white rounded-2xl shadow-sm border border-gray-100";case"glass":return"bg-white/80 backdrop-blur-md rounded-2xl shadow-sm border border-white/20";case"glass-dark":return"bg-gray-900/80 backdrop-blur-md rounded-2xl shadow-lg border border-gray-800 text-white";case"outline":return"bg-transparent rounded-2xl border border-gray-200";default:return"bg-white rounded-2xl shadow-sm"}})()} ${a}`,...r,children:s})])},67927,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",0,t],67927)},79258,e=>{"use strict";let t=(0,e.i(56420).default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);e.s(["Package",0,t],79258)},24071,e=>{"use strict";let t=(0,e.i(56420).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],24071)},8734,e=>{"use strict";let t=(0,e.i(56420).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,t],8734)},49882,e=>{"use strict";let t=(0,e.i(56420).default)("calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);e.s(["Calendar",0,t],49882)},99847,e=>{"use strict";let t=(0,e.i(56420).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["AlertCircle",0,t],99847)},48161,e=>{"use strict";let t=(0,e.i(56420).default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);e.s(["CheckCircle",0,t],48161)},96365,e=>{"use strict";let t=class{static STORAGE_KEY="ctc_orders";static getStoredOrders(){try{let e=localStorage.getItem(this.STORAGE_KEY);return e?JSON.parse(e):[]}catch{return[]}}static saveOrders(e){try{localStorage.setItem(this.STORAGE_KEY,JSON.stringify(e))}catch(e){console.error("Failed to write orders database:",e)}}static async createOrder(e,t,s,a){let r,l="ORD-"+Math.floor(1e5+9e5*Math.random()),i="CTC-"+Math.floor(1e8+9e8*Math.random());{let e=localStorage.getItem("ctc_user");if(e)try{r=JSON.parse(e).email}catch{}}let n={id:l,items:e,totalAmount:t,status:"pending",shippingAddress:s,paymentMethod:a,trackingCode:i,createdAt:new Date().toISOString(),userEmail:r};try{let e=window.location.pathname.startsWith("/u69319090023/Shop23")?"/u69319090023/Shop23/api":"/api",t=await fetch(`${e}/orders.php`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),s=await t.json();if(s&&s.success&&s.data){let e=this.getStoredOrders();return this.saveOrders([s.data,...e]),s.data}}catch{}let d=this.getStoredOrders();return this.saveOrders([n,...d]),n}static async getOrderById(e){return new Promise(t=>{setTimeout(()=>{t(this.getStoredOrders().find(t=>t.id===e))},200)})}static async trackOrder(e){return new Promise(t=>{setTimeout(()=>{t(this.getStoredOrders().find(t=>t.trackingCode===e||t.id===e))},200)})}static async searchOrders(e){return new Promise(t=>{setTimeout(()=>{let s=this.getStoredOrders(),a=e.trim().toLowerCase();a?t(s.filter(e=>e.id.toLowerCase().includes(a)||e.shippingAddress.phone.replace(/[^0-9]/g,"").includes(a.replace(/[^0-9]/g,"")))):t([])},200)})}static async getRecentOrders(){return new Promise(e=>{setTimeout(()=>{let t;{let e=localStorage.getItem("ctc_user");if(e)try{t=JSON.parse(e).email}catch{}}let s=this.getStoredOrders();t?e(s.filter(e=>!e.userEmail||e.userEmail.toLowerCase()===t.toLowerCase())):e(s)},100)})}};e.s(["default",0,t])},10818,e=>{"use strict";let t=(0,e.i(56420).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);e.s(["Info",0,t],10818)},47925,e=>{"use strict";let t=(0,e.i(56420).default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);e.s(["Wrench",0,t],47925)},61977,e=>{"use strict";var t=e.i(43476),s=e.i(71645),a=e.i(57688),r=e.i(99738),l=e.i(99847),i=e.i(48161),n=e.i(79258),d=e.i(67363),c=e.i(89664),o=e.i(67927),x=e.i(24071),m=e.i(49882),h=e.i(63676),u=e.i(8734),p=e.i(10818),g=e.i(47925),b=e.i(75183),f=e.i(96365),y=e.i(39964),j=e.i(59544),w=e.i(46932),N=e.i(88653);function v(e,t){let s="ORDER_PLACED";if(t)s=t;else switch(e.status){case"pending":default:s="ORDER_PLACED";break;case"processing":s="PROCESSING";break;case"shipped":s="IN_TRANSIT";break;case"delivered":s="DELIVERED"}let a=new Date(e.createdAt).getTime(),r=[{status:"ORDER_PLACED",name:"สั่งซื้อสำเร็จ",location:"ร้านค้า CMTC Shop",delayMs:0,lat:18.7883,lng:98.9853},{status:"PAID",name:"ชำระเงินเรียบร้อย",location:"ร้านค้า CMTC Shop",delayMs:9e5,lat:18.7883,lng:98.9853},{status:"PROCESSING",name:"กำลังจัดเตรียมพัสดุ",location:"คลังสินค้าหลัก CMTC",delayMs:72e5,lat:18.7883,lng:98.9853},{status:"SHIPPED",name:"ส่งมอบพัสดุให้บริษัทขนส่ง",location:"คลังสินค้าหลัก CMTC",delayMs:216e5,lat:18.7883,lng:98.9853},{status:"IN_TRANSIT",name:"พัสดุอยู่ระหว่างการขนส่ง",location:"ศูนย์คัดแยกสินค้าเชียงใหม่",delayMs:432e5,lat:18.795,lng:98.98},{status:"ARRIVED_AT_SORTING_CENTER",name:"พัสดุถึงศูนย์กระจายสินค้าปลายทาง",location:"ศูนย์กระจายสินค้าปลายทาง",delayMs:648e5,lat:18.798,lng:98.989},{status:"OUT_FOR_DELIVERY",name:"พัสดุกำลังนำจ่าย",location:"ศูนย์กระจายสินค้าปลายทาง",delayMs:792e5,lat:18.798,lng:98.989},{status:"DELIVERED",name:"จัดส่งสำเร็จ",location:`บ้านของผู้รับ (จ.${e.shippingAddress.province})`,delayMs:864e5,lat:18.803,lng:98.995}],l=r.findIndex(e=>e.status===s),i=r.slice(0,l+1).map(e=>({status:e.status,name:e.name,location:e.location,timestamp:new Date(a+e.delayMs).toISOString(),lat:e.lat,lng:e.lng})),n=r[l];return{orderId:e.id,dataSource:"DEMO",isSimulated:!0,shippingProvider:"Kerry Express",trackingNumber:e.trackingCode||"CTC-635219602",status:s,origin:{name:"ร้านค้า / คลังสินค้า CMTC",lat:18.7883,lng:98.9853},latestKnownLocation:{name:n.location,lat:n.lat,lng:n.lng,updatedAt:new Date(a+n.delayMs).toISOString()},destination:{name:`ปลายทางผู้รับ (จ.${e.shippingAddress.province})`,lat:18.803,lng:98.995},progress:({ORDER_PLACED:10,PAID:20,PROCESSING:35,SHIPPED:50,IN_TRANSIT:65,ARRIVED_AT_SORTING_CENTER:80,OUT_FOR_DELIVERY:90,DELIVERED:100})[s]||0,estimatedDelivery:new Date(a+1008e5).toISOString().split("T")[0],trackingEvents:[...i].reverse()}}e.s(["default",0,function(){let e,C,E,k,R,S,D,T,I,O,A,_,P,L,F,M,$,B,V,[z,G]=(0,s.useState)([]),[H,K]=(0,s.useState)(null),[Q,U]=(0,s.useState)(!1),[Y,q]=(0,s.useState)(!1),[J,W]=(0,s.useState)(null),[X,Z]=(0,s.useState)(null);(0,s.useEffect)(()=>{W(null),Z(null)},[H]),(0,s.useEffect)(()=>{f.default.getRecentOrders().then(e=>{G(e)})},[]),(0,s.useEffect)(()=>{let e=e=>{"Escape"===e.key&&K(null)};return H&&(window.addEventListener("keydown",e),document.body.style.overflow="hidden"),()=>{window.removeEventListener("keydown",e),document.body.style.overflow="unset"}},[H]),H&&(e=>{})(H.status),r.ShoppingCart,n.Package,d.Truck,i.CheckCircle;let ee=e=>{switch(e){case"pending":return"รอดำเนินการ";case"processing":return"กำลังจัดเตรียม";case"shipped":return"จัดส่งแล้ว";case"delivered":return"นำจ่ายสำเร็จ";case"cancelled":return"ยกเลิกแล้ว";default:return""}};return(0,t.jsxs)("div",{className:"mx-auto max-w-4xl px-4 sm:px-6 lg:px-8 pt-28 pb-10",children:[(0,t.jsxs)("div",{className:"border-b border-gray-200 pb-5 mb-8 text-left",children:[(0,t.jsx)("h1",{className:"text-3xl font-extrabold text-gray-900 tracking-tight",children:"ติดตามสถานะพัสดุ"}),(0,t.jsx)("p",{className:"mt-2 text-sm text-gray-500 font-light",children:"เลือกรายการสั่งซื้อล่าสุดของคุณด้านล่างเพื่อเช็คขั้นตอนการจัดส่งและดูรายละเอียดได้ทันที"})]}),z.length>0?(0,t.jsxs)("div",{className:"text-left space-y-4",children:[(0,t.jsxs)("h2",{className:"text-lg font-bold text-gray-900 flex items-center space-x-2",children:[(0,t.jsx)(m.Calendar,{className:"w-5 h-5 text-accent"}),(0,t.jsx)("span",{children:"ประวัติการสั่งซื้อล่าสุดบนอุปกรณ์นี้"})]}),(0,t.jsx)("p",{className:"text-xs text-gray-400 font-light",children:"สามารถคลิกเลือกรายการชิ้นงานของคุณเพื่อเช็คขั้นตอนการจัดส่งและดูรายละเอียดการสั่งซื้อทั้งหมดได้ทันที"}),(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:(Q?z:z.slice(0,4)).map(e=>{let s=e.items[0],r=e.items.length-1;return(0,t.jsxs)(w.motion.button,{whileHover:{y:-4},whileTap:{scale:.98},transition:{duration:.2,ease:"easeOut"},onClick:()=>{K(e)},className:"group bg-white border border-gray-100/80 hover:border-accent/15 rounded-premium p-6 text-left shadow-card-soft hover:shadow-lg transition-all duration-200 flex flex-col justify-between cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between w-full space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-start space-x-4 flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"relative w-[76px] h-[76px] rounded-xl bg-gray-50 p-1.5 flex-shrink-0 border border-gray-100/80 shadow-sm overflow-hidden",children:s?.product.images?.[0]?(0,t.jsx)(a.default,{src:s.product.images[0],alt:s.product.name,fill:!0,className:"object-contain transition-transform duration-200 ease-out group-hover:scale-[1.025]"}):(0,t.jsx)(n.Package,{className:"w-6 h-6 text-gray-300 m-auto"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 text-left pt-0.5 space-y-1.5",children:[(0,t.jsx)("h4",{className:"text-sm md:text-[20px] font-semibold text-gray-900 leading-snug line-clamp-1",children:s?.product.name}),r>0&&(0,t.jsxs)("span",{className:"inline-block text-[11px] font-medium bg-gray-50 border border-gray-100 text-gray-500 px-2.5 py-0.5 rounded-md",children:["+ อีก ",r," รายการ"]}),(0,t.jsxs)("div",{className:"flex items-center text-xs text-gray-400 font-light space-x-1.5 mt-1",children:[(0,t.jsxs)("span",{children:["สั่งเมื่อ ",new Date(e.createdAt).toLocaleDateString("th-TH")]}),(0,t.jsx)("span",{children:"•"}),(0,t.jsxs)("span",{className:"font-normal text-gray-500",children:["#",e.id.replace("ORD-","")]})]})]})]}),(0,t.jsx)("span",{className:"text-[11px] bg-accent/10 text-accent font-semibold px-2.5 py-0.5 rounded-full flex-shrink-0 self-start",children:ee(e.status)})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center border-t border-gray-50 pt-4 mt-5 w-full",children:[(0,t.jsxs)("div",{className:"text-left",children:[(0,t.jsx)("span",{className:"text-[10px] text-gray-400 font-light block mb-0.5",children:"ยอดชำระสุทธิ"}),(0,t.jsxs)("span",{className:"text-base md:text-[22px] font-bold text-accent",children:["฿",e.totalAmount.toLocaleString()]})]}),(0,t.jsxs)("div",{className:"text-right flex items-center text-xs font-semibold text-accent group-hover:text-accent/80 transition-colors",children:[(0,t.jsx)("span",{children:"ดูรายละเอียด"}),(0,t.jsx)(o.ChevronRight,{className:"w-3.5 h-3.5 ml-0.5 transition-transform duration-200 ease-out group-hover:translate-x-1"})]})]})]},e.id)})}),z.length>4&&(0,t.jsx)("div",{className:"flex justify-center pt-3",children:(0,t.jsx)(j.default,{type:"button",variant:"secondary",onClick:()=>U(!Q),className:"rounded-full px-6 py-2.5 text-xs font-bold",children:Q?"แสดงน้อยลง":`แสดงประวัติทั้งหมด (${z.length} รายการ)`})})]}):(0,t.jsxs)(y.default,{variant:"white",className:"p-8 text-center bg-white border border-gray-100 shadow-card-soft",children:[(0,t.jsx)(l.AlertCircle,{className:"w-10 h-10 text-gray-300 mx-auto mb-3"}),(0,t.jsx)("h3",{className:"text-sm font-bold text-gray-700",children:"ไม่พบประวัติการสั่งซื้อบนอุปกรณ์นี้"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-1",children:"ประวัติการสั่งซื้อของคุณจะถูกบันทึกที่นี่โดยอัตโนมัติเมื่อทำรายการสั่งซื้อเสร็จสิ้น"})]}),(0,t.jsx)(N.AnimatePresence,{children:H&&(e=v(H,J),C=null!==X?e.trackingEvents[X]:null,E=e=>(e-98.975)/.023000000000010346*100,k=e=>100-(e-18.785)/.019999999999999574*100,R=e=>{switch(e){case"ORDER_PLACED":case"PAID":default:return 0;case"PROCESSING":return 1;case"SHIPPED":case"IN_TRANSIT":case"ARRIVED_AT_SORTING_CENTER":case"OUT_FOR_DELIVERY":return 2;case"DELIVERED":return 3}},S=e=>{switch(e){case"ORDER_PLACED":case"PAID":case"PROCESSING":case"SHIPPED":default:return"shop";case"IN_TRANSIT":return"sorting";case"ARRIVED_AT_SORTING_CENTER":case"OUT_FOR_DELIVERY":return"distribution";case"DELIVERED":return"recipient"}},D=E(e.origin.lng),T=k(e.origin.lat),I=E(e.destination.lng),O=k(e.destination.lat),A=E(e.latestKnownLocation.lng),_=k(e.latestKnownLocation.lat),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>K(null),className:"fixed inset-0 bg-black/40 z-40"}),(0,t.jsxs)(w.motion.div,{role:"dialog","aria-modal":"true","aria-label":"รายละเอียดคำสั่งซื้อ",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:200},className:"fixed top-0 right-0 h-full w-full sm:w-[600px] md:w-[720px] lg:w-[840px] bg-[#FAF8F5] z-50 shadow-2xl flex flex-col focus:outline-none",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-100/60 bg-white",children:[(0,t.jsxs)("button",{onClick:()=>K(null),className:"flex items-center text-[15px] font-bold text-gray-700 hover:text-gray-900 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent rounded px-1 py-0.5",children:[(0,t.jsx)(x.ChevronLeft,{className:"w-5 h-5 mr-1"}),(0,t.jsx)("span",{children:"รายละเอียดคำสั่งซื้อ"})]}),(0,t.jsx)("button",{onClick:()=>K(null),className:"p-1.5 text-gray-400 hover:text-gray-900 hover:bg-gray-50 rounded-full transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-accent","aria-label":"Close details",children:(0,t.jsx)(h.X,{className:"w-5 h-5"})})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-6 space-y-6 bg-[#FAF8F5]",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"คำสั่งซื้อและสินค้า"}),(0,t.jsxs)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-4 shadow-sm flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-4 flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"relative w-16 h-16 rounded-xl bg-gray-50 p-1 flex-shrink-0 border border-gray-100 overflow-hidden shadow-xs",children:H.items[0]?.product.images?.[0]?(0,t.jsx)(a.default,{src:H.items[0].product.images[0],alt:H.items[0].product.name,fill:!0,className:"object-contain"}):(0,t.jsx)(n.Package,{className:"w-8 h-8 text-gray-300 m-auto"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,t.jsx)("h3",{className:"font-bold text-gray-900 text-[18px] leading-snug line-clamp-1",children:H.items[0]?.product.name}),H.items.length>1&&(0,t.jsxs)("p",{className:"text-xs text-gray-400 font-medium mt-0.5",children:["+ อีก ",H.items.length-1," รายการ"]}),(0,t.jsx)("span",{className:"inline-block mt-2 text-xs bg-[#FFF1F2] text-[#B91C1C] font-bold px-3 py-1 rounded-full border border-rose-100/50",children:ee(H.status)})]})]}),(0,t.jsx)("div",{className:"flex sm:items-center sm:space-x-4 w-full sm:w-auto border-t sm:border-t-0 sm:border-l border-gray-100 pt-3 sm:pt-0 sm:pl-4 text-xs text-gray-600 flex-col sm:flex-row gap-1.5 justify-end",children:(0,t.jsxs)("div",{className:"text-left space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-1.5 text-gray-500",children:[(0,t.jsx)("span",{children:"สั่งซื้อเมื่อ:"}),(0,t.jsxs)("span",{className:"font-semibold text-gray-800",children:[new Date(H.createdAt).toLocaleDateString("th-TH")," ",new Date(H.createdAt).toLocaleTimeString("th-TH",{hour:"2-digit",minute:"2-digit",hour12:!1})," น."]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1.5 text-gray-500",children:[(0,t.jsx)("span",{children:"คาดว่าจะถึง:"}),(0,t.jsx)("span",{className:"font-semibold text-gray-800",children:new Date(e.estimatedDelivery).toLocaleDateString("th-TH")})]})]})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"ขั้นตอนการจัดส่ง"}),(0,t.jsx)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-5 shadow-sm",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-6",children:[(0,t.jsx)("div",{className:"md:col-span-5 flex flex-col pr-0 md:pr-4",children:(0,t.jsxs)("div",{className:"relative flex flex-col h-full justify-between py-2 space-y-8 pl-5",children:[(0,t.jsx)("div",{className:"absolute left-[38px] top-6 bottom-6 w-0.5 bg-gray-200 -z-0"}),(0,t.jsx)("div",{className:"absolute left-[38px] top-6 w-0.5 bg-[#B91C1C] transition-all duration-500 -z-0",style:{height:`${0===R(e.status)?"0%":1===R(e.status)?"33%":2===R(e.status)?"66%":3===R(e.status)?"100%":"0%"}`}}),[{key:"ORDER_PLACED",label:"คำสั่งซื้อสำเร็จ",icon:(0,t.jsx)(c.Check,{className:"w-3.5 h-3.5"}),statuses:["ORDER_PLACED","PAID"]},{key:"PROCESSING",label:"ร้านค้าเตรียมสินค้า",icon:(0,t.jsx)(b.Store,{className:"w-3.5 h-3.5"}),statuses:["PROCESSING"]},{key:"SHIPPED",label:"จัดส่งสำเร็จ",icon:(0,t.jsx)(d.Truck,{className:"w-3.5 h-3.5"}),statuses:["SHIPPED","IN_TRANSIT","ARRIVED_AT_SORTING_CENTER","OUT_FOR_DELIVERY"]},{key:"DELIVERED",label:"ผู้รับได้รับสินค้า",icon:(0,t.jsx)(c.Check,{className:"w-3.5 h-3.5"}),statuses:["DELIVERED"]}].map((s,a)=>{let r=R(e.status),l=a<=r,i=e.trackingEvents.find(e=>s.statuses.includes(e.status)),n=i?new Date(i.timestamp).toLocaleTimeString("th-TH",{hour:"2-digit",minute:"2-digit",hour12:!1})+" น.":null;return(0,t.jsxs)("div",{className:"relative z-10 flex items-start space-x-4",children:[a===r&&(0,t.jsx)("div",{className:"absolute left-[-20px] top-[10px] text-[#B91C1C] flex items-center justify-center animate-pulse",children:(0,t.jsx)(o.ChevronRight,{className:"w-4 h-4 stroke-[3]"})}),(0,t.jsx)("div",{className:`w-9 h-9 rounded-full flex items-center justify-center border-2 shadow-xs transition-all duration-300 ${l?"bg-[#B91C1C] border-[#B91C1C] text-white":"bg-white border-gray-300 text-gray-400"}`,children:s.icon}),(0,t.jsxs)("div",{className:"flex-1 text-left pt-1",children:[(0,t.jsx)("h5",{className:`text-sm font-bold transition-colors ${l?"text-gray-900":"text-gray-400 font-medium"}`,children:s.label}),n&&(0,t.jsx)("p",{className:"text-[11px] text-gray-500 font-light mt-0.5",children:n})]})]},s.key)})]})}),(0,t.jsxs)("div",{className:"md:col-span-7 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-1.5 text-left",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-gray-800",children:"ความคืบหน้าการจัดส่ง"}),(0,t.jsxs)("span",{className:"bg-[#FFF1F2] text-[#B91C1C] text-xs px-2.5 py-0.5 rounded-lg font-extrabold shadow-2xs border border-rose-100/50",children:[e.progress,"%"]})]}),(0,t.jsx)("div",{className:"w-full h-2 bg-gray-100 rounded-full overflow-hidden shadow-inner",children:(0,t.jsx)("div",{className:"h-full bg-[#B91C1C] rounded-full transition-all duration-1000 ease-out",style:{width:`${e.progress}%`}})})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center text-left pt-1",children:[(0,t.jsx)("h5",{className:"font-bold text-gray-855 text-xs",children:"แผนที่ติดตามพัสดุ"}),(0,t.jsxs)("span",{className:"text-[10px] text-amber-800 bg-[#FEF3C7] px-2.5 py-0.5 rounded-full font-semibold flex items-center shadow-3xs border border-amber-200/40",children:[(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 mr-1.5 animate-pulse"}),"ข้อมูลจำลองสำหรับการสาธิตระบบ"]})]}),(0,t.jsxs)("div",{className:"relative w-full h-[200px] rounded-2xl bg-[#F8F6F2] border border-gray-200/80 overflow-hidden shadow-inner flex flex-col justify-between p-3 select-none",children:[(0,t.jsxs)("div",{className:"absolute inset-0 opacity-15 pointer-events-none",children:[(0,t.jsx)("div",{className:"absolute top-1/4 left-0 right-0 h-[1px] bg-slate-600"}),(0,t.jsx)("div",{className:"absolute top-2/3 left-0 right-0 h-[1px] bg-slate-600"}),(0,t.jsx)("div",{className:"absolute top-0 bottom-0 left-1/3 w-[1px] bg-slate-600"}),(0,t.jsx)("div",{className:"absolute top-0 bottom-0 left-3/4 w-[1px] bg-slate-600"}),(0,t.jsx)("svg",{className:"w-full h-full text-blue-400 opacity-40 fill-none stroke-current stroke-[6]",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:(0,t.jsx)("path",{d:"M 50,0 Q 60,25 45,50 T 55,100"})})]}),(0,t.jsxs)("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:[(0,t.jsx)("path",{d:"M 45,84 Q 30,67 22,50 Q 40,42 61,35 Q 74,22 87,10",className:"stroke-gray-300 stroke-[3.5] fill-none",strokeDasharray:"4,4"}),(0,t.jsx)("path",{d:(()=>{switch(e.status){case"ORDER_PLACED":case"PAID":case"PROCESSING":case"SHIPPED":default:return"M 45,84";case"IN_TRANSIT":return"M 45,84 Q 30,67 22,50";case"ARRIVED_AT_SORTING_CENTER":case"OUT_FOR_DELIVERY":return"M 45,84 Q 30,67 22,50 Q 40,42 61,35";case"DELIVERED":return"M 45,84 Q 30,67 22,50 Q 40,42 61,35 Q 74,22 87,10"}})(),className:"stroke-[#B91C1C] stroke-[3.5] fill-none transition-all duration-1000",strokeLinecap:"round"})]}),(P="shop"===S(e.status),(0,t.jsxs)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 flex flex-col items-center z-10",style:{left:`${D}%`,top:`${T}%`},children:[P?(0,t.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-7 h-7 bg-[#B91C1C] rounded-full flex items-center justify-center text-white border border-white shadow-md",children:(0,t.jsx)(b.Store,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-0 h-0 border-l-[4px] border-l-transparent border-r-[4px] border-r-transparent border-t-[6px] border-t-[#B91C1C] -mt-0.5 shadow-xs"})]}):(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-white border border-gray-300 flex items-center justify-center text-gray-400 shadow-2xs",children:(0,t.jsx)(b.Store,{className:"w-3 h-3"})}),(0,t.jsx)("span",{className:`text-[8px] font-bold mt-1 px-1.5 py-0.5 rounded border leading-none bg-white/90 backdrop-blur-[1px] ${P?"text-[#B91C1C] border-rose-100":"text-gray-500 border-gray-100"}`,children:"ร้านค้า"})]})),(L="sorting"===S(e.status),(0,t.jsxs)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 flex flex-col items-center z-10",style:{left:"22%",top:"50%"},children:[L?(0,t.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-7 h-7 bg-[#B91C1C] rounded-full flex items-center justify-center text-white border border-white shadow-md",children:(0,t.jsx)(n.Package,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-0 h-0 border-l-[4px] border-l-transparent border-r-[4px] border-r-transparent border-t-[6px] border-t-[#B91C1C] -mt-0.5 shadow-xs"})]}):(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-white border border-gray-300 flex items-center justify-center text-gray-400 shadow-2xs",children:(0,t.jsx)(n.Package,{className:"w-3 h-3"})}),(0,t.jsx)("span",{className:`text-[8px] font-bold mt-1 px-1.5 py-0.5 rounded border leading-none bg-white/90 backdrop-blur-[1px] ${L?"text-[#B91C1C] border-rose-100":"text-gray-500 border-gray-100"}`,children:"ศูนย์คัดแยก"})]})),(F="distribution"===S(e.status),(0,t.jsxs)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 flex flex-col items-center z-10",style:{left:"61%",top:"35%"},children:[F?(0,t.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-7 h-7 bg-[#B91C1C] rounded-full flex items-center justify-center text-white border border-white shadow-md",children:(0,t.jsx)(d.Truck,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("div",{className:"w-0 h-0 border-l-[4px] border-l-transparent border-r-[4px] border-r-transparent border-t-[6px] border-t-[#B91C1C] -mt-0.5 shadow-xs"})]}):(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-white border border-gray-300 flex items-center justify-center text-gray-400 shadow-2xs",children:(0,t.jsx)(d.Truck,{className:"w-3 h-3"})}),(0,t.jsx)("span",{className:`text-[8px] font-bold mt-1 px-1.5 py-0.5 rounded border leading-none bg-white/90 backdrop-blur-[1px] ${F?"text-[#B91C1C] border-rose-100":"text-gray-500 border-gray-100"}`,children:"ศูนย์กระจาย"})]})),(M="recipient"===S(e.status),(0,t.jsxs)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 flex flex-col items-center z-10",style:{left:`${I}%`,top:`${O}%`},children:[M?(0,t.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,t.jsx)("div",{className:"w-7 h-7 bg-emerald-500 rounded-full flex items-center justify-center text-white border border-white shadow-md",children:(0,t.jsx)(c.Check,{className:"w-3.5 h-3.5 stroke-[3]"})}),(0,t.jsx)("div",{className:"w-0 h-0 border-l-[4px] border-l-transparent border-r-[4px] border-r-transparent border-t-[6px] border-t-emerald-500 -mt-0.5 shadow-xs"})]}):(0,t.jsx)("div",{className:"w-6 h-6 rounded-full bg-white border border-gray-300 flex items-center justify-center text-gray-400 shadow-2xs",children:(0,t.jsx)(c.Check,{className:"w-3.5 h-3.5"})}),(0,t.jsx)("span",{className:`text-[8px] font-bold mt-1 px-1.5 py-0.5 rounded border leading-none bg-white/90 backdrop-blur-[1px] ${M?"text-emerald-500 border-emerald-100":"text-gray-500 border-gray-100"}`,children:"ผู้รับ"})]})),C&&(0,t.jsx)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 z-30",style:{left:`${E(C.lng)}%`,top:`${k(C.lat)}%`},children:(0,t.jsxs)("span",{className:"flex h-7 w-7 relative",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-500 opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-7 w-7 bg-transparent border-2 border-amber-500 shadow-md"})]})}),e.progress<100&&!S(e.status)&&(0,t.jsx)("div",{className:"absolute -translate-x-1/2 -translate-y-1/2 z-20 transition-all duration-1000",style:{left:`${A}%`,top:`${_}%`},children:(0,t.jsxs)("span",{className:"flex h-4.5 w-4.5 relative",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-[#B91C1C] opacity-75"}),(0,t.jsx)("span",{className:"relative inline-flex rounded-full h-4.5 w-4.5 bg-[#B91C1C] border border-white shadow-md flex items-center justify-center",children:(0,t.jsx)("span",{className:"w-1.5 h-1.5 bg-white rounded-full animate-pulse"})})]})})]})]})]})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"ข้อมูลการจัดส่ง"}),(0,t.jsx)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-5 shadow-sm text-left",children:H.trackingCode?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-y-2.5 text-sm",children:[(0,t.jsx)("span",{className:"text-gray-500 font-medium",children:"บริษัทขนส่ง:"}),(0,t.jsx)("span",{className:"font-bold text-gray-800 text-right",children:"Kerry Express"}),(0,t.jsx)("span",{className:"text-gray-500 font-medium pt-1",children:"เลขพัสดุ:"}),(0,t.jsx)("span",{className:"font-bold text-[#B91C1C] text-right pt-1",children:H.trackingCode})]}),(0,t.jsxs)(j.default,{type:"button",variant:"secondary",onClick:()=>{var e;return e=H.trackingCode,void("u">typeof navigator&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{q(!0),setTimeout(()=>q(!1),2e3)}))},className:"w-full py-2.5 text-xs font-bold rounded-xl border border-gray-200 hover:bg-gray-50 flex items-center justify-center space-x-1.5 cursor-pointer mt-2",children:[(0,t.jsx)(u.Copy,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:Y?"คัดลอกแล้ว!":"คัดลอกเลขพัสดุ"})]})]}):(0,t.jsx)("p",{className:"text-xs text-gray-400 font-light text-center py-2",children:"เลขพัสดุจะแสดงเมื่อคำสั่งซื้อถูกจัดส่งแล้ว"})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"รายละเอียดคำสั่งซื้อ"}),(0,t.jsxs)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-5 shadow-sm text-left text-xs space-y-3.5 text-gray-600",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-500 font-medium",children:"หมายเลขคำสั่งซื้อ:"}),(0,t.jsxs)("span",{className:"font-bold text-gray-800",children:["#",H.id.replace("ORD-","")]})]}),(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsx)("span",{className:"text-gray-500 font-medium",children:"วันที่สั่งซื้อ:"}),(0,t.jsxs)("span",{className:"font-bold text-gray-800",children:[new Date(H.createdAt).toLocaleDateString("th-TH")," ",new Date(H.createdAt).toLocaleTimeString("th-TH",{hour:"2-digit",minute:"2-digit",hour12:!1})," น."]})]}),(0,t.jsxs)("div",{className:"border-t border-gray-100 pt-3 flex flex-col space-y-1.5",children:[(0,t.jsx)("span",{className:"text-gray-500 font-medium",children:"ที่อยู่จัดส่ง:"}),(0,t.jsxs)("span",{className:"font-semibold text-gray-800 leading-relaxed bg-[#FAF8F5]/80 p-3 rounded-xl border border-[#F3F1ED]",children:[H.shippingAddress.fullName," • ",H.shippingAddress.phone,(0,t.jsx)("br",{}),H.shippingAddress.address,", ",H.shippingAddress.province,", ",H.shippingAddress.postalCode]})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"รายการสินค้า"}),(0,t.jsx)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-2 shadow-sm text-left divide-y divide-gray-100/70 overflow-hidden",children:H.items.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-center space-x-4 p-3 text-xs",children:[(0,t.jsx)("div",{className:"relative w-12 h-12 rounded-xl bg-gray-50 p-1 flex-shrink-0 border border-gray-100 overflow-hidden",children:e.product.images?.[0]?(0,t.jsx)(a.default,{src:e.product.images[0],alt:e.product.name,fill:!0,className:"object-contain"}):(0,t.jsx)(n.Package,{className:"w-5 h-5 text-gray-300 m-auto"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,t.jsx)("span",{className:"font-bold text-gray-800 block truncate text-[13px]",children:e.product.name}),(0,t.jsxs)("span",{className:"text-[10px] text-gray-400 block mt-0.5 font-medium",children:["ไซส์: ",e.selectedSize," × ",e.quantity]})]}),(0,t.jsxs)("span",{className:"font-bold text-[#B91C1C] text-sm",children:["฿",(e.product.price*e.quantity).toLocaleString()]})]},`${e.product.id}-${e.selectedSize}-${s}`))})]}),(B=($=H.items.reduce((e,t)=>e+t.product.price*t.quantity,0))>1e3||0===$?0:50,V=Math.max(0,$+B-H.totalAmount),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h4",{className:"font-bold text-gray-800 text-sm tracking-wide text-left",children:"สรุปยอดชำระ"}),(0,t.jsxs)("div",{className:"bg-white rounded-2xl border border-[#F3F1ED] p-5 shadow-sm text-left text-xs space-y-3",children:[(0,t.jsxs)("div",{className:"flex justify-between text-gray-500 font-medium",children:[(0,t.jsx)("span",{children:"ยอดรวมสินค้า:"}),(0,t.jsxs)("span",{className:"font-semibold text-gray-800",children:["฿",$.toLocaleString()]})]}),(0,t.jsxs)("div",{className:"flex justify-between text-gray-500 font-medium items-center",children:[(0,t.jsx)("span",{children:"ค่าจัดส่ง:"}),0===B?(0,t.jsx)("span",{className:"text-emerald-650 font-bold bg-emerald-50 px-2.5 py-0.5 rounded-full text-[10px] border border-emerald-100/50",children:"ฟรี"}):(0,t.jsxs)("span",{className:"font-semibold text-gray-800",children:["฿",B.toLocaleString()]})]}),V>0&&(0,t.jsxs)("div",{className:"flex justify-between text-emerald-600 font-medium",children:[(0,t.jsx)("span",{children:"ส่วนลดคูปอง:"}),(0,t.jsxs)("span",{className:"font-bold",children:["-฿",V.toLocaleString()]})]}),(0,t.jsxs)("div",{className:"flex justify-between text-sm font-extrabold text-gray-900 border-t border-gray-100 pt-3",children:[(0,t.jsx)("span",{children:"ยอดชำระสุทธิ:"}),(0,t.jsxs)("span",{className:"text-[#B91C1C] text-lg font-black",children:["฿",H.totalAmount.toLocaleString()]})]})]})]})),(0,t.jsx)("div",{className:"border-t border-dashed border-gray-200/80 pt-5 text-left pb-2",children:(0,t.jsxs)("div",{className:"bg-[#FEF3C7]/40 border border-amber-250/30 rounded-2xl p-5 space-y-3",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(g.Wrench,{className:"w-4.5 h-4.5 text-amber-700"}),(0,t.jsx)("h5",{className:"font-extrabold text-gray-800 text-xs uppercase tracking-wider",children:"ตัวควบคุมจำลองสถานะพัสดุ (สำหรับทดสอบ)"})]}),(0,t.jsxs)("div",{className:"text-[10px] text-gray-600 flex items-start space-x-2 leading-relaxed font-medium",children:[(0,t.jsx)(p.Info,{className:"w-4 h-4 text-amber-600 flex-shrink-0 mt-0.5"}),(0,t.jsx)("span",{children:"แถบนี้เป็นฟีเจอร์สำหรับทดสอบระบบ UX เท่านั้น จะถูกปิดใช้งานในการผลิตจริง คุณสามารถคลิกสถานะต่างๆ เพื่อจำลองการแสดงพิกัดบนแผนที่และไทม์ไลน์"})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 pt-1",children:[{status:"ORDER_PLACED",label:"1. สั่งซื้อพัสดุ"},{status:"PAID",label:"2. ชำระเงินแล้ว"},{status:"PROCESSING",label:"3. เตรียมพัสดุ"},{status:"SHIPPED",label:"4. ส่งมอบขนส่ง"},{status:"IN_TRANSIT",label:"5. เริ่มขนส่ง"},{status:"ARRIVED_AT_SORTING_CENTER",label:"6. ถึงศูนย์ปลายทาง"},{status:"OUT_FOR_DELIVERY",label:"7. กำลังนำจ่าย"},{status:"DELIVERED",label:"8. นำจ่ายสำเร็จ"}].map(s=>(0,t.jsx)("button",{onClick:()=>{W(s.status),Z(null)},className:`text-[10px] py-1.5 px-2 rounded-lg font-semibold border transition-all text-center focus:outline-none focus:ring-1 focus:ring-accent cursor-pointer ${(J||e.status)===s.status?"bg-accent text-white border-accent shadow-xs":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,children:s.label},s.status))})]})})]})]})]}))})]})},"getSimulatedTrackingData",0,v])}]);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings