Skip to content

Session Instance Management additional item tab UI improvement#19679

Merged
buddhika75 merged 2 commits intodevelopmentfrom
19661-session-details-additional-items-section-ui-alignment-issue
Apr 4, 2026
Merged

Session Instance Management additional item tab UI improvement#19679
buddhika75 merged 2 commits intodevelopmentfrom
19661-session-details-additional-items-section-ui-alignment-issue

Conversation

@OsaVS
Copy link
Copy Markdown
Collaborator

@OsaVS OsaVS commented Apr 3, 2026

Issue: #19661

Files changed:

  • session_instance_management
  • ChannelSchedulerController

fillSessionInstance() method changed to load the relevant fee and additional item details for selected service session

sendSmsOnChannelAppointmentTimeChange method null checks improved

Additional Items and Details tabs UI improved


image

Summary by CodeRabbit

  • Bug Fixes

    • Prevented crashes when sending SMS about appointment time changes by adding safer recipient checks.
    • Ensured fee totals refresh automatically when a session instance is selected.
  • Improvements

    • Updated session selector layout and spacing for more consistent display.
    • Reworked "Additional Items" section into clearer columns and preserved add/remove actions.
    • Changed session date rendering for more consistent, read-only display.

Signed-off-by: OsaVS <41975253+OsaVS@users.noreply.github.com>
@OsaVS OsaVS self-assigned this Apr 3, 2026
@OsaVS OsaVS added Channelling UI User Interface Improvements labels Apr 3, 2026
@OsaVS OsaVS linked an issue Apr 3, 2026 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63f6c4fd-9993-460e-a28b-0919c03f6f33

📥 Commits

Reviewing files that changed from the base of the PR and between d0cad41 and 141f57f.

📒 Files selected for processing (2)
  • src/main/java/com/divudi/bean/channel/ChannelScheduleController.java
  • src/main/webapp/channel/session_instance_management.xhtml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/channel/session_instance_management.xhtml

Walkthrough

Added a null-safe guard in SMS recipient lookup and introduced a public handler that loads session instance and fee totals. Updated JSF view layout and controls for session selection, session details, and restructured the Additional Items area with adjusted styling and event wiring.

Changes

Cohort / File(s) Summary
Controller Logic
src/main/java/com/divudi/bean/channel/ChannelScheduleController.java
Expanded null checks in sendSmsOnChannelAppointmentTimeChange() to guard bs.getBill().getPatient() and ...getPerson() before accessing getSmsNumber(). Added public method handleSessionSelectionSessionManagement() which calls fillSessionInstance() then fillFees() to refresh fee totals.
View: Session Management UI
src/main/webapp/channel/session_instance_management.xhtml
Adjusted layout/styling for selector grids (explicit width, table-layout fixed). Replaced sessions listbox class/overflow wrappers and updated its click handler to call channelScheduleController.handleSessionSelectionSessionManagement. Switched sessionDate from a disabled p:datePicker to a disabled p:inputText with f:convertDateTime. Restructured "Additional Items" from nested row/column markup to a 3-column p:panelGrid, moved the additional-items p:dataTable outside the grid, and preserved add/remove action wiring.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: UI improvements to the additional items tab in Session Instance Management.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 19661-session-details-additional-items-section-ui-alignment-issue

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/main/webapp/channel/session_instance_management.xhtml (1)

380-425: Unconventional usage of p:column within p:panelGrid with columns attribute.

When using p:panelGrid with the columns attribute, direct children are automatically distributed across columns. The p:column wrapper elements are designed for use with p:row (manual layout mode), not with the columns attribute.

The current structure will render but is unconventional. Consider removing the p:column wrappers for cleaner code:

