fix: [misc] 거래처 카운트 수정 + 생산현황판 통계 API 교체
- 거래처 목록 카운트를 stats API 호출로 교체 - 생산현황판 대시보드 통계를 work-orders/stats API 활용
This commit is contained in:
@@ -94,22 +94,17 @@ export default function CustomerAccountManagementPage() {
|
||||
// 전체 통계 로드 (최초 1회만)
|
||||
const loadTotalStats = useCallback(async () => {
|
||||
try {
|
||||
// 전체 데이터 조회 (검색 조건 없이)
|
||||
const response = await fetch("/api/proxy/clients?size=1000");
|
||||
const response = await fetch("/api/proxy/clients/stats");
|
||||
if (response.ok) {
|
||||
const result = await response.json();
|
||||
if (result.success && result.data) {
|
||||
const allClients = result.data.data || [];
|
||||
const data = result.data;
|
||||
setTotalStats({
|
||||
total: result.data.total || allClients.length,
|
||||
purchase: allClients.filter((c: { client_type?: string }) =>
|
||||
c.client_type === "매입" || c.client_type === "매입매출"
|
||||
).length,
|
||||
sales: allClients.filter((c: { client_type?: string }) =>
|
||||
c.client_type === "매출" || c.client_type === "매입매출"
|
||||
).length,
|
||||
active: allClients.filter((c: { is_active?: boolean }) => c.is_active === true).length,
|
||||
inactive: allClients.filter((c: { is_active?: boolean }) => c.is_active === false).length,
|
||||
total: data.total ?? 0,
|
||||
purchase: (data.purchase ?? 0) + (data.both ?? 0),
|
||||
sales: (data.sales ?? 0) + (data.both ?? 0),
|
||||
active: data.active ?? 0,
|
||||
inactive: data.inactive ?? 0,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user