Commit Graph

41 Commits

Author SHA1 Message Date
root efa2a83634 fix: requires_address warning only shown when address is actually empty
- Previously: status 'requires_address' always showed 'Адрес не указан' warning even when address was filled in
- Now: warning only appears when both status is 'requires_address' AND effectiveAddress is empty
- Label 'Доставка (требуется адрес)' also only shows when address is missing
2026-06-12 20:08:15 +00:00
root 6617abc27f feat: add picked_up (Вывезено) status — terminal status for self-pickup orders 2026-06-12 18:17:44 +00:00
root d22302838b fix: driver assignment only on delivery tab, hidden on pickup tab 2026-06-12 17:20:29 +00:00
root 62475c7e48 fix: remove duplicate renderValue declaration 2026-06-12 15:48:50 +00:00
root 2f2dae686c refactor: Phase 3 resilience — ErrorBoundary, split saving states, extract useStopWords
- ErrorBoundary: Russian UI, compact mode for card-level errors, reload button
- ErrorBoundary wraps OrderDetailPanel in GroupDetailPage + DeliverySetDetailPanel
- Split isSavingDeliveryChoice into 3 independent states:
  isSavingDeliveryChoice (delivery tab save)
  isSavingDriverAssignment (driver assign)
  isSavingStatusChange (status change)
- Extract useStopWords hook + matchesStopWord to shared hooks/useStopWords.js
- Remove 3x duplicated matchesStopWord from OrderDetailPanel, DriverShipmentPanel, OrderCompositionPanel
- Remove useStopWords + supabase import from OrderDetailPanel
2026-06-12 15:47:55 +00:00
root 129175fed7 refactor: Phase 2 decomposition — extract CalendarWidget, StatusActionPanel, DriverAssignmentPanel
- CalendarWidget: eliminates duplicated calendar JSX (delivery + pickup variants)
- StatusActionPanel: status action buttons with onConfirmStatus callback
- DriverAssignmentPanel: driver selection with onDriverSelect/onConfirmDriver callbacks
- OrderDetailPanel reduced from 1510 to 1261 lines
- No UI changes — all props passed through, all class names preserved
2026-06-12 15:30:30 +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 1a665b5165 fix: TDZ crash — move agreedTypeMatchesTab after isEditingDate declaration 2026-06-12 13:34:05 +00:00
root 1cab6c886e fix: tab-aware agreed banner — show delivery form when switching tabs, not stale pickup banner 2026-06-12 13:25:29 +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 005d4467bc Apply 7 UI fixes: center badges, hide not-ready, customer address for pickup, compact calendars, confirm modals, hide driver panel for pickup, format dates 2026-06-12 12:49:48 +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 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 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 136e5c826a fix: parseOrderList collects ALL source orders, edge fn returns orderItems 2026-05-27 14:36:00 +00:00
root 8dcab4da77 fix: show delivery date card for agreed+ statuses, not just agreed 2026-05-27 12:57:31 +00:00
root 58dc110007 feat: allow admin/logistician to re-edit delivery date after agreement 2026-05-27 12:44:43 +00:00
root 1f285ea718 feat: driver assigned confirmation block in delivery card 2026-05-27 12:41:17 +00:00
root a8d54699ff fix: restrict agreed/driver_assigned status buttons, show hints instead 2026-05-27 12:26:21 +00:00
root bb6708e94b fix: mega_admin in GroupDetailPage + OrderDetailPanel role checks 2026-05-27 11:19:43 +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 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 a2196d232b feat(order-detail): collapsible order composition with table layout
- Extracted IIFE into CollapsibleOrderComposition component to fix React hooks error
- Состав заказа свернут по умолчанию, разворачивается по клику
- Позиции отображаются в табличном виде (grid 1fr + auto)
- Количество и единицы измерения не обрезаются (whitespace-nowrap)
- Парсинг работает из source_orders, order_list, order_list_structured
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 874e9b3885 fix: debug order composition parsing and add visible error info 2026-05-20 16:25:06 +03:00
Codex 458414636d fix: parse order composition from source_orders field 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 0056e71b39 fix: add explicit text color and order composition to OrderDetailPanel 2026-05-20 16:25:06 +03:00
Codex f6bbfe1ba2 fix: add explicit text color to OrderDetailPanel value fields for dark theme visibility 2026-05-20 16:25:05 +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 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 f2230f3277 Add logistics UI actions and demo login buttons
- Fix bug in transfer-to-logistics: body.note was incorrectly used for delivery_agreement_status
- Add quick actions section in OrderDetailPanel for status changes (visible to role)
- Add driver assignment buttons for logistician/admin
- Add demo login buttons for all roles (works with real Supabase config)
- Add loginAsDemoUser function to AuthContext for quick demo login
2026-05-13 18:59:30 +03:00
Codex a5113a2ed5 feat: simplify delivery roles and docs 2026-04-16 13:31:17 +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