Files
tremble7681 7e2cf0c9c8 wip(mechanic): inflight damage-flow + vendor scheme + PhotoAnnotate + TT views
Маркер «вот где остановилась mechanic-сессия» — не разбито по логическим коммитам,
зафиксировано целиком чтобы не потерять при отвлечении/чекаутах.

Modified:
- pages/InspectionEditor.tsx — расширение damage-flow внутри редактора
- pages/VehicleCard.tsx — vendor data + расширение карточки
- pages/InspectionReview.tsx — обновлённый review
- api/{auth,inspections,photos,vehicles}.ts — новые endpoints для TT + photo flow
- components/damage-flow/DamageClassifyDialog.tsx — multi-step UI
- components/vehicle-scheme/VendorVehicleScheme.tsx — SVG zone interaction
- data/damageVocabulary.ts — обновлённый словарь повреждений
- frontend index.html/manifest/icons — PWA-метаданные

New (untracked):
- components/damage-flow/PhotoAnnotateStep.tsx — новый шаг flow'а
- components/tt/ — vendor TT-state UI
- pages/TtStateDetail.tsx — экран осмотра вендора
- recon/findings/damage_model.md + damage_vocabulary.json + scheme/ — recon docs

Cleanup: удалены bash-garbage 'Last' и 'dict[str' из frontend/.
2026-05-20 11:16:21 +10:00
..

Per-Part Detail SVG: API-Fetched, Not Embedded

Verdict: API-FETCHED

No per-part SVG <path d="..."> data is embedded in the DLL binaries. The vendor app fetches detail part SVGs from the server at runtime.

How It Works

1. Vehicle Load: vehicle/vehiclemeta?id=<vehicleId>

When the mechanic selects a vehicle, the app calls:

GET {baseUrl}/vehicle/vehiclemeta?id={vehicleId}
Authorization: Bearer {token}

The response includes a list of DetailScheme objects — one per tappable zone. Each DetailScheme has at minimum:

  • Id — database PK
  • MetaId — maps to the SVG class="N" zone ID (0..56)
  • Scheme — full SVG string for the enlarged part view
  • ViewBox — the viewBox string for that part's SVG (e.g. "0 0 400 300")

2. Zone Tap → Detail View

When user taps zone N on the composite SVG:

  1. Foo.TouchEnd(N) fires (JavaScript in WebView)
  2. App calls GetDamagedDetailScheme(metaId: N) (C# method in Ttc.dll)
  3. The cached DetailScheme for that MetaId is retrieved
  4. Its Scheme SVG is rendered in a new WebView/Activity (DetailSchemeActivity)
  5. The scheme has the same <script> click handler so mechanic can tap damage spots

3. Damage Point Overlay: damage/details + damage/damagescard?id=

Existing damage points are overlaid on the detail scheme via:

GET {baseUrl}/damage/details         # returns damage list for the part
GET {baseUrl}/damage/damagescard?id={damageId}  # returns single damage card

Key C# Symbols

DetailScheme           — per-part SVG wrapper (field: Scheme, ViewBox, MetaId)
DetailSchemeWithStack  — same with pre-rendered damage circle stack
DetailSchemeWithDamages — ViewModel binding damage points to scheme
GetDamagedDetailScheme(metaId)         — retrieves scheme by zone ID
GetDamagedDetailSchemeWithStack(...)   — retrieves scheme + overlaid damage marks
GenerateDamagesFromStack               — draws circle markers from DamageCoordinates
DetailSchemeActivity   — the Android Activity that hosts the per-part WebView

Base URL

http://ttcontrol.naughtysoft.ru/api/

(Found at US heap 0x83898 in Ttc.dll — hard-coded base URL)

Why No Embedded SVGs

The composite exterior and salon SVGs are embedded (they are static templates). Per-part detail SVGs are vehicle-model-specific and change when the fleet changes vehicle types, so they are served from the API to stay updatable without an app release.

Our Implementation Options

  1. Mirror the API contract: Implement our own GET /vehicle/vehiclemeta?id= that returns DetailScheme[] with our custom per-part SVGs.
  2. Embed static SVGs: For each of the 57 zone IDs we use, design our own per-part SVG and bundle it in the frontend. Simpler but requires a frontend release for changes.
  3. Hybrid: Embed SVGs for the top-N most common damage zones (bumpers, doors, hood, roof = zones 0,4,10,11,12,13,16,22) and fetch others from API.

Option 2 (embed static) is recommended for Phase 1 — we control all 57 shapes.