- 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 по городам'
- Поддержка '*' (все города / все кампании)
- 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
- 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
- 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)
- 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
- 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