Commit Graph

262 Commits

Author SHA1 Message Date
root d2ac10d849 feat: SMS campaign sub-tabs + recheck button + dual send protection
- SmsCampaignPanel: 4 sub-tabs (first_sms/second_sms/manual/paid_storage)
- 'Проверить снова' button sets needs_check=true in sms_campaign_log
- Auto-refresh every 30s with toggle
- Elapsed time display per row
- Script: after send, notification_status='sms_sending' (not 'link_ready')
  → double protection against re-sending to same group
- Script: get_sms_to_check includes needs_check=true records regardless of age
- Script: checked_at timestamp on each status check
- DB: needs_check boolean + checked_at timestamptz columns added
2026-06-23 10:35:52 +00:00
root 4215001ab7 feat: test_mode toggle in admin + cache bump v10
- test_mode + test_phone columns in sms_campaign_settings (DB)
- Script reads test_mode from DB settings, not env vars
- Admin panel: toggle Test/Production mode with visual indicator
- test_mode=true (default): SMS only to test_phone
- test_mode=false: SMS to real customers
- Service worker cache v9 → v10 (fixes white screen)
2026-06-23 08:58:59 +00:00
root f264a53c0a feat: SmsCampaignPanel — SMS log + settings in mega_admin dashboard
- sms_campaign_log table: full audit trail (phone, sms_id, status, code, attempts)
- sms_campaign_settings: editable by megaadmin (wait times, max attempts, delays)
- New tab 'SMS-кампании' in mega_admin navigation
- State machine: no blocking sleeps, fast cron runs
- Protection: no duplicate SMS within 24h, code 231/132 = limit, not retry
2026-06-23 08:39:24 +00:00
root f792ea6fb9 fix: table fonts 12px (text-xs), compact padding py-1.5 2026-06-23 08:01:49 +00:00
root b0370ed03e fix: handle status=first_sms_sent when notification_status=link_ready
n8n workflow writes status='first_sms_sent' but leaves notification_status='link_ready'.
Added first_sms_sent/second_sms_sent to ORDER_GROUP_STATUS_LABELS and tone logic.
2026-06-23 07:53:01 +00:00
root a55e5857f8 fix: add SMS notification statuses to filter options, increase Badge font size
- Add first_sms_sent, second_sms_sent, send_failed, link_ready, ready_to_launch
  to ORDER_GROUP_DISPLAY_STATUS_OPTIONS (were missing from filter dropdown)
- Badge: text-xs (12px) → text-sm (14px), font-semibold → font-medium,
  px-3 py-1 → px-2.5 py-0.5 (matches table text size, less padding)
2026-06-23 07:38:54 +00:00
root bbe578eb3a fix: parseGroupDate now handles DD.MM.YYYY (4-digit year) format
customer_date in DB is stored as 23.06.2026 (DD.MM.YYYY) but parseGroupDate
only matched DD.MM.YY (2-digit year). This caused date filter to reject all
groups when filtering by date range, since parseGroupDate returned null
for 4-digit year dates.
2026-06-23 07:22:09 +00:00
root 45dbbd4cb3 feat: show client page open analytics in OrderDetailPanel
- Add delivery_invitation nested select (opened_at, access_count, last_accessed_at)
- Map to invitationOpenedAt, invitationAccessCount, invitationLastAccessedAt
- Show in 'Ссылка на согласование' panel: 'Клиент открывал страницу X раз, последний раз DD.MM'
- Or 'Клиент ещё не открывал страницу согласования'
- Data only updated by client-facing RPC, not by admin actions
2026-06-23 05:15:58 +00:00
root b74add32ef fix: skip Sunday in delivery date selection (client flow + backend validation)
- buildDefaultDatedAvailableSlots(): skip Sunday via getNextWorkday()
- ClientDeliveryPage.jsx: getAllowedDeliveryDateKeys() + fallback slots skip Sunday
- confirm-delivery-choice edge function: reject Sunday for delivery
- confirm_delivery_choice_by_token SQL RPC: extract(dow) = 0 → RAISE EXCEPTION
- Tests: Friday→Sat+Mon, Saturday→Mon+Tue (skip Sunday)
- Skill updated with pitfall
2026-06-23 04:56:49 +00:00
root d04901d296 security: fix 9 vulnerabilities + OrdersTable 14px font + colored status badges
Security fixes:
- Remove VITE_SUPABASE_SERVICE_ROLE_KEY from Docker build args
- Add missing security.ts functions (verifyInternalRequest, requireSameOrigin, etc)
- Store only OTP hash, remove plaintext otp_code
- Fix CORS origin check: startsWith → exact match
- Use atomic SQL check_rate_limit RPC instead of JS rate limiter
- Mask PII in get_delivery_invitation_by_token single-order path
- Add RequireAuth wrapper for protected routes
- Revoke anon execute on confirm_delivery_choice_by_token
- Add HSTS header to Caddyfile

