- CRM: configurable pipeline (default: New → Contact → Meeting → Negotiation →
Connected / Lost), drag-and-drop board, lead card with call/meeting/note history,
photos and files, tasks with Telegram reminders at the due time, map of venues
(OpenStreetMap via Leaflet), lost reason. Sales reps see only their own leads.
- "Connected" in one click: a venue becomes a club card partner with a one-time
owner link to the work bot; an agency gets a code and a client link. The sales rep
is recorded on the partner for the bonus.
- Sales bonus formula in settings (per venue, per agency, % of revenue from the
rep's agency clients for N months); defaults are 0 until the owner sets them.
- Agencies (superadmin): clients, gift subscriptions, reward by month, payouts,
client link, edit. Venues: offers by membership level (5 languages), staff,
card checks, 8-week activity, owner link, map point.
- Schema: SalesStage/SalesLead/SalesActivity/SalesTask; salesId on Agency and
Partner; lat/lng/phone/note on Partner; agencyId on Payout.
- Tests for stage rules, conversion, task reminders and bonus; dev:crm-demo.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Provider messages store the order that was current when they wrote: a started
order first, otherwise the nearest assigned one within -4h..+12h; none — "no order".
- Admin chat: order tag above each provider message, "now / next" order strip in
the conversation header, order number (or "no order") in the thread list.
- Telegram notification to the team gets an order line or "no current order".
- Test for the order-picking rule; demo shows both cases.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- ChatThread per client/provider and channel; messages get files, internal notes,
source (bot/mini app) and delivery errors; reply templates. Migration moves old
concierge messages into threads.
- Routing: subscribers write to the concierge, others to support; /support and
/concierge in the client bot; staff can take, transfer, close and move threads.
- Telegram: photos/documents from clients and providers, replies with the channel
header, files sent from storage, notifications only to the assignee or the
channel's staff, "Reply" into a specific thread.
- New admin: /chats with list, conversation, notes, files, templates, client panel;
"Message" button on the client card; dashboard counts threads awaiting reply.
- Client mini app: in-app chat screen sharing the same conversation.
- Old admin keeps working on the same data (notes hidden there).
- Tests for routing, notes, assign/close/move, lists, recipients; separate test DB
via TEST_DB_NAME; dev:chats-demo script.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>