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:
@@ -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