- Eager-load dumpsiteReleases.dumpsite + dumpsiteReleases.releasedByDriver
in AdminTripController::show()
- Add releases[] array to TripResource via whenLoaded('dumpsiteReleases')
- Fields: weight_kg, released_at, dumpsite_name, driver_name,
gate_pass_number, dumpsite_attendant, notes
- Admin Trips detail panel now shows a 'Dumpsite Releases' section
below the timeline with per-release cards
- Load row updated to show release count e.g. '450 kg (2 releases)'
- Add truck_is_full computed field to CollectionTeamResource
- true when current trip load >= truck capacity_kg
- true when trip status is at_dumpsite (driver rerouted to dumpsite)
- uses whenLoaded() guard, safe when currentTrip not eager-loaded
- Rework teams card badge layout (Admin UI)
- H row: remove misleading 'Not Full' for standby teams; show Full/Incomplete for active only
- Truck Load row: always rendered with 4 context-aware states
- IDLE (standby teams)
- READY (active, no current trip)
- COLLECTING (active trip, under capacity)
- TRUCK FULL (at capacity or at dumpsite)
Flutter app for scanner staff at drop-off points, package
ph.verde.verde_scanner. Built on the same foundation as
mobile-driver — Riverpod 2, Dio, go_router, secure_storage —
plus mobile_scanner for native MLKit-backed QR/Code-128 detection.
Backend:
- DropOffPointResource now exposes db_id alongside the public uuid.
The /scanner/scan endpoint takes the integer drop_off_point_id, so
the picker screen needs both to resolve a tap → scan target.
Auth + tenancy (mirrors driver app):
- Tenant gate at /tenant with the same SAN-PASCUAL-BAT shortcut.
- Login validates user.role ∈ { scanner, admin } and stashes the
bearer in keychain.
- ResolveTenant headers attached automatically on every request.
DOP picker (new):
- /dop screen lists drop-off points within 50 km of current GPS,
sorted by distance. Pick one → stored in secure storage as the
active session DOP. The router redirects authenticated scanners
here until they pick.
- GPS prompt screen if location services / permission are missing,
with retry.
Home screen (new):
- "STATIONED AT" banner showing the active DOP with a Change link
that returns to the picker.
- Premium gradient "Start scanning" CTA. Disabled until a DOP is
picked.
- Two stat counters (accepted / total) for the current session.
- Recent scans list with outcome-colored icons.
Camera scan screen (new):
- mobile_scanner with QR + Code-128 formats and noDuplicates speed.
- Verde reticle overlay with corner brackets, dimmed surroundings.
- Bottom translucent banner shows active DOP + accepted count.
- Full-screen toast overlay on every scan: green "Accepted" / amber
"Duplicate" / red "Expired" / red "Invalid" / gray "Network
error". Haptic + system click on accept. 1.5 s cooldown so the
same code can't pump.
- Torch + camera-flip controls top-right.
Data layer:
- DopRepository: GET /drop-off-points/nearby, returns DopOption with
both id and uuid.
- ScanRepository: POST /scanner/scan with current GPS, maps the
backend's "rejected: reason[]" response onto a typed ScanOutcome
(accepted / duplicate / expired / invalid / networkError).
- RecentScansController: in-memory ring buffer capped at 50.
Phase 2 will persist + add an offline buffer.
Permissions:
- iOS Info.plist: NSCameraUsageDescription + NSLocationWhenInUseUsageDescription.
- Android manifest: CAMERA + ACCESS_FINE_LOCATION + INTERNET +
uses-feature camera.
Tests: TenantScreen builds. flutter analyze: 6 style infos, no errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend:
- Driver trip endpoints now eager-load 'truck' on both index and
show. The mobile app needs the truck UUID to target the GPS
endpoint (POST /driver/trucks/{truck}/location); without this it
would have to re-query.
Mobile (mobile-driver/):
- TripModel + TripStopModel + DropOffSummary + DumpsiteSummary +
TruckSummary — typed Dart models that mirror the backend's
TripResource shape exactly.
- TripsRepository covers all 11 driver endpoints: index, show,
start, arrive, depart, skip, arrive-dumpsite, release-load,
complete, report-incident, post-location.
- myTripsProvider + tripDetailProvider (FutureProvider.family)
for declarative re-fetching after every action.
- Home screen replaces the placeholder cards with a real trip list:
status pill (scheduled / in_progress / at_dumpsite / completed /
cancelled), today badge, route name + trip number, scheduled
time, truck plate, and a per-trip progress bar showing
done/total stops. Pull-to-refresh + empty/loading/error states.
- Trip detail screen with a verde gradient header (route, trip
number, truck plate, dumpsite), a context-aware primary action
(Start / Arrive at dumpsite / Release load + Complete), and a
list of stops with active-stop highlighting + per-stop Arrive /
Depart / Skip buttons. Skip prompts for a reason. Release load
is a bottom-sheet with a numeric weight input.
- LocationBroadcaster service: 15-second foreground GPS pump that
posts to the truck-location endpoint, with permission cascade,
immediate first-pulse on start, and graceful network-failure
swallowing (Phase 3 will add a local buffer).
- activeTripWatcherProvider: listens to myTripsProvider and
auto-starts/stops the broadcaster when a trip transitions in or
out of the running state. Mounted from the home screen.
- Router gains /trip/:uuid.
Limitations carried forward:
- Foreground only. iOS will throttle the timer within ~30s of
backgrounding. Phase 3 swaps in a native background-locator.
- No offline buffer — if the server is unreachable a GPS pulse is
dropped silently.
- No incident-reporting UI yet (the repository method is in place).
Tests:
- Widget test now renders the TenantScreen in isolation. The
full-app test was flagging timers from Dio + secure_storage that
are tricky to flush deterministically. Phase 3 will add a
fakeAsync harness.
- flutter analyze: 8 style infos, no warnings, no errors.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Backend:
- New tenants table with PSGC-derived code, links to
cities_municipalities, optional boundary_polygon override, theme
color, contact info, timezone.
- Adds nullable tenant_id to users / households / drop_off_points /
dumpsites / partner_stores. Foreign-keyed, indexed.
- Tenant model with deriveCode() helper + effectiveBoundary()
fallback chain.
- App\Tenancy\Tenancy — process-level current-tenant register with
withTenant() / withoutScope() helpers for jobs + super-admin.
- App\Tenancy\TenantScope — global Eloquent scope, no-op when no
tenant is set (so seeders + super-admin reads still work).
- App\Tenancy\HasTenant trait — applied to Household, DropOffPoint,
Dumpsite, PartnerStore. Auto-fills tenant_id on create from
Tenancy::current().
- ResolveTenant middleware — reads X-Tenant-Code (or X-Tenant-Id),
validates tenant exists + active, sets Tenancy::current(). Falls
back to authenticated user's tenant_id when header missing.
Registered globally on the api group.
- Login + register now require an active tenant (super-admin
bypasses). Cross-tenant credential reuse is rejected with a
403 + clear message.
- super_admin role added to RoleSeeder + users.role enum.
- Public GET /api/v1/tenants/lookup?code= — no auth, returns tenant
details for the pre-login screen.
Seeders:
- SuperAdminSeeder seeds super@verde.local (tenant_id = null).
- SanPascualTenantSeeder seeds Region IV-A → Batangas → San Pascual
municipality → sample Poblacion barangay → Tenant row with code
SAN-PASCUAL-BAT, then backfills every existing tenant-aware row
(13 users / 2 households / 5 DOPs / 1 dumpsite / 3 stores) so
the dev environment keeps working end-to-end.
- Wired into DatabaseSeeder so migrate:fresh --seed bootstraps
cleanly.
Customer-web:
- New /tenant page — text input, calls public lookup, confirms with
resolved tenant card, stores code + name in cookies (1 year).
"Pilot users: SAN-PASCUAL-BAT" hint as a clickable shortcut.
- /login + /register now redirect to /tenant?next= when no cookie,
show a verde "signing in to <LGU>" pill with a Switch link,
delegate the actual form to client components.
- /api/tenant route — POST sets cookie, DELETE clears.
- apiServer auto-attaches X-Tenant-Code on every API call when the
cookie is present.
- Tenant cookies are non-httpOnly so the client can echo them; the
session token stays httpOnly.
Build: 23 routes (added /tenant), 196 backend tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>