+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -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');