♻️ Suggested simplification
-<p:panelGrid  columns="3">
-    <p:column >
-        <p:outputLabel value="Item to add"/>
-    </p:column>
-    <p:column >
-        <p:autoComplete 
-            ...
-        </p:autoComplete>
-    </p:column>
-    <p:column  >
-        <p:commandButton 
-            ...
-        </p:commandButton>
-    </p:column>
-</p:panelGrid>
+<p:panelGrid columns="3">
+    <p:outputLabel value="Item to add"/>
+    <p:autoComplete 
+        ...
+    </p:autoComplete>
+    <p:commandButton 
+        ...
+    </p:commandButton>
+</p:panelGrid>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/webapp/channel/session_instance_management.xhtml` around lines 380 -
425, The p:column tags are being used inside a p:panelGrid that already uses the
columns attribute (unconventional); remove the p:column wrappers so the direct
children (the outputLabel, p:autoComplete with widgetVar/acAdditionalItem and
its inner columns, and the p:commandButton btnAddAdditionalItem) are immediate
children of p:panelGrid, preserving the same order so they distribute across the
three columns, and keep existing ids/attributes (acAdditionalItem,
btnAddAdditionalItem, and action
#{channelScheduleController.addAdditionalItems()}) and AJAX/process/update
references unchanged.
src/main/java/com/divudi/bean/channel/ChannelScheduleController.java (1)

385-387: Good defensive null check, but inconsistent with similar method.

The added null guards for getPatient() and getPerson() correctly prevent potential NPEs. However, the similar method sendSmsOnChannelDoctorArrival() at line 355 still uses the less defensive check:

if (bs.getBill().getPatient().getPerson().getSmsNumber() == null) {

Consider applying the same fix there for consistency.

🛡️ Suggested fix for sendSmsOnChannelDoctorArrival()
-            if (bs.getBill().getPatient().getPerson().getSmsNumber() == null) {
+            if (bs.getBill().getPatient() == null || bs.getBill().getPatient().getPerson() == null || bs.getBill().getPatient().getPerson().getSmsNumber() == null) {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/divudi/bean/channel/ChannelScheduleController.java` around
lines 385 - 387, In ChannelScheduleController, update
sendSmsOnChannelDoctorArrival() to match the defensive null checks used
elsewhere: when inspecting bs, replace the current
bs.getBill().getPatient().getPerson().getSmsNumber() == null check with a
guarded chain that verifies bs.getBill() != null, bs.getBill().getPatient() !=
null, bs.getBill().getPatient().getPerson() != null, and finally
bs.getBill().getPatient().getPerson().getSmsNumber() != null before proceeding;
ensure you reference the same bs variable and methods (getBill(), getPatient(),
getPerson(), getSmsNumber()) as in the other block to avoid NPEs and keep
behavior consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main/java/com/divudi/bean/channel/ChannelScheduleController.java`:
- Around line 1204-1207: The method fillSessionInstance() currently calls
fillFees(), causing duplicate DB writes and overriding callers' intent (notably
BookingControllerViewScopeMonth, BookingControllerViewScope, and
ClinicController which call fillFees() themselves or intentionally skip it);
revert this by removing the embedded fillFees() call from fillSessionInstance()
so callers retain control, or alternatively change the signature to
fillSessionInstance(boolean includeFees) and have callers pass true/false
(update all usages in BookingControllerViewScopeMonth,
BookingControllerViewScope, ClinicController accordingly) so the behavior is
explicit and no extra getFacade().edit(current) is performed implicitly.

---

Nitpick comments:
In `@src/main/java/com/divudi/bean/channel/ChannelScheduleController.java`:
- Around line 385-387: In ChannelScheduleController, update
sendSmsOnChannelDoctorArrival() to match the defensive null checks used
elsewhere: when inspecting bs, replace the current
bs.getBill().getPatient().getPerson().getSmsNumber() == null check with a
guarded chain that verifies bs.getBill() != null, bs.getBill().getPatient() !=
null, bs.getBill().getPatient().getPerson() != null, and finally
bs.getBill().getPatient().getPerson().getSmsNumber() != null before proceeding;
ensure you reference the same bs variable and methods (getBill(), getPatient(),
getPerson(), getSmsNumber()) as in the other block to avoid NPEs and keep
behavior consistent.

In `@src/main/webapp/channel/session_instance_management.xhtml`:
- Around line 380-425: The p:column tags are being used inside a p:panelGrid
that already uses the columns attribute (unconventional); remove the p:column
wrappers so the direct children (the outputLabel, p:autoComplete with
widgetVar/acAdditionalItem and its inner columns, and the p:commandButton
btnAddAdditionalItem) are immediate children of p:panelGrid, preserving the same
order so they distribute across the three columns, and keep existing
ids/attributes (acAdditionalItem, btnAddAdditionalItem, and action
#{channelScheduleController.addAdditionalItems()}) and AJAX/process/update
references unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d84a806e-6aeb-4545-a5f8-3f5882995c92

📥 Commits

Reviewing files that changed from the base of the PR and between f7393bc and d0cad41.

📒 Files selected for processing (2)
  • src/main/java/com/divudi/bean/channel/ChannelScheduleController.java
  • src/main/webapp/channel/session_instance_management.xhtml

@buddhika75 buddhika75 merged commit f43c097 into development Apr 4, 2026
3 checks passed
@buddhika75 buddhika75 deleted the 19661-session-details-additional-items-section-ui-alignment-issue branch April 4, 2026 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Channelling UI User Interface Improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session Details – Additional Items Section UI Alignment Issue

2 participants