Commit Graph

243 Commits

Author SHA1 Message Date
root 1a60fe07e0 fix: backup-code-s3 retention bash comparison 2026-07-22 06:59:44 +00:00
root f67fe6432d feat: backup code to S3 after deploy
- scripts/backup-code-s3.sh — tar.gz (без node_modules/.git/dist) → S3
- deploy.sh: вызывает backup-code-s3.sh после деплоя
- Retention 30 дней, Beget Cloud Storage
- Также добавить в cron: 0 1 * * *
2026-07-22 06:58:15 +00:00
root 6c9e13d19a fix: SMS city profiles UI — контраст цветов, выравнивание
- bg-[var(--color-surface-strong)] вместо --color-bg внутри карточек
- Карточки профилей: --color-surface-strong, вложенные блоки: --color-surface
- Текст всегда var(--color-text) — виден в светлой и тёмной теме
- Toggle: компактнее (h-5 w-10)
- Выравнивание: flex-wrap, gap, border-t для разделения секций
- SMS ON/OFF badge вместо toggle в строке заголовка
2026-07-22 06:45:39 +00:00
root 484f9efcba feat: SMS city profiles — гибкая конфигурация SMS по городам
- DB: sms_city_profiles (delivery_mode, pickup_mode, second_sms_enabled, paid_storage_enabled, sms_enabled)
- Python first_sms: link mode (согласование) vs notification mode (без ссылки, без 2-й SMS)
- Python second_sms: проверка second_sms_enabled из профиля
- Python paid_storage: проверка paid_storage_enabled из профиля
- Frontend: SmsCityProfilesPanel — выбор режима, кастомный текст, toggle'ы
- Дефолты: Севастополь=link, Ялта=notification без ссылки
- Замена sms_city_rules на sms_city_profiles
2026-07-21 19:55:51 +00:00
root a4ac117b51 fix: paid_storage SMS — убрать фильтр по городам
- Убран sms_allowed_for_city из paid_storage скрипта
- Убрана paid_storage из UI (dropdown + labels)
- Описание обновлено: только 1-е и 2-е SMS
2026-07-21 19:08:22 +00:00
root e2dcf6db72 merge: server updates + sms city rules 2026-07-21 14:58:19 +00:00
root de4ecaad27 feat: SMS city rules — гибкое управление SMS по городам
- DB: sms_city_rules table + sms_allowed_for_city() function + RLS
- Python: фильтр sms_allowed_for_city в first_sms, second_sms, paid_storage
- Frontend: SmsCityRulesPanel — toggle on/off, период дат, комментарии
- Интеграция в SmsCampaignPanel как вкладка 'SMS по городам'
- Поддержка '*' (все города / все кампании)
2026-07-21 14:58:11 +00:00
root a3ffd0c030 sync from mkn8n 2026-07-16 12:43:02 +00:00
root 319761a24c merge: server fixes + suggestions voting 2026-07-16 12:42:31 +00:00
root 6ad969f297 merge: suggestions voting + logistician access from mkn8n 2026-07-16 12:40:43 +00:00
root efe98c09d4 feat: suggestions voting + logistician access
- Add suggestion_votes table (DB migration applied)
- Vote/unvote with optimistic UI update
- Sort suggestions by vote_count desc, then created_at desc
- Add 'Предложения' tab to logistician role
- Vote button shows count, highlighted when voted
2026-07-16 12:30:14 +00:00
root 0f38ce0095 fix: normalizeDateForInput парсит dd.MM.yyyy + customerDate fallback для логистов 2026-07-14 18:52:02 +00:00
root 3b93e755fb fix: логисты могут ставить Доставлено без части дня + дублирующий индекс удалён 2026-07-14 18:48:03 +00:00
root 48e238e634 fix: логисты могут ставить прошедшие даты + dedup триггер 2026-07-14 18:00:35 +00:00
root 052e5e7e86 fix: calendar overlap + allow past dates for logistician
1. CalendarWidget: add relative to calendar container so absolute popup
   positions correctly (no more overlapping with other elements)
2. OrderDetailPanel: logistician/admin/manager can select past dates
   (3 months back) for retroactive delivery closing
