File manager - Edit - /home/webapp69.cm.in.th/u69319090023/Shop23/_next/static/chunks/1kr7zfao-iijm.js
Back
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,59544,e=>{"use strict";var t=e.i(43476);e.s(["default",0,({children:e,variant:s="primary",size:r="md",isLoading:a=!1,className:l="",disabled:c,...i})=>(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"}[r]} ${l}`,disabled:c||a,...i,children:[a&&(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]})])},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)},77071,e=>{"use strict";let t=(0,e.i(56420).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],77071)},49817,e=>{"use strict";let t=(0,e.i(56420).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",0,t],49817)},73474,e=>{"use strict";let t=(0,e.i(56420).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],73474)},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)},88442,e=>{"use strict";var t=e.i(43476);let s=({className:e=""})=>(0,t.jsx)("div",{className:`animate-pulse rounded-md bg-gray-200 dark:bg-gray-700 ${e}`}),r=()=>(0,t.jsxs)("div",{className:"flex flex-col overflow-hidden bg-white shadow-card-soft rounded-premium p-4 border border-gray-100",children:[(0,t.jsx)(s,{className:"aspect-square w-full rounded-premium mb-4"}),(0,t.jsx)(s,{className:"h-4 w-1/3 mb-2"}),(0,t.jsx)(s,{className:"h-6 w-3/4 mb-3"}),(0,t.jsxs)("div",{className:"flex items-center justify-between mt-auto pt-2",children:[(0,t.jsx)(s,{className:"h-6 w-1/4"}),(0,t.jsx)(s,{className:"h-10 w-24 rounded-full"})]})]});e.s(["SkeletonProductGrid",0,({count:e=4})=>(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",children:Array.from({length:e}).map((e,s)=>(0,t.jsx)(r,{},s))}),"default",0,s])},61621,e=>{"use strict";e.s(["LocalStorageAdapter",0,class{async getItem(e){try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch(t){return console.error(`Error reading key "${e}" from LocalStorage:`,t),null}}async setItem(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(t){console.error(`Error writing key "${e}" to LocalStorage:`,t)}}async removeItem(e){try{localStorage.removeItem(e)}catch(t){console.error(`Error removing key "${e}" from LocalStorage:`,t)}}}])},86624,e=>{"use strict";let t=new(e.i(61621)).LocalStorageAdapter,s=new class{storage;constructor(e){this.storage=e}getKey(e){return`ctc_addresses_${e}`}async getAddresses(e){let t=await this.storage.getItem(this.getKey(e));if(t)return t;let s=[{id:"addr_default_1",label:"หอพักนักศึกษา (Dormitory)",fullName:"อาทิตย์ ลุงกอ",phone:"088-765-4321",address:"123 หอพักนักศึกษาวิทยาลัยเทคนิคเชียงใหม่ ถ.ห้วยแก้ว ต.ศรีภูมิ",province:"เชียงใหม่",postalCode:"50200",isDefault:!0}];return await this.saveAddresses(e,s),s}async saveAddresses(e,t){await this.storage.setItem(this.getKey(e),t)}}(t),r=new class{repository;constructor(e=s){this.repository=e}async getAddresses(e){try{let t=await this.repository.getAddresses(e);return{success:!0,data:t}}catch(e){return{success:!1,error:{code:"DATABASE_ERROR",message:e?.message||"ไม่สามารถดึงที่อยู่จัดส่งได้"}}}}async saveAddress(e,t){try{if(!t.fullName.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"กรุณากรอกชื่อผู้รับจริง"}};if(!t.phone.trim()||!/^(0\d{8,9}|0\d{1,2}-\d{3,4}-\d{3,4})$/.test(t.phone.trim()))return{success:!1,error:{code:"VALIDATION_ERROR",message:"รูปแบบเบอร์โทรศัพท์ผู้รับไม่ถูกต้อง (เช่น 0812345678 หรือ 081-234-5678)"}};if(!t.address.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"กรุณากรอกข้อมูลที่อยู่ เช่น ถนน ซอย บ้านเลขที่"}};if(!t.province.trim())return{success:!1,error:{code:"VALIDATION_ERROR",message:"กรุณากรอกจังหวัดผู้รับ"}};if(!t.postalCode.trim()||!/^\d{5}$/.test(t.postalCode.trim()))return{success:!1,error:{code:"VALIDATION_ERROR",message:"รูปแบบรหัสไปรษณีย์ไม่ถูกต้อง (ต้องประกอบด้วยตัวเลข 5 หลัก)"}};let s=await this.repository.getAddresses(e),r=[...s],a=0===s.length||t.isDefault;a&&(r=r.map(e=>({...e,isDefault:!1})));let l=s.findIndex(e=>e.id===t.id),c={...t,isDefault:a};return l>-1?r[l]=c:r.push(c),await this.repository.saveAddresses(e,r),window.dispatchEvent(new Event("storage")),{success:!0,data:c}}catch(e){return{success:!1,error:{code:"DATABASE_ERROR",message:e?.message||"ไม่สามารถบันทึกที่อยู่ลงฐานข้อมูลได้"}}}}async deleteAddress(e,t){try{let s=await this.repository.getAddresses(e),r=s.find(e=>e.id===t),a=s.filter(e=>e.id!==t);return r?.isDefault&&a.length>0&&(a[0]={...a[0],isDefault:!0}),await this.repository.saveAddresses(e,a),window.dispatchEvent(new Event("storage")),{success:!0,data:void 0}}catch(e){return{success:!1,error:{code:"DATABASE_ERROR",message:e?.message||"ไม่สามารถลบที่อยู่ออกจากฐานข้อมูลได้"}}}}async setDefaultAddress(e,t){try{let s=await this.repository.getAddresses(e);if(!s.some(e=>e.id===t))return{success:!1,error:{code:"NOT_FOUND",message:"ไม่พบรายละเอียดที่อยู่นี้ในประวัติของคุณ"}};let r=s.map(e=>({...e,isDefault:e.id===t}));return await this.repository.saveAddresses(e,r),window.dispatchEvent(new Event("storage")),{success:!0,data:void 0}}catch(e){return{success:!1,error:{code:"DATABASE_ERROR",message:e?.message||"ไม่สามารถสลับที่อยู่หลักได้"}}}}};e.s(["default",0,r],86624)},78344,e=>{"use strict";let t=(0,e.i(56420).default)("navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);e.s(["Navigation",0,t],78344)},2062,e=>{"use strict";var t=e.i(43476),s=e.i(71645),r=e.i(20865),a=e.i(77071),l=e.i(73474),c=e.i(56420);let i=(0,c.default)("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var o=e.i(89664),n=e.i(99847),d=e.i(48161),u=e.i(49817);let x=(0,c.default)("briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]),m=(0,c.default)("school",[["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M18 4.933V21",key:"tjwmp4"}],["path",{d:"m4 6 7.106-3.79a2 2 0 0 1 1.788 0L20 6",key:"zywc2d"}],["path",{d:"m6 11-3.52 2.147a1 1 0 0 0-.48.854V19a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a1 1 0 0 0-.48-.853L18 11",key:"1d4ql0"}],["path",{d:"M6 4.933V21",key:"1ufz1j"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);var h=e.i(32781),p=e.i(63676);let f=(0,c.default)("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);var g=e.i(78344),y=e.i(44779),b=e.i(86624),j=e.i(59544),v=e.i(88442);e.s(["default",0,function(){let[e,c]=(0,s.useState)(null),[N,w]=(0,s.useState)([]),[k,A]=(0,s.useState)(!0),[C,S]=(0,s.useState)(!1),[E,R]=(0,s.useState)(null),[D,M]=(0,s.useState)(!1),[$,O]=(0,s.useState)(null),[_,z]=(0,s.useState)(""),[I,L]=(0,s.useState)(""),[T,V]=(0,s.useState)(""),[B,F]=(0,s.useState)(""),[P,H]=(0,s.useState)(""),[q,K]=(0,s.useState)("Home"),[U,G]=(0,s.useState)(!1),[J,W]=(0,s.useState)(""),[X,Z]=(0,s.useState)(!1),[Q,Y]=(0,s.useState)(!1),[ee,et]=(0,s.useState)(!1),[es,er]=(0,s.useState)(""),[ea,el]=(0,s.useState)(""),[ec,ei]=(0,s.useState)(""),eo=(0,s.useRef)(null),en=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(X&&!Q){if(!document.getElementById("leaflet-css")){let e=document.createElement("link");e.id="leaflet-css",e.rel="stylesheet",e.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",document.head.appendChild(e)}if(document.getElementById("leaflet-js"))window.L&&Y(!0);else{let e=document.createElement("script");e.id="leaflet-js",e.src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",e.async=!0,e.onload=()=>{Y(!0)},document.head.appendChild(e)}}},[X,Q]);let ed=async(e,t)=>{en.current&&en.current.abort();let s=new AbortController;en.current=s,et(!0);try{let r=await fetch(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${e}&lon=${t}&accept-language=th`,{signal:s.signal});if(!r.ok)throw Error("Network error");let a=await r.json();if(a&&a.address){let e=a.address,t=(e.state||e.province||e.city||"").replace("จังหวัด","").trim(),r=e.postcode||"",l=e.road||"",c=e.subdistrict||e.suburb||e.village||e.neighbourhood||e.townland||"",i=e.district||e.city_district||e.county||e.municipality||"",o="";if(l){let e=l.startsWith("ถนน")?l.substring(3).trim():l;o+=`ถนน${e}, `}if(c){let e=t.includes("กรุงเทพ")||t.includes("Bangkok"),s=c.replace(/^(ตำบล|แขวง)/,"").trim();o+=e?`แขวง${s}, `:`ตำบล${s}, `}if(i){let e=t.includes("กรุงเทพ")||t.includes("Bangkok"),s=i.replace(/^(อำเภอ|เขต)/,"").trim();o+=e?`เขต${s}`:`อำเภอ${s}`}(o=o.replace(/,\s*$/,"").trim())||!a.display_name||(o=a.display_name.split(",").slice(0,3).join(",").trim()),en.current===s&&(er(o),el(t),ei(r))}else en.current===s&&(er(`ตำแหน่งพิกัด: ${e.toFixed(4)}, ${t.toFixed(4)}`),el(""),ei(""))}catch(r){if("AbortError"===r.name)return;console.error("Geocoding error:",r),en.current===s&&er(`ตำแหน่งพิกัด: ${e.toFixed(4)}, ${t.toFixed(4)}`)}finally{en.current===s&&et(!1)}};(0,s.useEffect)(()=>{if(X&&Q){let e=setTimeout(()=>{let e=document.getElementById("address-picker-map");if(!e||e._leaflet_id)return;let t=window.L;if(!t)return;let s=(s,r)=>{let a=t.map(e,{center:[s,r],zoom:16,zoomControl:!1});t.control.zoom({position:"bottomright"}).addTo(a),t.tileLayer("https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png",{attribution:"© OpenStreetMap contributors © CARTO",subdomains:"abcd",maxZoom:20}).addTo(a),eo.current=a;let l=async()=>{if(!eo.current)return;let e=eo.current.getCenter();await ed(e.lat,e.lng)};a.on("moveend",l),ed(s,r)};navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{s(e.coords.latitude,e.coords.longitude)},()=>{s(18.7958,98.9876)}):s(18.7958,98.9876)},150);return()=>{if(clearTimeout(e),eo.current){try{eo.current.off(),eo.current.remove()}catch(e){console.error("Error during Leaflet cleanup:",e)}eo.current=null}}}},[X,Q]);let eu=e=>{A(!0),b.default.getAddresses(e).then(e=>{e.success&&w(e.data),A(!1)})};(0,s.useEffect)(()=>{let e=y.default.getCurrentUser();e&&(c(e),eu(e.id))},[]);let ex=()=>{W(""),O(null),z(""),L(""),V(""),F(""),H(""),K("Home"),G(0===N.length),M(!0)},em=async t=>{if(t.preventDefault(),!e)return;W(""),S(!0);let s={id:$?$.id:"addr_"+Math.floor(1e5+9e5*Math.random()),label:q,fullName:_,phone:I,address:T,province:B,postalCode:P,isDefault:U},r=await b.default.saveAddress(e.id,s);r.success?(M(!1),R({message:"บันทึกที่อยู่จัดส่งเรียบร้อยแล้ว",type:"success"}),eu(e.id)):W(r.error.message),S(!1)},eh=async t=>{if(!e||!confirm("คุณแน่ใจหรือไม่ว่าต้องการลบที่อยู่จัดส่งนี้?"))return;R(null);let s=await b.default.deleteAddress(e.id,t);s.success?(R({message:"ลบที่อยู่จัดส่งเรียบร้อยแล้ว",type:"success"}),eu(e.id)):R({message:s.error.message,type:"error"})},ep=async t=>{if(!e)return;R(null);let s=await b.default.setDefaultAddress(e.id,t);s.success?(R({message:"ตั้งที่อยู่จัดส่งหลักเรียบร้อยแล้ว",type:"success"}),eu(e.id)):R({message:s.error.message,type:"error"})},ef=e=>{switch(e.toLowerCase()){case"home":case"บ้าน":case"หอพัก":case"หอพักนักศึกษา (dormitory)":return(0,t.jsx)(u.Home,{className:"w-3.5 h-3.5"});case"office":case"ที่ทำงาน":return(0,t.jsx)(x,{className:"w-3.5 h-3.5"});default:return(0,t.jsx)(m,{className:"w-3.5 h-3.5"})}};return k?(0,t.jsxs)("div",{className:"space-y-6 text-left font-prompt",children:[(0,t.jsxs)("div",{className:"border-b border-gray-100 pb-4",children:[(0,t.jsx)(v.default,{className:"h-6 w-48"}),(0,t.jsx)(v.default,{className:"h-4 w-72 mt-2"})]}),(0,t.jsx)("div",{className:"space-y-4",children:[1,2].map(e=>(0,t.jsxs)("div",{className:"border border-gray-150 rounded-2xl p-6 space-y-3 bg-gray-50/10",children:[(0,t.jsx)(v.default,{className:"h-4 w-28"}),(0,t.jsx)(v.default,{className:"h-3 w-48"}),(0,t.jsx)(v.default,{className:"h-3 w-72"})]},e))})]}):(0,t.jsxs)("div",{className:"space-y-6 text-left font-prompt",children:[(0,t.jsxs)("div",{className:"border-b border-gray-100 pb-4 flex justify-between items-center select-none",children:[(0,t.jsxs)("div",{className:"text-left",children:[(0,t.jsx)("h2",{className:"text-xl font-bold text-gray-900",children:"ที่อยู่จัดส่ง"}),(0,t.jsx)("p",{className:"text-xs text-gray-500 font-light mt-1",children:"จัดการสมุดที่อยู่จัดส่งพัสดุเสื้อผ้าของคุณเพื่อความรวดเร็วในการชำระเงิน"})]}),(0,t.jsxs)(j.default,{onClick:ex,variant:"primary",size:"sm",className:"rounded-full px-4 py-2 text-xs flex items-center space-x-1.5 shadow-md",children:[(0,t.jsx)(a.Plus,{className:"w-4 h-4"}),(0,t.jsx)("span",{children:"เพิ่มที่อยู่ใหม่"})]})]}),E&&(0,t.jsxs)("div",{className:`p-4 rounded-2xl border flex items-start space-x-2.5 text-xs ${"success"===E.type?"bg-emerald-50 text-emerald-700 border-emerald-100":"bg-red-50 text-red-700 border-red-150/40"}`,children:["success"===E.type?(0,t.jsx)(d.CheckCircle,{className:"w-5 h-5 flex-shrink-0 text-emerald-500"}):(0,t.jsx)(n.AlertCircle,{className:"w-5 h-5 flex-shrink-0 text-red-500"}),(0,t.jsx)("span",{className:"font-semibold pt-0.5 leading-normal",children:E.message})]}),(0,t.jsx)("div",{className:"space-y-4",children:N.length>0?N.map(e=>(0,t.jsxs)("div",{className:`border rounded-2xl p-5 bg-white transition-all ${e.isDefault?"border-accent shadow-sm":"border-gray-150 hover:border-gray-300"}`,children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3 select-none",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsxs)("span",{className:"inline-flex items-center space-x-1 px-2.5 py-0.5 rounded-md bg-gray-100 text-gray-600 text-[10px] font-bold",children:[ef(e.label),(0,t.jsx)("span",{children:e.label})]}),e.isDefault&&(0,t.jsxs)("span",{className:"inline-flex items-center space-x-0.5 px-2.5 py-0.5 rounded-md bg-accent/10 text-accent border border-rose-100/30 text-[10px] font-bold",children:[(0,t.jsx)(o.Check,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:"ที่อยู่หลัก"})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-1",children:[(0,t.jsx)("button",{onClick:()=>{W(""),O(e),z(e.fullName),L(e.phone),V(e.address),F(e.province),H(e.postalCode),K(e.label),G(e.isDefault),M(!0)},title:"แก้ไขที่อยู่",className:"p-1.5 hover:bg-gray-50 rounded-lg text-gray-400 hover:text-gray-700 transition-colors cursor-pointer",children:(0,t.jsx)(i,{className:"w-4 h-4"})}),(0,t.jsx)("button",{onClick:()=>eh(e.id),title:"ลบที่อยู่",className:"p-1.5 hover:bg-gray-50 rounded-lg text-gray-400 hover:text-red-500 transition-colors cursor-pointer",children:(0,t.jsx)(l.Trash2,{className:"w-4 h-4"})})]})]}),(0,t.jsxs)("div",{className:"text-left space-y-1.5 text-sm text-gray-700",children:[(0,t.jsx)("span",{className:"font-bold text-gray-900 block",children:e.fullName}),(0,t.jsx)("span",{className:"text-gray-500 font-light block",children:e.phone}),(0,t.jsxs)("span",{className:"text-gray-500 font-light block leading-relaxed",children:[e.address,", จ.",e.province," ",e.postalCode]})]}),!e.isDefault&&(0,t.jsx)("div",{className:"border-t border-gray-50 pt-3 mt-4 text-left",children:(0,t.jsx)("button",{onClick:()=>ep(e.id),className:"text-xs font-semibold text-accent hover:underline flex items-center space-x-1 cursor-pointer",children:(0,t.jsx)("span",{children:"ตั้งเป็นที่อยู่จัดส่งหลัก"})})})]},e.id)):(0,t.jsxs)("div",{className:"border border-dashed border-gray-200 rounded-3xl p-10 text-center bg-gray-50/10",children:[(0,t.jsx)(r.MapPin,{className:"w-10 h-10 text-gray-300 mx-auto mb-2"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 font-light",children:"ยังไม่มีที่อยู่จัดส่งในสมุดบัญชีของคุณ"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(j.default,{onClick:ex,variant:"secondary",size:"sm",className:"rounded-full text-xs font-bold",children:(0,t.jsx)("span",{children:"เพิ่มที่อยู่จัดส่งรายการแรก"})})})]})}),D&&(0,t.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs select-none",children:(0,t.jsxs)("div",{className:"bg-white rounded-3xl w-full max-w-lg overflow-hidden shadow-2xl flex flex-col border border-gray-100 text-left animate-in fade-in zoom-in-95 duration-200",children:[(0,t.jsxs)("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center bg-gray-50/50",children:[(0,t.jsx)("h3",{className:"text-base font-bold text-gray-900",children:$?"แก้ไขที่อยู่จัดส่ง":"เพิ่มที่อยู่จัดส่งใหม่"}),(0,t.jsx)("button",{onClick:()=>M(!1),className:"p-1.5 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded-full transition-colors cursor-pointer animate-none",children:(0,t.jsx)(p.X,{className:"w-5 h-5"})})]}),(0,t.jsxs)("form",{onSubmit:em,className:"p-6 space-y-4 overflow-y-auto max-h-[500px]",children:[J&&(0,t.jsxs)("div",{className:"p-3 bg-red-50 text-red-600 text-xs font-semibold rounded-xl border border-red-100 flex items-center space-x-2",children:[(0,t.jsx)(n.AlertCircle,{className:"w-4.5 h-4.5 flex-shrink-0"}),(0,t.jsx)("span",{children:J})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsx)("span",{className:"text-xs font-bold text-gray-700",children:"แท็กประเภทที่อยู่"}),(0,t.jsx)("div",{className:"flex space-x-2",children:["Home","Office","Dormitory"].map(e=>{let s=q===e;return(0,t.jsxs)("button",{type:"button",onClick:()=>K(e),className:`px-4 py-2 rounded-xl text-xs font-semibold flex items-center space-x-1.5 transition-all cursor-pointer ${s?"bg-accent text-white border border-accent shadow-sm":"bg-gray-50 text-gray-600 border border-gray-200 hover:bg-gray-100"}`,children:[ef(e),(0,t.jsx)("span",{children:{Home:"บ้าน",Office:"ที่ทำงาน",Dormitory:"หอพัก"}[e]||e})]},e)})})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"fullName-addr-input",className:"text-xs font-bold text-gray-700",children:"ชื่อผู้รับพัสดุ"}),(0,t.jsx)("input",{id:"fullName-addr-input",type:"text",required:!0,placeholder:"ชื่อ-นามสกุลจริงของผู้รับ...",value:_,onChange:e=>z(e.target.value),className:"w-full border border-gray-200 rounded-xl py-2.5 px-4 text-sm focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent text-gray-800"})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"phone-addr-input",className:"text-xs font-bold text-gray-700",children:"เบอร์โทรศัพท์ผู้รับ"}),(0,t.jsx)("input",{id:"phone-addr-input",type:"text",required:!0,placeholder:"081-234-5678",value:I,onChange:e=>L(e.target.value),className:"w-full border border-gray-200 rounded-xl py-2.5 px-4 text-sm focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent text-gray-800"})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsxs)("div",{className:"flex justify-between items-center select-none",children:[(0,t.jsx)("label",{htmlFor:"addressContent-input",className:"text-xs font-bold text-gray-700",children:"รายละเอียดที่อยู่"}),(0,t.jsxs)("button",{type:"button",onClick:()=>Z(!0),className:"text-[11px] font-bold text-accent hover:underline flex items-center space-x-1 cursor-pointer",children:[(0,t.jsx)(f,{className:"w-3.5 h-3.5"}),(0,t.jsx)("span",{children:"เลือกผ่านแผนที่"})]})]}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("textarea",{id:"addressContent-input",required:!0,rows:2,placeholder:"บ้านเลขที่, อาคาร, ซอย, ถนน, ตำบล/แขวง, อำเภอ...",value:T,onChange:e=>V(e.target.value),className:"w-full border border-gray-200 rounded-xl py-2.5 pr-10 pl-4 text-sm focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent text-gray-800 resize-none"}),(0,t.jsx)("button",{type:"button",onClick:()=>Z(!0),className:"absolute right-3 top-3 text-gray-400 hover:text-accent transition-colors cursor-pointer",title:"เลือกตำแหน่งจากแผนที่",children:(0,t.jsx)(r.MapPin,{className:"w-5 h-5"})})]})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"province-input",className:"text-xs font-bold text-gray-700",children:"จังหวัด"}),(0,t.jsx)("input",{id:"province-input",type:"text",required:!0,placeholder:"เช่น เชียงใหม่",value:B,onChange:e=>F(e.target.value),className:"w-full border border-gray-200 rounded-xl py-2.5 px-4 text-sm focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent text-gray-800"})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,t.jsx)("label",{htmlFor:"postalCode-input",className:"text-xs font-bold text-gray-700",children:"รหัสไปรษณีย์"}),(0,t.jsx)("input",{id:"postalCode-input",type:"text",required:!0,placeholder:"เช่น 50200",value:P,onChange:e=>H(e.target.value),className:"w-full border border-gray-200 rounded-xl py-2.5 px-4 text-sm focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent text-gray-800"})]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2 pt-2 text-left",children:[(0,t.jsx)("input",{id:"isDefault-checkbox",type:"checkbox",checked:U,disabled:$?.isDefault,onChange:e=>G(e.target.checked),className:"w-4.5 h-4.5 rounded border-gray-300 text-accent focus:ring-accent cursor-pointer"}),(0,t.jsx)("label",{htmlFor:"isDefault-checkbox",className:`text-xs font-semibold cursor-pointer ${$?.isDefault?"text-gray-400 cursor-not-allowed":"text-gray-700"}`,children:"ตั้งเป็นที่อยู่จัดส่งหลัก"})]}),(0,t.jsxs)("div",{className:"border-t border-gray-100 pt-4 flex justify-end space-x-3",children:[(0,t.jsx)(j.default,{type:"button",onClick:()=>M(!1),variant:"secondary",className:"rounded-full px-5 py-2 text-xs font-bold",children:(0,t.jsx)("span",{children:"ยกเลิก"})}),(0,t.jsx)(j.default,{type:"submit",variant:"primary",isLoading:C,className:"rounded-full px-6 py-2 text-xs font-bold shadow-md",children:(0,t.jsx)("span",{children:"บันทึกที่อยู่"})})]})]})]})}),X&&(0,t.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs select-none",children:(0,t.jsxs)("div",{className:"bg-white rounded-3xl w-full max-w-2xl overflow-hidden shadow-2xl flex flex-col border border-gray-100 text-left animate-in fade-in zoom-in-95 duration-200",children:[(0,t.jsxs)("div",{className:"p-5 border-b border-gray-100 flex justify-between items-center bg-gray-50/50",children:[(0,t.jsxs)("h3",{className:"text-base font-bold text-gray-900 flex items-center space-x-2",children:[(0,t.jsx)(f,{className:"w-5 h-5 text-accent"}),(0,t.jsx)("span",{children:"เลือกตำแหน่งจัดส่งบนแผนที่"})]}),(0,t.jsx)("button",{onClick:()=>Z(!1),className:"p-1.5 hover:bg-gray-100 text-gray-400 hover:text-gray-700 rounded-full transition-colors cursor-pointer",children:(0,t.jsx)(p.X,{className:"w-5 h-5"})})]}),(0,t.jsxs)("div",{className:"relative w-full h-[350px] md:h-[400px] bg-gray-100",children:[(0,t.jsx)("div",{id:"address-picker-map",className:"w-full h-full z-10"}),!Q&&(0,t.jsx)("div",{className:"absolute inset-0 z-30 bg-white/40 backdrop-blur-xs flex items-center justify-center pointer-events-none",children:(0,t.jsxs)("div",{className:"bg-white/95 px-4 py-3 rounded-2xl shadow-lg border border-gray-100 flex items-center space-x-2.5",children:[(0,t.jsx)(h.Loader2,{className:"w-5 h-5 animate-spin text-accent"}),(0,t.jsx)("span",{className:"text-xs font-semibold text-gray-700",children:"กำลังโหลดแผนที่..."})]})}),Q&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none z-20",children:(0,t.jsxs)("div",{className:"flex flex-col items-center -mt-8",children:[(0,t.jsx)("div",{className:"w-4 h-4 bg-accent/20 border border-accent/40 rounded-full animate-ping absolute -bottom-1"}),(0,t.jsx)(r.MapPin,{className:"w-10 h-10 text-accent filter drop-shadow-[0_4px_6px_rgba(0,0,0,0.3)] animate-bounce"})]})}),Q&&(0,t.jsx)("button",{type:"button",onClick:()=>{navigator.geolocation&&eo.current&&navigator.geolocation.getCurrentPosition(e=>{let t=e.coords.latitude,s=e.coords.longitude;eo.current.setView([t,s],16)})},className:"absolute bottom-4 left-4 z-20 p-3 bg-white hover:bg-gray-50 text-gray-700 hover:text-accent rounded-full shadow-lg border border-gray-200/60 transition-all duration-200 hover:scale-105 active:scale-95 flex items-center justify-center cursor-pointer",title:"ระบุตำแหน่งพิกัดอุปกรณ์ของคุณ",children:(0,t.jsx)(g.Navigation,{className:"w-4.5 h-4.5 fill-current"})})]}),(0,t.jsxs)("div",{className:"p-6 bg-gray-50 border-t border-gray-100 space-y-4 font-prompt",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("span",{className:"text-[10px] font-bold text-gray-400 uppercase tracking-wider block",children:"ตำแหน่งที่เลือก"}),ee?(0,t.jsxs)("div",{className:"space-y-1.5 py-1",children:[(0,t.jsx)("div",{className:"h-4 w-3/4 bg-gray-200 rounded-md animate-pulse"}),(0,t.jsx)("div",{className:"h-3.5 w-1/2 bg-gray-200 rounded-md animate-pulse"})]}):(0,t.jsx)("div",{className:"text-sm font-semibold text-gray-800 leading-relaxed min-h-[40px]",children:es?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:es}),(ea||ec)&&(0,t.jsxs)("p",{className:"text-xs text-gray-500 font-light mt-0.5",children:["จ.",ea," ",ec]})]}):(0,t.jsx)("p",{className:"text-gray-400 font-light italic",children:"เลื่อนแผนที่เพื่อเลือกตำแหน่ง..."})})]}),(0,t.jsxs)("div",{className:"flex justify-end space-x-3 pt-2",children:[(0,t.jsx)(j.default,{type:"button",onClick:()=>Z(!1),variant:"secondary",className:"rounded-full px-5 py-2 text-xs font-bold",children:(0,t.jsx)("span",{children:"ยกเลิก"})}),(0,t.jsx)(j.default,{type:"button",onClick:()=>{es&&V(es),ea&&F(ea),ec&&H(ec),Z(!1)},disabled:!Q||ee||!es,variant:"primary",className:"rounded-full px-6 py-2 text-xs font-bold shadow-md",children:(0,t.jsx)("span",{children:"ยืนยันตำแหน่ง"})})]})]})]})})]})}],2062)}]);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.25 |
proxy
|
phpinfo
|
Settings