Screen responsive changes
This commit is contained in:
parent
303225458d
commit
81fb560898
@ -1,389 +1,535 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Button, FormControl, FormControlLabel, FormLabel, Grid, Paper, Radio, RadioGroup, TextField } from '@mui/material';
|
import {
|
||||||
|
Button,
|
||||||
|
FormControl,
|
||||||
|
FormControlLabel,
|
||||||
|
FormLabel,
|
||||||
|
Grid,
|
||||||
|
Paper,
|
||||||
|
Radio,
|
||||||
|
RadioGroup,
|
||||||
|
TextField,
|
||||||
|
} from '@mui/material';
|
||||||
import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers';
|
import { LocalizationProvider, DatePicker } from '@mui/x-date-pickers';
|
||||||
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
interface Patient {
|
interface Patient {
|
||||||
fullName: string;
|
fullName: string;
|
||||||
homePhone: string;
|
homePhone: string;
|
||||||
cellPhone: string;
|
cellPhone: string;
|
||||||
email: string;
|
email: string;
|
||||||
age: number | string;
|
age: number | string;
|
||||||
dateOfBirth: string;
|
dateOfBirth: string;
|
||||||
socialSecurityNumber: string;
|
socialSecurityNumber: string;
|
||||||
mailingAddress: string;
|
mailingAddress: string;
|
||||||
city: string;
|
city: string;
|
||||||
state: string;
|
state: string;
|
||||||
zipCode: string;
|
zipCode: string;
|
||||||
gender: string;
|
gender: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
handleFormSection1Data:(
|
handleFormSection1Data: (
|
||||||
fullName?: string|undefined,
|
fullName?: string | undefined,
|
||||||
homePhone?: string|undefined,
|
homePhone?: string | undefined,
|
||||||
cellPhone?: string|undefined,
|
cellPhone?: string | undefined,
|
||||||
email?: string|undefined,
|
email?: string | undefined,
|
||||||
age?: number|undefined|string,
|
age?: number | undefined | string,
|
||||||
dateOfBirth?: string|undefined,
|
dateOfBirth?: string | undefined,
|
||||||
socialSecurityNumber?: string|undefined,
|
socialSecurityNumber?: string | undefined,
|
||||||
mailingAddress?: string|undefined,
|
mailingAddress?: string | undefined,
|
||||||
city?: string|undefined,
|
city?: string | undefined,
|
||||||
state?: string|undefined,
|
state?: string | undefined,
|
||||||
zipCode?: string|undefined,
|
zipCode?: string | undefined,
|
||||||
gender?: string|undefined,
|
gender?: string | undefined
|
||||||
)=> void
|
) => void;
|
||||||
patientDataDiplay:any;
|
patientDataDiplay: any;
|
||||||
type:string;
|
type: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function PersonalSection({handleFormSection1Data,patientDataDiplay,type}:Props){
|
export default function PersonalSection({
|
||||||
|
handleFormSection1Data,
|
||||||
|
patientDataDiplay,
|
||||||
|
type,
|
||||||
|
}: Props) {
|
||||||
|
const [birthDateValue, setBirthDateValue] = React.useState<any>();
|
||||||
|
const [patient, setPatient] = React.useState<any>({
|
||||||
|
fullName: '',
|
||||||
|
fullNameError: false,
|
||||||
|
homePhone: '',
|
||||||
|
cellPhone: '',
|
||||||
|
cellPhoneError: false,
|
||||||
|
email: '',
|
||||||
|
emailError: false,
|
||||||
|
age: '',
|
||||||
|
ageError: false,
|
||||||
|
dateOfBirth: birthDateValue,
|
||||||
|
socialSecurityNumber: '',
|
||||||
|
mailingAddress: '',
|
||||||
|
mailingAddressFalse: false,
|
||||||
|
city: '',
|
||||||
|
state: '',
|
||||||
|
zipCode: '',
|
||||||
|
gender: 'male',
|
||||||
|
});
|
||||||
|
|
||||||
const [birthDateValue, setBirthDateValue] = React.useState<any>();
|
useEffect(() => {
|
||||||
const [patient, setPatient] = React.useState<any>({
|
handleFormSection1Data(
|
||||||
fullName: "",
|
patient.fullName,
|
||||||
fullNameError:false,
|
patient.homePhone,
|
||||||
homePhone: "",
|
patient.cellPhone,
|
||||||
cellPhone: "",
|
patient.email,
|
||||||
cellPhoneError: false,
|
patient.age,
|
||||||
email: "",
|
birthDateValue,
|
||||||
emailError: false,
|
patient.socialSecurityNumber,
|
||||||
age: "",
|
patient.mailingAddress,
|
||||||
ageError: false,
|
patient.city,
|
||||||
dateOfBirth: birthDateValue,
|
patient.state,
|
||||||
socialSecurityNumber: "",
|
patient.zipCode,
|
||||||
mailingAddress:"",
|
patient.gender
|
||||||
mailingAddressFalse:false,
|
);
|
||||||
city: "",
|
}, [patient]);
|
||||||
state: "",
|
|
||||||
zipCode: "",
|
|
||||||
gender: "male",
|
|
||||||
});
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Grid container direction='row' className='section1-test-class'>
|
||||||
|
<Grid
|
||||||
|
item
|
||||||
|
xs={2}
|
||||||
|
xl={3}
|
||||||
|
lg={4}
|
||||||
|
md={6}
|
||||||
|
sm={12}
|
||||||
|
className='collapsable-form-style '
|
||||||
|
>
|
||||||
|
<TextField
|
||||||
|
variant='outlined'
|
||||||
|
label="Patient's Full Name"
|
||||||
|
name='fullName'
|
||||||
|
placeholder='Please enter your name'
|
||||||
|
value={
|
||||||
|
type == 'display' ? patientDataDiplay.fullName : patient.fullName
|
||||||
|
}
|
||||||
|
disabled={type == 'display'}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
fullName: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
if (e.target.value === '') {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
fullNameError: true,
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
fullNameError: false,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
required
|
||||||
|
error={patient.fullNameError}
|
||||||
|
helperText={patient.fullNameError ? 'Please enter your name' : ''}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
useEffect(()=>{
|
<Grid
|
||||||
handleFormSection1Data(
|
item
|
||||||
patient.fullName,
|
xs={2}
|
||||||
patient.homePhone,
|
xl={3}
|
||||||
patient.cellPhone,
|
lg={4}
|
||||||
patient.email,
|
md={6}
|
||||||
patient.age,
|
sm={12}
|
||||||
birthDateValue,
|
className='collapsable-form-style'
|
||||||
patient.socialSecurityNumber,
|
>
|
||||||
patient.mailingAddress,
|
<TextField
|
||||||
patient.city,
|
required
|
||||||
patient.state,
|
variant='outlined'
|
||||||
patient.zipCode,
|
label='Phone Number'
|
||||||
patient.gender,
|
name='cellPhone'
|
||||||
)
|
type='number'
|
||||||
},[patient])
|
placeholder='Please enter your cell Phone number'
|
||||||
|
value={
|
||||||
|
type == 'display'
|
||||||
|
? patientDataDiplay.cellPhone
|
||||||
|
: patient.cellPhone
|
||||||
|
}
|
||||||
|
disabled={type == 'display'}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
cellPhone: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
if (!/^\d{10}$/.test(e.target.value)) {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
cellPhoneError: true,
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
cellPhoneError: false,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
error={patient.cellPhoneError}
|
||||||
|
helperText={
|
||||||
|
patient.cellPhoneError
|
||||||
|
? 'Please enter a valid 10-digit phone number'
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
item
|
||||||
return(
|
xs={2}
|
||||||
<>
|
xl={3}
|
||||||
<Grid container direction="row" className='section1-test-class'>
|
lg={4}
|
||||||
<Grid item xs={4} className='collapsable-form-style '>
|
md={6}
|
||||||
<TextField
|
sm={12}
|
||||||
variant="outlined"
|
className='collapsable-form-style'
|
||||||
label="Patient's Full Name"
|
>
|
||||||
name="fullName"
|
<TextField
|
||||||
placeholder='Please enter your name'
|
variant='outlined'
|
||||||
value={type=='display'?patientDataDiplay.fullName:patient.fullName}
|
label='Home Phone Number'
|
||||||
disabled={type=='display'}
|
name='homePhone'
|
||||||
onChange={(e)=>{
|
type='number'
|
||||||
setPatient((prevValues:any) => ({
|
placeholder='Please enter your home phone'
|
||||||
...prevValues,
|
value={
|
||||||
fullName: e.target.value,
|
type == 'display'
|
||||||
}));
|
? patientDataDiplay.homePhone
|
||||||
}}
|
: patient.homePhone
|
||||||
onBlur={(e) => {
|
}
|
||||||
if (e.target.value === "") {
|
disabled={type == 'display'}
|
||||||
setPatient((prevValues:any) => ({
|
onChange={(e) => {
|
||||||
...prevValues,
|
setPatient((prevValues: any) => ({
|
||||||
fullNameError: true,
|
...prevValues,
|
||||||
}));
|
homePhone: e.target.value,
|
||||||
} else {
|
}));
|
||||||
setPatient((prevValues:any) => ({
|
}}
|
||||||
...prevValues,
|
// error={!(/^\d{10}$/.test(patient.homePhone))}
|
||||||
fullNameError: false,
|
// helperText={!(/^\d{10}$/.test(patient.homePhone)) ? "Please enter a valid 10-digit phone number" : ""}
|
||||||
}));
|
/>
|
||||||
}
|
</Grid>
|
||||||
}}
|
|
||||||
required
|
|
||||||
error={patient.fullNameError}
|
|
||||||
helperText={patient.fullNameError ? "Please enter your name" : ""}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
|
<Grid
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
item
|
||||||
<TextField
|
xs={2}
|
||||||
required
|
xl={3}
|
||||||
variant="outlined"
|
lg={4}
|
||||||
label="Phone Number"
|
md={6}
|
||||||
name="cellPhone"
|
sm={12}
|
||||||
type="number"
|
className='collapsable-form-style'
|
||||||
placeholder='Please enter your cell Phone number'
|
>
|
||||||
value={type=='display'?patientDataDiplay.cellPhone:patient.cellPhone}
|
<TextField
|
||||||
disabled={type=='display'}
|
required
|
||||||
onChange={(e)=>{
|
variant='outlined'
|
||||||
setPatient((prevValues:any) => ({
|
label='Email'
|
||||||
...prevValues,
|
name='email'
|
||||||
cellPhone: e.target.value,
|
placeholder='Please enter your email'
|
||||||
}));
|
value={type == 'display' ? patientDataDiplay.email : patient.email}
|
||||||
}}
|
disabled={type == 'display'}
|
||||||
onBlur={(e) => {
|
onChange={(e) => {
|
||||||
if (!(/^\d{10}$/.test(e.target.value))) {
|
setPatient((prevValues: any) => ({
|
||||||
setPatient((prevValues:any) => ({
|
...prevValues,
|
||||||
...prevValues,
|
email: e.target.value,
|
||||||
cellPhoneError: true,
|
}));
|
||||||
}));
|
}}
|
||||||
} else {
|
onBlur={(e) => {
|
||||||
setPatient((prevValues:any) => ({
|
if (!/^\S+@\S+\.\S+$/.test(e.target.value)) {
|
||||||
...prevValues,
|
setPatient((prevValues: any) => ({
|
||||||
cellPhoneError: false,
|
...prevValues,
|
||||||
}));
|
emailError: true,
|
||||||
}
|
}));
|
||||||
}}
|
} else {
|
||||||
error={patient.cellPhoneError}
|
setPatient((prevValues: any) => ({
|
||||||
helperText={patient.cellPhoneError? "Please enter a valid 10-digit phone number" : ""}
|
...prevValues,
|
||||||
/>
|
emailError: false,
|
||||||
</Grid>
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
error={patient.emailError}
|
||||||
|
helperText={
|
||||||
|
patient.emailError ? 'Please enter a valid email address' : ''
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
<Grid
|
||||||
|
item
|
||||||
|
xs={2}
|
||||||
|
xl={3}
|
||||||
|
lg={4}
|
||||||
|
md={6}
|
||||||
|
sm={12}
|
||||||
|
className='collapsable-form-style'
|
||||||
|
>
|
||||||
|
<TextField
|
||||||
|
required
|
||||||
|
variant='outlined'
|
||||||
|
label='Age'
|
||||||
|
name='age'
|
||||||
|
type='number'
|
||||||
|
placeholder='Please enter your age'
|
||||||
|
value={type == 'display' ? patientDataDiplay.age : patient.age}
|
||||||
|
disabled={type == 'display'}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
age: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
if (e.target.value === '') {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
ageError: true,
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
ageError: false,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
error={patient.ageError}
|
||||||
|
helperText={patient.ageError ? 'Please enter your age' : ''}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<TextField
|
item
|
||||||
variant="outlined"
|
xs={2}
|
||||||
label="Home Phone Number"
|
xl={3}
|
||||||
name="homePhone"
|
lg={4}
|
||||||
type='number'
|
md={6}
|
||||||
placeholder='Please enter your home phone'
|
sm={12}
|
||||||
value={type=='display'?patientDataDiplay.homePhone:patient.homePhone}
|
className='collapsable-form-style'
|
||||||
disabled={type=='display'}
|
>
|
||||||
onChange={(e)=>{
|
<FormControl>
|
||||||
setPatient((prevValues:any) => ({
|
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
||||||
...prevValues,
|
<DatePicker
|
||||||
homePhone: e.target.value,
|
label='Date of Birth'
|
||||||
}));
|
value={
|
||||||
}}
|
type == 'display'
|
||||||
// error={!(/^\d{10}$/.test(patient.homePhone))}
|
? patientDataDiplay.dateOfBirth
|
||||||
// helperText={!(/^\d{10}$/.test(patient.homePhone)) ? "Please enter a valid 10-digit phone number" : ""}
|
: birthDateValue
|
||||||
/>
|
}
|
||||||
</Grid>
|
disabled={type == 'display'}
|
||||||
|
onChange={(newValue) => {
|
||||||
|
setBirthDateValue(newValue);
|
||||||
|
}}
|
||||||
|
renderInput={(params) => (
|
||||||
|
<TextField variant='outlined' {...params} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</LocalizationProvider>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<TextField
|
item
|
||||||
required
|
xs={2}
|
||||||
variant="outlined"
|
xl={3}
|
||||||
label="Email"
|
lg={4}
|
||||||
name="email"
|
md={6}
|
||||||
placeholder='Please enter your email'
|
sm={12}
|
||||||
value={type=='display'?patientDataDiplay.email:patient.email}
|
className='collapsable-form-style'
|
||||||
disabled={type=='display'}
|
>
|
||||||
onChange={(e)=>{
|
<TextField
|
||||||
setPatient((prevValues:any) => ({
|
variant='outlined'
|
||||||
...prevValues,
|
label='Social Security Number'
|
||||||
email: e.target.value,
|
name='socialSecurityNumber'
|
||||||
}));
|
value={
|
||||||
}}
|
type == 'display'
|
||||||
onBlur={(e) => {
|
? patientDataDiplay.socialSecurityNumber
|
||||||
if (!(/^\S+@\S+\.\S+$/.test(e.target.value))) {
|
: patient.socialSecurityNumber
|
||||||
setPatient((prevValues:any) => ({
|
}
|
||||||
...prevValues,
|
disabled={type == 'display'}
|
||||||
emailError: true,
|
onChange={(e) => {
|
||||||
}));
|
setPatient((prevValues: any) => ({
|
||||||
} else {
|
...prevValues,
|
||||||
setPatient((prevValues:any) => ({
|
socialSecurityNumber: e.target.value,
|
||||||
...prevValues,
|
}));
|
||||||
emailError: false,
|
}}
|
||||||
}));
|
// onBlur={formik.handleBlur}
|
||||||
}
|
// error={formik.touched.socialSecurityNumber && Boolean(formik.errors.socialSecurityNumber)}
|
||||||
}}
|
// helperText={formik.touched.socialSecurityNumber && formik.errors.socialSecurityNumber}
|
||||||
error={patient.emailError}
|
/>
|
||||||
helperText={patient.emailError? "Please enter a valid email address" : ""}
|
</Grid>
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
|
||||||
<TextField
|
|
||||||
required
|
|
||||||
variant="outlined"
|
|
||||||
label="Age"
|
|
||||||
name="age"
|
|
||||||
type="number"
|
|
||||||
placeholder='Please enter your age'
|
|
||||||
value={type=='display'?patientDataDiplay.age:patient.age}
|
|
||||||
disabled={type=='display'}
|
|
||||||
onChange={(e)=>{
|
|
||||||
setPatient((prevValues:any) => ({
|
|
||||||
...prevValues,
|
|
||||||
age: e.target.value,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
onBlur={(e) => {
|
|
||||||
if (e.target.value === "") {
|
|
||||||
setPatient((prevValues:any) => ({
|
|
||||||
...prevValues,
|
|
||||||
ageError: true,
|
|
||||||
}));
|
|
||||||
} else {
|
|
||||||
setPatient((prevValues:any) => ({
|
|
||||||
...prevValues,
|
|
||||||
ageError: false,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
error={patient.ageError}
|
|
||||||
helperText={patient.ageError ? "Please enter your age" : ""}
|
|
||||||
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<FormControl >
|
item
|
||||||
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
xs={2}
|
||||||
<DatePicker
|
xl={3}
|
||||||
label="Date of Birth"
|
lg={4}
|
||||||
value={type=='display'?patientDataDiplay.dateOfBirth:birthDateValue}
|
md={6}
|
||||||
disabled={type=='display'}
|
sm={12}
|
||||||
onChange={(newValue) => {
|
className='collapsable-form-style'
|
||||||
setBirthDateValue(newValue);
|
>
|
||||||
}}
|
<TextField
|
||||||
renderInput={(params) => <TextField variant="outlined" {...params} />}
|
required
|
||||||
/>
|
variant='outlined'
|
||||||
</LocalizationProvider>
|
label='Mailing Address'
|
||||||
</FormControl>
|
name='mailingAddress'
|
||||||
|
value={
|
||||||
</Grid>
|
type == 'display'
|
||||||
|
? patientDataDiplay.mailingAddress
|
||||||
|
: patient.mailingAddress
|
||||||
|
}
|
||||||
|
disabled={type == 'display'}
|
||||||
|
onChange={(e) => {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
mailingAddress: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
onBlur={(e) => {
|
||||||
|
if (e.target.value === '') {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
mailingAddressError: true,
|
||||||
|
}));
|
||||||
|
} else {
|
||||||
|
setPatient((prevValues: any) => ({
|
||||||
|
...prevValues,
|
||||||
|
mailingAddressError: false,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
error={patient.mailingAddressError}
|
||||||
|
helperText={
|
||||||
|
patient.mailingAddressError
|
||||||
|
? 'Please enter your mailing address'
|
||||||
|
: ''
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<TextField
|
item
|
||||||
variant="outlined"
|
xs={2}
|
||||||
label="Social Security Number"
|
xl={3}
|
||||||
name="socialSecurityNumber"
|
lg={4}
|
||||||
value={type=='display'?patientDataDiplay.socialSecurityNumber:patient.socialSecurityNumber}
|
md={6}
|
||||||
disabled={type=='display'}
|
sm={12}
|
||||||
onChange={(e)=>{
|
className='collapsable-form-style'
|
||||||
setPatient((prevValues:any) => ({
|
>
|
||||||
...prevValues,
|
<TextField
|
||||||
socialSecurityNumber: e.target.value,
|
variant='outlined'
|
||||||
}));
|
label='State'
|
||||||
}}
|
name='state'
|
||||||
// onBlur={formik.handleBlur}
|
value={type == 'display' ? patientDataDiplay.state : patient.state}
|
||||||
// error={formik.touched.socialSecurityNumber && Boolean(formik.errors.socialSecurityNumber)}
|
disabled={type == 'display'}
|
||||||
// helperText={formik.touched.socialSecurityNumber && formik.errors.socialSecurityNumber}
|
onChange={(e) => {
|
||||||
/>
|
setPatient((prevValues: any) => ({
|
||||||
</Grid>
|
...prevValues,
|
||||||
|
state: e.target.value,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<TextField
|
item
|
||||||
required
|
xs={2}
|
||||||
variant="outlined"
|
xl={3}
|
||||||
label="Mailing Address"
|
lg={4}
|
||||||
name="mailingAddress"
|
md={6}
|
||||||
value={type=='display'?patientDataDiplay.mailingAddress:patient.mailingAddress}
|
sm={12}
|
||||||
disabled={type=='display'}
|
className='collapsable-form-style'
|
||||||
onChange={(e)=>{
|
>
|
||||||
setPatient((prevValues:any) => ({
|
<TextField
|
||||||
...prevValues,
|
variant='outlined'
|
||||||
mailingAddress: e.target.value,
|
label='City'
|
||||||
}));
|
name='city'
|
||||||
}}
|
value={type == 'display' ? patientDataDiplay.city : patient.city}
|
||||||
onBlur={(e) => {
|
disabled={type == 'display'}
|
||||||
if (e.target.value === "") {
|
onChange={(e) => {
|
||||||
setPatient((prevValues:any) => ({
|
setPatient((prevValues: any) => ({
|
||||||
...prevValues,
|
...prevValues,
|
||||||
mailingAddressError: true,
|
city: e.target.value,
|
||||||
}));
|
}));
|
||||||
} else {
|
}}
|
||||||
setPatient((prevValues:any) => ({
|
/>
|
||||||
...prevValues,
|
</Grid>
|
||||||
mailingAddressError: false,
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
error={patient.mailingAddressError}
|
|
||||||
helperText={patient.mailingAddressError? "Please enter your mailing address" : ""}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
|
||||||
<TextField
|
|
||||||
variant="outlined"
|
|
||||||
label="State"
|
|
||||||
name="state"
|
|
||||||
value={type=='display'?patientDataDiplay.state:patient.state}
|
|
||||||
disabled={type=='display'}
|
|
||||||
onChange={(e)=>{
|
|
||||||
setPatient((prevValues:any) => ({
|
|
||||||
...prevValues,
|
|
||||||
state: e.target.value,
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
<Grid
|
||||||
<TextField
|
item
|
||||||
variant="outlined"
|
xs={2}
|
||||||
label="City"
|
xl={3}
|
||||||
name="city"
|
lg={4}
|
||||||
value={type=='display'?patientDataDiplay.city:patient.city}
|
md={6}
|
||||||
disabled={type=='display'}
|
sm={12}
|
||||||
onChange={(e)=>{
|
className='collapsable-form-style'
|
||||||
setPatient((prevValues:any) => ({
|
>
|
||||||
...prevValues,
|
<TextField
|
||||||
city: e.target.value,
|
variant='outlined'
|
||||||
}));
|
label='Zip Code'
|
||||||
}}
|
name='zipCode'
|
||||||
/>
|
value={
|
||||||
</Grid>
|
type == 'display' ? patientDataDiplay.zipCode : patient.zipCode
|
||||||
|
}
|
||||||
<Grid item xs={4} className='collapsable-form-style'>
|
disabled={type == 'display'}
|
||||||
<TextField
|
onChange={(e) => {
|
||||||
variant="outlined"
|
setPatient((prevValues: any) => ({
|
||||||
label="Zip Code"
|
...prevValues,
|
||||||
name="zipCode"
|
zipCode: e.target.value,
|
||||||
value={type=='display'?patientDataDiplay.zipCode:patient.zipCode}
|
}));
|
||||||
disabled={type=='display'}
|
}}
|
||||||
onChange={(e)=>{
|
// onBlur={formik.handleBlur}
|
||||||
setPatient((prevValues:any) => ({
|
// error={formik.touched.zipCode && Boolean(formik.errors.zipCode)}
|
||||||
...prevValues,
|
// helperText={formik.touched.zipCode && formik.errors.zipCode}
|
||||||
zipCode: e.target.value,
|
/>
|
||||||
}));
|
</Grid>
|
||||||
}}
|
|
||||||
// onBlur={formik.handleBlur}
|
|
||||||
// error={formik.touched.zipCode && Boolean(formik.errors.zipCode)}
|
|
||||||
// helperText={formik.touched.zipCode && formik.errors.zipCode}
|
|
||||||
/>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid item xs={4} className='collapsable-form-style-radioButtons'>
|
<Grid
|
||||||
<FormControl >
|
item
|
||||||
<FormLabel>Gender</FormLabel>
|
xs={2}
|
||||||
<RadioGroup
|
xl={3}
|
||||||
aria-labelledby="demo-radio-buttons-group-label"
|
lg={4}
|
||||||
defaultValue={type=='display'?patientDataDiplay.gender:patient.gender}
|
md={6}
|
||||||
name="radio-buttons-group"
|
sm={12}
|
||||||
onChange={(e)=>{
|
className='collapsable-form-style-radioButtons'
|
||||||
setPatient((prevValues:any) => ({
|
>
|
||||||
...prevValues,
|
<FormControl>
|
||||||
gender: e.target.value,
|
<FormLabel>Gender</FormLabel>
|
||||||
}));
|
<RadioGroup
|
||||||
}}
|
aria-labelledby='demo-radio-buttons-group-label'
|
||||||
sx={{display:'flex', flexDirection:'row'}}
|
defaultValue={
|
||||||
>
|
type == 'display' ? patientDataDiplay.gender : patient.gender
|
||||||
<FormControlLabel
|
}
|
||||||
disabled={type=='display'}
|
name='radio-buttons-group'
|
||||||
value="male" control={<Radio />} label="Male" />
|
onChange={(e) => {
|
||||||
<FormControlLabel
|
setPatient((prevValues: any) => ({
|
||||||
disabled={type=='display'}
|
...prevValues,
|
||||||
value="female" control={<Radio />} label="Female" />
|
gender: e.target.value,
|
||||||
</RadioGroup>
|
}));
|
||||||
</FormControl>
|
}}
|
||||||
</Grid>
|
sx={{ display: 'flex', flexDirection: 'row' }}
|
||||||
</Grid>
|
>
|
||||||
</>
|
<FormControlLabel
|
||||||
)
|
disabled={type == 'display'}
|
||||||
}
|
value='male'
|
||||||
|
control={<Radio />}
|
||||||
|
label='Male'
|
||||||
|
/>
|
||||||
|
<FormControlLabel
|
||||||
|
disabled={type == 'display'}
|
||||||
|
value='female'
|
||||||
|
control={<Radio />}
|
||||||
|
label='Female'
|
||||||
|
/>
|
||||||
|
</RadioGroup>
|
||||||
|
</FormControl>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user