3. canGoBack always true for logistician — can navigate to past months
4. Existing past delivery dates are preserved (not reset to tomorrow)
2026-07-13 14:42:36 +00:00
root c86e0e1ea6 fix: SMS labels — clarify delivered means SMS delivered to phone, not goods
1-е SMS: «✓ доставлено» → «✓ получено клиентом»
2-е SMS: added «✓ получено клиентом»
«ждём подтверждения» → «ждём ответ оператора»
2026-07-13 14:32:19 +00:00
root 5818b94bbe fix: remove duplicate status displays
1. Remove delivery status from info grid (already shown as Badge in header)
2. Remove SMS notification Badge from SmsStatusCard header (timeline shows it)
3. Remove inline hint on blocked buttons — keep only warning banner below
2026-07-13 14:21:57 +00:00
root 9cf7cfbdf4 fix: unique Traefik middleware name for HTTP->HTTPS redirect
Previous redirect-to-https middleware name conflicted with other
containers (n8n, gitea), causing HTTP router to fail with 404 instead
of redirecting to HTTPS. Renamed to supersam-redirect.
2026-07-13 13:53:20 +00:00
root b2dc1a3310 fix: restore filter persistence in LogisticsReadinessBoard
Filters (query, displayStatus, city, deliveryType, dateFrom/To) now
persist to localStorage and restore on page reload.
2026-07-13 13:38:46 +00:00
root 755385cf0e fix: StatusActionPanel smart hints + driver name lookup + logistician can edit shipment + completed label
1. StatusActionPanel: all buttons clickable (no more manual:false blocking)
   - Click on current status shows actual state: "Водитель уже назначен: Иван"
   - "Назначен водитель" clickable even if already assigned
   - "Согласовано" clickable even if already agreed
2. Status indicators: green badges ✓ Дата согласована / ✓ Водитель: имя
   + warning badges if missing
3. DriverAssignmentPanel: look up driver name from drivers list if
   assignedDriverName is empty (Supabase join failed)
4. DriverShipmentPanel: now visible to logistician/admin too — can edit
   shipment data (fix wrong driver checkboxes)
5. SmsStatusCard: add completed label ("Завершено")
2026-07-13 13:16:48 +00:00
root 17f93a65ae fix: logistics UI — problem badge overlap, driver name, SMS labels, shipment report
1. LogisticsReadinessBoard: problem badge on separate line (no overlap)
2. DriverAssignmentPanel: show "Водитель назначен" instead of "Неизвестно"
   when driver name not resolved from join
3. SmsStatusCard: "confirmed" label = "Клиент согласовал дату" (not "Согласовано")
4. StatusActionPanel: when currentStatus=problem, all status buttons clickable
   (logistician can resolve problem by setting any status)
5. DriverShipmentReport: show ALL items — green check for delivered,
   red cross for not delivered, with reason comments
2026-07-13 13:07:03 +00:00
root 1ffd8bacc5 fix: block Доставлено/Вывезено without delivery date+half-day, remove Загружено from logistic panel
- StatusActionPanel: removed Загружено button
- StatusActionPanel: Доставлено/Вывезено require deliveryDate + half-day
- StatusActionPanel: warning banner when schedule missing
- Driver status panel in OrderDetailPanel: same schedule check
- Blocked buttons shown dimmed (opacity-40)
2026-07-13 12:02:25 +00:00
root fbfcb71d61 fix: driver delivery UX — remove Загружено status, fix checkbox reset, fix confirmed label
1. Remove "Загружено" status from driver workflow — driver goes directly
   Назначен водитель → Доставлено (or Проблема)
2. Driver can undo "Доставлено" → "Вернуть в работу" (back to Назначен водитель)
3. Fix checkbox reset: shippedItems only resets when order ID changes,
   not on every order data refetch — driver can toggle items freely
4. Fix "confirmed" showing in SMS status card — add Russian label
5. onResetStatus resets to driver_assigned, not loaded
6. ShipmentPanel "Сбросить" works for all active statuses
2026-07-13 11:51:56 +00:00
root 1766ccb897 fix: driver planner uses fs-zone-table not fs-zone-card
User changes "Таблицы" slider in Settings → expects table text to scale.
DriverDeliveryPlanner was wrapped in fs-zone-card (responds to "Карточки"),
not fs-zone-table (responds to "Таблицы").
2026-07-13 11:35:52 +00:00
root edb6784c16 fix: remove duplicate fmtTime declaration in OrderDetailPanel 2026-07-13 11:26:31 +00:00
root 0821bcc747 merge: dev → main — driver table layout, filters, status reset, SMS campaigns, font zones
Merges dev branch into main:
- Driver delivery list: table layout (№, Client, Phone, City, Half-day)
- Driver filters: search, half-day filter, problem sorting
- DriverShipmentPanel: reset status with confirmation
- SmsCampaignPanel: campaigns refactor
- LogisticsReadinessBoard: unified table view
- Font zone classes (fs-zone-card) on all driver components
- SMS campaign scripts updates
2026-07-13 11:24:56 +00:00
root 6c7d83c2be fix: add fs-zone-card to driver components so font size settings apply
Driver components (DriverDeliveryPlanner, DriverShipmentPanel,
DriverDeliveryDetail) were missing fs-zone-card class wrappers.
Font size settings from SettingsPage saved to localStorage correctly
but never applied to driver UI because fontSettings.css only
overrides Tailwind text-* classes inside .fs-zone-* wrappers.
2026-07-13 06:58:49 +00:00
root 112147cb0a fix: driver delivery list — table layout with columns: № | Client | Phone | City | Half-day
Replaced card-style delivery items with proper table:
- № счёта (order numbers, accent color)
- Клиент (customer name)
- Телефон (tel: link, clickable)
- Город (extracted from address)
- Часть дня (delivery half-day)
Problem rows highlighted with red tint + ⚠ icon
2026-07-10 15:15:16 +00:00
root ced5958eac feat: driver filters + status fixes + logistics problem indicator
DriverDeliveryPlanner:
- Text search (name, address, phone, order numbers)
- Half-day filter (morning/afternoon/unknown)
- 'Reset all filters' button
- tel: link on phone in delivery cards
- Order numbers badges in cards
- Partial delivery warning badge
- Problems-first sorting

