I want to migrate the legacy PHP page [legacy_page.php]
to CodeIgniter 4.6.
- Follow MVC style used in the existing page
[driver_payments.php]
- The controller method should be named:
[methodName]
- The controller is located in:
DispatchController
underapp/Controllers/Dispatch/Pages
- The view is placed at:
app/Views/Pages/[new_view_name].php
- The API should return data for DataTables in pages of 100 rows
- Do NOT use layout extensions (no
<?= $this->extend(...) ?>
) - Match the form layout, filter positioning, and structure of
driver_payments.php
exactly - Use
render_select()
helper for all dropdowns
- Include the following filters, in this order:
- Active Drivers (name:
driver_active
) - Finished Drivers (name:
driver_finished
) - Suppliers (name:
supplier
) - Category
- Status
- Active Drivers (name:
- All dropdowns must be visible by default β do not implement any hide/show logic
- All filter names must be unique; send only one
assignedTo
value to the API based on whichever is filled
- Create a new API method under
App\Controllers\Api
- Route should be added to the
api
route group - Use
POST
method unless explicitly asked to useGET
- API must use models (no raw SQL in controller)
- Use
DriverModel::getDriverNameById()
andSupplierModel::getSupplierNameById()
to format names
- Add a route to the
dispatch
group:/dispatch/[page-url]
- Add a route to the
api
group:/api/[resource-name]/list
- Reuse existing
render_select()
for all dropdowns - Use existing
DriverModel
andSupplierModel
where applicable - View must follow the same card and Bootstrap layout as
driver_payments.php
I will test this by:
- Visiting the dropdown link from dispatch home
- Checking that all filters appear in the specified order
- Validating the complaints table loads correctly via AJAX
- Verifying correct driver/supplier names in AssignedTo column
- Legacy PHP file:
[complaints.php]
- Reference page layout:
[driver_payments.php]
- Routes file:
[Routes.php]
- API sample:
[DriverPayments.php]