(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7980],{4144:function(e,s,a){Promise.resolve().then(a.bind(a,3961))},3961:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return u}});var n=a(7437),r=a(2265),t=a(9376),d=a(8706);function u(){let e=(0,d.T)(),s=(0,t.useRouter)(),[a,u]=(0,r.useState)([]),[i,l]=(0,r.useState)(null),[o,c]=(0,r.useState)(!0);return((0,r.useEffect)(()=>{fetch("/api/customers/0/addresses").then(e=>e.json()).then(e=>{if(e.success){let s=e.data||[];u(s);let a=s.find(e=>e.primary);a?l(a.id):s.length>0&&l(s[0].id)}}).finally(()=>c(!1))},[]),o)?(0,n.jsx)("div",{className:"text-gray-500",children:e("loading",{defaultValue:"Duke ngarkuar..."})}):(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold mb-6",children:e("select_address",{defaultValue:"Zgjidh Adresen e Dergeses"})}),(0,n.jsx)("div",{className:"space-y-3 mb-6",children:a.map(e=>(0,n.jsx)("label",{className:"block bg-white rounded-xl p-4 shadow-sm cursor-pointer border-2 transition-all ".concat(i===e.id?"border-orange-500":"border-transparent"),children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("input",{type:"radio",name:"address",checked:i===e.id,onChange:()=>l(e.id),className:"accent-orange-500"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-medium",children:e.address}),e.addressdetails&&(0,n.jsx)("p",{className:"text-sm text-gray-500",children:e.addressdetails})]})]})},e.id))}),0===a.length&&(0,n.jsx)("div",{className:"bg-white rounded-xl p-8 shadow-sm text-center text-gray-500 mb-6",children:e("no_addresses_order",{defaultValue:"Nuk keni asnje adrese. Shtoni nje adrese per te vazhduar."})}),(0,n.jsx)("button",{onClick:function(){i&&s.push("/porosi/koha")},disabled:!i,className:"w-full bg-orange-500 hover:bg-orange-600 disabled:bg-orange-300 text-white font-semibold px-6 py-3 rounded-lg transition-colors",children:e("continue",{defaultValue:"Vazhdo"})})]})}},9376:function(e,s,a){"use strict";var n=a(5475);a.o(n,"useParams")&&a.d(s,{useParams:function(){return n.useParams}}),a.o(n,"usePathname")&&a.d(s,{usePathname:function(){return n.usePathname}}),a.o(n,"useRouter")&&a.d(s,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(s,{useSearchParams:function(){return n.useSearchParams}})}},function(e){e.O(0,[8706,2971,2117,1744],function(){return e(e.s=4144)}),_N_E=e.O()}]);