- UI: Refactored admin layout to a fixed 'App Shell' design with independent scrollbars for sidebar and content area. - UI: Cleaned up sidebar partial structure to support nested scrolling. - GEOFENCING: Added support for Circle and Rectangle tools in LGU configuration. - GEOFENCING: Implemented high-precision (128-point) circle-to-polygon conversion for database storage. - PAGINATION: Integrated standard Laravel pagination across Teams and Reports tables. - PAGINATION: Added a global 'renderPagination' helper and 'Per Page' selector (25, 50, 100). - DATA: Created QuezonCitySeeder with 142 official barangays and 3 months of historical collection/sales data. - FIX: Corrected API total aggregations in reports to remain accurate during pagination. - FIX: Resolved unique constraint and axis-order issues in spatial data seeders.
5.1 KiB
5.1 KiB
Walkthrough — Truck Status Management
We have successfully implemented the ability to edit and delete trucks from the admin dashboard, enforced Plate number read-only behavior post-creation, and automated active trip cancellation and collection team unassignment when a truck is moved to a non-active status (maintenance or retired).
Changes Made
1. Backend Changes
- Request Validation: Updated StoreTruckRequest.php to ignore the current truck's ID when validating the unique
plate_numberconstraint during updates. - Controller Logic: Extended
update()in AdminTruckController.php:- When the truck status is updated from
activeto a non-active status (maintenanceorretired), any active/scheduled trips (scheduled,in_progress,at_dumpsite) for that truck are automatically marked ascancelledwith a system note. - The truck is unassigned from any active collection teams (setting
truck_idtonullon the team).
- When the truck status is updated from
2. Frontend Changes
- Table Actions: Added an Actions column with an Edit button to the trucks list inside trucks.blade.php.
- Edit & Delete slide-over modal:
- Re-used the existing form structure for edit mode.
- Configured the plate number input field to be read-only (and visually styled as disabled) in edit mode.
- Added a Delete button at the bottom of the form when editing a truck, complete with an interactive confirm dialog.
- Form submit handler automatically switches between
POST(create) andPATCH(update) based on the context.
Walkthrough - Partner Store Portal Overhaul
I have successfully enhanced the Partner Store Portal with advanced search, LGU-scoped pricing, and professional PDF receipts.
Key Changes
1. Dynamic LGU Pricing
- Added
qr_retail_price_centavosto thetenantstable. - Each LGU can now set its own retail price for QR stickers.
- The Store Portal automatically fetches and displays the correct price for the current store's LGU.
2. Enhanced Household Search
- Integrated TomSelect for a lightning-fast, searchable dropdown.
- Search results are strictly scoped to the store's LGU.
- Added Leaflet.js map verification to show the resident's location upon selection.
3. Professional PDF Receipts
- Implemented professional receipt generation using DomPDF.
- Receipts include store details, transaction numbers, and branded formatting.
- Added a "Download Receipt" flow immediately after a successful sale.
Work Accomplished
Backend Enhancements
- Reporting Data Seeding: Successfully populated the system with 30 days of daily stats, 8 weeks of route performance, 6 months of store sales, and 20 dumpsite releases for testing.
- AdminReportController Refactoring:
- Implemented
resolveTargetTenanthelper to allow SuperAdmins to view reports for specific LGUs via atenant_idquery parameter. - Updated all reporting API endpoints (
dailyCollection,tripPerformance,storeSales,complianceCsv) to respect tenant overrides. - Fixed syntax errors and ensured proper method scoping.
- Implemented
Frontend Implementation
- LGU Selector Header: Added a dynamic LGU selector to the Reports dashboard (SuperAdmin only).
- Geofence Visualization: Integrated Leaflet.js to render the
boundary_polygonof the selected LGU, providing immediate spatial context for the reports. - Dynamic Report Loading: Updated the frontend reporting logic to automatically reload data when the LGU is switched, passing the appropriate
tenant_idto the backend.
Verification Results
- Seeder Validation:
ReportDataSeedersuccessfully executed, confirming that unique constraints are handled and data is correctly associated with tenants. - API Verification: Backend endpoints now correctly handle
tenant_idand applyTenancy::withTenantscoping as expected. - UI Audit: Reports dashboard now features a sleek map header and an intuitive LGU selector for SuperAdmin users.
Automated Tests
Created and ran a new test file: AdminTruckCrudTest.php
All test cases pass successfully:
PASS Tests\Feature\Api\V1\Admin\AdminTruckCrudTest
✓ admin can update truck details 14.39s
✓ admin updating plate uniqueness checks 0.16s
✓ changing status to maintenance cancels trips and unassigns teams 0.18s
✓ admin can delete truck 0.10s
Tests: 4 passed (13 assertions)
Duration: 15.17s
Frontend Assets
Built the frontend assets successfully via Vite compilation:
✓ built in 3.40s