mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix(payment-methods): admin display_name/description override locale on balance
White-label (per-method display_name + description in admin) was defeated on balance/top-up pages: render used `translatedName || method.name` and `translatedDesc || method.description`, so the bundled locale always won and the admin override was ignored. - Flip priority: admin-configured value first, locale as fallback (TopUpMethodSelect, Balance) - Add missing Description field to payment-method edit page (mirrors Display name: description / reset_description) - Add description to admin PaymentMethodConfig type - Add description/descriptionHint i18n keys (ru, en)
This commit is contained in:
@@ -232,6 +232,7 @@ export default function AdminPaymentMethodEdit() {
|
||||
// Local state for editing
|
||||
const [isEnabled, setIsEnabled] = useState(false);
|
||||
const [customName, setCustomName] = useState('');
|
||||
const [customDesc, setCustomDesc] = useState('');
|
||||
const [subOptions, setSubOptions] = useState<Record<string, boolean>>({});
|
||||
const [minAmount, setMinAmount] = useState<number | ''>('');
|
||||
const [maxAmount, setMaxAmount] = useState<number | ''>('');
|
||||
@@ -249,6 +250,7 @@ export default function AdminPaymentMethodEdit() {
|
||||
if (config) {
|
||||
setIsEnabled(config.is_enabled);
|
||||
setCustomName(config.display_name || '');
|
||||
setCustomDesc(config.description || '');
|
||||
setSubOptions(config.sub_options || {});
|
||||
setMinAmount(config.min_amount_kopeks ?? '');
|
||||
setMaxAmount(config.max_amount_kopeks ?? '');
|
||||
@@ -290,6 +292,13 @@ export default function AdminPaymentMethodEdit() {
|
||||
data.reset_display_name = true;
|
||||
}
|
||||
|
||||
// Description
|
||||
if (customDesc.trim()) {
|
||||
data.description = customDesc.trim();
|
||||
} else {
|
||||
data.reset_description = true;
|
||||
}
|
||||
|
||||
// Sub-options
|
||||
if (config.available_sub_options) {
|
||||
data.sub_options = subOptions;
|
||||
@@ -478,6 +487,22 @@ export default function AdminPaymentMethodEdit() {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div>
|
||||
<label className="mb-2 block text-sm font-medium text-dark-300">
|
||||
{t('admin.paymentMethods.description')}
|
||||
</label>
|
||||
<textarea
|
||||
value={customDesc}
|
||||
onChange={(e) => setCustomDesc(e.target.value)}
|
||||
rows={2}
|
||||
className="input"
|
||||
/>
|
||||
<p className="mt-1 text-xs text-dark-500">
|
||||
{t('admin.paymentMethods.descriptionHint')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Sub-options */}
|
||||
{config.available_sub_options && config.available_sub_options.length > 0 && (
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user