UI:
- OrdersTable desktop: all cells text-sm (14px)
- Status column: use colored Badge with tone from getOrderGroupStatusTone
- Header row: text-sm (14px)
2026-06-19 12:14:19 +00:00
root cdb2ec7098 fix: Button→native button everywhere, table font 12px, dropdowns cleanup
- OrdersTable: font text-xs (12px), headers 11px, city column, horizontal scroll
- OrderFilters: dropdown items native button, no ovals, counter as plain text
- DriverAssignmentPanel: custom DriverDropdown in app style
- StopWordsPanel: all Button→button
- UserManagementPanel: all Button→button, RoleDropdown native
- SuggestionsPanel: all Button→button
- ActionLogPanel: Button→button
- ErrorLogPanel: all Button→button
- OrderDetailPanel: delivery tabs, problem reasons, expand toggle→button
- CalendarWidget: month nav arrows→button
- AppShell: nav buttons variant=ghost
- NotificationBell: buttons→native
- ClientDeliveryPage: hide delivery status badge, pickup code block
- PickupSlotsPicker: fix today morning slot logic
2026-06-19 11:36:45 +00:00
root 17fe2125a5 fix: replace Button with native button for mobile cards — proper left-align
Button component forces inline-flex items-center justify-center rounded-full
which was overriding all alignment. Switched to native <button> with
flex flex-col items-start justify-start. SW v8→v9.
2026-06-18 18:35:42 +00:00
root 28ccb655d3 fix: mobile card — no phone, show ordersTotal badge, cache-control headers
Mobile: removed phone + buildGroupSummary, kept name + type badge + status +
  order numbers + count badge (N сч.)
Caddyfile: Cache-Control immutable for assets, no-cache for HTML+SW
SW v7→v8
2026-06-18 17:56:37 +00:00
root 7b773dd4aa fix: mobile card left-align (!items-start !justify-start override Button center)
Button base has inline-flex items-center justify-center — overriding with
!important Tailwind utilities for mobile cards. SW cache v6→v7.
2026-06-18 17:48:19 +00:00
root 05b81cf128 fix: client name wraps to 2 lines in desktop table, prevents column stretch 2026-06-18 17:27:16 +00:00
root 0b0626daa5 fix: restore mobile card (name+phone), remove updatedAt column, clean layout
Mobile: restored customer name + phone, buildGroupSummary, delivery type badge
Desktop: removed 'Обновлён' column (7→6 cols), grid updated
Server: added WatchdogSec=30 + Type=notify + sd_notify heartbeat to webhook-listener
2026-06-18 17:13:05 +00:00
root aefc588844 fix: clean up mobile card + desktop first column
Mobile card: removed phone, dates, updatedAt, buildGroupSummary — kept only
  name + delivery type badge + status badge + order numbers + problem alert
Desktop first column: removed duplicate name and groupKey (phone|date),
  kept only name + phone
2026-06-18 16:40:23 +00:00
root 693da3236e feat: payment + manager info in detail card, delivery type badge in mobile header
- orderGroupRepository: added manager_name, manager_email, manager_tel, payed_ship, is_payed_ship to SELECT
- OrderDetailPanel: manager name + tel, payment status with amount (✓ Оплачено + ₽), hidden for drivers
- OrdersTable mobile: delivery type badge moved to header row next to status badge
  - 🏪 Самовывоз (accent color) / 🚚 Доставка — immediately visible at top of card
