From 307355f5a79fb2250a25c15691df8dda1ae8a5ca Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Fri, 28 Aug 2026 03:26:02 +0530 Subject: [PATCH] feat(nursing): add dynamic medical route options for Fluid Intake / Output --- app/Views/ipd_nursing/workspace.php | 118 ++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 7 deletions(-) diff --git a/app/Views/ipd_nursing/workspace.php b/app/Views/ipd_nursing/workspace.php index cde79b3..0e28338 100644 --- a/app/Views/ipd_nursing/workspace.php +++ b/app/Views/ipd_nursing/workspace.php @@ -566,13 +566,12 @@ $admNote = (string) ($latestAdmissionEntry['general_note'] ?? '');
-
-
-
+
+
-
-
-
-
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
@@ -1457,6 +1477,90 @@ $admNote = (string) ($latestAdmissionEntry['general_note'] ?? ''); } } + var fluidRoutesMap = { + intake: [ + 'IV (Intravenous)', + 'Oral / PO (Per Os)', + 'NG Tube (Nasogastric)', + 'PEG / G-Tube', + 'J-Tube (Jejunostomy)', + 'Blood / Plasma Transfusion', + 'TPN (Total Parenteral Nutrition)', + 'Subcutaneous (Hypodermoclysis)', + 'Peritoneal Dialysis Infusion', + 'Other / Custom' + ], + output: [ + 'Urine (Foley Catheter)', + 'Urine (Voided)', + 'Urine (Suprapubic / Nephrostomy)', + 'NG Aspirate / Vomitus', + 'Surgical Drain (JP / Hemovac)', + 'Chest Tube / ICD Drain', + 'Stoma / Ileostomy Output', + 'Diarrhea / Stool Output', + 'Ascitic / Abdominal Drain', + 'Bile Drain (T-Tube)', + 'CSF / EVD Drain', + 'Other / Custom' + ] + }; + + function syncFluidRoutes() { + var dirSelect = document.getElementById('nursing_fluid_direction'); + var routeSelect = document.getElementById('nursing_fluid_route_select'); + var routeInput = document.getElementById('nursing_fluid_route_input'); + if (!dirSelect || !routeSelect || !routeInput) return; + + var direction = dirSelect.value || 'intake'; + var routes = fluidRoutesMap[direction] || fluidRoutesMap.intake; + + var currentVal = routeInput.value; + routeSelect.innerHTML = ''; + routes.forEach(function (r) { + var opt = document.createElement('option'); + opt.value = r; + opt.textContent = r; + routeSelect.appendChild(opt); + }); + + if (!currentVal) { + routeInput.value = routes[0]; + routeSelect.value = routes[0]; + } else { + var matched = routes.indexOf(currentVal) !== -1; + if (matched) { + routeSelect.value = currentVal; + } else { + routeSelect.value = 'Other / Custom'; + } + } + } + + var dirSelect = document.getElementById('nursing_fluid_direction'); + var routeSelect = document.getElementById('nursing_fluid_route_select'); + var routeInput = document.getElementById('nursing_fluid_route_input'); + + if (dirSelect) { + dirSelect.addEventListener('change', function() { + routeInput.value = ''; + syncFluidRoutes(); + }); + } + + if (routeSelect) { + routeSelect.addEventListener('change', function() { + if (this.value === 'Other / Custom') { + routeInput.value = ''; + routeInput.focus(); + } else { + routeInput.value = this.value; + } + }); + } + + syncFluidRoutes(); + forms.forEach(function (form) { var recordedAtInput = form.querySelector('input[name="recorded_at"]'); var shiftDisplayInput = form.querySelector('.nursing-shift-display');