4.1 KiB
4.1 KiB
1C Delivery UI Design Spec
Overview
The frontend is a delivery workspace centered on logisticians, drivers, admins, and the public client delivery page. Orders are imported from 1C; the web app does not create orders. Delivery automation starts only when the full client order set is ready.
Key Principles
- 1C is the source of truth for order creation and production progress. The web app never creates new orders; it receives them via import.
- Supabase is the source of truth for delivery workflow state. Invitations, slots, delivery-set groupings, and operator actions all live in Supabase.
- Delivery sets, not individual orders, are the primary unit. A client delivery set groups all orders for the same client and becomes actionable when every order in the set is accepted by QC (
source_accept_atpresent,source_ship_atabsent). - The legacy SMS field is informational only. It must not start the new delivery scenario.
- The client is not an authenticated user. The client uses a public invitation link.
Screen Flow
Operator Login
- Email + OTP login via Supabase Auth.
- Unknown email shows: "Email не найден в системе. Обратитесь к администратору."
- After sending OTP, the UI tells the user to check inbox and Spam.
- Roles:
logistician,driver,admin(and legacymanager,production_lead).
Logistician Workspace
The logistician lands on the logistics section of the dashboard. The primary widget is the LogisticsReadinessBoard showing delivery sets grouped into buckets:
| Bucket | Russian Label | Meaning |
|---|---|---|
approaching |
На подходе | Some orders in the set have not yet been accepted by QC |
ready_to_launch |
Готово к запуску | All orders accepted, delivery can be started |
awaiting_client |
Ожидает клиента | Invitation sent, waiting for client choice |
manual_work |
Нужна ручная работа | Transferred to logistician, paid storage, or problem |
agreed |
Согласовано | Client confirmed the delivery slot |
completed |
Завершено | All orders in the set delivered |
Clicking a set opens the DeliverySetDetailPanel showing:
- Set name, city, order count, linked bill texts
- Per-order source fields: 1C order number, production steps (saw, glue, H-glue, curve, accept, ship)
- Slot state if available
- Manual action placeholders (future: start invitation, assign driver)
Driver Workspace
The driver sees assigned deliveries with:
- Address, client name, phone, city
- Delivery time slot (date + half-day)
- Delivery set reference (1C number, set name)
- Quick status transitions: Загружен → В пути → Доставлен / Проблема доставки
Client Delivery Page
Public page at /delivery/:token. States:
- awaiting_choice / opened / reminder_sent: Shows DeliverySlotsPicker with date + half-day slots, then DeliveryChoiceFlow buttons.
- transferred_to_logistics: "С вами свяжется логист"
- paid_storage: "Платное хранение"
- agreed: "Доставка уже согласована"
- delivered: "Заказ уже доставлен"
Data Model Key Fields
public.orders source fields (imported from 1C)
source_order_number,source_order_date,source_customer_name,source_customer_phone,source_customer_email,source_customer_city,source_total_sum,source_paid_at,source_gateway,source_associated_bills_text,source_production_at,source_saw_at,source_glue_at,source_h_glue_at,source_curve_at,source_accept_at,source_ship_at,source_payload jsonb
public.orders delivery-set fields (computed/derived)
delivery_set_key,delivery_set_name,delivery_set_status,delivery_set_ready_at,delivery_ready_reason,source_sms_legacy_at
Readiness Rule
A single imported order is ready when source_accept_at IS NOT NULL AND source_ship_at IS NULL.
A client delivery set is ready only when all linked imported orders are ready.