added create contact flow for registration

This commit is contained in:
2021-10-13 07:40:36 +01:00
parent 7238a79895
commit b34c56145d
22 changed files with 663 additions and 307 deletions
+50 -19
View File
@@ -87,9 +87,21 @@ const RegisterForm = (props) => {
? "Invalid phone number"
: undefined;
const passwordsMatch = (value, allValues) =>
value !== allValues.pinswg_custom_password
? "Passwords don't match"
: undefined;
const minLength = (min) => (value) =>
value && value.length < min
? `Must be ${min} characters or more`
: undefined;
const minLength5 = minLength(5);
const [hasErrors, setHasErrors] = useState("");
const onHandleSubmit = (values) => {
//console.log(values);
setRegisterFormComplete(true);
};
@@ -125,8 +137,8 @@ const RegisterForm = (props) => {
errorMsg="Is required"
/>
<Field
name="email"
id="email"
name="emailaddress1"
id="emailaddress1"
component={RenderTextfield}
type="email"
className="govuk-input govuk-input--width-20"
@@ -134,8 +146,8 @@ const RegisterForm = (props) => {
label="Email address"
/>
<Field
name="telephone"
id="telephone"
name="telephone1"
id="telephone1"
component={RenderTextfield}
type="number"
className="govuk-input govuk-input--width-20"
@@ -144,14 +156,29 @@ const RegisterForm = (props) => {
/>
<Field
name="companygroup"
id="companygroup"
name="pinswg_custom_password"
id="pinswg_custom_password"
component={RenderTextfield}
type="text"
type="password"
className="govuk-input govuk-input--width-20"
label="Company/Group"
label="Password"
validate={[required, minLength5]}
errorMsg="Is required"
/>
<Field
name="custom_password_check"
id="custom_password_check"
component={RenderTextfield}
type="password"
className="govuk-input govuk-input--width-20"
label="Confirm password"
validate={[
required,
passwordsMatch,
minLength5,
]}
errorMsg="Passwords do not match"
/>
</fieldset>
<fieldset className="govuk-fieldset">
<legend className="govuk-fieldset__legend govuk-fieldset__legend--m">
@@ -161,8 +188,8 @@ const RegisterForm = (props) => {
</legend>
<Field
name="addressline1"
id="addressline1"
name="address1_line1"
id="address1_line1"
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-20"
@@ -171,8 +198,8 @@ const RegisterForm = (props) => {
errorMsg="Is required"
/>
<Field
name="addressline2"
id="addressline2"
name="address1_line2"
id="address1_line2"
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-20"
@@ -180,8 +207,8 @@ const RegisterForm = (props) => {
errorMsg="Is required"
/>
<Field
name="towncity"
id="towncity"
name="address1_city"
id="address1_city"
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-10"
@@ -190,8 +217,8 @@ const RegisterForm = (props) => {
errorMsg="Is required"
/>
<Field
name="county"
id="county"
name="address1_county"
id="address1_county"
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-10"
@@ -200,8 +227,8 @@ const RegisterForm = (props) => {
errorMsg="Is required"
/>
<Field
name="postcode"
id="postcode"
name="address1_postalcode"
id="address1_postalcode"
component={RenderTextfield}
type="text"
className="govuk-input govuk-input--width-5"
@@ -229,7 +256,11 @@ const RegisterForm = (props) => {
/>
)
) : (
<RegisterComplete />
<RegisterComplete
props={props}
setRegisterFormComplete={setRegisterFormComplete}
setAccountCreatedComplete={setAccountCreatedComplete}
/>
)}
</>
);