diff --git a/src/components/SmsNegativeBalanceModal.vue b/src/components/SmsNegativeBalanceModal.vue index dd3b8f7..7c46393 100644 --- a/src/components/SmsNegativeBalanceModal.vue +++ b/src/components/SmsNegativeBalanceModal.vue @@ -41,9 +41,6 @@ function formatNumber(value: number) {

موجودی کیف پول پیامک منفی است

-

- تا زمان شارژ و مثبت شدن موجودی، این هشدار با هر بار ورود به صفحات ادمین نمایش داده می‌شود. -

diff --git a/src/components/SubscriptionExpiryHost.vue b/src/components/SubscriptionExpiryHost.vue new file mode 100644 index 0000000..0f2003a --- /dev/null +++ b/src/components/SubscriptionExpiryHost.vue @@ -0,0 +1,90 @@ + + + diff --git a/src/components/SubscriptionExpiryModal.vue b/src/components/SubscriptionExpiryModal.vue new file mode 100644 index 0000000..0e9194f --- /dev/null +++ b/src/components/SubscriptionExpiryModal.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/config-loader.js b/src/config-loader.js index 88364d0..27b6667 100644 --- a/src/config-loader.js +++ b/src/config-loader.js @@ -367,8 +367,7 @@ '
' + '
' + '
⚠️
' + - '

خطا در برقراری ارتباط با سرور

' + - '

لطفاً چند لحظه دیگر دوباره تلاش کنید.

' + + '

خطا در برقراری ارتباط با سرور

' + '' + '
'; } diff --git a/src/core/layouts/BasicLayout.vue b/src/core/layouts/BasicLayout.vue index 75fdf99..038058a 100644 --- a/src/core/layouts/BasicLayout.vue +++ b/src/core/layouts/BasicLayout.vue @@ -91,6 +91,7 @@ + @@ -104,6 +105,7 @@ import BaseSettings from '@core/layouts/BaseSettings.vue' import BasicMobileHeader from '@/components/BasicMobileHeader.vue' import BasicMobileBottomNav from '@/components/BasicMobileBottomNav.vue' import SmsNegativeBalanceHost from '@/components/SmsNegativeBalanceHost.vue' +import SubscriptionExpiryHost from '@/components/SubscriptionExpiryHost.vue' const { prefixCls } = usePrefix('basic-layout') const layoutStore = useLayoutStore() diff --git a/src/pages/menuPages/smsPanel/index.vue b/src/pages/menuPages/smsPanel/index.vue index 7fda7ef..45a7a3a 100644 --- a/src/pages/menuPages/smsPanel/index.vue +++ b/src/pages/menuPages/smsPanel/index.vue @@ -319,7 +319,7 @@ />

- در حالت مسدود، هیچ پیامکی از این نسخه ارسال نمی‌شود. + در حالت مسدود، ارسال پیامک متوقف می‌شود.

diff --git a/src/store/smsWalletStore.ts b/src/store/smsWalletStore.ts index 357e328..8dd7fa3 100644 --- a/src/store/smsWalletStore.ts +++ b/src/store/smsWalletStore.ts @@ -10,6 +10,32 @@ const EMPTY_DEPOSIT: SmsDepositInfo = { note: '' } +const NEGATIVE_WARNING_SESSION_KEY = 'khanegi_admin_sms_negative_warning_shown' + +function wasNegativeWarningShownThisSession() { + try { + return sessionStorage.getItem(NEGATIVE_WARNING_SESSION_KEY) === '1' + } catch { + return false + } +} + +function markNegativeWarningShownThisSession() { + try { + sessionStorage.setItem(NEGATIVE_WARNING_SESSION_KEY, '1') + } catch { + // ignore storage failures + } +} + +function clearNegativeWarningShownThisSession() { + try { + sessionStorage.removeItem(NEGATIVE_WARNING_SESSION_KEY) + } catch { + // ignore storage failures + } +} + /** وضعیت کیف پول پیامک برای نمایش «اعتبار پیامک» در هدر (همه ادمین‌ها). */ export const useSmsWalletStore = defineStore('smsWallet', () => { const userStore = useUserStore() @@ -19,7 +45,7 @@ export const useSmsWalletStore = defineStore('smsWallet', () => { const deposit = ref({ ...EMPTY_DEPOSIT }) const loaded = ref(false) const loading = ref(false) - /** هشدار موجودی منفی — با هر refresh اگر هنوز منفی باشد دوباره باز می‌شود */ + /** هشدار موجودی منفی — فقط یک‌بار در هر باز شدن نشست ادمین */ const negativeWarningVisible = ref(false) /** ویجت فقط وقتی billing/پنل پیامک فعال است نمایش داده می‌شود. */ @@ -40,7 +66,16 @@ export const useSmsWalletStore = defineStore('smsWallet', () => { isBlocked.value = res.is_blocked deposit.value = res.deposit ?? { ...EMPTY_DEPOSIT } loaded.value = true - negativeWarningVisible.value = res.balance < 0 + + if (res.balance >= 0) { + negativeWarningVisible.value = false + clearNegativeWarningShownThisSession() + } else if (!wasNegativeWarningShownThisSession()) { + negativeWarningVisible.value = true + markNegativeWarningShownThisSession() + } else { + negativeWarningVisible.value = false + } } catch { // خطای موجودی نباید مزاحم کاربر شود؛ ویجت در صورت نبود داده مخفی می‌ماند } finally { @@ -50,6 +85,7 @@ export const useSmsWalletStore = defineStore('smsWallet', () => { function dismissNegativeWarning() { negativeWarningVisible.value = false + markNegativeWarningShownThisSession() } return { diff --git a/src/utils/serverUnavailable.ts b/src/utils/serverUnavailable.ts index 80ed6cf..3354560 100644 --- a/src/utils/serverUnavailable.ts +++ b/src/utils/serverUnavailable.ts @@ -27,10 +27,7 @@ export function showServerUnavailableOverlay(message = MESSAGE) {
⚠️
-

${message}

-

- لطفاً چند لحظه دیگر دوباره تلاش کنید. -

+

${message}