Commit Graph

15 Commits

Author SHA1 Message Date
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 1d288279c0 fix: extractCity word boundary + filter persistence in sessionStorage 2026-07-03 14:07:13 +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 b78bdc48bb feat: drag-n-drop status sections + localStorage filters/collapsed + pickup date in logistics board
- Drag-n-drop reordering of status sections (desktop + touch)
- Section order saved in localStorage (logistics-section-order)
- Collapsed/expanded state saved in localStorage (logistics-collapsed)
- Filters (city, status, search) saved in localStorage (logistics-filters)
- Pickup date shown in delivery date column for self-pickup orders
- SMS campaign scripts (manual, second, paid_storage, timer manager)
- SmsCampaignStats + SmsStatusCard components
- DashboardPage: unified LogisticsReadinessBoard for all roles
- OrdersTable cleanup, StatusActionPanel updates
- SW v42
2026-07-01 16:16:22 +00:00
root 94f534ded3 fix: manual campaign no longer moves first_sms_sent groups to manual before second SMS is sent
Bug: sms_manual_campaign.py condition 2 caught first_sms_sent groups after 3h
WITHOUT checking if second SMS was already sent. This caused manual campaign
(5min timer) to move groups to manual_required before second campaign (10min timer)
could send the second SMS.

Fix: added second_sms_sent_at IS NOT NULL check to condition 2.
Now manual only moves groups where second SMS was already sent AND client
still didn't agree after 3 more hours.

Also restored 17 groups that were incorrectly moved to manual_required back
to first_sms_sent so second campaign can send their second SMS.
2026-06-30 15:27:56 +00:00
root 23c0ed78ef feat: drag-and-drop section ordering in LogisticsReadinessBoard + unified table visuals
- LogisticsReadinessBoard: @dnd-kit/sortable for drag-and-drop section reordering
  - Drag handle (6-dot grip icon) on left of each section header
  - Custom order persists in localStorage (key: logistics-section-order)
  - Default: agreed → manual_required → funnel order
  - Flat rows (no Button/rounded), matches OrdersTable style
  - 7 columns: Клиент | Город | Тип | Дата | Водитель | Статус | Обновлён
  - Horizontal scroll: overflow-x-auto + min-w-[1080px]
  - Type column wide enough for Самовывоз/Доставка in one line

- OrdersTable: widened Type column (minmax 70px→100px), min-w 920→1080px
  for consistent horizontal scroll across tables
2026-06-30 12:21:54 +00:00
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 174c74ec0b fix: DB host 10.0.4.5 (Docker internal IP) 2026-06-23 08:21:57 +00:00
root 05d4d86d37 feat: Python script replacing n8n first SMS campaign
- sms_first_campaign.py: full replacement for n8n workflow JnfZwOnpjEazseW5
- sms_campaign_log table: full audit trail in Supabase (visible in admin)
- sms_campaign_settings table: configurable by megaadmin (wait times, attempts, schedule)
- systemd service + timer (NOT activated, ready for deployment)
- Logic: send SMS → wait 25s → check status (102=in transit, 103=delivered)
  → retry check up to 90 min → retry SMS send up to 2 attempts → manual_required
- Telegram notifications after each send/delivery/failure
- Log file: /var/log/supersam-sms-first.log
2026-06-23 08:20:42 +00:00
root dda8f8fe1f feat: add stopWords to delivery invitation RPC response 2026-05-28 19:24:40 +00:00
Codex 1798e3acfd refactor: align delivery flow with 1c imports 2026-04-13 16:24:04 +03:00