refactor: align tariff builder with bot functionality

- Remove unused fields: custom_days, custom_traffic (bot doesn't use them)
- Add promo groups selection to tariff form
- Add API endpoint for fetching available promo groups
- Make traffic topup packages dynamic (add/remove any number)
- Fix stuck 0 in number inputs when clearing
- Add validation messages explaining why save button is blocked
- Match bot validation: name 2-50 chars, device_limit >= 1, tier_level 1-10
- Add missing i18n translations for new fields and validation errors
This commit is contained in:
c0mrade
2026-02-02 04:27:52 +03:00
parent 8cd95b84fb
commit d6edb659a3
6 changed files with 430 additions and 297 deletions

View File

@@ -1059,6 +1059,7 @@
"nameLabel": "套餐名称",
"nameExamplePeriod": "例如:标准",
"nameExampleDaily": "例如:日套餐",
"nameHint": "2到50个字符",
"descriptionLabel": "描述",
"trafficLimitLabel": "流量限制",
"gbUnit": "GB",
@@ -1074,8 +1075,12 @@
"addButton": "添加",
"noPeriodsHint": "没有添加的周期。请至少添加一个周期。",
"daysShort": "天",
"serversTitle": "服务器",
"serversTabHint": "选择此套餐上可用的服务器。",
"noServersAvailable": "没有可用的服务器",
"promoGroupsTitle": "促销组",
"promoGroupsHint": "选择可以访问此套餐的促销组。如果未选择任何组,则所有人都可以访问。",
"noPromoGroups": "没有促销组",
"extraDeviceTitle": "额外设备",
"devicePriceLabel": "设备价格30天",
"devicePriceHint": "0 = 无法购买设备",
@@ -1085,6 +1090,8 @@
"trafficMaxLimitLabel": "最大限制:",
"trafficLimitHint2": "0 = 无限制)",
"trafficPackagesLabel": "流量包:",
"addPackageTitle": "添加流量包",
"noPackagesHint": "没有添加流量包。请至少添加一个流量包。",
"gbPackageUnit": "GB",
"customDaysTitle": "自定义天数",
"customDaysDesc": "用户自行选择订阅期限",
@@ -1116,7 +1123,18 @@
"dailyPriceLabel": "每天价格",
"currencyPerDay": "₽/天",
"dailyDeductionDesc": "每天从用户余额中扣除",
"dailyPriceRequired": "请输入大于0的每日价格"
"dailyPriceRequired": "请输入大于0的每日价格",
"cannotSave": "无法保存套餐:",
"validation": {
"nameRequired": "请输入套餐名称",
"nameLength": "名称必须为2到50个字符",
"deviceLimitRequired": "请指定设备数量至少1个",
"tierLevelInvalid": "等级必须在1到10之间",
"fieldsRequired": "请填写必填字段(设备数、等级)",
"periodsRequired": "请添加至少一个期限",
"dailyPriceRequired": "请输入大于0的每日价格",
"trafficPackagesRequired": "请添加至少一个流量包(或关闭流量购买)"
}
},
"servers": {
"title": "服务器管理",