-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3127 from glific/enhancement/erp
ERP: Modifications in registration form
- Loading branch information
Showing
12 changed files
with
449 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/containers/Organization/Onboarding/Steps/Address/Address.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
.Label { | ||
font-size: 14px; | ||
font-weight: 500; | ||
color: #111; | ||
line-height: 22px; | ||
margin: 6px 0; | ||
display: flex; | ||
column-gap: 4px; | ||
} | ||
|
||
.Heading { | ||
composes: Label; | ||
font-size: 1rem; | ||
} | ||
|
||
.InputBox { | ||
width: 100%; | ||
} | ||
|
||
.OutlinedInput { | ||
padding: 12.5px 14px; | ||
} | ||
|
||
|
||
.AddressField { | ||
display: grid; | ||
grid-template-columns: repeat(2, 1fr); | ||
grid-template-rows: repeat(3, 1fr); | ||
grid-gap: 0.5rem; | ||
|
||
} | ||
|
||
.FullRow { | ||
grid-column-start: 1; | ||
grid-column-end: 3; | ||
} | ||
|
||
.Errors { | ||
font-size: 12px; | ||
margin: 0; | ||
margin-left: 14px; | ||
line-height: 18px; | ||
font-weight: 400; | ||
color: #fb5c5c; | ||
} |
77 changes: 77 additions & 0 deletions
77
src/containers/Organization/Onboarding/Steps/Address/Address.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { OutlinedInput, Typography } from '@mui/material'; | ||
import { formatString } from 'common/utils'; | ||
import styles from './Address.module.css'; | ||
|
||
interface RegisteredAddressProps { | ||
inputLabel: string; | ||
inputLabelSubtext: any; | ||
address: any; | ||
disabled: boolean; | ||
form: { touched: any; errors: any; setFieldValue: any }; | ||
field: { name: string; value: any }; | ||
} | ||
|
||
export const RegisteredAddress = ({ | ||
inputLabel, | ||
address, | ||
disabled, | ||
inputLabelSubtext, | ||
form, | ||
field, | ||
}: RegisteredAddressProps) => { | ||
const handleChange = (e: any, value: any) => { | ||
form.setFieldValue(field.name, { | ||
...field.value, | ||
[value]: e.target.value, | ||
}); | ||
}; | ||
|
||
const errors = form.errors[field.name]; | ||
const touched = form.touched[field.name]; | ||
|
||
return ( | ||
<div> | ||
<Typography variant="caption" className={styles.Heading} data-testid="inputLabel"> | ||
{inputLabel} | ||
{inputLabelSubtext} | ||
</Typography> | ||
|
||
<div className={styles.AddressField}> | ||
{Object.keys(address) | ||
.slice(0, 2) | ||
.map((key) => ( | ||
<div className={styles.FullRow} key={key}> | ||
<p className={styles.Label}>{formatString(key)}</p> | ||
<OutlinedInput | ||
disabled={disabled} | ||
className={styles.InputBox} | ||
classes={{ input: styles.OutlinedInput }} | ||
onChange={(e) => handleChange(e, key)} | ||
value={field.value[key]} | ||
/> | ||
<p className={styles.Errors}> | ||
{touched && errors && touched[key] && errors[key] ? errors[key] : ''} | ||
</p> | ||
</div> | ||
))} | ||
{Object.keys(address) | ||
.slice(2) | ||
.map((key) => ( | ||
<div className={styles.Row} key={key}> | ||
<p className={styles.Label}>{formatString(key)}</p> | ||
<OutlinedInput | ||
disabled={disabled} | ||
className={styles.InputBox} | ||
classes={{ input: styles.OutlinedInput }} | ||
onChange={(e) => handleChange(e, key)} | ||
value={field.value[key]} | ||
/> | ||
<p className={styles.Errors}> | ||
{touched && errors && touched[key] && errors[key] ? errors[key] : ''} | ||
</p> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.