- Notifications
You must be signed in to change notification settings - Fork 115
#16682 - EMR Document Template can be saved with empty data #17513
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
base: development
Are you sure you want to change the base?
#16682 - EMR Document Template can be saved with empty data #17513
Conversation
…ng mandatory field validations)
WalkthroughNavigation return paths now include faces-redirect; form fields enforce required validation for Template name and Type; controller save logic adjusts validation and refines user-facing save/update messages. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{xhtml,java}
📄 CodeRabbit inference engine (AGENTS.md)
Implement accessibility with proper tooltips and labeling
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
**/*.{java,xhtml}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{java,xhtml}: UsewebUserController.hasPrivilege()for UI privilege integration
UseconfigOptionApplicationControllerfor dynamic configuration values
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
**/*Controller.java
📄 CodeRabbit inference engine (AGENTS.md)
Reuse existing controller properties and methods; avoid introducing new filtered values, global filters, or backend logic for UI-only tasks
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Do not 'fix' intentional typos in model/controller property names used for database compatibility
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
**/*.{xhtml,css}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{xhtml,css}: For UI improvements, limit work to XHTML/CSS/PrimeFaces unless backend changes are explicitly requested
Prefer PrimeFaces button classes (e.g.,ui-button-success,ui-button-warning) over Bootstrap button classes
Files:
src/main/webapp/emr/settings/document_template.xhtml
**/*.xhtml
📄 CodeRabbit inference engine (AGENTS.md)
**/*.xhtml: Escape&as&in XML/XHTML attribute values; maintain standard HTML DOCTYPE withui:compositiontemplating
Useh:outputTextfor headings/labels rather than raw HTML heading tags in XHTML
Files:
src/main/webapp/emr/settings/document_template.xhtml
**/*.{xhtml,jsf}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{xhtml,jsf}: When modifying only XHTML/JSF files (no Java changes), compilation and testing are not required
When UI improvements are requested, make ONLY frontend/XHTML changes - do NOT add new controller properties, methods, or backend dependencies unless explicitly requested
NEVER use plain HTML elements (div, span, etc.) with id attributes for AJAX updates - use JSF components (h:panelGroup, p:outputPanel, etc.) instead
NEVER userenderedattribute on plain HTML elements - JSF ignores it; use JSF components like h:panelGroup with layout="block" instead
UseselectionMode="multiple"on dataTable element andselectionBox="true"on column (NOTselectionModeon column) for PrimeFaces DataTable selection
Useh:outputTextinstead of HTML headings (h1-h6) in ERP UI
Use PrimeFaces button classes instead of Bootstrap CSS classes
Use HTML DOCTYPE withui:compositionand template insideh:bodyfor XHTML structure
Always escape ampersands as&in XHTML attributes
Use PrimeFacesp:resolveFirstComponentWithIdfunction for JSF AJAX component updates: update=":#{p:resolveFirstComponentWithId('componentId',view).clientId}" or render=":#{p:resolveFirstComponentWithId('pDetails',view).clientId} :#{p:resolveFirstComponentWithId('pPreview',view).clientId}" for multiple components
Follow comprehensive UI development guidelines documented in developer_docs/ui/comprehensive-ui-guidelines.md
Follow icon management standards and sizing guidelines documented in developer_docs/ui/icon-management.md
Follow JSF AJAX update critical guidelines documented in developer_docs/jsf/ajax-update-guidelines.md
Follow PrimeFaces DataTable selection implementation guide documented in developer_docs/jsf/primefaces-datatable-selection.md
Files:
src/main/webapp/emr/settings/document_template.xhtml
🧠 Learnings (27)
📓 Common learnings
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 13897 File: src/main/webapp/resources/ezcomp/prints/five_eight_opd_bill_inward.xhtml:128-133 Timestamp: 2025-07-13T18:48:17.155Z Learning: In the HMIS bill printing system, patient age information is mandatory, so null safety checks for cc.attrs.bill.patient.person.ageAsShortString and related patient properties are not needed in bill print templates as the data will always be present by business rule. 📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : When UI improvements are requested, make ONLY frontend/XHTML changes - do NOT add new controller properties, methods, or backend dependencies unless explicitly requested Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-13T18:41:53.231Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 13897 File: src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml:247-249 Timestamp: 2025-07-13T18:41:53.231Z Learning: In src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml, damithdeshan98 prefers using explicit Save buttons rather than adding AJAX listeners for immediate auto-saving on flag select menus, even though other similar fields in the form have auto-save functionality. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : Reuse existing controller properties/methods in views; avoid introducing new global filters or backend logic from the UI Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: Applies to **/*Controller.java : Reuse existing controller properties and methods; avoid introducing new filtered values, global filters, or backend logic for UI-only tasks Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-08-31T18:33:43.772Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-08-31T18:33:43.772Z Learning: buddhika75 fixed critical PrimeFaces.monitorDownload() JavaScript errors by removing undefined callbacks, added meaningful tooltips to improve UX, replaced Bootstrap classes with inline CSS, and implemented comprehensive privilege checks (PharmacyStockAdjustment, PharmacyPhysicalCountApprove, PharmacyStockTakeApprove) for pharmacy stock take operations in commit 70ab98d803. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-06-13T21:00:50.052Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13038 File: src/main/java/com/divudi/bean/inward/InwardReportControllerBht.java:202-207 Timestamp: 2025-06-13T21:00:50.052Z Learning: In the HMIS project, JSF navigation outcomes typically do NOT include the .xhtml extension. The JSF configuration supports both styles, but the codebase standard is to use navigation strings without .xhtml extensions. Mixed usage is acceptable as the application handles both patterns correctly. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-06-13T21:00:50.052Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13038 File: src/main/java/com/divudi/bean/inward/InwardReportControllerBht.java:202-207 Timestamp: 2025-06-13T21:00:50.052Z Learning: In JSF applications, navigation outcomes can work with or without .xhtml extensions depending on the servlet mapping configuration. The HMIS project allows both styles of navigation outcomes to function properly, so inconsistency between .xhtml and no extension in navigation returns is not necessarily an issue. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-06-24T23:00:35.409Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 13350 File: src/main/java/com/divudi/bean/common/SearchController.java:11610-11613 Timestamp: 2025-06-24T23:00:35.409Z Learning: In JSF navigation strings, do not append a semicolon after `faces-redirect=true`; the semicolon is not valid and may break navigation. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-11-06T06:42:14.188Z
Learnt from: ChinthakaPrasad Repo: hmislk/hmis PR: 16336 File: src/main/webapp/inward/inward_admission.xhtml:57-59 Timestamp: 2025-11-06T06:42:14.188Z Learning: In src/main/webapp/inward/inward_admission.xhtml, ChinthakaPrasad confirmed that the p:messages component is intentionally commented out because the global p:growl component from template.xhtml handles message display for the admission page. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : For UI improvements, limit changes to XHTML/CSS/PrimeFaces unless backend changes are explicitly requested Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: JSF-only changes (XHTML/JSF files without Java changes) do not require compilation or testing Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : Follow comprehensive UI development guidelines documented in developer_docs/ui/comprehensive-ui-guidelines.md Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: Applies to **/*Composite.xhtml : Do not rename composite components without auditing all usages across the codebase Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : Follow JSF AJAX update critical guidelines documented in developer_docs/jsf/ajax-update-guidelines.md Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: Applies to **/*.{xhtml,css} : For UI improvements, limit work to XHTML/CSS/PrimeFaces unless backend changes are explicitly requested Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-07T14:17:19.975Z
Learnt from: DhaneshKaushan Repo: hmislk/hmis PR: 16372 File: src/main/webapp/pharmacy/pharmacy_item_import_with_stock.xhtml:32-40 Timestamp: 2025-11-07T14:17:19.975Z Learning: In src/main/webapp/pharmacy/pharmacy_item_import_with_stock.xhtml, DhaneshKaushan prefers to defer wiring the Download Template <p:fileDownload> to a backend implementation in a later PR; for UI-only changes, disable or hide the button temporarily to avoid broken UX and console errors. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-26T13:29:32.079Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 14180 File: src/main/webapp/inward/inward_bill_final.xhtml:144-158 Timestamp: 2025-07-26T13:29:32.079Z Learning: In src/main/webapp/inward/inward_bill_final.xhtml, the Credit Company Details panel with commented-out ui:repeat block for displaying credit company information is intentionally reserved for future development, as confirmed by DARKDRAGON-LK. The empty panel structure should be kept as is for future implementation. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-10T12:46:35.931Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 16446 File: src/main/webapp/resources/ezcomp/view/bill_edit.xhtml:135-136 Timestamp: 2025-11-10T12:46:35.931Z Learning: In src/main/webapp/resources/ezcomp/view/bill_edit.xhtml, fields in the "Amounts" tab are intentionally always editable (using simple p:inputText without conditional rendering based on cc.attrs.editable), unlike fields in the "Bill Information" tab which respect the editable attribute with conditional rendering. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-09-07T20:04:10.743Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 15313 File: src/main/webapp/pharmacy/pharmacy_item_transactions_popup.xhtml:3-13 Timestamp: 2025-09-07T20:04:10.743Z Learning: In src/main/webapp/pharmacy/pharmacy_item_transactions_popup.xhtml, buddhika75 confirmed that popup pages should be complete standalone pages without template inheritance, preferring lightweight independent popup windows over template-based architecture. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : Use HTML DOCTYPE with `ui:composition` and template inside `h:body` for XHTML structure Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : Fetch dynamic configuration values via configOptionApplicationController in UI Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-06-17T07:15:26.221Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13144 File: src/main/webapp/pharmacy/pharmacy_report_supplier_expiary_stock_by_batch.xhtml:72-75 Timestamp: 2025-06-17T07:15:26.221Z Learning: In PrimeFaces, <p:printer> component can be nested inside <p:commandButton> and functions correctly, not requiring the separate widgetVar and onclick pattern. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-18T06:37:28.921Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 12368 File: src/main/webapp/opd/opd_cancel_batch_bill_print.xhtml:39-39 Timestamp: 2025-05-18T06:37:28.921Z Learning: In the JSF/PrimeFaces implementation for HMIS, a commandButton with ajax="false" and no explicit action attribute is intentionally used when the purpose is to simply reload the page after making a selection change (such as changing paper type), as the page reload will reflect the new selection. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-04-27T09:00:54.818Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 11958 File: src/main/webapp/dataAdmin/historical_record_list.xhtml:84-91 Timestamp: 2025-04-27T09:00:54.818Z Learning: In PrimeFaces, a <p:dataExporter> can be effectively placed inside a <p:commandButton> with ajax="false" to trigger Excel/PDF exports when the button is clicked. This is a valid and working pattern that shouldn't be changed. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-24T14:49:44.897Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 12476 File: src/main/webapp/resources/ezcomp/midding_data_fields.xhtml:48-51 Timestamp: 2025-05-24T14:49:44.897Z Learning: In XHTML pages, when displaying read-only content for copy/paste purposes (like execution feedback), use h:outputText with a raw HTML textarea instead of p:inputTextarea to avoid unnecessary form submission overhead. The p:inputTextarea component would submit its value during form submission, which is not needed for display-only fields. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : Prefer PrimeFaces button classes (ui-button-success, ui-button-warning) over Bootstrap button classes Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
🧬 Code graph analysis (1)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java (1)
src/main/java/com/divudi/core/util/JsfUtil.java (1)
JsfUtil(12-97)
🔇 Additional comments (6)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java (3)
92-92: LGTM! Navigation redirect added.The
faces-redirect=trueparameter is a good addition that prevents form resubmission on browser refresh and enables proper back button behavior.
139-139: LGTM! Navigation redirect added.Consistent with the add flow, the redirect parameter ensures clean navigation after editing.
157-157: LGTM! Removed duplicate success message.The success message removal here is correct since
saveSelected()already handles the messaging based on whether it's a create or update operation.src/main/webapp/emr/settings/document_template.xhtml (3)
24-29: LGTM! Required validation added for Name field.The
required="true"andrequiredMessage="Template name is required"attributes correctly enforce mandatory field validation. The tooltip text is also helpful for users.
48-52: LGTM! Required validation added for Type field.The
required="true"andrequiredMessage="Type is required"attributes correctly enforce mandatory field validation on the Type dropdown. This addresses the PR objective of preventing empty data submission.
87-91: LGTM! Save button configuration is correct.The
ajax="false"attribute ensures full form submission with validation, and the action binding is appropriate. The PrimeFaces button styling follows the coding guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java (1)
147-169: Server-side validation successfully addresses the critical issue.The validation logic correctly prevents saving templates with empty or whitespace-only names and null types, fully addressing the PR objective and the previously requested server-side validation. The
trim().isEmpty()check properly handles edge cases.Optional: Consider checking for empty string in type validation
While the
required="true"attribute in the XHTML prevents empty string submission under normal circumstances, you could add an additional check for empty string in the type validation for defense-in-depth against validation bypass:if (current.getType() == null) { JsfUtil.addErrorMessage("Template type is required"); return; } +if (current.getType().toString().trim().isEmpty()) { + JsfUtil.addErrorMessage("Template type is required"); + return; +}However, this is purely optional since enum types typically don't allow empty strings, and the required field validation should catch this at the client side.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{xhtml,java}
📄 CodeRabbit inference engine (AGENTS.md)
Implement accessibility with proper tooltips and labeling
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
**/*.{java,xhtml}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{java,xhtml}: UsewebUserController.hasPrivilege()for UI privilege integration
UseconfigOptionApplicationControllerfor dynamic configuration values
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
**/*Controller.java
📄 CodeRabbit inference engine (AGENTS.md)
Reuse existing controller properties and methods; avoid introducing new filtered values, global filters, or backend logic for UI-only tasks
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
**/*.java
📄 CodeRabbit inference engine (AGENTS.md)
Do not 'fix' intentional typos in model/controller property names used for database compatibility
Files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
**/*.{xhtml,css}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{xhtml,css}: For UI improvements, limit work to XHTML/CSS/PrimeFaces unless backend changes are explicitly requested
Prefer PrimeFaces button classes (e.g.,ui-button-success,ui-button-warning) over Bootstrap button classes
Files:
src/main/webapp/emr/settings/document_template.xhtml
**/*.xhtml
📄 CodeRabbit inference engine (AGENTS.md)
**/*.xhtml: Escape&as&in XML/XHTML attribute values; maintain standard HTML DOCTYPE withui:compositiontemplating
Useh:outputTextfor headings/labels rather than raw HTML heading tags in XHTML
Files:
src/main/webapp/emr/settings/document_template.xhtml
**/*.{xhtml,jsf}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{xhtml,jsf}: When modifying only XHTML/JSF files (no Java changes), compilation and testing are not required
When UI improvements are requested, make ONLY frontend/XHTML changes - do NOT add new controller properties, methods, or backend dependencies unless explicitly requested
NEVER use plain HTML elements (div, span, etc.) with id attributes for AJAX updates - use JSF components (h:panelGroup, p:outputPanel, etc.) instead
NEVER userenderedattribute on plain HTML elements - JSF ignores it; use JSF components like h:panelGroup with layout="block" instead
UseselectionMode="multiple"on dataTable element andselectionBox="true"on column (NOTselectionModeon column) for PrimeFaces DataTable selection
Useh:outputTextinstead of HTML headings (h1-h6) in ERP UI
Use PrimeFaces button classes instead of Bootstrap CSS classes
Use HTML DOCTYPE withui:compositionand template insideh:bodyfor XHTML structure
Always escape ampersands as&in XHTML attributes
Use PrimeFacesp:resolveFirstComponentWithIdfunction for JSF AJAX component updates: update=":#{p:resolveFirstComponentWithId('componentId',view).clientId}" or render=":#{p:resolveFirstComponentWithId('pDetails',view).clientId} :#{p:resolveFirstComponentWithId('pPreview',view).clientId}" for multiple components
Follow comprehensive UI development guidelines documented in developer_docs/ui/comprehensive-ui-guidelines.md
Follow icon management standards and sizing guidelines documented in developer_docs/ui/icon-management.md
Follow JSF AJAX update critical guidelines documented in developer_docs/jsf/ajax-update-guidelines.md
Follow PrimeFaces DataTable selection implementation guide documented in developer_docs/jsf/primefaces-datatable-selection.md
Files:
src/main/webapp/emr/settings/document_template.xhtml
🧠 Learnings (42)
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : When UI improvements are requested, make ONLY frontend/XHTML changes - do NOT add new controller properties, methods, or backend dependencies unless explicitly requested Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: Applies to **/*Controller.java : Reuse existing controller properties and methods; avoid introducing new filtered values, global filters, or backend logic for UI-only tasks Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : Reuse existing controller properties/methods in views; avoid introducing new global filters or backend logic from the UI Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-08-31T18:33:43.772Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-08-31T18:33:43.772Z Learning: buddhika75 fixed critical PrimeFaces.monitorDownload() JavaScript errors by removing undefined callbacks, added meaningful tooltips to improve UX, replaced Bootstrap classes with inline CSS, and implemented comprehensive privilege checks (PharmacyStockAdjustment, PharmacyPhysicalCountApprove, PharmacyStockTakeApprove) for pharmacy stock take operations in commit 70ab98d803. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-13T18:41:53.231Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 13897 File: src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml:247-249 Timestamp: 2025-07-13T18:41:53.231Z Learning: In src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml, damithdeshan98 prefers using explicit Save buttons rather than adding AJAX listeners for immediate auto-saving on flag select menus, even though other similar fields in the form have auto-save functionality. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : Follow JSF AJAX update critical guidelines documented in developer_docs/jsf/ajax-update-guidelines.md Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : For UI improvements, limit changes to XHTML/CSS/PrimeFaces unless backend changes are explicitly requested Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-13T18:49:02.315Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 13897 File: src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml:15-15 Timestamp: 2025-07-13T18:49:02.315Z Learning: In src/main/webapp/lab/patient_report_without_sample_sending_process.xhtml, damithdeshan98 wants to keep the current privilege check pattern using OR condition (LabDataentry OR LabPrinting) rather than requiring dual privileges like other dashboard components. This page should not follow the standard dual-privilege requirement pattern used in other HMIS dashboard components. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-11-24T07:14:42.869Z
Learnt from: DhaneshKaushan Repo: hmislk/hmis PR: 16790 File: src/main/webapp/reports/managementReports/surgery_count_type.xhtml:20-30 Timestamp: 2025-11-24T07:14:42.869Z Learning: In src/main/webapp/reports/managementReports/surgery_count_type.xhtml for PR #16790, DhaneshKaushan confirmed this is wireframe-only work for Surgery Count (Type) report, intentionally deferring value bindings and backend integration to a later PR. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-08-31T17:51:57.011Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-08-31T17:51:57.011Z Learning: buddhika75 demonstrates exceptional thoroughness in addressing code review feedback, implementing comprehensive error handling with extensive null checks, standardizing data loading methods, and ensuring proper navigation patterns. Their fixes show deep understanding of JSF best practices and healthcare application reliability requirements. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-08-31T18:33:43.772Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-08-31T18:33:43.772Z Learning: buddhika75 in PharmacyStockTakeController.java demonstrates excellent systematic fix implementation, including JavaScript error resolution in PrimeFaces.monitorDownload() calls, UI enhancement with meaningful tooltips, Bootstrap class cleanup with inline CSS, and comprehensive security privilege checks for pharmacy operations. Shows strong attention to review feedback and production readiness. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.javasrc/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-05T07:29:50.729Z
Learnt from: RaveeshaPeiris Repo: hmislk/hmis PR: 16704 File: src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml:0-0 Timestamp: 2025-12-05T07:29:50.729Z Learning: In PR #16704, RaveeshaPeiris confirmed that the Branch, Department, Consultant, Service Center, and Discharge Type dropdowns in src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml are intentional placeholder wireframe work with empty value="" bindings. Backend bindings and data integration will be added in a later PR. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-12-05T07:28:42.897Z
Learnt from: RaveeshaPeiris Repo: hmislk/hmis PR: 16704 File: src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml:0-0 Timestamp: 2025-12-05T07:28:42.897Z Learning: In PR #16704, RaveeshaPeiris confirmed that the dataTable section (lines 294-361) in src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml is intentional placeholder wireframe work with empty value="" bindings and empty column outputs. Backend bindings and data integration for the results table will be added in a later PR. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-12-05T07:27:55.890Z
Learnt from: RaveeshaPeiris Repo: hmislk/hmis PR: 16704 File: src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml:0-0 Timestamp: 2025-12-05T07:27:55.890Z Learning: In PR #16704, RaveeshaPeiris confirmed that src/main/webapp/reports/inpatientReports/ip_unsettled_invoices.xhtml contains intentional placeholder dropdowns for wireframe work (Sponsor, Patient Category, Admission Types, Payment Mode, Room Category) with empty value="" bindings. Backend bindings and data integration will be added in a later PR. This is wireframe-only work. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-08-19T04:39:11.840Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 15012 File: src/main/webapp/resources/pharmacy/pharmacy_donation_receipt.xhtml:126-159 Timestamp: 2025-08-19T04:39:11.840Z Learning: In src/main/webapp/resources/pharmacy/pharmacy_donation_receipt.xhtml and PharmacyDonationController.java, buddhika75 confirmed that the BillFinanceDetails population issue (empty summary values in donation receipts due to unpopulated totalCostValue, totalExpense, totalTaxValue fields) will be handled separately in a donation-related issue, preferring to keep the current PR focused on the main donation feature implementation. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-06-13T21:00:50.052Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13038 File: src/main/java/com/divudi/bean/inward/InwardReportControllerBht.java:202-207 Timestamp: 2025-06-13T21:00:50.052Z Learning: In the HMIS project, JSF navigation outcomes typically do NOT include the .xhtml extension. The JSF configuration supports both styles, but the codebase standard is to use navigation strings without .xhtml extensions. Mixed usage is acceptable as the application handles both patterns correctly. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-06-13T21:00:50.052Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13038 File: src/main/java/com/divudi/bean/inward/InwardReportControllerBht.java:202-207 Timestamp: 2025-06-13T21:00:50.052Z Learning: In JSF applications, navigation outcomes can work with or without .xhtml extensions depending on the servlet mapping configuration. The HMIS project allows both styles of navigation outcomes to function properly, so inconsistency between .xhtml and no extension in navigation returns is not necessarily an issue. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-06-24T23:00:35.409Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 13350 File: src/main/java/com/divudi/bean/common/SearchController.java:11610-11613 Timestamp: 2025-06-24T23:00:35.409Z Learning: In JSF navigation strings, do not append a semicolon after `faces-redirect=true`; the semicolon is not valid and may break navigation. Applied to files:
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: JSF-only changes (XHTML/JSF files without Java changes) do not require compilation or testing Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-17T12:19:05.569Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 17352 File: src/main/webapp/inward/view_appointment.xhtml:165-171 Timestamp: 2025-12-17T12:19:05.569Z Learning: In HMIS XHTML files, the EL expression pattern #{not empty r.patientMobile.blank} with .blank accessor is valid and working correctly, and should not be flagged or changed in view_appointment.xhtml or similar files. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-24T21:54:09.952Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-11-24T21:54:09.952Z Learning: Applies to **/*Composite.xhtml : Do not rename composite components without auditing all usages across the codebase Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-20T14:14:33.574Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 16003 File: src/main/webapp/resources/ezcomp/prints/request/five_eight_bill_cancel_request.xhtml:47-63 Timestamp: 2025-10-20T14:14:33.574Z Learning: In src/main/webapp/resources/ezcomp/prints/request/five_eight_bill_cancel_request.xhtml and similar bill cancellation request templates, the Request entity's institution and department properties are guaranteed to be non-null, so null safety checks are not required when accessing cc.attrs.request.institution.name or cc.attrs.request.department.* properties. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-06T06:42:14.188Z
Learnt from: ChinthakaPrasad Repo: hmislk/hmis PR: 16336 File: src/main/webapp/inward/inward_admission.xhtml:57-59 Timestamp: 2025-11-06T06:42:14.188Z Learning: In src/main/webapp/inward/inward_admission.xhtml, ChinthakaPrasad confirmed that the p:messages component is intentionally commented out because the global p:growl component from template.xhtml handles message display for the admission page. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-08-03T07:03:06.143Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 14483 File: src/main/webapp/pharmacy/pharmacy_reprint_transfer_receive.xhtml:91-91 Timestamp: 2025-08-03T07:03:06.143Z Learning: The component name "transfeRecieve_detailed" in XHTML files (like pharmacy_reprint_transfer_receive.xhtml) contains a spelling inconsistency but is used consistently across 6 files and matches the actual component filename. This should not be flagged as a typo in future reviews as changing it would require coordinated refactoring across multiple files and could break the application. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-09-04T16:31:48.916Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 15280 File: src/main/webapp/errorPages/generalError.xhtml:9-9 Timestamp: 2025-09-04T16:31:48.916Z Learning: For hardening changes in src/main/webapp/errorPages/generalError.xhtml (e.g., wrapping ui:composition in h:body and restricting error details), buddhika75 prefers creating a separate GitHub issue instead of modifying the current PR. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-28T20:22:14.251Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 12594 File: src/main/webapp/resources/ezcomp/lab/dashboard/patient_sample.xhtml:246-409 Timestamp: 2025-05-28T20:22:14.251Z Learning: In src/main/webapp/resources/ezcomp/lab/dashboard/patient_sample.xhtml, the duplicate "Status Details" column (alongside "Current Status" column) is intentionally kept for future use and should not be removed despite appearing redundant. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-26T13:29:32.079Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 14180 File: src/main/webapp/inward/inward_bill_final.xhtml:144-158 Timestamp: 2025-07-26T13:29:32.079Z Learning: In src/main/webapp/inward/inward_bill_final.xhtml, the Credit Company Details panel with commented-out ui:repeat block for displaying credit company information is intentionally reserved for future development, as confirmed by DARKDRAGON-LK. The empty panel structure should be kept as is for future implementation. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-12-20T07:53:25.435Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: CLAUDE.md:0-0 Timestamp: 2025-12-20T07:53:25.435Z Learning: Applies to **/*.{xhtml,jsf} : Follow comprehensive UI development guidelines documented in developer_docs/ui/comprehensive-ui-guidelines.md Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-09-07T20:04:10.743Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 15313 File: src/main/webapp/pharmacy/pharmacy_item_transactions_popup.xhtml:3-13 Timestamp: 2025-09-07T20:04:10.743Z Learning: In src/main/webapp/pharmacy/pharmacy_item_transactions_popup.xhtml, buddhika75 confirmed that popup pages should be complete standalone pages without template inheritance, preferring lightweight independent popup windows over template-based architecture. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-09-20T07:52:00.058Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-09-20T07:52:00.058Z Learning: buddhika75 in PR #15493 demonstrated exemplary systematic approach to fixing CodeRabbit AI issues, including XML parsing errors (ampersand escaping), tautological expressions, number formatting patterns, and documentation typos. Provided comprehensive status reporting with clear impact statements about preventing receipt generation failures in the healthcare system. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-04-17T21:06:42.948Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 11765 File: src/main/java/com/divudi/core/data/IncomeBundle.java:48-51 Timestamp: 2025-04-17T21:06:42.948Z Learning: buddhika75 appreciates thorough code reviews that identify subtle issues like missing fields in utility methods (resetTotals, aggregation methods). The user specifically requested continued detailed code reviews in the future. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-09-20T07:52:00.058Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 0 File: :0-0 Timestamp: 2025-09-20T07:52:00.058Z Learning: buddhika75 in PR #15493 demonstrated systematic approach to addressing CodeRabbit feedback with accurate fixes for tautological expressions and documentation typos, but missed critical XML ampersand escaping issues in attribute values that can cause parsing errors. Verification revealed incomplete implementation of ampersand fixes and number formatting issues that still require attention for production safety. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-04-17T21:03:00.643Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 11765 File: src/main/java/com/divudi/core/data/IncomeBundle.java:48-51 Timestamp: 2025-04-17T21:03:00.643Z Learning: buddhika75 values detailed code reviews and is receptive to suggestions for improvement, even for subtle issues that others on the project might not prioritize. They specifically requested continued attention to these types of details in future reviews. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-28T00:04:01.772Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 12560 File: src/main/java/com/divudi/ejb/SmsManagerEjb.java:70-70 Timestamp: 2025-05-28T00:04:01.772Z Learning: User buddhika75 prefers code reviews to focus on PR-specific changes rather than flagging unrelated existing code issues. They work under deadlines and want reviews scoped to the actual changes being made for the feature, not comprehensive audits of untouched existing code. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-07-23T23:55:25.639Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 14118 File: src/main/webapp/pharmacy/admin/vmp.xhtml:98-98 Timestamp: 2025-07-23T23:55:25.639Z Learning: In PrimeFaces, p:outputLabel components automatically add asterisks (*) to indicate required fields when the 'for' attribute points to an input field with required="true". Manually adding asterisks to the label value would result in duplicate asterisks being displayed. The framework handles this visual indication automatically. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-10T12:46:35.931Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 16446 File: src/main/webapp/resources/ezcomp/view/bill_edit.xhtml:135-136 Timestamp: 2025-11-10T12:46:35.931Z Learning: In src/main/webapp/resources/ezcomp/view/bill_edit.xhtml, fields in the "Amounts" tab are intentionally always editable (using simple p:inputText without conditional rendering based on cc.attrs.editable), unlike fields in the "Bill Information" tab which respect the editable attribute with conditional rendering. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-06-17T07:15:26.221Z
Learnt from: DARKDRAGON-LK Repo: hmislk/hmis PR: 13144 File: src/main/webapp/pharmacy/pharmacy_report_supplier_expiary_stock_by_batch.xhtml:72-75 Timestamp: 2025-06-17T07:15:26.221Z Learning: In PrimeFaces, <p:printer> component can be nested inside <p:commandButton> and functions correctly, not requiring the separate widgetVar and onclick pattern. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-18T06:37:28.921Z
Learnt from: damithdeshan98 Repo: hmislk/hmis PR: 12368 File: src/main/webapp/opd/opd_cancel_batch_bill_print.xhtml:39-39 Timestamp: 2025-05-18T06:37:28.921Z Learning: In the JSF/PrimeFaces implementation for HMIS, a commandButton with ajax="false" and no explicit action attribute is intentionally used when the purpose is to simply reload the page after making a selection change (such as changing paper type), as the page reload will reflect the new selection. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-04-27T09:00:54.818Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 11958 File: src/main/webapp/dataAdmin/historical_record_list.xhtml:84-91 Timestamp: 2025-04-27T09:00:54.818Z Learning: In PrimeFaces, a <p:dataExporter> can be effectively placed inside a <p:commandButton> with ajax="false" to trigger Excel/PDF exports when the button is clicked. This is a valid and working pattern that shouldn't be changed. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-11-07T14:17:19.975Z
Learnt from: DhaneshKaushan Repo: hmislk/hmis PR: 16372 File: src/main/webapp/pharmacy/pharmacy_item_import_with_stock.xhtml:32-40 Timestamp: 2025-11-07T14:17:19.975Z Learning: In src/main/webapp/pharmacy/pharmacy_item_import_with_stock.xhtml, DhaneshKaushan prefers to defer wiring the Download Template <p:fileDownload> to a backend implementation in a later PR; for UI-only changes, disable or hide the button temporarily to avoid broken UX and console errors. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-05-24T14:49:44.897Z
Learnt from: buddhika75 Repo: hmislk/hmis PR: 12476 File: src/main/webapp/resources/ezcomp/midding_data_fields.xhtml:48-51 Timestamp: 2025-05-24T14:49:44.897Z Learning: In XHTML pages, when displaying read-only content for copy/paste purposes (like execution feedback), use h:outputText with a raw HTML textarea instead of p:inputTextarea to avoid unnecessary form submission overhead. The p:inputTextarea component would submit its value during form submission, which is not needed for display-only fields. Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
📚 Learning: 2025-10-12T05:32:34.145Z
Learnt from: CR Repo: hmislk/hmis PR: 0 File: AGENTS.md:0-0 Timestamp: 2025-10-12T05:32:34.145Z Learning: Applies to **/*.xhtml : Prefer PrimeFaces button classes (ui-button-success, ui-button-warning) over Bootstrap button classes Applied to files:
src/main/webapp/emr/settings/document_template.xhtml
🧬 Code graph analysis (1)
src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java (1)
src/main/java/com/divudi/core/util/JsfUtil.java (1)
JsfUtil(12-97)
🔇 Additional comments (6)
src/main/webapp/emr/settings/document_template.xhtml (3)
23-28: Client-side validation for Name field looks good.The
required="true"attribute with a clearrequiredMessagewill prevent form submission when the template name is empty, aligning with the PR objective. This works in conjunction with the server-side validation added in the controller.
47-51: Client-side validation for Type field is properly configured.The
required="true"attribute on thep:selectOneMenuwill prevent submission when the default "-- Select Type --" option (with empty value) is selected, ensuring users must choose a valid template type.
85-96: Button configuration is correct.The
ajax="false"attribute on the Save Template button ensures proper full-page form submission, which is necessary for therequiredfield validations to work correctly. The formatting changes improve readability without altering behavior.src/main/java/com/divudi/bean/clinical/DocumentTemplateController.java (3)
88-93: Good practice: Added redirect parameter to navigation.Including
faces-redirect=trueensures a proper browser redirect, preventing URL mismatches and improving the user experience with clean, bookmarkable URLs.
134-140: Consistent navigation pattern with redirect.The addition of
faces-redirect=truemaintains consistency with the add-new navigation method and follows JSF best practices.
182-193: Corrected success messages for save operations.The messages now accurately reflect the operation: "Updated" for editing existing templates (when
idexists) and "Saved" for creating new ones. This improves user feedback clarity.
Missing mandatory field validations
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.