Add SMS templates UI, prepaid balance settings, and list filter layout.

Business settings manage templates and balance; Super Admin verifies templates and tops up via SMS settings; filters use a separate panel with even field gaps.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-08 16:24:26 +03:30
co-authored by Cursor
parent 8f0b4cef85
commit 0eb19bbebd
27 changed files with 2324 additions and 527 deletions
+12 -3
View File
@@ -315,9 +315,18 @@ Products accept optional `brandId` on create/update.
- `GET /businesses/:businessId/customers/search` — autocomplete for order cart
- `GET /businesses/:businessId/customers/export` — Excel (.xlsx) of business customers (`phone`, `first_name`, `last_name`)
- `POST /businesses/:businessId/customers/import` — Excel import for SMS lists; only `phone` required; new users get a random password hash (OTP login still works); existing users are linked; already-linked / staff rows skipped
- `POST /businesses/:businessId/customers/:userId/sms` — single SMS via Gama **SendQuick**; uses `settings.sms.senderNumber` or advertising shortcode `5000990009`
- `POST /businesses/:businessId/customers/sms` — bulk SMS via Gama **SendBulk** (`destinations[]`); body `{ message, userIds? }` — empty/omitted `userIds` → all enabled customers; selected ids → those recipients
- Super Admin business edit: optional **SMS sender number** stored in `businesses.settings.sms.senderNumber`
- `POST /businesses/:businessId/customers/:userId/sms` — single SMS via Gama **SendQuick**; body `{ message, templateId? }`
- `POST /businesses/:businessId/customers/sms` — bulk SMS via Gama **SendBulk** (or per-recipient when template/vars); body `{ message, userIds?, templateId? }` — empty/omitted `userIds` → all enabled customers
- Free-text SMS source: `settings.sms.senderNumber` (Super Admin only) or advertising shortcode `9000590009`
- Verified SMS template → service shortcode `5000110005` (fixed); unverified template → `9000590009`
- Per-business prepaid `businesses.sms_balance` (IRT) — all Meshkee SMS (OTP login/forgot-password, customer SMS, partner/public SMS for linked domains) costs **400 IRT per 64 characters** per recipient (`ceil(len/64)*400`). Insufficient balance blocks send.
- New businesses created in Super Admin start with **500,000 IRT** SMS balance
- External domains (no Meshkee website) still bill via their business row once the domain is linked
- Business Settings → **SMS settings**: balance (read-only) + template CRUD
- Super Admin business overflow → **SMS settings** modal: sender number + SMS balance top-up
- Super Admin → **SMS Templates** (`/sms-templates`): verify / unverify
- Online payment gateways live under **Website → Settings** (not main Settings)
- Template vars: `{{user.name}}`, `{{user.lastname}}`, `{{user.title}}`
### Orders
- `GET/POST/PATCH/DELETE /businesses/:businessId/orders`