Use this format when working with ChatGPT to refactor or migrate pages to CI4. Submit the CONTEXT once, and use the TASK section for specific actions.
This is a CodeIgniter 4.6 application.
- Views: No layout extensions; use plain Bootstrap structure from
driver_payments.php - Trigger: View is rendered when selected from a dropdown in
Home.php - Controller Location:
DispatchControllerinsideapp/Controllers/Dispatch/Pages - View Location:
app/Views/Pages/ - Route Setup:
- Page route in
dispatchgroup - API route in
apigroup
- Page route in
- Use
render_select()helper for all filter dropdowns - Use
DriverModel::getActiveDrivers()/getFinishedDrivers() - Use
SupplierModel::getActiveContractors() - Use
getDriverNameById()andgetSupplierNameById()to resolve names in the API
- Match the exact structure and filter layout of
driver_payments.php - All filters (driver, supplier, status, category) should be visible at once
- Use Bootstrap cards,
.table-sm, and.table-responsive
- Returns paginated data via DataTables (100 rows per page)
- Uses
POSTmethod - Filtered using driver/supplier/category/status
- Result columns must include AssignedTo display name
[Example: Migrate complaints.php]
- Create a new controller method:
complaintsView() - Add the view
complaints_view.phpunderViews/Pages - Create API controller method to return filtered JSON data for DataTables
- Add necessary routes to
Routes.php(dispatch + api) - Use the context above for all code structure and styling
Once context is set, you can just say:
"Use the same context. Here's the next task..."