(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9811],{1889:function(e,a,r){Promise.resolve().then(r.bind(r,9886))},9886:function(e,a,r){"use strict";r.r(a),r.d(a,{default:function(){return c}});var s=r(7437),n=r(2265),t=r(9376),o=r(8706);function c(){let e=(0,o.T)(),a=(0,t.useRouter)(),[r,c]=(0,n.useState)("cash"),[l,d]=(0,n.useState)(""),[i,u]=(0,n.useState)(!1);async function h(){u(!0);try{let e=await fetch("/api/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paymentMethod:r,note:l})}),s=await e.json();s.success&&(s.paymentUrl?window.location.href=s.paymentUrl:a.push("/porosi/checkout/ne-pritje"))}catch(e){}finally{u(!1)}}return(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold mb-6",children:e("order_summary",{defaultValue:"Permbledhje e Porosise"})}),(0,s.jsxs)("div",{className:"bg-white rounded-xl p-6 shadow-sm mb-6",children:[(0,s.jsx)("h2",{className:"font-semibold mb-4",children:e("payment_method",{defaultValue:"Metoda e Pageses"})}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("label",{className:"block p-3 rounded-lg cursor-pointer border-2 transition-all ".concat("cash"===r?"border-orange-500 bg-orange-50":"border-gray-200"),children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("input",{type:"radio",name:"payment",checked:"cash"===r,onChange:()=>c("cash"),className:"accent-orange-500"}),(0,s.jsx)("span",{children:e("cash",{defaultValue:"Para ne dorezim"})})]})}),(0,s.jsx)("label",{className:"block p-3 rounded-lg cursor-pointer border-2 transition-all ".concat("card"===r?"border-orange-500 bg-orange-50":"border-gray-200"),children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("input",{type:"radio",name:"payment",checked:"card"===r,onChange:()=>c("card"),className:"accent-orange-500"}),(0,s.jsx)("span",{children:e("card",{defaultValue:"Karte krediti/debiti"})})]})})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-xl p-6 shadow-sm mb-6",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:e("order_note",{defaultValue:"Shenim per porosine (opsionale)"})}),(0,s.jsx)("textarea",{value:l,onChange:e=>d(e.target.value),rows:3,className:"w-full border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none"})]}),(0,s.jsx)("button",{onClick:h,disabled:i,className:"w-full bg-orange-500 hover:bg-orange-600 disabled:bg-orange-300 text-white font-semibold px-6 py-4 rounded-lg transition-colors text-lg",children:i?e("placing_order",{defaultValue:"Duke derguar porosine..."}):e("place_order",{defaultValue:"Dergo Porosine"})})]})}},9376:function(e,a,r){"use strict";var s=r(5475);r.o(s,"useParams")&&r.d(a,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(a,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(a,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(a,{useSearchParams:function(){return s.useSearchParams}})}},function(e){e.O(0,[8706,2971,2117,1744],function(){return e(e.s=1889)}),_N_E=e.O()}]);