From c65a5cdc68a2389f94760a25947588dcf2e61fa1 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sun, 7 Jun 2026 07:48:43 +0530 Subject: [PATCH] Add routes for debug endpoints - fix 404 errors Problem: - GET: Ipd_discharge/debug_discharge_html/1 returning 404 - GET: Ipd_discharge/debug_ipd_fields/1 returning 404 - Debug endpoints were created but routes were not registered Solution: Added two new routes in app/Config/Routes.php: 1. Debug IPD Fields Endpoint: Route: Ipd_discharge/debug_ipd_fields/(:num) Controller: Ipd_discharge::debug_ipd_fields/\ Method: GET Returns JSON showing: - All available field names in ipd_master table - Values of time fields (reg_time, discharge_time) - Values of department fields (dept_id) - Values of doctor fields (r_doc_id, r_doc_name) - Result of getDischargeDepartmentName() function - Result of getDischargeDoctorNames() function - Result of safeTime() for time fields 2. Debug Discharge HTML Endpoint: Route: Ipd_discharge/debug_discharge_html/(:num) Controller: Ipd_discharge::debug_discharge_html/\ Method: GET Returns HTML page showing: - Complete discharge summary HTML source - Syntax highlighted for easy reading - All placeholders replaced with actual values - Useful for checking spacing and HTML structure Route Placement: - Added after search_patient_ajax route - Before ipd_select route - Follows existing Ipd_discharge route pattern - Uses (:num) parameter for IPD ID Usage: - http://localhost:8080/Ipd_discharge/debug_ipd_fields/1 - http://localhost:8080/Ipd_discharge/debug_discharge_html/1 - Replace '1' with actual IPD ID Note: Routes must be defined BEFORE more general routes Otherwise, the (:num) pattern in ipd_select would catch them first Testing: 1. Pull latest code 2. Access /Ipd_discharge/debug_ipd_fields/1 3. Should return JSON with field values 4. Access /Ipd_discharge/debug_discharge_html/1 5. Should return HTML source page --- app/Config/Routes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index b0ea11d..163aab1 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -368,6 +368,8 @@ $routes->get('ipdNew/show_ipd_form/(:num)/(:num)', 'Billing\\Ipd::showIpdForm/$1 // Legacy compatibility: old discharge summary links should open current discharge tab. $routes->get('Ipd_discharge/search_patient', 'Ipd_discharge::search_patient'); $routes->get('Ipd_discharge/search_patient_ajax', 'Ipd_discharge::search_patient_ajax'); +$routes->get('Ipd_discharge/debug_ipd_fields/(:num)', 'Ipd_discharge::debug_ipd_fields/$1'); +$routes->get('Ipd_discharge/debug_discharge_html/(:num)', 'Ipd_discharge::debug_discharge_html/$1'); $routes->match(['get', 'post'], 'Ipd_discharge/ipd_select/(:num)', 'Ipd_discharge::ipd_select/$1'); $routes->match(['get', 'post'], 'Ipd_discharge/ipd_select/(:num)/(:num)', 'Ipd_discharge::ipd_select/$1/$2'); $routes->get('Ipd_discharge/section_past_data', 'Ipd_discharge::section_past_data');