import { ChevronDown, ChevronRight } from 'lucide-react'; import type { InventoryStatisticsSectionProps } from './types'; type InventoryMobileListProps = Pick< InventoryStatisticsSectionProps, | 'inventoryTab' | 'inventoryByRegion' | 'expandedInventoryRegions' | 'toggleInventoryRegion' | 'inventoryByModel' | 'expandedInventoryTypes' | 'toggleInventoryType' | 'setVehicleSelection' >; export function InventoryMobileList({ inventoryTab, inventoryByRegion, expandedInventoryRegions, toggleInventoryRegion, inventoryByModel, expandedInventoryTypes, toggleInventoryType, setVehicleSelection: setShowPlateNumbers, }: InventoryMobileListProps) { return (
{inventoryTab === 'region' ? ( Object.entries(inventoryByRegion).map(([region, cities]) => (
toggleInventoryRegion(region)} >
{expandedInventoryRegions.has(region) ? : } {region}
{Object.values(cities).flat().reduce((acc, s) => acc + s.quantity, 0)} 台
{expandedInventoryRegions.has(region) && (
{Object.entries(cities).map(([city, stats]) => (
{city}
{stats.map((stat, idx) => (
{stat.brand} {stat.model}
))}
))}
)}
)) ) : ( Object.entries(inventoryByModel).map(([type, models]) => (
toggleInventoryType(type)} >
{expandedInventoryTypes.has(type) ? : } {type}
{Object.values(models).flat().reduce((acc, s) => acc + s.quantity, 0)} 台
{expandedInventoryTypes.has(type) && (
{Object.entries(models).map(([model, stats]) => (
{model}
{stats.map((stat, idx) => (
{stat.brand} {stat.region} / {stat.city}
))}
))}
)}
)) )}
); }