Commit Graph

29 Commits

Author SHA1 Message Date
root ae1e0a2e0e fix: 3 бага доставки — самовывоз/водитель/отгрузка
Bug 1: deliveryType='delivery' перезаписывался на 'pickup' маппером из-за адреса/источника. Теперь если БД явно содержит delivery_type='delivery', маппер это уважает.

Bug 2: водитель не мог сохранить частичную отгрузку — добавлена кнопка 'Сохранить отгрузку' в DriverShipmentPanel + saveShipmentData() в репозитории.

Bug 3: при смене типа на самовывоз assigned_driver_id не очищался — добавлено assigned_driver_id: null в updatePayload.
2026-06-15 15:10:30 +00:00
root 6617abc27f feat: add picked_up (Вывезено) status — terminal status for self-pickup orders 2026-06-12 18:17:44 +00:00
root 4dde64ff5a refactor: Phase 1 stabilization — hooks ordering, deduplicate utils, extract shared constants
- P0-1: Move all hooks (useState, useCallback, useMemo) before early return to fix Rules of Hooks violation
- P0-3: Replace 7 inline isPickupOrder checks with single computed variable
- P1: Extract getErrorMessage, normalizeNom to shared utils/deliveryUtils.js
- P1: Replace duplicate STATUS_LABELS with DELIVERY_GROUP_STATUS_LABELS import
- P1: Add requires_address to DELIVERY_GROUP_STATUS_LABELS
- Remove duplicate getErrorMessage from useOrderGroups.js and OrderDetailPanel.jsx
- Remove duplicate normalizeNom from OrderDetailPanel.jsx and orderGroupRepository.js
2026-06-12 14:50:56 +00:00
root fb5728ba43 fix: order numbers clickable+copy, expandable sub-accounts, preserve delivery address on pickup switch, opaque calendar, tab-aware date label 2026-06-12 13:19:57 +00:00
root 498faca24d feat: delivery/pickup switching in admin card + address field
- Added delivery address input field in manual agreement form (visible when delivery type)
- Pickup switching clears delivery_address in DB, delivery switching preserves/updates it
- useOrderGroups passes deliveryType, deliveryAddress, pickupDate, pickupTimeSlot to API
- orderGroupRepository: updateOrderGroupDeliveryChoice now handles delivery_type and address
- Pickup orders: address cleared, pickup_date/pickup_time_slot saved
- Delivery orders: address saved, pickup fields cleared
- Updated tests to match new payload structure
2026-06-12 08:23:41 +00:00
root 9aef4d49c0 fix: pickup display — detect from source_orders.ship, show correct labels, hide placeholder address
- orderGroupRepository: detect pickup from source_orders.ship='САМОВЫВОЗ' and address='САМОВЫВОЗ'
- orderGroupRepository: set effectiveDeliveryType='pickup' when source data indicates pickup even if DB says 'delivery'
- orderGroupRepository: clear deliveryAddress when it's just 'САМОВЫВОЗ' placeholder
- OrderDetailPanel: dynamic header 'Карточка группы самовывоза' vs 'Карточка группы доставки'
- OrderDetailPanel: subtitle now includes orderNumbers for visibility
- OrderDetailPanel: label changed from 'Номер счёта' to 'Заказ' with '+N сч.' for sub-bills
- GroupDetailPage: neutral 'Группа не найдена' instead of 'Группа доставки не найдена'
- Added pickup-specific test case
2026-06-12 08:14:20 +00:00
root 813852ff45 fix: JSX structure errors + orderGroupRepository syntax 2026-06-10 12:12:04 +00:00
root e05613ac1d feat: add pickup (самовывоз) delivery type
- New status pickup in delivery workflow
- DB: delivery_type, pickup_date, pickup_time_slot columns
- Client page: tabs Доставка/Самовывоз with PickupSlotsPicker
- PickupSlotsPicker: today/tomorrow/day-after with half-day slots
- Storage notice: free 2 workdays, then 300₽/day
- OrderDetailPanel: delivery type tabs, pickup date/time, status button
- Edge function: delivery_type/pickup fields in confirm-delivery-choice
- RPC: confirm_delivery_choice_by_token updated for pickup
- orderGroupRepository: full pickup field mapping
2026-06-10 12:02:46 +00:00
root 50f504c2ff fix: city regex requires mandatory dot+space — no more Гор→ор, Годная→одная 2026-05-28 11:05:38 +00:00
root 9e992d8280 fix: extractCity uses known cities list instead of first-chunk heuristic 2026-05-28 10:57:03 +00:00
root 2d1bca9cb4 fix: default city=Севастополь when not specified 2026-05-28 10:33:38 +00:00
root 6f29948f8a fix: remove Группы tab from logistician, remove Справка, Телефон→Город, Заказы→Водитель, add city filter 2026-05-28 10:29:13 +00:00
root bb439a4d93 fix: clean action log — no UUID/ID duplicates, smart expanded row 2026-05-28 10:22:31 +00:00
root a5b9dc1153 fix: ternary syntax in assignDriver logPayload 2026-05-28 10:18:29 +00:00
root 1e0344ee34 fix: action log — resolve UUID to names, show old→new, add oldValue for driver reassignment 2026-05-28 10:17:29 +00:00
root 581a275bc0 fix: action log — readable driver names, no duplicate columns, meaningful descriptions 2026-05-28 10:11:57 +00:00
root 805ceca152 fix: 8 bugfixes — current undefined, auth email, sequential statuses, problem dialog, action log details, KPI layout, date sort, driver lock 2026-05-28 10:03:19 +00:00
root dac8450586 feat: action_logs — журнал действий сотрудников с фильтрами 2026-05-27 15:12:46 +00:00
root 8f50a68687 feat: delivery_date_source tracking + manual date in analytics funnel 2026-05-27 14:59:57 +00:00
root 470270118b fix: driver_assigned status on assign + driver column in table 2026-05-27 12:48:48 +00:00
root 9ec7d8e8ae fix: assign driver preserves agreed+ statuses instead of downgrading to driver_assigned 2026-05-27 12:34:41 +00:00
root f451add13c fix: replace assign_driver RPC with direct supabase update 2026-05-26 19:55:35 +00:00
Codex 838c4cb7ae feat(paid-storage): bypass stale RPC for paid_storage transitions
- OrderDetailPanel: paid_storage bypasses update_delivery_status RPC
- Repository: direct table update for paid_storage entry/exit
- LogisticsBoard: collapsible sections ordered by funnel
- SQL: updated paid_storage schema patch
- LoginPage: hide dev quick-login in production
2026-05-20 16:25:06 +03:00
Codex c8fbe95bd1 feat(paid-storage): inline confirmation + cancel action + status display
- Replaced window.confirm with inline confirmation panel in app style
- Shows confirmation block with 'Yes, transfer' / 'Cancel' buttons
- After transfer: shows 'Transferred to paid storage' with date and yellow indicator
- Added cancel button to revert from paid_storage back to pending_confirmation
2026-05-20 16:25:06 +03:00
Codex 3728ed0e95 fix: include order_list fields in queries and map to frontend object 2026-05-20 16:25:06 +03:00
Codex b9c6bb2810 fix: RLS recursion, driver UI, auth errors, status counts
- Fix infinite RLS recursion in users policies via current_role_name()
- Add is_admin() helper and simplify users select policies
- Fix order_groups insert for service_role (n8n integration)
- Fix status option counts in dropdown (LogisticsReadinessBoard)
- Add driver delivery status buttons (loaded, on_route, delivered, problem, cancelled)
- Replace driver date range filters with single date picker + date pills
- Hide SMS/internal data from driver view in OrderDetailPanel
- Fix Edge Function error messages in OTP flow (read error.context body)
- Add update_delivery_status RPC for driver workflow
- Remove customer column from order_groups fetch (DB schema mismatch)
- UI: swap filter/search positions, limit modal width, status label cleanup
2026-05-20 16:25:05 +03:00
Codex 7e399f2517 fix(delivery): tighten public flow
Filter client delivery slots to tomorrow and the day after,\nkeep invalid delivery times out of the UI, and show a clearer\nerror state when saving fails.
2026-05-13 18:59:30 +03:00
Codex b79de7afba feat(delivery): auto-create invitation links
Add a Supabase trigger that creates delivery invitations and writes delivery_link on order_groups changes. n8n can now consume link_ready rows without calling the edge function first.
2026-05-13 18:59:30 +03:00
Codex 684424dd25 feat(order-groups): wire driver delivery flow 2026-05-13 18:59:30 +03:00