2026-06-18 16:34:22 +00:00
root 7054390dcb feat: add delivery link panel in OrderDetail for non-driver roles
- Map delivery_link DB field to deliveryLink in order group object
- New panel in OrderDetailPanel: 'Ссылка на согласование'
- Two buttons: open approval page (link) + copy link to clipboard
- Visible for all roles except driver
- Shows when order.deliveryLink is present
2026-06-18 15:15:43 +00:00
root 54386e9710 feat: Тип column replaces Проблема, red highlight for problem rows, delivery type filter, clean status options
- OrdersTable: replaced 'Проблема' column with 'Тип' (Самовывоз/Доставка)
- Problem rows highlighted red (bg rgba danger 10%)
- Mobile cards also show Тип label
- OrderFilters: added deliveryType dropdown (Доставка/Самовывоз)
- filterOrderGroups: filter by deliveryType
- useOrderGroups: deliveryType in default filters state
- Cleaned ORDER_GROUP_DISPLAY_STATUS_OPTIONS: removed 'Повторное SMS' and 'SMS отправлены' (not used)
2026-06-18 15:00:58 +00:00
root 8d3d8dc0fe refactor: unify all buttons to <Button> component across app
- Replace 82 inline <button> elements with <Button variant/size> in 19 files
- UI primitives (SegmentedTabs, ThemeToggle, DatePicker) and ErrorBoundary kept as-is
- Consistent styling: primary (accent), secondary (outline), ghost (transparent)
2026-06-16 20:11:57 +00:00
root d28e00782b fix: never show raw English status keys to user — fall back to 'Неизвестно (key)' 2026-06-16 13:29:38 +00:00
root f1e2b47396 fix: refetch order groups on window focus and GroupDetailPage mount to prevent stale status 2026-06-16 13:25:41 +00:00
root 37ea7d3a19 fix: убрать генерацию pickup_code — приходит из 1С, показывать только при самовывозе 2026-06-16 07:36:47 +00:00
root 9408b98f06 fix: pickup_code — 6-значное число вместо букв 2026-06-16 06:57:57 +00:00
root 5867272873 feat: pickup_code для самовывоза + упрощение статуса отгрузки
- pickup_code: автогенерация 6-значного кода при выборе самовывоза
- Колонка pickup_code в order_groups + SELECT
- Отображение кода выдачи в карточках (логист, клиент)
- Упрощение: любая отгрузка → delivered (проблемы в has_delivery_problem)
- RPC: добавлены deliveryType, pickupCode, pickupDate, pickupTimeSlot
2026-06-16 06:53:12 +00:00
root 6184f5aeed fix: авто-статус delivered при полной отгрузке (включая с комментарием)
Раньше: все позиции отгружены → delivered, иначе → problem
Теперь: все отгружены ИЛИ все неотгруженные с комментарием → delivered
Только если есть неотгруженные без комментария → problem
2026-06-16 06:33:55 +00:00
root c288251cec feat: автосменя статуса при сохранении отгрузки
- Все позиции отгружены → delivery_status = 'delivered'
- Частичная отгрузка (есть неотгруженные) → delivery_status = 'problem'
- Без сохранения отгрузки — статус не меняется
2026-06-15 18:40:42 +00:00
root b888eba09b feat: колонка has_delivery_problem + delivery_problem_note
- saveShipmentData автоматически заполняет has_delivery_problem (boolean) и delivery_problem_note (текст с перечислением неотгруженных позиций и причин)
- OrdersTable: колонка 'Проблема' показывает ⚠ Проблема + детали из delivery_problem_note
- orderGroupViews: warning-тон для групп с hasDeliveryProblem
- n8n/1C: просто читать has_delivery_problem (0/1) и delivery_problem_note
2026-06-15 17:32:14 +00:00
root 187ef90c96 fix: кнопка 'Сохранить' → 'Сохранить изменения' после первого сохранения 2026-06-15 16:29:20 +00:00
root 55c91d8d32 fix: визуальная обратная связь после сохранения отгрузки водителем
- После нажатия 'Сохранить отгрузку' показывается заметный summary-блок
- Каждая позиция в отдельной карточке: зелёная рамка (отгружено) / оранжевая рамка (не отгружено)
- Причина неотгрузки показана внутри карточки
- Кнопка 'Изменить' позволяет вернуться к редактированию
- При повторном открытии — компактная плашка 'Отгрузка ранее сохранена'
2026-06-15 16:01:17 +00:00
root 41272bdbbf fix: аудит доставки — критические и средние баги
Edge function confirm-delivery-choice:
- currentGroup использовался до объявления — перемещён вверх
- pickup не очищал assigned_driver_id — добавлена очистка
- выборка currentGroup теперь включает delivery_address, customer_address

