Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) O3-4342: Split allergy form fields #2193

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Muppasanipraneeth
Copy link

@Muppasanipraneeth Muppasanipraneeth commented Jan 14, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR separates the 'Onset date' and 'Additional comments' fields in the allergy form. Presently, the two are combined in a single field. Separating them aligns them with the designs and allows for proper validation of the individual fields.

Screenshots

onsetDate added onsetDate

Related Issue

https://issues.openmrs.org/browse/O3-4342

Other

@Muppasanipraneeth
Copy link
Author

@denniskigen

@Muppasanipraneeth Muppasanipraneeth marked this pull request as ready for review January 15, 2025 10:30
@Muppasanipraneeth Muppasanipraneeth marked this pull request as draft January 15, 2025 10:32
@denniskigen denniskigen changed the title (feat) : 03-4342 Separate 'Onset Date' and 'Additional Comments' Fields in Allergy Record Form (feat) O3-4342: Separate 'Onset Date' and 'Additional Comments' Fields in Allergy Record Form Jan 17, 2025
@denniskigen denniskigen changed the title (feat) O3-4342: Separate 'Onset Date' and 'Additional Comments' Fields in Allergy Record Form (feat) O3-4342: Split allergy form fields Jan 17, 2025
@denniskigen
Copy link
Member

@Muppasanipraneeth could you add screenshots to support your changes?

@@ -45,7 +45,7 @@ const AllergiesDetailedSummary: React.FC<AllergiesDetailedSummaryProps> = ({ pat
{ key: 'reaction', header: t('reaction', 'Reaction') },
{
key: 'note',
header: t('onsetDateAndComments', 'Onset date and comments'),
header: t('onsetDate', 'Onset date '),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header: t('onsetDate', 'Onset date '),
header: t('onsetDate', 'Onset date'),

return currentDate <= new Date();
},
{
message: 'Date cannot be in the future',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap this in a t function for i18n.

render={({ field: { onBlur, onChange, value } }) => (
<OpenmrsDatePicker
id="onsetDate"
label={t('DateofOnset', 'Date of Onset ')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
label={t('DateofOnset', 'Date of Onset ')}
label={t('dateOfOnset', 'Date of Onset')}

Comment on lines 426 to 428
onChange={(selectedDate) => {
return onChange(selectedDate);
}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onChange={(selectedDate) => {
return onChange(selectedDate);
}}
onChange={(selectedDate) => onChange(selectedDate})

@@ -410,7 +443,7 @@ function AllergyForm(props: AllergyFormProps) {
<TextArea
id="comments"
invalidText={t('invalidComment', 'Invalid comment, try again')}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
invalidText={t('invalidComment', 'Invalid comment, try again')}

In which circumstances would the comment field be invalid? Per the zod schema, it's an optional field (comment: z.string().optional()). It has no calidation rules that could make it invalid. We should only use the invalid and invalidText props if there are validation rules in place.

@Muppasanipraneeth Muppasanipraneeth marked this pull request as ready for review January 22, 2025 04:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants