(feat) O3-3190: Add print support to FormEngine#543
(feat) O3-3190: Add print support to FormEngine#543MohamedAliMefteh wants to merge 4 commits intoopenmrs:mainfrom
Conversation
samuelmale
left a comment
There was a problem hiding this comment.
@MohamedAliMefteh I think rendering some controls like the "Add" button from the repeat section, isn't necessary while in "print mode"
| kind="tertiary" | ||
| onClick={handlePrint} | ||
| size={responsiveSize}> | ||
| Print Form |
There was a problem hiding this comment.
Can you localise text?
{t("printForm", "Print Form")}… Header with a custom hook for it, adjusted pages and certain elements to not break within the print view
hey @samuelmale, yeah there is a lot to consider here, I think this works fine especially in 'view' mode, and in 'enter' mode when the form is filled it does the job but when the form is empty like in the form builder, it's not perfect especially in cases where there are questions that render conditionally. I don't how this feature could be used in a real-life scenario but I would like any guidance so I can adjust it accordingly |
|
So, I think we should probably push the discussion here to Slack or (even better) a Jira ticket. Before we leap to "what should the code do?" We really need to answer: "who is printing a form and why are they printing it?" At a very minimum, I don't see any use for "interactive" widgets like "Upload an Image", "Add", or any boxes labelled "Choose an option". But specific requirements could push other decisions in different directions. Things like:
I think without having those requirements clear, we'll never really get anywhere. As-is, we cannot merge in anything like this without stuffing it behind a feature flag and I'm not sure we've gotten enough of the requirements yet to make it worthwhile doing so. Thanks for the work on this though! It's definitely an important thing for us to address! |
|
Yeah that does make sense, so should i close this for now ? |
Requirements
Summary
This pull request introduces a new print feature to the FormEngine, allowing users to print the currently rendered form via a dedicated Print button.
Key enhancements include:
Print Functionality Integration: Utilizes the react-to-print library to reference the printable portion of the form.
Optimized Print View: Applies @media print rules to:
Hide non-essential UI elements.
Ensure a clean layout across multiple pages.
Prevent page breaks between related elements such as question labels and their corresponding inputs.
Cross-Mode Support: The feature works consistently across all FormEngine modes:
View Mode:
Renders a clean print view.
Empty forms hide placeholder elements.
Filled forms display answers as expected.
Enter Mode:
Filled forms print correctly.
Empty forms still display checkboxes and radio groups as-is. These should be updated to render as standard input placeholders for print.
Images and certain component types should ideally render as empty, or placeholder sections based on future design decisions.
This feature lays the foundation for a consistent and user-friendly print experience, with future improvements planned for component-specific print behaviour.
Screenshots
formbuilder-entermode.mp4
formbuilder-viewmode.mp4
patientchart.mp4
Related Issue
https://openmrs.atlassian.net/browse/O3-3190
Other