1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6598],{15097:function(e,s,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/partner/register/new",function(){return a(66415)}])},92288:function(e,s,a){"use strict";a.d(s,{Z:function(){return BlankWrapper}});var r=a(85893),t=a(80166);function BlankWrapper(e){let{title:s,children:a,show:l=!0,url:n}=e;return(0,r.jsxs)("div",{className:"flex flex-col max-w-screen-xl",children:[(0,r.jsx)("div",{className:"",children:(0,r.jsxs)("h1",{className:"titulo-pagina flex gap-[0.5rem] items-center",children:[s,(0,r.jsx)(t.Z,{url:n,show:l})]})}),(0,r.jsx)("hr",{className:"border-1 my-6 mt-1"}),(0,r.jsx)("div",{className:"-my-2 ",children:(0,r.jsx)("div",{className:"py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8",children:(0,r.jsx)("div",{className:"border-b border-gray-200 sm:rounded-lg",children:(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsx)("div",{className:"bg-white px-[1rem] sm:px-[3rem]",children:a})})})})})]})}},80166:function(e,s,a){"use strict";var r=a(85893),t=a(42746),l=a(25675),n=a.n(l),o=a(11163);s.Z=e=>{let{show:s,url:a}=e,l=(0,o.useRouter)(),i=(0,t.useTranslations)("buttons"),handleClick=()=>{a?l.replace(a):l.back()};return s?(0,r.jsx)("button",{onClick:()=>{handleClick()},className:"text-green-500 hover:text-green-700",title:i("return"),children:(0,r.jsx)(n(),{width:20,height:15,src:"/icon/redirectDark.svg",alt:"SVG",className:"!text-pink-500"})}):null}},66415:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return PartnerRegister}});var r=a(85893),t=a(99971),l=a(42746),n=a(67294),o=a(11163),i=a(4023),c=a(30727),m=a(22920),d=a(33299),p=a(92288);function PartnerRegister(){let{token:e,APIURL:s}=(0,i.qD)(),a=(0,l.useTranslations)("sideBar"),[x,h]=(0,n.useState)(""),{setIsOpen:u,setModalContent:N,setAfterAction:f}=(0,i.qD)(),modalContent=e=>{let{title:s,message:a}=e;u(!0),f({emit:()=>{j.push("/"),u(!1)}}),N((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:" text-center ",children:(0,r.jsxs)("div",{id:"Denomination",className:"",children:[(0,r.jsx)("div",{className:"titulo-pagina ",children:s}),(0,r.jsx)("br",{}),a]})}),(0,r.jsx)("div",{className:"text-center mt-4",children:(0,r.jsx)(t.z,{action:()=>{j.push("/partner/register"),u(!1)},name:"OK",twClass:"!text-white !px-[3rem] !py-2 !text-base "})})]}))},{data:v}=(0,d.useSession)(),b=(0,n.useMemo)(()=>new c.Z(s,void 0),[e]),j=(0,o.useRouter)(),g=(0,l.useTranslations)("howDoes"),y=(0,l.useTranslations)("register"),w=(0,l.useTranslations)("toast"),E=(0,l.useTranslations)("buttons"),[k,A]=(0,n.use
1State)({companyName:"",responsibleName:"",phone:"",corporateEmail:"",password:"",confirmPassword:"",termsAccepted:!1}),[C,P]=(0,n.useState)({}),[D,B]=(0,n.useState)(!1);g("registerBodyFull");let F=["companyName","responsibleName","phone","corporateEmail","termsAccepted"],_={companyName:y("companyNameError"),responsibleName:y("responsibleNameError"),phone:y("companyPhoneError"),corporateEmail:y("corporateEmailError"),termsAccepted:y("termsError")},handleFieldValidation=(e,s,a)=>{"string"==typeof s[e]&&""===s[e].trim()?a[e]=_[e]:delete _[e]},handleSubmit=async e=>{let s={};for(let e of F)"termsAccepted"===e&&!1===k[e]?s[e]=_[e]:k.hasOwnProperty(e)?"termsAccepted"!==e&&handleFieldValidation(e,k,s):s[e]=_[e];if(P(s),0===Object.keys(s).length){e.preventDefault(),B(!0);try{await b.postObject("partners",k,[],x,"company-registrations").then(e=>{B(!1),(0,m.Am)(w("registrationDone")),modalContent({title:y("information"),message:y("informationBody")})})}catch(e){var a,r,t,l,n,o,i,c,d;B(!1),m.Am.error((null===(l=e.response)||void 0===l?void 0:null===(t=l.data)||void 0===t?void 0:null===(r=t.errorsDetails)||void 0===r?void 0:null===(a=r.debugMessage[0])||void 0===a?void 0:a.message)||(null===(i=e.response)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:null===(n=o.errorsDetails)||void 0===n?void 0:n.debugMessage)||(null===(d=e.response)||void 0===d?void 0:null===(c=d.data)||void 0===c?void 0:c.message))}}else console.log("Fix the errors"),e.preventDefault()},set=e=>{let{name:s,value:a}=e.target;A({...k,[s]:a})}
1,[S,T]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{},[e,j]),(0,n.useEffect)(()=>{var s;e&&b.getById(null==v?void 0:null===(s=v.user)||void 0===s?void 0:s.email,"accounts/by-email").then(e=>{h(e.data.id)}).catch(e=>{console.log("errorDashboard",e),m.Am.error("Erro ao carregar Parceiro",{toastId:"notRegistered"})})},[b]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(r.Fragment,{}),(0,r.jsx)(p.Z,{title:a("registerPartner"),children:(0,r.jsxs)("form",{className:"w-full",onSubmit:handleSubmit,children:[(0,r.jsxs)("div",{className:"grid md:grid-cols-2 md:gap-8",children:[(0,r.jsxs)("div",{className:"flex flex-col relative",children:[(0,r.jsx)("label",{className:"text-[#2B434E] pb-1 mt-6 font-semibold font-sans",htmlFor:"companyName",children:y("companyName")}),(0,r.jsx)("input",{id:"companyName",name:"companyName",type:"text",value:k.companyName,onChange:set,placeholder:y("companyNamePH"),className:"mt-1 bg-[#ebf6fe] rounded-lg p-3"}),C.companyName&&(0,r.jsx)("span",{className:"error",children:C.companyName})]}),(0,r.jsxs)("div",{className:"flex flex-col relative",children:[(0,r.jsx)("label",{className:"text-[#2B434E] pb-1 mt-6 font-semibold font-sans",htmlFor:"responsibleName",children:y("responsibleName")}),(0,r.jsx)("input",{id:"responsibleName",name:"responsibleName",type:"text",value:k.responsibleName,onChange:set,placeholder:y("responsibleNamePH"),className:"mt-1 bg-[#ebf6fe] rounded-lg p-3"}),C.responsibleName&&(0,r.jsx)("span",{className:"error",children:C.responsibleName})]})]}),(0,r.jsxs)("div",{className:"grid md:grid-cols-2 md:gap-8",children:[(0,r.jsxs)("div",{className:"flex flex-col relative",children:[(0,r.jsx)("label",{className:"text-[#2B434E] pb-1 mt-6 font-semibold font-sans",htmlFor:"corporateEmail",children:y("corporateEmailPH")}),(0,r.jsx)("input",{id:"corporateEmail",name:"corporateEmail",type:"email",value:k.corporateEmail,onChange:set,placeholder:y("corporateEmailPH"),className:"mt-1 bg-[#ebf6fe] rounded-lg p-3"}),C.corporateEmail&&(0,r.jsx)("span",{className:"error",children:C.corporateEmail})]}),(0,r.jsxs)("div",{className:"flex flex-col relative",children:[(0,r.jsx)("label",{className:"text-[#2B434E] pb-1 mt-6 font-semibold font-sans",htmlFor:"phone",children:y("companyPhone")}),(0,r.jsx)("input",{id:"phone",name:"phone",type:"number",value:k.phone,onChange:set,placeholder:y("companyPhonePH"),className:"mt-1 bg-[#ebf6fe] rounded-lg p-3"}),C.phone&&(0,r.jsx)("span",{className:"error",children:C.phone})]})]}),(0,r.jsx)("div",{className:"mt-5",children:(0,r.jsxs)("div",{className:"",children:[(0,r.jsxs)("label",{className:"flex items-center",htmlFor:"termsAccepted",children:[(0,r.jsx)("input",{id:"termsAccepted",type:"checkbox",className:"w-10 h-5",checked:k.termsAccepted,onChange:()=>{T(!S)}}),y("terms")]}),(0,r.jsx)("div",{children:S&&(0,r.jsx)("div",{className:"modalBackdrop",children:(0,r.jsxs)("div",{className:"modalContainer",children:[(0,r.jsx)("div",{className:"flex min-w-[10rem] max-w-[40rem] h-[20rem] md:h-auto overflow-auto",children:(0,r.jsxs)("div",{id:"Denomination",className:"text-justify",children:[(0,r.jsx)("div",{className:"flex justify-center titulo-pagina ",children:y("terms")}),(0,r.jsx)("br",{}),y("termsText1"),(0,r.jsx)("br",{}),(0,r.jsx)("br",{}),y("termsText2")]})}),(0,r.jsxs)("div",{className:"flex justify-evenly mt-4",children:[(0,r.jsx)("button",{className:"button-novo-diagnostico bg-[white] text-[#AD8B19] font-[500]",onClick:()=>{k.termsAccepted=!1,T(!1)},children:E("cancel")}),(0,r.jsx)("button",{className:"button-novo-diagnostico bg-[#AD8B19] text-[white] font-[500]",onClick:()=>{k.termsAccepted=!0,T(!1)},children:y("terms")})]})]})})}),C.termsAccepted&&(0,r.jsx)("span",{className:"error",children:C.termsAccepted})]})}),(0,r.jsx)("div",{className:"flex justify-center mt-10",children:(0,r.jsx)("div",{className:"flex flex-col ",children:(0,r.jsx)(t.z,{action:()=>"",name:a("registerPartner"),twClass:"!text-white !rounded-full !px-[6rem] !py-2 !text-base",loading:D})})})]})})]})}}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=15097)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.