'use client'; import { AlertTriangle, CheckCircle, Clock, CreditCard, Wallet } from 'lucide-react'; export type UpgradeCostSummary = { proratedAmount: number; remainingHours: number; currentCost: { hourly: number; monthly: number; yearly: number }; newCost: { hourly: number; monthly: number; yearly: number }; }; export function ResourceUpgradeConfirmModal({ open, upgradeCostData, walletBalance, isPending, onCancel, onConfirm, }: { open: boolean; upgradeCostData: UpgradeCostSummary | null; walletBalance?: number; isPending: boolean; onCancel: () => void; onConfirm: () => void; }) { if (!open || !upgradeCostData) return null; const needsPay = upgradeCostData.proratedAmount > 0; const walletShort = needsPay && walletBalance != null && upgradeCostData.proratedAmount > walletBalance; return (

Confirm Resource Upgrade

{needsPay ? 'This upgrade requires payment for the remaining billing period.' : 'No additional cost for this change.'}

Current hourly cost {upgradeCostData.currentCost.hourly.toLocaleString()} Toman/hour
New hourly cost {upgradeCostData.newCost.hourly.toLocaleString()} Toman/hour
Remaining hours in period {upgradeCostData.remainingHours} hours
Prorated amount to pay {upgradeCostData.proratedAmount.toLocaleString()} Toman
Wallet Balance
{walletBalance?.toLocaleString() ?? 0} Toman
{walletShort && (

Wallet is short by{' '} {(upgradeCostData.proratedAmount - (walletBalance ?? 0)).toLocaleString()} Toman. You can pay the delta by gateway on the invoice page.

)}
); }