(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[301],{4535:function(e,t,r){Promise.resolve().then(r.bind(r,5590))},6648:function(e,t,r){"use strict";r.d(t,{default:function(){return n.a}});var a=r(5601),n=r.n(a)},6463:function(e,t,r){"use strict";var a=r(1169);r.o(a,"redirect")&&r.d(t,{redirect:function(){return a.redirect}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}})},8064:function(e,t,r){"use strict";Object.defineProperty(t,"$",{enumerable:!0,get:function(){return n}});let a=r(4590);function n(e){let{createServerReference:t}=r(6671);return t(e,a.callServer)}},5601:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var r in t)Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}(t,{default:function(){return c},getImageProps:function(){return s}});let a=r(9920),n=r(497),o=r(8173),i=a._(r(1241));function s(e){let{props:t}=(0,n.getImgProps)(e,{defaultLoader:i.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,r]of Object.entries(t))void 0===r&&delete t[e];return{props:t}}let c=o.Image},5367:function(e,t,r){"use strict";r.d(t,{AU:function(){return h},E7:function(){return b},HM:function(){return o},NY:function(){return d},Nq:function(){return f},Q6:function(){return n},SP:function(){return u},Zt:function(){return p},bG:function(){return m},cn:function(){return s},co:function(){return l},fS:function(){return i},kg:function(){return x},yN:function(){return c}}),r(4590);var a=r(8064),n=(0,a.$)("ef12e00308dff653f404cf3fdc15744e49f4d1b5"),o=(0,a.$)("c4819ee5705c5e10eb6138be4fcf8c32f8c42d3d"),i=(0,a.$)("36150de30e4a99989b7bacaae23909c3f6d160a0"),s=(0,a.$)("f026d538ed67c65cf9a79a5e1e7e005698ad99db"),c=(0,a.$)("f778538dd97c3d96d2ca219de49011fc2471e14b");(0,a.$)("dce10b3daca82f1dc2ba9e01924e70ef26551eee"),(0,a.$)("c8904f4e020b42bcf614b59212f09a448e8c0245");var l=(0,a.$)("5e0f04e5a15ec39c18d96adcf66d6d0f5741a45c"),d=(0,a.$)("36fc5dc46ca33fd21d93afaec5d308cdfc6658b1"),u=(0,a.$)("be14ddb25561e04779c7ace009b4133bf032b1da"),f=(0,a.$)("dbc0103bd714bea0bdae62d6e833f5879ee76e95"),m=(0,a.$)("726be7015d9c07a6bc0b4495edab1ab4105f184a"),p=(0,a.$)("bb4c7d46fac81e8dc1f62d9bda6d86f51d9a4612"),b=(0,a.$)("bd42a552a8b1f79b072bff0d8598805e1fbe8778"),x=(0,a.$)("c87d1520ac90af8e01d2397589a267f569d8ca3a"),h=(0,a.$)("1af88b71b194c91bce1418f220c8307add9ff2e0");(0,a.$)("5ff464bded13ae9707bd7c3492f854f6381b9c49")},5590:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return b}});var a=r(7437),n=r(9343),o=r(2265),i=r(7138),s=r(5367),c=r(9548),l=r(8749),d=r(2647),u=r(4447),f=function(e){let{onRedirect:t}=e,[r,f]=(0,o.useState)(!1),[m,p]=(0,o.useState)(!1),[b,x]=(0,o.useState)(""),[h,g]=(0,o.useState)(""),[y,j]=(0,o.useState)(""),[w,v]=(0,o.useState)(!1),[N,S]=(0,o.useState)(!1),[M,$]=(0,o.useState)(""),[D,A]=(0,o.useState)(""),[H,P]=(0,o.useState)(!1),[C,G]=(0,o.useState)(!1),[O,k]=(0,o.useState)(null),{register:_,handleSubmit:q,formState:{errors:B}}=(0,n.cI)();function E(e){g(e),setTimeout(()=>{g("")},4e3)}async function F(e){e.preventDefault();try{if(v(!0),M===D){var r,a,n,o,i,c;let e={email:null!==(r=null==O?void 0:O.email)&&void 0!==r?r:"",name:null!==(a=null==O?void 0:O.name)&&void 0!==a?a:"",company:null!==(n=null==O?void 0:O.company)&&void 0!==n?n:"",phone:null!==(o=null==O?void 0:O.phone)&&void 0!==o?o:"",password:null!==(i=null==O?void 0:O.password)&&void 0!==i?i:"",address:null!==(c=null==O?void 0:O.address)&&void 0!==c?c:""},l=await (0,s.cn)(e,"buyer");if(l.error){x("Something Went Wrong"),setTimeout(()=>{x("")},4e3);return}l&&t(!0)}else G(!0);v(!1)}catch(e){console.error(e)}finally{v(!1)}}let U=async e=>{try{S(e=>!0);let{password:t,email:r,phone:a,company:n,name:o,address:i}=e;if(!(0,c.D7)(a)){j("Invalid phone Number"),setTimeout(()=>{j("")},4e3);return}(0,c.oH)(r)||E("please enter a valid Email");let l=await (0,s.yN)({email:r});if(console.log(l),500===l){E("Email already exists.");return}if(!t){p(!0);return}if(console.log(M),""===D){let e=(0,u.ON)();A(t=>e),console.log(e),await (0,d.mC)({code:e,email:r})}console.log(M,D),k({name:o,password:t,email:r,phone:a,company:n,address:i}),S(e=>!1),P(!0)}catch(e){console.error(e)}finally{S(e=>!1)}};return console.log(b,h,y),(0,a.jsxs)("section",{className:"flex bg-white text-black items-center  justify-center flex-col gap-3 px-4 md:px-6",children:[(0,a.jsx)(l.Z,{error:b}),(0,a.jsx)(l.Z,{error:h}),(0,a.jsx)(l.Z,{error:y}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-center text-[1.3rem] lg:text-[1.7rem] font-bold",children:"Create Account"}),(0,a.jsx)("p",{className:" text-center text-[0.8rem] lg:text-[1rem] font-medium",children:"Lets get started with a new account"})]}),(0,a.jsxs)("p",{className:"text-[0.9rem]",children:["Already have an account?"," ",(0,a.jsx)(i.default,{className:"border-b-2 border-primary",href:"/auth/sign-in",children:"Sign in"})]}),(0,a.jsxs)("form",{onSubmit:q(U),className:"flex flex-col  gap-4  w-full",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 justify-between",children:[(0,a.jsx)("div",{children:(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"username",children:["Username",(0,a.jsx)("input",{disabled:w,className:"".concat(B.name?" border-red-600":""," focus:outline-primary caret-primary border w-full py-2 px-5 rounded-md"),type:"text",id:"username",placeholder:"Enter your username",..._("name",{required:!0})})]})}),(0,a.jsx)("div",{children:(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"email",children:["Email",(0,a.jsx)("input",{disabled:w,className:" ".concat(B.email?" border-red-600":""," focus:outline-primary caret-primary border w-full py-2 px-5 rounded-md"),type:"text",id:"email",placeholder:"Enter your email",..._("email",{required:!0})})]})})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"company",children:["School/Company",(0,a.jsx)("input",{disabled:w,className:"".concat(B.company?" border-red-600":"",' focus:outline-primary caret-primary border py-2 px-5 rounded-md"\n    '),type:"text",id:"company",placeholder:"Company",..._("company",{required:!0})})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"address",children:["Address",(0,a.jsx)("input",{disabled:w,className:"".concat(B.address?" border-red-600":"",' focus:outline-primary caret-primary border py-2 px-5 rounded-md"\n    '),type:"text",id:"address",placeholder:"Address",..._("address",{required:!0})})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"phone",children:["Phone",(0,a.jsx)("input",{disabled:w,className:"".concat(B.phone?" border-red-600":"",' focus:outline-primary caret-primary border py-2 px-5 rounded-md"\n    '),type:"text",id:"phone",placeholder:"Enter your phone number",..._("phone",{required:!0})})]}),(0,a.jsxs)("label",{className:"flex flex-col gap-1 font-semibold text-[0.9rem]",htmlFor:"password",children:["Password",(0,a.jsx)("input",{disabled:w,className:" ".concat(B.password?" border-red-600":"",' focus:outline-primary caret-primary border py-2 px-5 rounded-md"\n    '),type:r?"text":"password",id:"password",placeholder:"Enter your password",..._("password",{required:!0})})]}),(0,a.jsxs)("div",{className:"w-full flex items-center justify-end gap-3",children:[(0,a.jsx)("span",{className:"whitespace-nowrap text-[0.8rem]",children:"Show password"})," ",(0,a.jsx)("input",{type:"checkbox",className:" cursor-pointer accent-primary",onChange:()=>f(!r)})]})]}),""===D&&(0,a.jsx)("button",{disabled:N,className:"bg-black text-white font-medium py-2 rounded-md hover:opacity-95",type:"submit",children:N?"loading...":"confirm"})]}),""!==D&&(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsx)("p",{className:"text-[0.8rem] font-medium mb-3",children:"A code was sent to your email please enter it to complete signup"}),(0,a.jsxs)("div",{className:"flex items-center gap-3 w-full",children:[(0,a.jsx)("input",{onChange:e=>$(e.target.value),className:' focus:outline-primary caret-primary w-full border py-2 px-5 rounded-md"\n    ',type:"text",placeholder:"Please enter the code"}),(0,a.jsx)("button",{onClick:F,className:"bg-black text-white whitespace-nowrap  font-medium px-4 py-2 rounded-md hover:opacity-95",children:w?"signing up...":"Sign Up"})]}),C&&(0,a.jsx)("p",{className:"text-[0.8rem] text-red-600 font-medium mb-3",children:"Code is incorrect"})]}),(0,a.jsxs)("div",{className:"flex items-center w-full gap-3",children:[(0,a.jsx)("hr",{className:" font-semibold w-full"}),(0,a.jsx)("span",{className:"font-semibold",children:"Or"}),(0,a.jsx)("hr",{className:" font-semibold w-full"})]}),(0,a.jsxs)("p",{children:["Register as a farmer"," ",(0,a.jsx)(i.default,{className:"border-b-2 border-primary font-semibold",href:"/farmer-registration",children:"Farmer Registration"})]})]})},m=r(6648),p=r(6463),b=function(){let[e,t]=(0,o.useState)(!1);return e&&(0,p.redirect)("/auth/sign-in"),(0,a.jsxs)("section",{className:"h-svh grid md:grid-cols-12",children:[(0,a.jsxs)("div",{className:" w-full bg-white md:col-span-5 overflow-y-scroll ",children:[(0,a.jsx)(i.default,{href:"/",className:"mb-5",children:(0,a.jsx)(m.default,{src:"/tololi-logo.webp",width:130,height:40,className:"max-w-[130px] min-w-[100px] min-h-[50]",alt:"Tololi Logo",priority:!0})}),(0,a.jsx)(f,{onRedirect:t})]}),(0,a.jsx)("figure",{className:"md:block  hidden md:col-span-7 ",children:(0,a.jsx)("img",{className:"w-full h-svh object-cover",src:"https://images.unsplash.com/photo-1550989460-0adf9ea622e2?q=80&w=1374&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",alt:"vegetables"})})]})}},4447:function(e,t,r){"use strict";r.d(t,{$2:function(){return s},ON:function(){return c},Xv:function(){return n},dU:function(){return i},ow:function(){return a},p7:function(){return o}});let a=[{name:"Home",pathUrl:"/"},{name:"Our Story",pathUrl:"/about-us"},{name:"Contact Us",pathUrl:"/contact-us"}],n=[{title:"Location",detail:"13 Mozart St, Windhoek"},{title:"Email Address",detail:"sales@tololishop.com"},{title:"Call Us",detail:"+264 81 200 9492"},{title:"Open From",detail:"Mon - Fri (9AM - 5PM) - Sat (9AM - 1PM)"}],o={Tomatoes:{url:"https://images.unsplash.com/photo-1582284540020-8acbe03f4924?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",price:12.19},Spinach:{url:"/spinach.jpg",price:12.67},Mahangu:{url:"https://stories.isu.pub/81732223/images/55_original_file_I2.jpg",price:20},Onions:{url:"/onions.jpg",price:9.03},Cabbage:{url:"/cabbage.jpg",price:18},Carrots:{url:"/carrots.jpg",price:12.17},Potatoes:{url:"/potatoes.jpg",price:13.45},Beans:{url:"/beans.jpg",price:24},Sorghum:{url:"/sorghum.jpg",price:20},GreenPepper:{url:"/green-pepper.jpg",price:12.5},Maize:{url:"/maize.jpg",price:8}},i=[{name:"Tomatoes",id:1},{name:"Spinach",id:2},{name:"Mahangu",id:3},{name:"Onions",id:4},{name:"Cabbage",id:5},{name:"Potatoes",id:6},{name:"Beans",id:7},{name:"Sorghum",id:9},{name:"GreenPepper",id:10},{name:"Carrots",id:11}],s=[{id:1,path:"https://images.unsplash.com/photo-1518994603110-1912b3272afd?q=80&w=1448&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"},{id:2,path:"https://images.unsplash.com/photo-1601648764658-cf37e8c89b70?q=80&w=1471&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"},{id:3,path:"https://images.unsplash.com/photo-1518390643573-66f352c5492e?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"}];function c(){return"".concat(Math.floor(9*Math.random()+1).toString()).concat(Math.floor(9*Math.random()+1).toString()).concat(Math.floor(9*Math.random()+1).toString()).concat(Math.floor(9*Math.random()+1).toString()).concat(Math.floor(9*Math.random()+1).toString()).concat(Math.floor(9*Math.random()+1).toString())}},8749:function(e,t,r){"use strict";var a=r(7437);t.Z=function(e){let{error:t}=e;return(0,a.jsx)("div",{className:"fixed top-0 p-3 z-[100] flex items-center justify-center rounded-md  w-[240px] bg-black/90 text-white font-semibold transition-all duration-300 ease-in-out ".concat(t?" translate-y-[10px]":"translate-y-[-450px]"),children:t})}},9548:function(e,t,r){"use strict";r.d(t,{D7:function(){return o},Z$:function(){return i},oH:function(){return n}});var a=r(7001);let n=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);function o(e){return!!(0,a.h)(e,"NA").isValid()}function i(e){var t;let r=parseInt(null!==(t=e.month)&&void 0!==t?t:""),a=e.year,n=e.day;return"".concat(r,"/").concat(n,"/").concat(a)}},2647:function(e,t,r){"use strict";r.d(t,{b8:function(){return i},gO:function(){return o},mC:function(){return n}}),r(4590);var a=r(8064),n=(0,a.$)("d188eb3aa430cf31921f896e8ce453458025d6cb"),o=(0,a.$)("e0c126cd31f2da0e17524c27d5aed5064b2847e7"),i=(0,a.$)("5dfd2bc80e8c307e04a4a8413c5b80460c27e509")}},function(e){e.O(0,[138,343,173,1,971,23,744],function(){return e(e.s=4535)}),_N_E=e.O()}]);