HOCO B2B
Team tasksImad

MDA-05 — Delegate app — visit flow

Visit detail with GPS validation, start/end, live duration, checklist, quick note, photos, call; not-done reason sheet. Works offline.

FieldDetails
Task codeMDA-05
PhaseP1 — V1 build & integration
Product scopeV1
StatusPlanned
StartThu 3 Dec 2026
DueSun 6 Dec 2026
ResponsibleImad — Mobile developer (Flutter)
Co-responsible—
Effort1.5 person-day(s) planned · 5 from scratch · size S
Area · appDelegate app · mobile
Depends onDES-13, MOB-11
Unblocks—
Milestones—

Summary

Visit detail with GPS validation, start/end, live duration, checklist, quick note, photos, call; not-done reason sheet. Works offline.

Description

The visit is the core field record: check-in time and position, duration, checklist, note, photos and call, locked once finished (FLD-08), or a mandatory reason when it did not happen (FLD-09) — all of it must work with no network (SYN-04). Scope: visit detail DA-10 with the GPS validation banner from the arrive result, start/end, live duration timer, checklist, quick note (≤ 300 characters), photos with capture position, call action and the requirement check before ending; and the not-done reason sheet DA-11. Every action is an outbox mutation (delegate.visits.start|checklist|note|addPhoto|end|notDone) with occurredAt; photos go through the MOB-11 upload queue first. It needs SRV-21 visit rules (VisitType requirements, VISIT_REQUIREMENTS_NOT_MET with details.missing, VISIT_LOCKED) and Akram's DES-13 frames. MDA-06 adds the report that the end-of-visit check may require; MDA-10 reads visit states at closing.

Subtasks

#SubtaskOwner
1VisitDetailScreen (DA-10) on GET /delegate/visits/{id} with drift fallback: point of sale, visit type, checklist template, report config, VisitStatusImad
2GPS validation banner bound to the arrive result: « Position validée (42 m) », « Hors tolérance — justification envoyée », or « À confirmer » for offline check-insImad
3« Commencer la visite » → delegate.visits.start through the outbox; visit timer provider restored from startedAt in the local visits table after app killImad
4Checklist widget writing PUT /delegate/visits/{id}/checklist to the outbox (unsent checklist mutations for the same visit coalesced into the latest state)Imad
5Quick note field (300-character counter) saved with PUT /delegate/visits/{id}/note, debounced and coalescedImad
6Photo capture → MOB-11 upload queue → POST /delegate/visits/{id}/photos with client photo id, capture position and time; thumbnails with per-photo sync stateImad
7« Appeler » action logging a CALL interaction on the reseller timelineImad
8End-of-visit requirement check (mandatory checklist items, VisitType.minPhotos, report when required) before delegate.visits.end; server VISIT_REQUIREMENTS_NOT_MET details.missing mapped to the same checklistImad
9Locked visit UI after end: read-only fields, « Visite terminée à 10:42 — durée 18 min »; edits replayed after lock rejected with VISIT_LOCKED and shown in the sync centreImad
10Not-done reason sheet (DA-11) with the VISIT_NOT_DONE_REASON list from cached reference.lists, comment required for « Autre », position when available → delegate.visits.notDoneImad

Deliverables

  • apps/delegate/lib/src/features/visit/ (DA-10 detail, timer, checklist, note, photos; DA-11 not-done sheet)
  • Outbox mutation types delegate.visits.start, .checklist, .note, .addPhoto, .end, .notDone with dependsOn on arrive
  • integration_test/visit_offline_test.dart
  • Firebase App Distribution build 0.4.0 (staging) of the delegate app with the visit flow

Acceptance criteria

  • A complete visit (arrive, start, checklist, note, 2 photos, end) done in airplane mode survives an app kill and syncs in order on reconnection (FLD-08, SYN-04)
  • The timer shows the right elapsed time after the app is killed and reopened mid-visit
  • « Terminer la visite » is refused locally with the list of missing items when mandatory checklist items, photos or the report are missing; the server's VISIT_REQUIREMENTS_NOT_MET shows the same list
  • After end the visit is read-only; an edit made offline after the end is rejected with VISIT_LOCKED and listed in the sync centre
  • A visit cannot be marked not done without a reason, and « Autre » requires a comment (FLD-09)
  • Uploaded photos carry their capture position and time, without EXIF metadata in the file

Requirements covered

RequirementTitleRelease
FLD-08Visit and check-in: time and position at check-in, duration, checklist, note, photos (mandatory by visit type), call; finished visit lockedV1
FLD-09A visit not carried out requires a reasonV1
SYN-04Delegate app keeps the tour, visits, notes and photos locally under weak networkV1

Screens

ScreenNameApp
DA-10Visit & check-inDA
DA-11Visit not done — reasonDA

API surface

Endpoint groupOperations
Tours & visits19
File uploads & downloads3

Test measures

  • integration_test of the full offline visit with kill/relaunch and replay against Prism or staging
  • Unit tests of mutation coalescing (checklist, note) and of the requirement checker
  • Widget tests of DA-10 in PLANNED, CHECKED_IN, IN_PROGRESS, DONE (locked) and NOT_DONE states

Risks

  • Coalescing mutations could drop an intermediate state the server expects — coalesce only unsent mutations of idempotent PUT types (checklist, note), never start/end/photos
  • Clock changes on the phone distort durations — store monotonic elapsed time alongside occurredAt and let the server's plausibility check flag outliers

KPI

  • Delivered by Sun 6 Dec 2026 within 1.5 person-day(s).
  • Every acceptance criterion above demonstrated before hand-off; linked requirements' acceptance criteria pass.
  • Zero open critical defects, permission gaps or data-integrity regressions at sign-off.

Generated from content/plan/tasks.json by scripts/generate-team-tasks.mjs. Dates are computed by the scheduler (Sunday–Thursday weeks, holidays excluded) — change the plan, not this page.

On this page