fix: show fallback when tariff has no available periods for renewal

When all periods are removed from a tariff, users saw an empty
purchase form with no way to renew. Now shows a message explaining
the situation and a button to choose a different tariff.
This commit is contained in:
Fringg
2026-03-10 01:27:36 +03:00
parent 4ac3792971
commit ea06ad1d8f
5 changed files with 39 additions and 0 deletions

View File

@@ -346,6 +346,9 @@
"daysBeforeExpiry_one": "{{count}} day before expiry",
"daysBeforeExpiry_other": "{{count}} days before expiry",
"selectPeriod": "Select Period",
"noPeriodsAvailable": "No available periods for renewal",
"noPeriodsAvailableHint": "The administrator has changed this plan's settings. Please choose a different plan to renew your subscription.",
"chooseDifferentTariff": "Choose a different plan",
"selectTraffic": "Select Traffic",
"selectServers": "Select Servers",
"selectDevices": "Devices",

View File

@@ -297,6 +297,9 @@
"daysBeforeExpiry": "روز قبل از انقضا",
"daysBeforeExpiry_other": "{{count}} روز قبل از انقضا",
"selectPeriod": "انتخاب دوره",
"noPeriodsAvailable": "دوره‌ای برای تمدید موجود نیست",
"noPeriodsAvailableHint": "مدیر تنظیمات این طرح را تغییر داده است. لطفاً طرح دیگری را برای تمدید اشتراک خود انتخاب کنید.",
"chooseDifferentTariff": "انتخاب طرح دیگر",
"selectTraffic": "انتخاب ترافیک",
"selectServers": "انتخاب سرورها",
"selectDevices": "انتخاب دستگاه‌ها",

View File

@@ -365,6 +365,9 @@
"daysBeforeExpiry_few": "{{count}} дня до окончания",
"daysBeforeExpiry_many": "{{count}} дней до окончания",
"selectPeriod": "Выберите период",
"noPeriodsAvailable": "Нет доступных периодов для продления",
"noPeriodsAvailableHint": "Администратор изменил настройки этого тарифа. Выберите другой тариф для продления подписки.",
"chooseDifferentTariff": "Выбрать другой тариф",
"selectTraffic": "Выберите трафик",
"selectServers": "Выберите серверы",
"selectDevices": "Устройства",

View File

@@ -297,6 +297,9 @@
"daysBeforeExpiry": "到期前天数",
"daysBeforeExpiry_other": "到期前 {{count}} 天",
"selectPeriod": "选择时长",
"noPeriodsAvailable": "没有可用的续订周期",
"noPeriodsAvailableHint": "管理员已更改此套餐的设置。请选择其他套餐续订您的订阅。",
"chooseDifferentTariff": "选择其他套餐",
"selectTraffic": "选择流量",
"selectServers": "选择服务器",
"selectDevices": "选择设备",

View File

@@ -1123,6 +1123,33 @@ export default function SubscriptionPurchase() {
</div>
)}
{/* No periods available fallback */}
{selectedTariff.periods.length === 0 &&
!useCustomDays &&
!(
selectedTariff.custom_days_enabled &&
(selectedTariff.price_per_day_kopeks ?? 0) > 0
) && (
<div className="rounded-xl border border-amber-500/30 bg-amber-500/10 p-4 text-center">
<div className="mb-2 text-sm font-medium text-amber-400">
{t('subscription.noPeriodsAvailable')}
</div>
<div className="text-xs text-dark-400">
{t('subscription.noPeriodsAvailableHint')}
</div>
<button
onClick={() => {
setShowTariffPurchase(false);
setSelectedTariff(null);
setSelectedTariffPeriod(null);
}}
className="btn-secondary mt-3 px-4 py-2 text-sm"
>
{t('subscription.chooseDifferentTariff')}
</button>
</div>
)}
{/* Custom days option */}
{selectedTariff.custom_days_enabled &&
(selectedTariff.price_per_day_kopeks ?? 0) > 0 && (