import { Form, Head, Link } from '@inertiajs/react';
import { CheckCircle2, Clock3, CreditCard, Server } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
type Plan = {
code: string;
name: string;
deployment: string;
price: number;
max_devices: number;
max_users: number;
};
type License = {
plan: string;
status: string;
max_devices: number | null;
max_users: number | null;
expires_at: string | null;
grace_until: string | null;
};
type Order = {
uuid: string;
plan_code: string;
gateway: string;
status: string;
total: number;
currency: string;
checkout_url: string | null;
created_at: string;
};
const money = (value: number) =>
new Intl.NumberFormat('id-ID', {
style: 'currency',
currency: 'IDR',
maximumFractionDigits: 0,
}).format(value);
export default function BillingIndex({
installation,
license,
plans,
orders,
gateways,
pendingOrder,
}: {
installation: { deployment_type: string; status: string };
license: License | null;
plans: Plan[];
orders: Order[];
gateways: string[];
pendingOrder: Pick
RADIQ NDM · BILLING
Pilih paket, checkout, dan pantau masa berlaku lisensi tenant.
Pembayaran masih pending
{pendingOrder.plan_code} · {money(pendingOrder.total)}. Selesaikan order ini sebelum membuat perpanjangan baru.
{license?.plan ?? 'Belum aktif'}
Status {license?.status ?? installation.status}
{license?.max_devices ?? '—'}
{license?.plan === 'cloud_free' ? 'Selama paket tersedia' : license?.expires_at ? new Date( license.expires_at, ).toLocaleDateString('id-ID') : '—'}
{plan.price === 0 ? 'Gratis' : money(plan.price)} {plan.price > 0 && '/bulan'}
Belum ada checkout.
) : ({order.plan_code} ·{' '} {money(order.total)}
{new Date( order.created_at, ).toLocaleString('id-ID')}{' '} · {order.gateway}