diff --git a/src/components/business/CEODashboard/CEODashboard.tsx b/src/components/business/CEODashboard/CEODashboard.tsx index f2ec3373..b79e9ef4 100644 --- a/src/components/business/CEODashboard/CEODashboard.tsx +++ b/src/components/business/CEODashboard/CEODashboard.tsx @@ -332,6 +332,25 @@ export function CEODashboard() { }, [currentModalCardId, monthlyExpenseDetailData, cardManagementModals, dashboardSettings.entertainment, dashboardSettings.welfare]); + // 모달 테이블 행 클릭 → 관련 페이지 이동 + const handleModalRowClick = useCallback((_row: Record) => { + if (!currentModalCardId) return; + + const routeMap: Record = { + cm2: '/ko/accounting/card-transactions', // 가지급금 → 카드거래 목록 + me1: '/ko/accounting/purchase', // 당월 매입 → 매입관리 + me2: '/ko/accounting/card-transactions', // 당월 카드 → 카드거래 목록 + me3: '/ko/accounting/bills', // 당월 발행어음 → 어음관리 + me4: '/ko/accounting/expected-expenses', // 당월 지출 예상 → 지출예상 + }; + + const targetPath = routeMap[currentModalCardId]; + if (targetPath) { + handleDetailModalClose(); + router.push(targetPath); + } + }, [currentModalCardId, handleDetailModalClose, router]); + // 카드/가지급금 관리 카드 클릭 → 모두 가지급금 상세(cm2) 모달 // 기획서 P52: 카드, 경조사, 상품권, 접대비, 총합계 모두 동일한 가지급금 상세 모달 const handleCardManagementCardClick = useCallback(async (_cardId: string) => { @@ -842,6 +861,7 @@ export function CEODashboard() { onClose={handleDetailModalClose} config={detailModalConfig} onDateFilterChange={handleDateFilterChange} + onRowClick={handleModalRowClick} /> )} diff --git a/src/components/business/CEODashboard/modalConfigs/cardManagementConfigTransformers.ts b/src/components/business/CEODashboard/modalConfigs/cardManagementConfigTransformers.ts index 4ddae7cb..f99203f6 100644 --- a/src/components/business/CEODashboard/modalConfigs/cardManagementConfigTransformers.ts +++ b/src/components/business/CEODashboard/modalConfigs/cardManagementConfigTransformers.ts @@ -203,6 +203,7 @@ export function transformCm2ModalConfig( // 테이블 데이터 매핑 (백엔드 필드명 기준, 영문 키 → 한글 변환) const tableData = (loans || []).map((item) => ({ + id: item.id, date: item.loan_date, classification: CATEGORY_LABELS[item.category] || item.category || '카드', category: item.status_label || '-', diff --git a/src/components/business/CEODashboard/modals/DetailModal.tsx b/src/components/business/CEODashboard/modals/DetailModal.tsx index 7dce6055..c9594da9 100644 --- a/src/components/business/CEODashboard/modals/DetailModal.tsx +++ b/src/components/business/CEODashboard/modals/DetailModal.tsx @@ -29,9 +29,10 @@ interface DetailModalProps { onClose: () => void; config: DetailModalConfig; onDateFilterChange?: (params: { startDate: string; endDate: string; search: string }) => void; + onRowClick?: (row: Record) => void; } -export function DetailModal({ isOpen, onClose, config, onDateFilterChange }: DetailModalProps) { +export function DetailModal({ isOpen, onClose, config, onDateFilterChange, onRowClick }: DetailModalProps) { return ( !open && onClose()} > @@ -104,7 +105,7 @@ export function DetailModal({ isOpen, onClose, config, onDateFilterChange }: Det )} {/* 메인 테이블 영역 */} - {config.table && } + {config.table && } {/* 참조 테이블 영역 (다중 - 테이블 아래 표시) */} {config.referenceTables && config.referenceTables.length > 0 && ( diff --git a/src/components/business/CEODashboard/modals/DetailModalSections.tsx b/src/components/business/CEODashboard/modals/DetailModalSections.tsx index 0f86614b..36219ae2 100644 --- a/src/components/business/CEODashboard/modals/DetailModalSections.tsx +++ b/src/components/business/CEODashboard/modals/DetailModalSections.tsx @@ -544,7 +544,7 @@ export const ReferenceTableSection = ({ config }: { config: ReferenceTableConfig ); }; -export const TableSection = ({ config }: { config: TableConfig }) => { +export const TableSection = ({ config, onRowClick }: { config: TableConfig; onRowClick?: (row: Record) => void }) => { const [filters, setFilters] = useState>(() => { const initial: Record = {}; config.filters?.forEach((filter) => { @@ -662,7 +662,11 @@ export const TableSection = ({ config }: { config: TableConfig }) => { {filteredData.map((row, rowIndex) => ( onRowClick(row) : undefined} > {config.columns.map((column) => { const cellValue = column.key === 'no'