Bill SMS in credits and add IRT top-up in Super Admin.
Show credit balance in business settings; Super Admin tops up by IRT (adds credits) and tracks SMS sent per business. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
a8676854fb
commit
6bc57f26ed
@@ -8,7 +8,6 @@ import { Tooltip } from './Tooltip'
|
||||
import { useToast } from '../context/ToastContext'
|
||||
import { useT } from '../i18n/useT'
|
||||
import { ApiError, isAbortError } from '../lib/api'
|
||||
import { formatIrtPrice } from '../utils/irtPrice'
|
||||
import {
|
||||
createSmsTemplate,
|
||||
deleteSmsTemplate,
|
||||
@@ -26,7 +25,7 @@ import settingsStyles from '../pages/SettingsPage.module.css'
|
||||
import modalStyles from './VariationsModal.module.css'
|
||||
|
||||
const SMS_TEMPLATE_VARS = ['{{user.name}}', '{{user.lastname}}', '{{user.title}}'] as const
|
||||
const LOW_BALANCE_IRT = 200_000
|
||||
const LOW_BALANCE_CREDITS = 400
|
||||
const ANIMATION_MS = 220
|
||||
const MAX_BODY_LEN = 700
|
||||
|
||||
@@ -131,7 +130,7 @@ export function SmsSettingsSection() {
|
||||
}, [listMounted, editorMounted, editorOpen, listOpen, submitting, removeTarget])
|
||||
|
||||
const verifiedCount = templates.filter((item) => item.isVerified).length
|
||||
const isLowBalance = balance < LOW_BALANCE_IRT
|
||||
const isLowBalance = balance < LOW_BALANCE_CREDITS
|
||||
|
||||
function openCreate() {
|
||||
setEditing(null)
|
||||
@@ -265,7 +264,11 @@ export function SmsSettingsSection() {
|
||||
>
|
||||
<span className={settingsStyles.smsCreditLabel}>{t('settings.sms.balance')}</span>
|
||||
<strong className={settingsStyles.smsCreditValue}>
|
||||
{loading ? '…' : formatIrtPrice(balance)}
|
||||
{loading
|
||||
? '…'
|
||||
: t('settings.sms.balanceValue', {
|
||||
count: balance.toLocaleString(isFa ? 'fa-IR' : 'en-US'),
|
||||
})}
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user