https://www.americanlandrecords.com/_next/static/chunks/pages/dashboard/user/new-d56e670e4833d7b5.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1137],{98967:function(e,s,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/user/new",function(){return r(17905)}])},17905:function(e,s,r){"use strict";r.r(s),r.d(s,{default:function(){return O}});var a=r(85893),t=r(9008),n=r.n(t),l=r(83490),o=r(98426),i=r(51015),d=r(96788),c=r(37734),u=r(36505),m=r(38575),h=r(67294),x=r(86501),f=r(16310),p=r(20512),w=r(60762),j=r(71919),Z=r(68573),v=r(40492),b=r(95611),g=r(52857),C=r(65806),y=r(29437),P=r(14312),I=r(97182),k=r(98443),A=r(19958),E=r(19170),_=r(35499),B=r(74904),S=r(86025),W=r(18525),N=r(3425),R=r(34795);let T=e=>{var s;let[t,n]=(0,h.useState)(!1),{scrollRef:o}=e,{user:c}=(0,E.a)(),u=null==c?void 0:c.drmsAdministrator,m=null==c?void 0:c.states.flatMap(e=>e.counties.filter(e=>e.subscriptions.some(e=>11===e.moduleTypeId&&e.roles.some(e=>e))).map(e=>({id:e.id,stateId:e.stateId,name:"".concat(e.countyName," (").concat(e.stateAbbreviation,")")}))),T=(0,S.s)(),[q,z]=(0,h.useState)(!1),[D,U]=(0,h.useState)(!1),M=e=>{e.preventDefault()},O=e=>"Your password must have at least 1 ".concat(e," character"),[F,X]=(0,h.useState)([]),[H,L]=(0,h.useState)({name:"",email:"",password:"",confirmPassword:"",officeWorker:!0,drmsAdministrator:!1,modules:[]}),V=(0,p.TA)({enableReinitialize:!0,initialValues:H,validationSchema:f.Ry({name:f.Z_().max(100).required("Name is required"),email:f.Z_().email("Invalid email").max(100).required("Email is required"),password:f.Z_().required("Please enter a password").min(8,"Password must have at least 8 characters").matches(/[0-9]/,O("digit")).matches(/[a-z]/,O("lowercase")).matches(/[A-Z]/,O("uppercase")),confirmPassword:f.Z_().oneOf([f.iH("password"),null],"Passwords must match").required("Confirm password")}),onSubmit:async(e,s)=>{try{n(!0),n(!0);let r=await _.B.create(e),a=await r.json();if(r.ok&&a){L(H),s.resetForm(),x.ZP.success("User added successfully!"),o.current.scroll(0,0),n(!1);return}let t=a&&a.error||r.status;throw Error(t)}catch(e){"Error: 401 Authentication Required"==e&&(await Promise.resolve().then(r.t.bind(r,11163,23))).default.reload(window.location.pathname),console.error(e),n(!1),x.ZP.error("Error adding new user!"),s.setStatus({success:!1}),s.setErrors({submit:e.message}),s.setSubmitting(!1),n(!1)}}}),G=(0,h.useCallback)(async()=>{try{n(!0);let e=await B.B.listConnected(),s=await e.json();if(T){if(e.ok&&s){let e=s.counties.map(e=>({id:e.stateId,name:e.state})),r=s.counties.filter(e=>u||m.some(s=>s.id===e.id)).map(e=>({id:e.id,stateId:e.stateId,name:"".concat(e.countyName," (").concat(e.stateAbbreviation,")")})),a=[],t=null;u&&a.push({id:0,stateId:0,name:"All Counties"}),r.forEach(s=>{s.stateId!==t&&u&&(a.push({id:0,stateId:s.stateId,name:"All ".concat(e.find(e=>e.id===s.stateId).name)}),t=s.stateId),a.push(s)}),X(a),n(!1);return}let r=s&&s.error||e.status;throw Error(r)}}catch(e){"Error: 401 Authentication Required"==e&&(await Promise.resolve().then(r.t.bind(r,11163,23))).default.reload(window.location.pathname),console.error(e),n(!1),x.ZP.error("Error loading counties!")}},[T,V,u,m]);return(0,h.useEffect)(()=>{G()},[]),(0,W.W)(V),(0,a.jsxs)("form",{noValidate:!0,onSubmit:V.handleSubmit,children:[(0,a.jsx)(w.Z,{children:(0,a.jsx)(j.Z,{children:(0,a.jsxs)(Z.ZP,{container:!0,spacing:3,children:[(0,a.jsx)(Z.ZP,{item:!0,md:4,xs:12,children:(0,a.jsx)(d.Z,{variant:"h6",children:"Basic Details"})}),(0,a.jsxs)(Z.ZP,{item:!0,md:8,xs:12,sx:{mt:3},children:[(0,a.jsx)(l.Z,{sx:{display:"flex",alignItems:"center"},children:(0,a.jsx)(v.Z,{size:"small",fullWidth:!0,label:"User Full Name",name:"name",error:!!(V.touched.name&&V.errors.name),helperText:V.touched.name&&V.errors.name,onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.name})}),(0,a.jsx)(l.Z,{sx:{display:"flex",mt:3,alignItems:"center"},children:(0,a.jsx)(v.Z,{size:"small",fullWidth:!0,label:"User Email",name:"email",error:!!(V.touched.email&&V.errors.email),helperText:V.touched.email&&V.errors.email,onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.email})}),(0,a.jsx)(l.Z,{sx:{display:"flex",mt:3,alignItems:"center"},children:(0,a.jsx)(v.Z,{size:"small",fullWidth:!0,label:"User Password",autoComplete:"chrome-off",type:q?"text":"password",name:"password",error:!!(V.touched.password&&V.errors.password),helperText:V.touched.password&&V.errors.password,onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.password,InputProps:{endAdornment:(0,a.jsx)(b.Z,{position:"end",children:(0,a.jsx)(g.Z,{tabIndex:-1,"aria-label":"toggle password visibility",onClick:()=>{z(!q)},onMouseDown:M,edge:"end",children:q?(0,a.jsx)(A.Z,{}):(0,a.jsx)(k.Z,{})})})}})}),(0,a.jsx)(l.Z,{sx:{display:"flex",mt:3,alignItems:"center"},children:(0,a.jsx)(v.Z,{size:"small",fullWidth:!0,label:"Confirm password",autoComplete:"chrome-off",type:D?"text":"password",name:"confirmPassword",error:!!(V.touched.confirmPassword&&V.errors.confirmPassword),helperText:V.touched.confirmPassword&&V.errors.confirmPassword,onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.confirmPassword,InputProps:{endAdornment:(0,a.jsx)(b.Z,{position:"end",children:(0,a.jsx)(g.Z,{tabIndex:-1,"aria-label":"toggle password visibility",onClick:()=>{U(!D)},onMouseDown:M,edge:"end",children:D?(0,a.jsx)(A.Z,{}):(0,a.jsx)(k.Z,{})})})}})}),u&&(0,a.jsxs)(l.Z,{sx:{display:"flex",mt:3,gap:3,alignItems:"center"},children:[(0,a.jsx)(C.Z,{label:"Office Worker",control:(0,a.jsx)(y.Z,{name:"officeWorker",onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.officeWorker,checked:V.values.officeWorker})}),(0,a.jsx)(C.Z,{label:"DRMS Administrator",control:(0,a.jsx)(y.Z,{name:"drmsAdministrator",onBlur:V.handleBlur,onChange:V.handleChange,value:V.values.drmsAdministrator,checked:V.values.drmsAdministrator})})]})]})]})})}),(0,a.jsx)(w.Z,{sx:{mt:4},children:(0,a.jsx)(j.Z,{children:(0,a.jsx)(R.$,{formik:V,counties:F,modules:null==c?void 0:null===(s=c.county)||void 0===s?void 0:s.subscriptions})})}),(0,a.jsxs)(l.Z,{sx:{display:"flex",flexWrap:"wrap",mx:-1,mb:-1,mt:3,float:"right"},children:[(0,a.jsx)(i.Z,{sx:{m:1},startIcon:(0,a.jsx)(N.h,{fontSize:"small"}),variant:"outlined",color:"primary",name:"reset",onClick:()=>{V.resetForm()},children:"Reset"}),(0,a.jsx)(i.Z,{sx:{m:1},type:"submit",variant:"contained",disabled:t,children:"Create"})]}),(0,a.jsx)(P.Z,{open:t,children:(0,a.jsx)(I.Z,{})})]})};var q=r(1722),z=r(41664),D=r.n(z),U=r(99087);let M=()=>{let e=(0,h.useRef)();return(0,a.jsxs)(q.n,{scrollableNodeProps:{ref:e},children:[(0,a.jsx)(n(),{children:(0,a.jsxs)("title",{children:["Users : New | ","American Land Records"]})}),(0,a.jsx)(l.Z,{component:"main",sx:{flexGrow:1,py:8},children:(0,a.jsxs)(o.Z,{maxWidth:"lg",children:[(0,a.jsx)(D(),{href:"/dashboard/user",passHref:!0,children:(0,a.jsx)(i.Z,{component:"a",startIcon:(0,a.jsx)(U.X,{fontSize:"small"}),children:"Dashboard"})}),(0,a.jsx)(l.Z,{sx:{mb:3,mt:3},children:(0,a.jsx)(d.Z,{variant:"h4",children:"Create a new user"})}),(0,a.jsx)(T,{scrollRef:e})]})})]})};M.getLayout=e=>(0,a.jsx)(c.a,{children:(0,a.jsx)(u.C,{moduleType:11,children:(0,a.jsx)(m.c,{children:e})})});var O=M}},function(e){e.O(0,[4648,5241,8913,6633,5646,5063,7491,9844,1281,5275,6156,193,7958,4984,8073,7068,1807,8575,3736,2888,9774,179],function(){return e(e.s=98967)}),_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.