-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update intake form fields and removed substances field required (#136)
* update intake form fields and removed substances field required Problem - Feedback from the client to: - Remove substances field as required to submit the form - Add comments field to the intake form - Add document number field to the intake form Solution - Remove substances field as required to submit the form - Add comments field to the intake form - Add document number field to the intake form - Updated API calls to include the new fields Ticket: https://mediform.atlassian.net/browse/MEDI-91 Documentation: N/A Tests - manual testing - new fields are displayed on the intake form - substances field is not required to submit the form - NOTE: API has not implemented the new fields yet, so the form will submit but retrieval will not have the new fields - `yarn build` passes * Update helper text for DocumentNumberField component for consistency
- Loading branch information
Showing
8 changed files
with
92 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from "react"; | ||
import { Box, FormControl, TextField } from "@mui/material"; | ||
import { Controller } from "react-hook-form"; | ||
import { FormFieldProps } from "../../interfaces/FormFieldProps"; | ||
import { IntakeFormDataInterface } from "../../interfaces/IntakeFormDataInterface"; | ||
|
||
|
||
/** | ||
* Renders a comments input field controlled by React Hook Form. | ||
* | ||
* @param props FormField component props. | ||
* | ||
* @returns CommentsField component. | ||
*/ | ||
export function CommentsField({ control }: FormFieldProps<IntakeFormDataInterface>) { | ||
return ( | ||
<Box> | ||
<FormControl fullWidth> | ||
<Controller | ||
name="comment" | ||
control={control} | ||
render={({ field }) => ( | ||
<TextField | ||
placeholder="Enter additional comments here" | ||
variant="outlined" | ||
label="Comments" | ||
multiline={true} | ||
rows={3} | ||
{...field} | ||
/> | ||
)} | ||
/> | ||
</FormControl> | ||
</Box> | ||
); | ||
} |
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,35 @@ | ||
import React from "react"; | ||
import { FormControl, TextField } from "@mui/material"; | ||
import { Controller } from "react-hook-form"; | ||
import { FormFieldProps } from "../../interfaces/FormFieldProps"; | ||
import { IntakeFormDataInterface } from "../../interfaces/IntakeFormDataInterface"; | ||
|
||
|
||
|
||
/** | ||
* Renders a document number input field controlled by React Hook Form. | ||
* | ||
* @param props FormField component props. | ||
* | ||
* @returns DocumentNumberField component. | ||
*/ | ||
export function DocumentNumberField({ control, errors }: FormFieldProps<IntakeFormDataInterface>) { | ||
return ( | ||
<FormControl> | ||
<Controller | ||
name="document_num" | ||
control={control} | ||
render={({ field }) => ( | ||
<TextField | ||
{...field} | ||
label="Document Number" | ||
variant="outlined" | ||
placeholder="1234" | ||
helperText="Enter the document number, e.g., 1234." | ||
error={Boolean(errors?.document_num)} | ||
/> | ||
)} | ||
/> | ||
</FormControl> | ||
); | ||
} |
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
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