main
New leads entity (own numbering VTH{yy}-{seq}, 2-stage funnel, converts
into inquiries) sitting ahead of the existing Request/Order pipeline.
Request funnel expanded from 4 to 6 statuses (kp_preparation -> kp_response
-> negotiation -> signing -> converted/declined) and Order funnel from 4
to 11 (new -> ... -> completed/declined), matching the stage names/fields/
decline-reasons from the flowcharts. Decline now always requires a reason
(+ free-text detail for "other"), reused across all three entities via one
DeclineWithReason component. Added shared deal-reference fields (Incoterms,
payment terms, carrier1-3, insurance company, customs broker) to both
inquiries and orders, carried over on conversion. Added a minimal outbound
SMTP capability (reusing the existing mailbox credentials) so order
status changes can best-effort email the client, matching the stages the
diagrams call out. Per-stage informational panels (requirements + transition
criteria) shown on each entity's detail page — structure only, no SLA-timer
automation yet (explicitly deferred, per this session's scoping).
Fixed a drizzle-kit migration-generation bug by hand: the generated
INSERT...SELECT for the inquiries table rebuild referenced brand-new
columns on the pre-migration source table, which don't exist there yet.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gh2UXUQUVBWroWEnn1FLFG
Thunderbird Portal (THBD)
Единый портал THBD: запросы → ставки подрядчиков → заявки → документы →
слежение → финансы → отчёты. Дубликат elmi-portal, адаптированный под
другую компанию — та же архитектура и функциональность.
Стек: Next.js (App Router) + TypeScript, Drizzle ORM + better-sqlite3 (WAL),
Docker/docker-compose — тот же проверенный стек, что и в соседнем top-tickets.
Разработка
cp .env.example .env # заполнить ADMIN_BOOTSTRAP_PASSWORD
npm install
npm run db:migrate
npm run dev
Прод (Docker)
cp .env.example .env # заполнить ADMIN_BOOTSTRAP_PASSWORD
docker compose build
docker compose up -d
Приложение слушает порт 8088 (см. docker-compose.yml, PORT/DATA_DIR).
Роли
- admin — полный доступ, справочники, пользователи, шаблоны документов.
- manager — свои запросы/заявки/слежение.
- accountant — заявки (просмотр), финансы (к оплате/к получению), отчёты.
- client — только страница слежения по токену (
/t/[token]), без входа.
Известные ограничения MVP (см. план — Фаза 2/3)
- Шаблоны документов (
templates-seed/) — пусто на старте (в отличие от elmi-portal, откуда это скопировано). Загрузить .docx компании можно в Настройки → Шаблоны. - Нет email→запрос авто-парсинга (Claude API) и интеграции со СБИС/ЭДО.
- Известный интермиттентный флейк при сборке образа:
SQLITE_BUSYво время параллельного сбора данных страниц Turbopack'ом — при сбое просто повторитьdocker compose build(1–3 раза), как и вtop-tickets.
Languages
TypeScript
98.1%
CSS
1.4%
JavaScript
0.4%
Dockerfile
0.1%