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