Edge function update-order-group-delivery-choice:
- добавлена поддержка deliveryType=pickup (ранее всегда ставил 'agreed')
- pickup очищает assigned_driver_id, устанавливает pickup_date/time_slot
- дата доставки не обязательна для pickup

Фронтенд:
- assignDriverToOrderGroup: null → 'agreed' (NOT NULL constraint)
- isDeliveryAgreed включает статус 'pickup'
- orderGroupViews: warning-тон для групп с проблемами отгрузки
- OrdersTable: колонка Отгрузка с визуализацией проблем
2026-06-15 15:38:42 +00:00
root 3847625005 feat: колонка Отгрузка в таблице + подсветка проблем
- Новая колонка 'Отгрузка' в таблице групп доставки (десктоп и мобайл)
- Показывает ✓ N/N для полностью отгруженных, ⚠ X/N для частичной отгрузки
- В мобильных карточках: блок с перечислением проблемных товаров и причин
- Подсветка warning-тоном для групп с неотгруженными позициями
- Восстановление состояния чекбоксов из driverShipmentData
2026-06-15 15:27:50 +00:00
root a687d0b8a8 feat: визуальный результат отгрузки — восстановление состояния + блок с результатом
- Восстановление shippedItems и comments из order.driverShipmentData при загрузке
- Визуальный блок 'Отгрузка сохранена' с галочками/крестиками и комментариями
- Зачёркнутый текст для отгруженных позиций, причина для неотгруженных
2026-06-15 15:24:13 +00:00
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 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 491b7705fd fix: date format dd.MM.yyyy in logistics board, align columns via CSS grid
- LogisticsReadinessBoard: formatDate() for delivery date (was raw yyyy-MM-dd)
- LogisticsReadinessBoard: replaced <table> with CSS grid for aligned columns
- OrdersTable: replaced <table> with CSS grid for aligned columns
- Both tables: 6-column grid with fixed proportions, all columns visible
2026-06-12 19:28:10 +00:00
root d313a3b6b9 fix: driver badge shows only assigned deliveries, add agreed+paid_storage to visible statuses
- DashboardPage: driver badge now counts only groups visible to driver AND assigned to current user
- DRIVER_VISIBLE_DELIVERY_STATUSES: added 'agreed' and 'paid_storage' so driver sees all relevant statuses
- DriverDeliveryPlanner: added agreed/paid_storage to status sort order
- Previously badge showed allOrderGroups.length (5) but list was empty because filter was too strict
2026-06-12 19:22:36 +00:00
root 3e5be5edf1 fix: remove on_route and pickup from manual status buttons and filters 2026-06-12 18:25:52 +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 fe2d8c4e9b fix: restore deleted data preparation vars in AdminDashboard (TDZ crash) 2026-06-12 12:21:23 +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 ec9b28fa6f fix: resolve merge conflict - remove duplicate order declaration in GroupDetailPage 2026-06-12 07:48:20 +00:00
root 55422ec65a feat: add skeleton loading states across all pages
- New Loading.jsx component library (Skeleton, SkeletonPanel, SkeletonPage, SkeletonTable, Spinner, LoadingBlock)
- Dashboard: SkeletonTable/SkeletonPage during isLoading
- OrdersTable, LogisticsReadinessBoard, DriverDeliveryPlanner: show skeleton instead of empty state
- ChatTimeline, DeliverySlotsPicker, GroupDetailPage: skeleton while loading
- AdminDashboard, StopWordsPanel, UserManagementPanel, ErrorLogPanel, ActionLogPanel: skeleton during initial load
- NotificationSettings: skeleton for push toggle and notification preferences
- ClientDeliveryPage: skeleton bars instead of text-only loading
2026-06-12 07:46:58 +00:00
root 69a2023ec1 feat: suggestions panel for employees + admin review 2026-06-10 18:24:58 +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 c774c6a362 feat: add pickup analytics — RPC, hook, PickupStatsPanel, dashboard integration 2026-06-10 12:32:51 +00:00
root 3651dbb484 chore: cleanup 2026-06-10 12:12:10 +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 3c22eb71ab fix: case-insensitive stop word matching 2026-05-28 19:55:57 +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 2ee437e83e fix: add Ошибки tab to admin nav + already fixed client→supabase in ErrorLogPanel 2026-05-27 15:33:06 +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 f90b476bfd fix: hide delivery choice flow after save, remove confusing hero block 2026-05-27 14:40:20 +00:00
root 136e5c826a fix: parseOrderList collects ALL source orders, edge fn returns orderItems 2026-05-27 14:36:00 +00:00
root d0f2a72dda feat: stop words CRUD + client-side filtering 2026-05-27 14:28:52 +00:00
root a764213a77 feat: logistics board as grouped tables with column headers 2026-05-27 14:16:00 +00:00
root f8c6c538b7 compact: logistics readiness cards — single-line on desktop, stacked on mobile 2026-05-27 14:12:39 +00:00
root 0930ea9c26 fix: back button uses browser history instead of hardcoded /dashboard 2026-05-27 14:06:54 +00:00
root db555bbf55 remove: drop readiness column from orders table 2026-05-27 14:03:57 +00:00
root d43dd04e9b feat: add orders table tab for logistician role 2026-05-27 13:59:21 +00:00
root 8dcab4da77 fix: show delivery date card for agreed+ statuses, not just agreed 2026-05-27 12:57:31 +00:00
root 470270118b fix: driver_assigned status on assign + driver column in table 2026-05-27 12:48:48 +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 19bed475ee feat: delivery date in table+card, driver assign preserves agreed status 2026-05-27 12:39:02 +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 a8d54699ff fix: restrict agreed/driver_assigned status buttons, show hints instead 2026-05-27 12:26:21 +00:00
root 0f32d6d73a feat: URL-based navigation via ?tab= param for shareable links 2026-05-27 12:21:32 +00:00
root 15f2ab3cde refactor: PATCH user via supabase client, not edge function 2026-05-27 12:12:44 +00:00
root fd3f738b9f fix: no default role, placeholder for role dropdown 2026-05-27 12:01:45 +00:00
root cee5acab1d fix: modal styling - solid bg, full-width dropdown, labels 2026-05-27 11:59:43 +00:00
root e04485c446 feat: add-user modal dialog — compact, centered, backdrop 2026-05-27 11:53:54 +00:00
root 696f275567 fix: simple add-user form — 3 fields + small button 2026-05-27 11:50:12 +00:00
root 9009ffdfb0 feat: manage-users edge function, admin CRUD via API instead of direct supabase.auth.admin 2026-05-27 11:28:53 +00:00
root b9b227e524 feat: UserManagementPanel — themed dropdown, inline edit name/email/role 2026-05-27 11:23:37 +00:00
root bb6708e94b fix: mega_admin in GroupDetailPage + OrderDetailPanel role checks 2026-05-27 11:19:43 +00:00
root c59a806c2c fix: mega_admin role in UI checks + fix UserManagementPanel client→supabase 2026-05-27 11:17:41 +00:00
root 58a96355f1 fix: replace createClient with shared supabase singleton in useAdminStats and errorLogger 2026-05-27 10:59:37 +00:00
root 2fea387d43 fix: use shared supabase client with auth session in admin panels
- UserManagementPanel: replace createClient() with supabase from supabaseClient
- ErrorLogPanel: same — reuse authenticated supabase singleton
- Remove production_lead role from ROLES/ROLE_LABELS/ROLE_TONES
- Remove service_role key dependency — RLS handles auth
- Fixes: admin Users tab showing empty (RLS couldnt resolve auth.uid())
2026-05-27 09:50:07 +00:00
root c996805122 fix: duplicate client declaration 2026-05-27 08:55:35 +00:00
root f4a4082677 fix: remove service_role from ErrorLogPanel - use anon key + RLS 2026-05-27 08:54:49 +00:00
root 3934e6a872 feat: error log panel - delete, export JSON/CSV, select rows 2026-05-27 06:14:33 +00:00
root f451add13c fix: replace assign_driver RPC with direct supabase update 2026-05-26 19:55:35 +00:00
root 41e36299b7 fix: persist signed-out flag in sessionStorage to block auto-login after logout 2026-05-26 17:53:21 +00:00
root 8a8446bfec fix: prevent session restore after signOut with signedOutRef flag 2026-05-26 14:43:43 +00:00
root 844f052462 fix: kill session on signOut, .maybeSingle() for 406, remove StrictMode 2026-05-26 14:36:50 +00:00
root cbc6242613 fix: remove TS annotations from jsx file 2026-05-25 15:34:03 +00:00
root ca6f160073 feat: secure auth storage - obfuscated sessionStorage instead of plaintext localStorage 2026-05-25 15:32:17 +00:00
root cf18ecb6ff fix: funnel show all steps, center KPI, top nav, roles RU, admin users tab 2026-05-25 13:17:24 +00:00
root 0d5fb1b79a mobile: responsive admin dashboard 2026-05-25 12:57:46 +00:00
root 79e1173dd3 funnel: outcomes only, SMS separate panel 2026-05-25 12:47:57 +00:00
root 011dd08f08 bump: SW cache v4 to force cache invalidation 2026-05-25 12:41:25 +00:00
root 40b28be0ee fix: automation funnel — correct data logic, remove emojis, rename to Воронка согласования 2026-05-25 12:31:58 +00:00
root 89d6a01b68 feat: add PWA install button to header 2026-05-22 14:10:08 +00:00
root a04e8edb6e feat: auto-restore push subscription + bump SW cache v3 2026-05-22 11:18:58 +00:00
root 5f88b2ca65 feat: role-based notification settings, push via DB trigger 2026-05-22 11:11:01 +00:00
root f099cf20d8 fix: update VAPID public key to match server-side keys 2026-05-22 10:59:39 +00:00
root bcf6f9d16f fix: JSX syntax error in Navigate component 2026-05-22 10:49:48 +00:00
root dc9d7de60f feat: push notifications + PWA notifications UI
- VAPID keys generated for web push
- push_subscriptions, notifications, notification_preferences tables
- DB triggers: auto-notify on order status change, driver assignment
- Edge functions: send-push-notification, subscribe-push, unsubscribe-push
- Frontend: NotificationBell, NotificationSettings components
- usePushNotifications hook (subscribe/unsubscribe push)
- useNotifications hook (fetch + realtime + mark read)
- Service worker: push event handler + notification click
- AppShell: notification bell in header
- DashboardPage: wired notifications
- manifest.webmanifest: name updated to SuperSam
- Caddyfile: CSP allows wss:// + fcm push
2026-05-22 10:48:33 +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 140fbc8122 fix(logistics): pass group.id instead of group object to onSelectSet 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 496abc761b fix(delivery): simplify public choice flow 2026-05-14 21:10:27 +03:00
Codex fc74241378 fix(delivery): show invoice refs in client flow 2026-05-14 12:51:25 +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 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 e29a51e7ea Harden auth and delivery endpoints 2026-05-13 18:59:30 +03:00
Codex 5dcfa80940 Polish demo UI and delivery filters 2026-05-13 18:59:30 +03:00
root d44d944517 Add deployment config files and supabaseClient lock fix 2026-05-03 16:44:58 +00:00
Codex b3b8657b43 fix: merge saved delivery status into choice block 2026-04-16 19:34:57 +03:00
Codex a867bf5464 fix: remove duplicate saved choice block 2026-04-16 18:18:45 +03:00
Codex 5142ff30db fix: persist saved client delivery choice 2026-04-16 18:04:45 +03:00