'use client'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import type { ValuationHistoryItem } from '@/lib/valuation-api'; interface ValuationHistoryProps { items: ValuationHistoryItem[]; total: number; page: number; onPageChange: (page: number) => void; onSelect: (id: string) => void; isLoading?: boolean; } function formatPrice(num: number): string { if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(2)} ty`; if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(0)} trieu`; return num.toLocaleString('vi-VN'); } const PROPERTY_TYPE_LABELS: Record = { APARTMENT: 'Can ho', HOUSE: 'Nha rieng', VILLA: 'Biet thu', LAND: 'Dat nen', OFFICE: 'Van phong', SHOPHOUSE: 'Shophouse', }; export function ValuationHistory({ items, total, page, onPageChange, onSelect, isLoading, }: ValuationHistoryProps) { const totalPages = Math.ceil(total / 10); return ( Lich su dinh gia {total} lan dinh gia truoc do {isLoading ? (
Dang tai...
) : items.length === 0 ? (
Chua co lich su dinh gia
) : ( <>
{items.map((item) => ( ))}
{totalPages > 1 && (
Trang {page}/{totalPages}
)} )}
); }