mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
fix: partner system bugs - commission field, withdrawal UX, admin amount
1. Add desired commission percent field to partner application form and admin review page (Bug 1) 2. Add prominent "Requested Amount" row in admin withdrawal detail (Bug 2) 3. Switch withdrawal input from kopecks to rubles with auto-conversion on submit (Bug 3) Includes i18n updates for all 4 locales (ru, en, zh, fa).
This commit is contained in:
@@ -136,6 +136,14 @@ export default function AdminApplicationReview() {
|
||||
<span className="text-dark-200">{app.expected_monthly_referrals}</span>
|
||||
</div>
|
||||
)}
|
||||
{app.desired_commission_percent != null && (
|
||||
<div className="rounded-lg bg-dark-700/50 p-3">
|
||||
<span className="text-dark-500">
|
||||
{t('admin.partners.applicationFields.desiredCommission')}:
|
||||
</span>{' '}
|
||||
<span className="text-dark-200">{app.desired_commission_percent}%</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -126,6 +126,14 @@ export default function AdminWithdrawalDetail() {
|
||||
<h3 className="mb-4 font-medium text-dark-200">
|
||||
{t('admin.withdrawals.detail.userInfo')}
|
||||
</h3>
|
||||
<div className="mb-3 rounded-lg border border-accent-500/30 bg-accent-500/10 p-3">
|
||||
<div className="mb-1 text-sm text-dark-400">
|
||||
{t('admin.withdrawals.detail.requestedAmount')}
|
||||
</div>
|
||||
<div className="text-lg font-bold text-accent-400">
|
||||
{formatWithCurrency(detail.amount_kopeks / 100, 0)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
|
||||
<div className="rounded-lg bg-dark-700/50 p-3">
|
||||
<div className="mb-1 text-sm text-dark-400">
|
||||
|
||||
@@ -15,6 +15,7 @@ export default function ReferralPartnerApply() {
|
||||
telegram_channel: '',
|
||||
description: '',
|
||||
expected_monthly_referrals: undefined,
|
||||
desired_commission_percent: undefined,
|
||||
});
|
||||
|
||||
// Guard: redirect if already approved or pending
|
||||
@@ -50,6 +51,9 @@ export default function ReferralPartnerApply() {
|
||||
if (form.expected_monthly_referrals) {
|
||||
payload.expected_monthly_referrals = form.expected_monthly_referrals;
|
||||
}
|
||||
if (form.desired_commission_percent) {
|
||||
payload.desired_commission_percent = form.desired_commission_percent;
|
||||
}
|
||||
applyMutation.mutate(payload);
|
||||
};
|
||||
|
||||
@@ -126,6 +130,25 @@ export default function ReferralPartnerApply() {
|
||||
placeholder={t('referral.partner.fields.expectedReferralsPlaceholder')}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label className="mb-1 block text-sm font-medium text-dark-300">
|
||||
{t('referral.partner.fields.desiredCommission')}
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={100}
|
||||
className="input w-full"
|
||||
value={form.desired_commission_percent ?? ''}
|
||||
onChange={(e) =>
|
||||
setForm({
|
||||
...form,
|
||||
desired_commission_percent: e.target.value ? Number(e.target.value) : undefined,
|
||||
})
|
||||
}
|
||||
placeholder={t('referral.partner.fields.desiredCommissionPlaceholder')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{applyMutation.isError && (
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function ReferralWithdrawalRequest() {
|
||||
const { formatWithCurrency, currencySymbol } = useCurrency();
|
||||
|
||||
const [form, setForm] = useState({
|
||||
amount_kopeks: 0,
|
||||
amount_rubles: 0,
|
||||
payment_details: '',
|
||||
});
|
||||
|
||||
@@ -40,9 +40,9 @@ export default function ReferralWithdrawalRequest() {
|
||||
const handleSubmit = (e: FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (form.payment_details.length < 5) return;
|
||||
if (form.amount_kopeks <= 0) return;
|
||||
if (form.amount_rubles <= 0) return;
|
||||
withdrawMutation.mutate({
|
||||
amount_kopeks: form.amount_kopeks,
|
||||
amount_kopeks: form.amount_rubles * 100,
|
||||
payment_details: form.payment_details,
|
||||
});
|
||||
};
|
||||
@@ -64,21 +64,25 @@ export default function ReferralWithdrawalRequest() {
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
min={balance?.min_amount_kopeks ?? 0}
|
||||
max={balance?.available_total ?? 0}
|
||||
step={100}
|
||||
min={balance ? Math.ceil(balance.min_amount_kopeks / 100) : 0}
|
||||
max={balance ? Math.floor(balance.available_total / 100) : 0}
|
||||
className="input w-full"
|
||||
value={form.amount_kopeks || ''}
|
||||
value={form.amount_rubles || ''}
|
||||
onChange={(e) =>
|
||||
setForm({
|
||||
...form,
|
||||
amount_kopeks: e.target.value ? Number(e.target.value) : 0,
|
||||
amount_rubles: e.target.value ? Number(e.target.value) : 0,
|
||||
})
|
||||
}
|
||||
placeholder={t('referral.withdrawal.fields.amountPlaceholder')}
|
||||
placeholder={t('referral.withdrawal.fields.amountPlaceholder', {
|
||||
currency: currencySymbol,
|
||||
})}
|
||||
/>
|
||||
<p className="mt-1 text-xs text-dark-500">
|
||||
{t('referral.withdrawal.fields.amountHint', { currency: currencySymbol })}
|
||||
{t('referral.withdrawal.fields.amountHint', {
|
||||
min: balance ? Math.ceil(balance.min_amount_kopeks / 100) : 0,
|
||||
currency: currencySymbol,
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
@@ -115,12 +119,12 @@ export default function ReferralWithdrawalRequest() {
|
||||
disabled={
|
||||
withdrawMutation.isPending ||
|
||||
form.payment_details.length < 5 ||
|
||||
form.amount_kopeks <= 0
|
||||
form.amount_rubles <= 0
|
||||
}
|
||||
className={`btn-primary flex-1 px-5 ${
|
||||
withdrawMutation.isPending ||
|
||||
form.payment_details.length < 5 ||
|
||||
form.amount_kopeks <= 0
|
||||
form.amount_rubles <= 0
|
||||
? 'opacity-50'
|
||||
: ''
|
||||
}`}
|
||||
|
||||
Reference in New Issue
Block a user