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