refactor(agents): simplify billing currency logic in players panel
Removed redundant fallback for billing currency, streamlining the logic to use the player's default currency or defaulting to "NPR". Updated the display of unpaid amounts in the billing bills list to utilize the simplified currency logic, enhancing code clarity and maintainability.
This commit is contained in:
@@ -597,8 +597,7 @@ export function AgentsPlayersPanel({
|
|||||||
() => billingBills.find((bill) => bill.id === selectedBillId) ?? null,
|
() => billingBills.find((bill) => bill.id === selectedBillId) ?? null,
|
||||||
[billingBills, selectedBillId],
|
[billingBills, selectedBillId],
|
||||||
);
|
);
|
||||||
const billingCurrency =
|
const billingCurrency = billingPlayer?.default_currency ?? "NPR";
|
||||||
selectedBill?.currency_code ?? billingPlayer?.default_currency ?? "NPR";
|
|
||||||
|
|
||||||
function resetBillingForm(): void {
|
function resetBillingForm(): void {
|
||||||
setPayAmount("");
|
setPayAmount("");
|
||||||
@@ -1140,7 +1139,7 @@ export function AgentsPlayersPanel({
|
|||||||
<SelectContent>
|
<SelectContent>
|
||||||
{billingBills.map((bill) => (
|
{billingBills.map((bill) => (
|
||||||
<SelectItem key={bill.id} value={String(bill.id)}>
|
<SelectItem key={bill.id} value={String(bill.id)}>
|
||||||
{`#${bill.id} · ${bill.status} · ${bill.player_site_player_id ?? bill.owner_id} · ${formatAdminMinorUnits(bill.unpaid_amount ?? 0, bill.currency_code ?? billingPlayer?.default_currency ?? "NPR")}`}
|
{`#${bill.id} · ${bill.status} · ${bill.player_site_player_id ?? bill.owner_id} · ${formatAdminMinorUnits(bill.unpaid_amount ?? 0, billingCurrency)}`}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user