import { useState } from 'react'; import { ImagePreviewModal } from '@/components/image-preview-modal'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from '@/components/ui/table'; import type { Restock } from './columns'; function formatCurrency(amount: number): string { return new Intl.NumberFormat('id-ID', { style: 'currency', currency: 'IDR', minimumFractionDigits: 0, }).format(amount); } function formatNumber(num: number): string { return new Intl.NumberFormat('id-ID', { maximumFractionDigits: 4, }).format(num); } function VariantPhotoPreview({ url, title }: { url: string; title: string }) { const [open, setOpen] = useState(false); return ( <> ); } export function RestockItemSubRow({ restock }: { restock: Restock }) { const items = restock.restock_items ?? []; return (
No Foto Produk Varian Harga Modal Qty Subtotal {items.length === 0 ? ( Tidak ada item. ) : ( items.map((item, index) => ( {index + 1} {item.product_variant?.photo_url ? ( ) : (
N/A
)}
{item.product_variant?.product?.name ?? '-'} {item.product_variant?.name ?? '-'} {formatCurrency(item.unit_price)} {formatNumber(item.quantity)} {formatCurrency(item.subtotal)}
)) )}
); }