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-4043: Dispensing: Allow back dating dispense events for ret… #122

Merged
merged 2 commits into from
Oct 8, 2024

Conversation

mogoodrich
Copy link
Member

…rospective entry

(update to latest Core libraries and fix usage of OpenMRS datepicker accordingly)

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This is a follow-up commit for the original, merged commit for https://openmrs.atlassian.net/browse/O3-4043

Unfortunately, I built against an old version of the core ESM libraries, and the OpenmrsDatepicker had been updated since then so things failed when deployed to our staging servers.

This updates Dispense to run against the latest ESM Core, and then fixed the code to work with the OpenmrsDatepicker and currently defined.

Updating the datepicker also fixed some of the issues I was seeing with it... :)

Screenshots

No new UI changes beyond the initial, merged PR

Related Issue

https://openmrs.atlassian.net/browse/O3-4043

Other

…rospective entry

(update to latest Core libraries and fix usage of OpenMRS datepicker accordingly)
@@ -506,13 +501,14 @@ const MedicationDispenseReview: React.FC<MedicationDispenseReviewProps> = ({
labelText={t('dispenseDate', 'Date of Dispense')}
minDate={prescriptionDate ? dayjs(prescriptionDate).startOf('day').toDate() : null}
maxDate={dayjs().toDate()}
onChange={(selectedDate) => {
const currentDate = dayjs(medicationDispense.whenHandedOver);
onChange={(input) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

the OpenMRS datepicker now returns a Date, not a CalenderDate, which makes things simpler

};
});

jest.mocked(openmrsFetch);
Copy link
Member Author

@mogoodrich mogoodrich Oct 8, 2024

Choose a reason for hiding this comment

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

Updating to the cleaner method of mocking

@@ -1248,7 +1240,7 @@ describe('Medication Request Resource Test', () => {

// @ts-ignore
useSWR.mockImplementation(() => ({ data: { data: queryRequestBundle } }));
const { allergies, totalAllergies } = usePatientAllergies('558494fe-5850-4b34-a3bf-06550334ba4a', 10000);
const { totalAllergies } = usePatientAllergies('558494fe-5850-4b34-a3bf-06550334ba4a', 10000);
Copy link
Member Author

Choose a reason for hiding this comment

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

unused variable caught by the linter

@@ -1,26 +1,30 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

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

I just copied this from the Patient Management

Copy link

@chibongho chibongho left a comment

Choose a reason for hiding this comment

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

Looks good.

tsconfig.json Outdated
"es2021",
"es2022",
"es5",
"scripthost",

Choose a reason for hiding this comment

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

Probably harmless, but we don't need "scripthost" (it's a Microsoft Windows API thing), or anything before "es2022" (since es2022 includes those things already).

We should probably clean up the tsconfig in patient-management / patient-chart / esm-core at some point....

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool, I removed those (and confirmed things still worked), thanks!

…rospective entry

(remove unused libs from tsconfig)
@mogoodrich
Copy link
Member Author

Thanks @chibongho @ibacher , merging!

@mogoodrich mogoodrich merged commit ca3c9ef into main Oct 8, 2024
4 checks passed
@mogoodrich mogoodrich deleted the O3-4043-2 branch October 8, 2024 16:22
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.

3 participants