saveShipmentData fix:
- Partial shipment with problems → status 'problem' (not 'delivered')
- Full shipment → 'delivered' (unchanged)

DriverShipmentPanel:
- Reset button: confirmation dialog when status is final
- Calls onResetStatus to revert delivery status to 'loaded'

OrderDetailPanel (driver status section):
- 'Return to work' button for delivered/problem/picked_up statuses
- Passes onResetStatus + isSavingStatusChange to DriverShipmentPanel

LogisticsReadinessBoard:
- Warning badge for has_delivery_problem groups in table rows
- Shows delivery_problem_note as tooltip
2026-07-10 14:50:15 +00:00
root e7365b6c0c fix(analytics): remove 1С import category, bypassed_completed covers all no-date completions 2026-07-06 15:00:41 +00:00
root 14a3006918 fix(analytics): funnel shows real order path with bypass detection 2026-07-06 13:47:02 +00:00
root a695a73af7 fix(analytics): rewrite funnel as real order path
- SQL admin_automation_economics: new columns based on actual order lifecycle
  - sms_sent: got at least 1 SMS
  - completed_auto: delivered/picked_up without manual_confirmation_at
  - completed_manual: delivered/picked_up with manual_confirmation_at
  - stuck_in_manual: manual_required + still waiting
  - no_sms_completed: imported as already delivered
- Funnel steps: Всего → SMS → Авто-завершено → Завершено вручную → Застряло → Без SMS → Хранение → Отменено
- Footer: Автоматизация % / Ручное вмешательство % / Завершено всего
- Fixes: old funnel counted manual_confirmation_required as "согласовано"
  and missed 31 completed orders (notification_status=completed vs confirmed)
