Skip to content

(feat) O3-2510: Should be able to launch Add Drug Order workspace from a form#95

Merged
brandones merged 9 commits into
mainfrom
workspace-launcher
Oct 30, 2023
Merged

(feat) O3-2510: Should be able to launch Add Drug Order workspace from a form#95
brandones merged 9 commits into
mainfrom
workspace-launcher

Conversation

@brandones

@brandones brandones commented Oct 23, 2023

Copy link
Copy Markdown
Contributor

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 creates a new question type that renders a button that opens whatever workspace is configured.

Screenshots

image

Screencast.from.2023-10-25.14-01-15.mp4

Related Issue

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

Other

Depends on openmrs/openmrs-esm-patient-chart#1430

this.label = options.label || '';
this.buttonLabel = options.buttonLabel || '';
this.workspaceName = options.workspaceName || 'order-basket';
this.controlType = AfeControlType.AfeFormControl;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have no idea what this line does or if it is needed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's to ensure this code does the right thing. Technically, this should probably be AfeControlType.None because I can't see why we need validators of value calculators on a button, but if it works, 🤷.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, I missed this comment

@Input() public workspaceName: string;

public handleClick() {
if (!window['_openmrs_esm_patient_common_lib']) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should these checks go somewhere where they will run at form load time, rather than when clicked? onInit or something?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe do a one-time check the first time toWorkspaceLauncher() is called; that way, we're still only checking on forms that are using this component, but the check is done during the render cycle?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cool, did that.

@brandones brandones marked this pull request as ready for review October 25, 2023 18:41
@rbuisson

Copy link
Copy Markdown
Contributor

@brandones , is there a way to open directly the drug order screen, not the "drug + lab" order basket?

@rbuisson

rbuisson commented Oct 26, 2023

Copy link
Copy Markdown
Contributor

A cosmetic consideration: would it be possible to have a button less conspicuous?
Screenshot 2023-10-26 at 11 35 15
This styling might be better, but if there is constraints in Carbon as when to use or not those buttons, then we must stick to the guidelines.

@brandones

Copy link
Copy Markdown
Contributor Author

It supports sending to any workspace; order-basket is the default if none is specified. I have just added support for changing the button type. Adding support for icons would be tricky (without hard-coding the icon SVG). Here's videos with a couple different configurations.

Screencast.from.2023-10-29.18-19-05.mp4
Screencast.from.2023-10-29.18-26-10.mp4

@brandones brandones requested a review from ibacher October 29, 2023 22:31
@ibacher ibacher changed the title O3-2510 Should be able to launch Add Drug Order workspace from a form (feat) O3-2510: Should be able to launch Add Drug Order workspace from a form Oct 30, 2023
@brandones brandones merged commit 17c33ff into main Oct 30, 2023
@donaldkibet donaldkibet deleted the workspace-launcher branch December 7, 2023 07:23
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