Commit Graph

5 Commits

Author SHA1 Message Date
Developer
7dc074e3c3 Implement household, QR sale, team helpers assignment, and helper endpoints 2026-06-29 16:56:33 +08:00
Developer
b85fc255cf feat: implement barangay and household management with associated tests 2026-06-29 15:02:52 +08:00
b1bc73b100 feat(mobile-driver): Phase 2 — trip lifecycle + foreground GPS
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>
2026-05-01 23:36:43 +08:00
15d56d0e98 feat(backend): finish Module 13 sub-modules + flow fixes
Notifications: notification_preferences + Laravel notifications inbox.
SmsChannel adapter for our SmsService. RoutesByPreferences trait reads
per-user toggles. HouseholdApproved/Rejected, QrBalanceLow, and
CodesPurchased notifications wired in via auto-discovered listeners
or direct dispatch from controllers/StoreOperations.

Payments: payments table + PaymentDriver interface. ManualPaymentDriver
works out of the box; PayMongoDriver activates when
PAYMONGO_SECRET_KEY is set, falls back to manual otherwise. Resident
initiates code-purchase, admin can mark paid manually, webhook applies
real provider events. Fulfillment runs StoreOperations::sellToHousehold.

Live tracking (HTTP polling): truck_location_history (with SPATIAL
INDEX + 7-day retention plan). Driver POST /driver/trucks/{uuid}/location
writes history, updates trucks.last_known_coordinates, caches in Redis,
flags geofence-trigger when entering active trip dumpsite. Admin
GET /admin/live/trucks returns active truck positions. Reverb broadcast
deferred.

Flow corrections:
- QrAllocator now idempotent — re-approving a household no longer
  re-dispenses free codes.
- arrive-dumpsite enforces dumpsite geofence via ST_Contains; can be
  bypassed with override_geofence: true.

171 feature tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 14:01:38 +08:00
13148fab97 feat(backend): complete Module 10 (trips + timeline)
trips, trip_stops, trip_timeline_events. Admin: schedule/show/cancel.
Driver: start, arrive/depart/skip stops, report incident, arrive at
dumpsite, release load (creates dumpsite_release row + tallies trip
load), complete. Every action writes a typed timeline event with GPS.
Trip number auto-generated TRIP-YYYYMMDD-NNN. Promotes
dumpsite_releases.trip_id to a real FK now that trips exists.

148 feature tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 02:51:52 +08:00