(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5674],{5886:function(e,r,a){Promise.resolve().then(a.bind(a,5895))},5895:function(e,r,a){"use strict";a.r(r),a.d(r,{default:function(){return l}});var t=a(7437),s=a(2265),n=a(9376),u=a(8706);function l(){let e=(0,u.T)(),r=(0,n.useRouter)(),[a,l]=(0,s.useState)(""),[o,i]=(0,s.useState)(""),[d,c]=(0,s.useState)(""),[m,g]=(0,s.useState)("+355"),[f,h]=(0,s.useState)(""),[x,b]=(0,s.useState)(""),[p,j]=(0,s.useState)(""),[y,v]=(0,s.useState)(!1);async function N(t){t.preventDefault(),j(""),v(!0);try{let t=await fetch("/api/auth/register",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a,surname:o,phone:d,phonePrefix:m,email:f,password:x})}),s=await t.json();s.success?r.push("/porosi/adresa"):j(s.message||e("error",{defaultValue:"Gabim."}))}catch(r){j(e("generic_error",{defaultValue:"Ndodhi nje gabim."}))}finally{v(!1)}}return(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold mb-6",children:e("create_profile",{defaultValue:"Krijo Profilin"})}),(0,t.jsxs)("div",{className:"bg-white rounded-xl p-6 shadow-sm",children:[p&&(0,t.jsx)("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:p}),(0,t.jsxs)("form",{onSubmit:N,className:"space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("name",{defaultValue:"Emri"})}),(0,t.jsx)("input",{type:"text",value:a,onChange:e=>l(e.target.value),required:!0,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,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("surname",{defaultValue:"Mbiemri"})}),(0,t.jsx)("input",{type:"text",value:o,onChange:e=>i(e.target.value),required:!0,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,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),(0,t.jsx)("input",{type:"email",value:f,onChange:e=>h(e.target.value),required:!0,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,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("phone",{defaultValue:"Telefoni"})}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsxs)("select",{value:m,onChange:e=>g(e.target.value),className:"border border-gray-300 rounded-lg px-3 py-2",children:[(0,t.jsx)("option",{value:"+355",children:"+355"}),(0,t.jsx)("option",{value:"+383",children:"+383"})]}),(0,t.jsx)("input",{type:"tel",value:d,onChange:e=>c(e.target.value),required:!0,className:"flex-1 border border-gray-300 rounded-lg px-4 py-2 focus:ring-2 focus:ring-orange-500 focus:border-transparent outline-none"})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e("password",{defaultValue:"Fjalekalimi"})}),(0,t.jsx)("input",{type:"password",value:x,onChange:e=>b(e.target.value),required:!0,minLength:6,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,t.jsx)("button",{type:"submit",disabled:y,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:y?e("creating",{defaultValue:"Duke krijuar..."}):e("create_and_continue",{defaultValue:"Krijo dhe Vazhdo"})})]})]})]})}},9376:function(e,r,a){"use strict";var t=a(5475);a.o(t,"useParams")&&a.d(r,{useParams:function(){return t.useParams}}),a.o(t,"usePathname")&&a.d(r,{usePathname:function(){return t.usePathname}}),a.o(t,"useRouter")&&a.d(r,{useRouter:function(){return t.useRouter}}),a.o(t,"useSearchParams")&&a.d(r,{useSearchParams:function(){return t.useSearchParams}})}},function(e){e.O(0,[8706,2971,2117,1744],function(){return e(e.s=5886)}),_N_E=e.O()}]);