Compare commits
No commits in common. "d8a25984fc5e7baf3ff4db5fb7866029ce04778f" and "9c7ff223fec9d27b74e01e55f96a3ebc84e12c49" have entirely different histories.
d8a25984fc
...
9c7ff223fe
@ -42,20 +42,15 @@ interface Patient {
|
||||
export default function PersonalSection({handleFormSection1Data,patientDataDiplay,type}:Props){
|
||||
|
||||
const [birthDateValue, setBirthDateValue] = React.useState<any>();
|
||||
const [patient, setPatient] = React.useState<any>({
|
||||
const [patient, setPatient] = React.useState<Patient>({
|
||||
fullName: "",
|
||||
fullNameError:false,
|
||||
homePhone: "",
|
||||
cellPhone: "",
|
||||
cellPhoneError: false,
|
||||
email: "",
|
||||
emailError: false,
|
||||
age: "",
|
||||
ageError: false,
|
||||
dateOfBirth: birthDateValue,
|
||||
socialSecurityNumber: "",
|
||||
mailingAddress:"",
|
||||
mailingAddressFalse:false,
|
||||
city: "",
|
||||
state: "",
|
||||
zipCode: "",
|
||||
@ -85,40 +80,26 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
return(
|
||||
<>
|
||||
<Grid container direction="row" className='section1-test-class'>
|
||||
<Grid item xs={4} 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 item xs={4} 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) => ({
|
||||
...prevValues,
|
||||
fullName: e.target.value,
|
||||
}));
|
||||
}}
|
||||
required
|
||||
error={patient.fullName === ""}
|
||||
helperText={patient.fullName === "" ? "Please enter your name" : ""}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
|
||||
<Grid item xs={4} className='collapsable-form-style'>
|
||||
<TextField
|
||||
required
|
||||
@ -130,26 +111,13 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.cellPhone:patient.cellPhone}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...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" : ""}
|
||||
error={!(/^\d{10}$/.test(patient.cellPhone))}
|
||||
helperText={!(/^\d{10}$/.test(patient.cellPhone)) ? "Please enter a valid 10-digit phone number" : ""}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@ -163,7 +131,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.homePhone:patient.homePhone}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
homePhone: e.target.value,
|
||||
}));
|
||||
@ -183,26 +151,13 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.email:patient.email}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
email: e.target.value,
|
||||
}));
|
||||
}}
|
||||
onBlur={(e) => {
|
||||
if (!(/^\S+@\S+\.\S+$/.test(e.target.value))) {
|
||||
setPatient((prevValues:any) => ({
|
||||
...prevValues,
|
||||
emailError: true,
|
||||
}));
|
||||
} else {
|
||||
setPatient((prevValues:any) => ({
|
||||
...prevValues,
|
||||
emailError: false,
|
||||
}));
|
||||
}
|
||||
}}
|
||||
error={patient.emailError}
|
||||
helperText={patient.emailError? "Please enter a valid email address" : ""}
|
||||
error={!(/^\S+@\S+\.\S+$/.test(patient.email))}
|
||||
helperText={!(/^\S+@\S+\.\S+$/.test(patient.email)) ? "Please enter a valid email address" : ""}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid item xs={4} className='collapsable-form-style'>
|
||||
@ -216,26 +171,13 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.age:patient.age}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...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" : ""}
|
||||
error={patient.age === ""}
|
||||
helperText={patient.age === "" ? "Please enter your age" : ""}
|
||||
|
||||
/>
|
||||
</Grid>
|
||||
@ -250,7 +192,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
onChange={(newValue) => {
|
||||
setBirthDateValue(newValue);
|
||||
}}
|
||||
renderInput={(params) => <TextField variant="outlined" {...params} />}
|
||||
renderInput={(params) => <TextField required variant="outlined" {...params} />}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</FormControl>
|
||||
@ -265,7 +207,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.socialSecurityNumber:patient.socialSecurityNumber}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
socialSecurityNumber: e.target.value,
|
||||
}));
|
||||
@ -285,26 +227,13 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.mailingAddress:patient.mailingAddress}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...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" : ""}
|
||||
error={patient.mailingAddress === ""}
|
||||
helperText={patient.mailingAddress === "" ? "Please enter your mailing address" : ""}
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
@ -316,7 +245,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.state:patient.state}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
state: e.target.value,
|
||||
}));
|
||||
@ -332,7 +261,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.city:patient.city}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
city: e.target.value,
|
||||
}));
|
||||
@ -348,7 +277,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
value={type=='display'?patientDataDiplay.zipCode:patient.zipCode}
|
||||
disabled={type=='display'}
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
zipCode: e.target.value,
|
||||
}));
|
||||
@ -367,7 +296,7 @@ export default function PersonalSection({handleFormSection1Data,patientDataDipla
|
||||
defaultValue={type=='display'?patientDataDiplay.gender:patient.gender}
|
||||
name="radio-buttons-group"
|
||||
onChange={(e)=>{
|
||||
setPatient((prevValues:any) => ({
|
||||
setPatient((prevValues) => ({
|
||||
...prevValues,
|
||||
gender: e.target.value,
|
||||
}));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user