2026-01-08 17:15:42 +09:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useRouter } from 'next/navigation';
|
2026-03-04 22:19:10 +09:00
|
|
|
import { Banknote, CircleDollarSign, Building2, TrendingUp, ChevronRight } from 'lucide-react';
|
2026-02-24 21:54:21 +09:00
|
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
|
import { AmountCardItem, CheckPointItem, CollapsibleDashboardCard, type SectionColorTheme } from '../components';
|
2026-01-08 17:15:42 +09:00
|
|
|
import type { ReceivableData } from '../types';
|
|
|
|
|
|
2026-03-04 22:19:10 +09:00
|
|
|
// 카드별 아이콘 매핑 (누적미수금, 당월미수금, 거래처, Top3)
|
|
|
|
|
const CARD_ICONS = [CircleDollarSign, Banknote, Building2, TrendingUp];
|
2026-01-28 14:53:20 +09:00
|
|
|
const CARD_THEMES: SectionColorTheme[] = ['amber', 'green', 'orange', 'red'];
|
|
|
|
|
|
2026-01-08 17:15:42 +09:00
|
|
|
interface ReceivableSectionProps {
|
|
|
|
|
data: ReceivableData;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ReceivableSection({ data }: ReceivableSectionProps) {
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const handleDetailClick = () => {
|
|
|
|
|
if (data.detailButtonPath) {
|
|
|
|
|
router.push(data.detailButtonPath);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2026-02-24 21:54:21 +09:00
|
|
|
<CollapsibleDashboardCard
|
|
|
|
|
icon={<Banknote style={{ color: '#ffffff' }} className="h-5 w-5" />}
|
|
|
|
|
title="미수금 현황"
|
|
|
|
|
subtitle="미수금 관리 현황"
|
|
|
|
|
rightElement={
|
|
|
|
|
data.detailButtonLabel ? (
|
|
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
|
|
|
|
onClick={(e) => { e.stopPropagation(); handleDetailClick(); }}
|
|
|
|
|
className="text-white hover:bg-white/10 gap-1 text-xs"
|
|
|
|
|
>
|
|
|
|
|
{data.detailButtonLabel}
|
|
|
|
|
<ChevronRight className="h-3 w-3" />
|
|
|
|
|
</Button>
|
|
|
|
|
) : undefined
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<div className="grid grid-cols-1 xs:grid-cols-2 md:grid-cols-4 gap-3 xs:gap-4 mb-4">
|
|
|
|
|
{data.cards.map((card, idx) => (
|
|
|
|
|
<AmountCardItem
|
|
|
|
|
key={card.id}
|
|
|
|
|
card={card}
|
|
|
|
|
onClick={handleDetailClick}
|
|
|
|
|
icon={CARD_ICONS[idx] || Banknote}
|
|
|
|
|
colorTheme={CARD_THEMES[idx] || 'amber'}
|
|
|
|
|
showTrend={!!card.previousLabel}
|
|
|
|
|
trendValue={card.previousLabel}
|
|
|
|
|
trendDirection={idx === 3 ? 'down' : 'up'}
|
|
|
|
|
/>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2026-01-08 17:15:42 +09:00
|
|
|
|
2026-02-24 21:54:21 +09:00
|
|
|
{data.checkPoints.length > 0 && (
|
|
|
|
|
<div className="border-t pt-4 space-y-1">
|
|
|
|
|
{data.checkPoints.map((cp) => (
|
|
|
|
|
<CheckPointItem key={cp.id} checkpoint={cp} />
|
2026-01-08 17:15:42 +09:00
|
|
|
))}
|
|
|
|
|
</div>
|
2026-02-24 21:54:21 +09:00
|
|
|
)}
|
|
|
|
|
</CollapsibleDashboardCard>
|
2026-01-08 17:15:42 +09:00
|
|
|
);
|
2026-02-24 21:54:21 +09:00
|
|
|
}
|