From f6749d266421b723e5311e08601933b2b71abe71 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sat, 6 Jun 2026 05:58:04 +0530 Subject: [PATCH] Fix undefined variable - use \ not \ BUGFIX: Uncaught SyntaxError expected expression, got ')' PROBLEM: JavaScript syntax error on page load caused by undefined PHP variable ROOT CAUSE: Controller passes 'complaint_rows' to view but JavaScript code tried to use \ (camelCase). PHP is case-sensitive, so: - Controller: 'complaint_rows' => \ - View variable name: \ (snake_case) - Used in view: \ (wrong!) When \ was undefined, the !empty() check failed and PHP tried to iterate over undefined variable, generating malformed JavaScript that caused syntax errors. SOLUTION: Changed \ to \ in foreach loop Now the existing complaints will load correctly from database into the selectedDischargeComplaints JavaScript array. --- app/Views/billing/ipd/discharge_create.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Views/billing/ipd/discharge_create.php b/app/Views/billing/ipd/discharge_create.php index c34ec07..6ea6ea8 100644 --- a/app/Views/billing/ipd/discharge_create.php +++ b/app/Views/billing/ipd/discharge_create.php @@ -1668,9 +1668,9 @@ $allergyStatusNoKnown = in_array($allergyStatusNormalized, ['no known drug aller function initDischargeComplaintsTable() { // Load existing complaints from PHP (if any) - + selectedDischargeComplaints = [ - + { id: , term: ,