2026-07-06 13:16:44 +00:00
root b0bc056090 fix(analytics): separate Вывезено (status) from Самовывоз (type) in KPI
- KPI: Вывезено = picked_up (all types), Самовывоз = pickup type only
- SQL admin_delivery_stats: + picked_up_delivery, picked_up_pickup columns
- Fixes confusion: 17 picked_up vs 5 pickup type were different metrics
2026-07-06 10:20:55 +00:00
root eba1769078 redesign(analytics): dashboard desktop layout + pickup period label
- 12-col responsive grid: pie 4/8 trend, table 4/8 drivers
- KPI cards: 7 metrics with uppercase labels, larger values
- Period label in every section subtitle (за 7 дней, etc)
- PickupStatsPanel: period label, status breakdown (завершено/ожидает/ручное)
- PickupStatsPanel: hide empty schedule bars when no planned pickups
- SQL admin_pickup_stats: + picked_up, pending, manual columns
- Colors: delivered #22c55e, picked_up #14b8a6 (distinct)
- Desktop: 3-col grid inside pickup panel
2026-07-06 10:09:11 +00:00
root 1b9fea7f1d fix(analytics): picked_up as separate status in dashboard
- KPI: separate Доставлено and Вывезено cards
- Trend: separate line for Вывезено (#14b8a6)
- Driver chart: separate bar for Вывезено
- SQL: admin_delivery_stats returns picked_up column
- SQL: admin_daily_trend returns picked_up column
- SQL: admin_driver_stats returns picked_up column
- delivery_rate = (delivered + picked_up) / total
- Colors: delivered #22c55e, picked_up #14b8a6 (distinct)
2026-07-06 06:42:31 +00:00
root 6786779f2c fix(analytics): recognize picked_up status in dashboard and stats
- Add picked_up to STATUS_COLORS and STATUS_LABELS in AdminDashboard
- SQL: admin_delivery_stats counts picked_up as delivered
- SQL: admin_daily_trend counts picked_up as delivered
- SQL: admin_driver_stats counts picked_up as delivered
- Fixes: picked_up showed as Unknown, delivered count was 17 short
2026-07-06 06:17:32 +00:00
root eabf30bceb fix: stop SMS UI for terminal delivery statuses (picked_up/delivered/cancelled)
- SmsStatusCard: show "SMS не отправляется" when delivery is terminal, hide countdown + restart buttons
- SmsCampaignPanel fmtAgreement: check terminal status FIRST → " Самовывоз завершён" instead of "Самовывоз (неполно)"
- update_delivery_status RPC: reset notification_status→completed on terminal transition
- Add completed to notification_status check constraint
- SW v60→v61
2026-07-04 11:27:03 +00:00
root 43d9116c51 fix: restore localStorage filter persistence in LogisticsReadinessBoard, SW v60 2026-07-03 15:04:05 +00:00
root 468c3c4097 fix: sessionStorage→localStorage for filter persistence, SW v59 2026-07-03 14:14:00 +00:00
root 1d288279c0 fix: extractCity word boundary + filter persistence in sessionStorage 2026-07-03 14:07:13 +00:00
root 8ade6a6ff3 fix: fallback fresh slots when all availableSlots passed + SW v57 2026-07-03 13:37:42 +00:00
root a74a5242b8 fix: use current date for slot availability + SW v56 2026-07-03 13:32:24 +00:00
root e93215f837 feat: SMS filter no_sms in queue + SW v55 2026-07-03 13:26:13 +00:00
root 6a34f36621 SW v54 — business schedule 2026-07-03 12:45:26 +00:00
root d397d0cb24 feat: configurable business schedule (delivery/pickup/SMS days)
- New table business_schedule_settings (delivery_days, pickup_days, sms_days)
- RPC get_business_schedule() (public) + update_business_schedule() (admin)
- Admin UI: BusinessSchedulePanel with day pills for each category
- ClientDeliveryPage: fetches schedule, replaces hardcoded Sunday/weekend checks
- PickupSlotsPicker: uses pickupDays prop instead of hardcoded isWeekend
- Edge function confirm-delivery-choice: reads delivery_days from DB
- delivery-invitations.ts: buildDefaultDatedAvailableSlots reads delivery_days
- RPC confirm_delivery_choice_by_token: checks delivery_days instead of extract(dow)=0
- SMS scripts: get_sms_days() reads sms_days from business_schedule_settings
  and overrides per-campaign work_days setting
- Nav item Расписание for mega_admin and admin roles
- Default: Mon-Fri (1,2,3,4,5) for all three categories
2026-07-03 12:45:02 +00:00
root d4d85bc767 fix: normalize_phone handles +7, 8, text, and multi-number fields
- Two numbers in one field (XXX / YYY) → take first 10 digits
- Text in field (Екатерина +7978...) → extract digits only
- 8 prefix → 7 (Russian landline style)
- 10 digits (no country code) → prepend 7
- All 4 SMS scripts patched (first, second, paid_storage)
2026-07-03 12:33:53 +00:00
root e55a4cafcc fix: manual_campaign EXISTS check — no manual_required without SMS sent
Scenario 3 (link_ready + next_check expired) now requires EXISTS
in sms_campaign_log. Prevents groups from being moved to
manual_required before first SMS is ever sent.
2026-07-03 12:18:28 +00:00
root c1e5f109be docs: SMS campaigns architecture + font settings + stale highlight 2026-07-02 14:37:58 +00:00
root 20873bdc5f fix: font zones + stale highlight + fmtTime + SW v49
- FontSettingsContext: body zone first in CSS (specific zones win)
- Arbitrary px sizes (10-14px) overrides in table/card zones
- fs-zone-table on OrdersTable + LogisticsReadinessBoard
- fs-zone-body/heading/nav in AppShell + const navigate = useNavigate()
- Stale delivery highlight: isStale() 24h + bg tint, isLinkOpened 👁
- fmtTime defined in OrderDetailPanel (was used but never declared)
- SmsStatusCard synced from prod
- SW v49 (fixed: addEventListener was broken by sed)
2026-07-02 14:25:40 +00:00
root f69a52779f fix: font zone classes on tables + body/heading/nav zones in AppShell
- fs-zone-table on OrdersTable + LogisticsReadinessBoard (was missing)
- fs-zone-body on main content area
- fs-zone-heading on mobile + desktop headers
- fs-zone-nav on mobile tab nav
- CSS: added arbitrary px size overrides (10px/11px/12px/13px/14px)
- CSS: reordered body zone last so table/card/nav/heading win at equal specificity
2026-07-02 13:19:10 +00:00