Commit Graph

44 Commits

Author SHA1 Message Date
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 7e43f9e990 feat: requires_address status + address input for pickup-to-delivery switch
- New status: requires_address (Требуется адрес) in deliveryWorkflow
- ClientDeliveryPage: address input shown when delivery chosen without address on file
- OrderDetailPanel: requires_address status badge + address input for manager
- confirm_delivery_choice_by_token RPC: p_delivery_address param, sets requires_address status
- Edge function: delivery_address passed to RPC
- deliveryInvitationApi: deliveryAddress param
- CHECK constraint: requires_address, address_required added
- PickupSlotsPicker: styled storage conditions info block
2026-06-10 14:52:17 +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 7dfdd91798 fix: comprehensive error logging — all errors now captured in client_error_logs
- safeSupabaseCall: logs caught errors via logError
- AuthContext: logs sendOtp, verifyOtp errors
- ErrorLogPanel: fixed client→supabase reference in delete functions
- AuthContext: sets window.__supersam_user_id__ on auth state change
2026-05-27 15:30:33 +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 c59a806c2c fix: mega_admin role in UI checks + fix UserManagementPanel client→supabase 2026-05-27 11:17:41 +00:00
root f451add13c fix: replace assign_driver RPC with direct supabase update 2026-05-26 19:55:35 +00:00
root 40b28be0ee fix: automation funnel — correct data logic, remove emojis, rename to Воронка согласования 2026-05-25 12:31:58 +00:00
Codex 43c5f75055 feat: delivery page improvements and driver shipment workflow
- OrderCompositionPanel: flatten nested source_orders into product list, collapsed by default
- DeliverySlotsPicker: single-line heading 'Доставка завтра · 22.05.2026' instead of two-line
- OrderDetailPanel: add logistics status change panel, reorder sections (delivery date → driver → status → paid storage)
- OrderDetailPanel: require delivery date before assigning driver
- GroupDetailPage: dedicated route /dashboard/group/:groupId instead of modal
- DashboardPage: navigate to group detail page instead of opening modal
- DriverDeliveryPlanner: remove 'agreed' status, add city filter pills, group by status within dates
- DriverDeliveryPlanner: show delivery address instead of order numbers/ready count/SMS
- DriverShipmentPanel: new component with per-item checkboxes, ship-all, comments for unshipped items
- OrderDetailPanel: driver sees shipment panel + status buttons; 'delivered' requires all items shipped or commented
- Driver status: start from 'Назначено вам' (driver_assigned), not 'agreed'
- Remove duplicate header from GroupDetailPage
2026-05-22 12:53:43 +03:00
Codex 9abfbff654 feat: show order composition collapsed with product list from source_orders
- OrderCompositionPanel now collapsed by default with position count badge
- Flattens all products from source_orders into a single list
- RPC migration to extract items from source_orders (needs DB deploy)
- Edge Function updated to include source_orders items
- Removed Edge Function enrichment hack from fetchDeliveryInvitation
2026-05-21 14:18:10 +03:00
Codex e6dc1972fb feat: show full order composition on delivery page
- Extract OrderCompositionPanel as standalone component
- Support nested order items with sub-positions from source_orders
- Enrich order items from Edge Function when RPC only has invoice refs
- Update RPC SQL to extract product items from source_orders
- Update Edge Function to include source_orders items in invitation
- Add detail rows (account, customer) when no order items available
2026-05-21 11:52:46 +03:00
Codex 6244749545 feat: unify manual_required status and driver label
- orderGroupViews: unify notification manual_required + pending delivery_status into single "Требуется ручное управление" status
- LogisticsReadinessBoard: use status:manual_required in funnel instead of delivery:manual_confirmation_required
- DriverDeliveryPlanner: show "Назначено вам" for driver_assigned instead of "Назначен водитель"
- Add sync-manual-status.sql trigger patch for backend
2026-05-20 16:25:06 +03: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 0d3be0502c fix(order-detail): show positions from order_list column
- parseOrderList now checks orderList first (Supabase), then orderListStructured, then sourceOrders
- removed debug output from UI rendering
- added flexible field fallbacks for position name/quantity/unit
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 eeb2620547 fix(delivery): switch public flow to rpc 2026-05-13 18:59:30 +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 633973142d fix(delivery): load links and schedule SMS 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
Codex 5dcfa80940 Polish demo UI and delivery filters 2026-05-13 18:59:30 +03:00
Codex 5142ff30db fix: persist saved client delivery choice 2026-04-16 18:04:45 +03:00
Codex 3b4b6648ff fix: make client flow load without edge function 2026-04-16 17:00:31 +03:00
Codex c28c826601 feat: show client order items in delivery flow 2026-04-16 12:42:41 +03:00
Codex b147d632e8 feat: add role switch login and clean production copy 2026-04-14 23:01:02 +03:00
Codex 49e60d48c1 feat: complete delivery workflow updates 2026-04-13 16:32:18 +03:00
Codex 1798e3acfd refactor: align delivery flow with 1c imports 2026-04-13 16:24:04 +03:00
Codex b40a4a553e Initial import 2026-03-14 18:40:54 +03:00