diff --git a/src/app/(pages)/(main)/bridge-platform/page.tsx b/src/app/(pages)/(main)/bridge-platform/page.tsx index 20b20a3..8a55c7f 100644 --- a/src/app/(pages)/(main)/bridge-platform/page.tsx +++ b/src/app/(pages)/(main)/bridge-platform/page.tsx @@ -14,6 +14,7 @@ const BridgePlatformPage = () => { selectedDiv={selectedDiv} viewSubTitle={false} sectionTitleSuffix={COMMENT_TABLE_TITLE} + widthClassName="w-[1200px]" />; }; diff --git a/src/app/(pages)/(main)/consulting/page.tsx b/src/app/(pages)/(main)/consulting/page.tsx index 9ff835c..3198bd2 100644 --- a/src/app/(pages)/(main)/consulting/page.tsx +++ b/src/app/(pages)/(main)/consulting/page.tsx @@ -7,7 +7,7 @@ import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDe const ConsultingPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" ? : ; }; export default ConsultingPage; diff --git a/src/app/(pages)/(main)/fire-investigation/page.tsx b/src/app/(pages)/(main)/fire-investigation/page.tsx index 12838c2..6acba52 100644 --- a/src/app/(pages)/(main)/fire-investigation/page.tsx +++ b/src/app/(pages)/(main)/fire-investigation/page.tsx @@ -7,7 +7,7 @@ import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDe const FireInvestigationPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" ? : ; }; export default FireInvestigationPage; diff --git a/src/app/(pages)/(main)/insurance-operations/page.tsx b/src/app/(pages)/(main)/insurance-operations/page.tsx index 4a89495..7ec2cd0 100644 --- a/src/app/(pages)/(main)/insurance-operations/page.tsx +++ b/src/app/(pages)/(main)/insurance-operations/page.tsx @@ -7,7 +7,7 @@ import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDe const InsuranceOperationsPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" ? : ; }; export default InsuranceOperationsPage; diff --git a/src/app/(pages)/(main)/safety-inspection/page.tsx b/src/app/(pages)/(main)/safety-inspection/page.tsx index 935e158..86402a9 100644 --- a/src/app/(pages)/(main)/safety-inspection/page.tsx +++ b/src/app/(pages)/(main)/safety-inspection/page.tsx @@ -7,7 +7,12 @@ import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDe const SafetyInspectionPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" + ? + : ; }; export default SafetyInspectionPage; diff --git a/src/app/(pages)/(main)/ucis/page.tsx b/src/app/(pages)/(main)/ucis/page.tsx index edc4313..de7560d 100644 --- a/src/app/(pages)/(main)/ucis/page.tsx +++ b/src/app/(pages)/(main)/ucis/page.tsx @@ -14,6 +14,7 @@ const UcisPage = () => { selectedDiv={selectedDiv} viewSubTitle={false} sectionTitleSuffix={COMMENT_TABLE_TITLE} + widthClassName="w-[1200px]" />; }; diff --git a/src/app/globals.css b/src/app/globals.css index 8ae7729..f6b3beb 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -122,6 +122,8 @@ --kfpa-red-100: #f2a8b5; --kfpa-red-50: #fae6ea; + --kfpa-null: #9a9a9a; + /* ============================= Surface ============================= */ @@ -357,6 +359,7 @@ .border-border { border-color: var(--border); } .text-zero { color: var(--kfpa-black-150) !important; } +.text-null { color: var(--kfpa-null) !important; } /* KFPA neutral scale */ .bg-black-600 { background-color: var(--kfpa-black-600) !important; } @@ -410,6 +413,7 @@ .bg-csi { background-color: var(--kfpa-csi) !important; } .bg-direct { background-color: var(--kfpa-direct) !important; } .bg-indirect { background-color: var(--kfpa-indirect) !important; } +.bg-null { background-color: var(--kfpa-null) !important; } /* ============================= Content Text Size Utilities @@ -599,10 +603,11 @@ .kfpa-detail-table { --kfpa-detail-table-head-height: 56px; + --kfpa-detail-table-row-height: 56px; + --kfpa-detail-comment-table-row-height: 112px; } .kfpa-detail-rank-table { - --kfpa-detail-table-row-height: 56px; min-width: 285px !important; } @@ -618,6 +623,7 @@ } .kfpa-detail-comment-table tbody td { + min-height: var(--kfpa-detail-comment-table-row-height); vertical-align: top; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4908a21..cf2a49e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -15,8 +15,8 @@ const geistMono = Geist_Mono({ }); export const metadata: Metadata = { - title: "화재보험협회 대시보드", - description: "화재보험협회 CX 대시보드", + title: "고객 관점 성과관리 대시보드", + description: "고객 관점 성과관리 대시보드", }; export default function RootLayout({ diff --git a/src/components/chart/VerticalBar.tsx b/src/components/chart/VerticalBar.tsx index 3fda295..1703b3b 100644 --- a/src/components/chart/VerticalBar.tsx +++ b/src/components/chart/VerticalBar.tsx @@ -35,9 +35,52 @@ type Props = { position?: "top" | "insideTop" | "right" | "insideRight"; color?: string; distance?: number; + minPositionValue?: number; }; }; +type ChartCallbackParam = { + data?: unknown; + value?: unknown; + axisValueLabel?: string; + name?: string; + marker?: string; + seriesName?: string; +}; + +const isRecord = (value: unknown): value is Record => + typeof value === "object" && value !== null && !Array.isArray(value); + +const toChartCallbackParam = (value: unknown): ChartCallbackParam => + isRecord(value) ? value : {}; + +const getActualValue = (param: unknown) => { + const data = toChartCallbackParam(param).data; + + if (isRecord(data) && "actualValue" in data) { + return data.actualValue; + } + + return toChartCallbackParam(param).value; +}; + +const createLabelPositionTooltip = (fmt: ValueFormatter): EChartsOption["tooltip"] => ({ + trigger: "axis", + axisPointer: { type: "shadow" }, + formatter: (params: unknown) => { + const items = (Array.isArray(params) ? params : [params]).map(toChartCallbackParam); + const title = items[0]?.axisValueLabel ?? items[0]?.name ?? ""; + const lines = items.map((item) => { + const value = getActualValue(item); + const text = typeof value === "number" ? fmt(value) : value == null ? "-" : String(value); + + return `${item.marker ?? ""}${item.seriesName} ${text}`; + }); + + return [title, ...lines].join("
"); + }, +}); + const VerticalBar = ({ data, height, @@ -58,21 +101,31 @@ const VerticalBar = ({ const option: EChartsOption = useMemo(() => { const fmt = valueFormatter ?? ((v: number) => String(v)); + const minPositionValue = labelOptions?.minPositionValue; return { color: palette, - tooltip: tooltip ?? createDefaultTooltip(fmt), + tooltip: tooltip ?? (typeof minPositionValue === "number" ? createLabelPositionTooltip(fmt) : createDefaultTooltip(fmt)), legend: legend ?? createDefaultLegend(), grid: grid ?? createDefaultGrid(), xAxis: xAxis ?? createCategoryAxis(data.categories, false, { axisTick: { alignWithLabel: true } }), yAxis: yAxis ?? createValueAxis(), series: data.series.map((s, index) => { const showLabel = getIsShowLabel(showFocusLabel, index, data.series.length); + const seriesData = s.data.map((value) => + typeof minPositionValue === "number" && + typeof value === "number" && + Number.isFinite(value) && + value > 0.00 && + value < minPositionValue + ? { value: minPositionValue, actualValue: value } + : value + ); return { name: s.name, type: "bar", - data: s.data, + data: seriesData, emphasis: { disabled: true }, barMaxWidth: barMaxWidth ?? BAR_WIDTHS.DEFAULT, label: showLabel @@ -81,7 +134,10 @@ const VerticalBar = ({ position: labelOptions?.position ?? "right", color: labelOptions?.color, distance: labelOptions?.distance, - formatter: (p: any) => (typeof p?.value === "number" ? fmt(p.value) : (p?.value ?? "")) as any, + formatter: (p: unknown) => { + const value = getActualValue(p); + return typeof value === "number" ? fmt(value) : value == null ? "" : String(value); + }, } : undefined, } diff --git a/src/components/combo/TopChartTable.tsx b/src/components/combo/TopChartTable.tsx index 9b36cd4..eb66a31 100644 --- a/src/components/combo/TopChartTable.tsx +++ b/src/components/combo/TopChartTable.tsx @@ -1,301 +1,310 @@ "use client"; -import React, { useMemo } from "react"; -import { cn, parseNumber } from "@/lib/utils"; +import React, {useMemo} from "react"; +import {cn, parseNumber} from "@/lib/utils"; import BaseTableHeader from "../table/core/BaseTableHeader"; import { -formatSignedValue, getSignTextClass, -resolveSignStyle, -toCssSize, -toRoundedNumber + formatSignedValue, getSignTextClass, + resolveSignStyle, + toCssSize, + toRoundedNumber } from "../table/core/table-core.helpers"; import { -TopChartTablePreAppendCell, -TopChartTablePreAppendCellConfig, -TopChartTableRow, -TopChartTableSectionRow + TopChartTablePreAppendCell, + TopChartTablePreAppendCellConfig, + TopChartTableRow, + TopChartTableSectionRow } from "./types"; import {ChartData} from "../chart/types"; import {CHART_HEIGHTS, TABLE_DIMENSIONS} from "../chart/chart.config"; import type {DataColumn, SignStyle} from "@/components/table/types"; -import { KFPA_DECIMAL_POINT } from "@/config/kfpa.config"; +import {KFPA_DECIMAL_POINT} from "@/config/kfpa.config"; export type TopChartTableProps = { -title?: string; -columns: DataColumn>[]; -rows: TopChartTableRow[]; -sectionRows?: TopChartTableSectionRow[]; -chart?: - | React.ReactNode - | ((ctx: { - chartData: ChartData; - }) => React.ReactNode); -chartHeight?: number | string; -minWidthPx?: number; -minWidth?: number; -maxWidth?: number; -subLabelHeader?: string; -rowHeaderWidth?: number | string; -categoryColumnWidth?: number | string; -categoryColumnWidths?: Array; -tableClassName?: string; -wrapperClassName?: string; -signStyle?: SignStyle; + title?: string; + columns: DataColumn>[]; + rows: TopChartTableRow[]; + sectionRows?: TopChartTableSectionRow[]; + chart?: + | React.ReactNode + | ((ctx: { + chartData: ChartData; + }) => React.ReactNode); + chartHeight?: number | string; + minWidthPx?: number; + minWidth?: number; + maxWidth?: number; + subLabelHeader?: string; + rowHeaderWidth?: number | string; + categoryColumnWidth?: number | string; + categoryColumnWidths?: Array; + tableClassName?: string; + wrapperClassName?: string; + signStyle?: SignStyle; }; const isPreAppendCellConfig = ( -cell: TopChartTablePreAppendCell + cell: TopChartTablePreAppendCell ): cell is TopChartTablePreAppendCellConfig => -typeof cell === "object" && -cell !== null && -!Array.isArray(cell) && -"content" in cell; + typeof cell === "object" && + cell !== null && + !Array.isArray(cell) && + "content" in cell; const renderPreAppendCell = (cell: TopChartTablePreAppendCell, index: number) => { -if (!isPreAppendCellConfig(cell)) { - return {cell}; -} + if (!isPreAppendCellConfig(cell)) { + return {cell}; + } -return ( - - {cell.content} - -); + return ( + + {cell.content} + + ); }; const getLeadingColumnWidths = (rows: TopChartTableRow[], preAppendColumnCount: number) => { -const widths = Array(preAppendColumnCount).fill(undefined); + const widths = Array(preAppendColumnCount).fill(undefined); -rows.forEach((row) => { - let columnIndex = 0; + rows.forEach((row) => { + let columnIndex = 0; - row.preAppendCells?.forEach((cell) => { - const colSpan = isPreAppendCellConfig(cell) ? cell.colSpan ?? 1 : 1; - const width = isPreAppendCellConfig(cell) ? toCssSize(cell.width) : undefined; + row.preAppendCells?.forEach((cell) => { + const colSpan = isPreAppendCellConfig(cell) ? cell.colSpan ?? 1 : 1; + const width = isPreAppendCellConfig(cell) ? toCssSize(cell.width) : undefined; - if (width && colSpan === 1 && !widths[columnIndex]) { - widths[columnIndex] = width; - } + if (width && colSpan === 1 && !widths[columnIndex]) { + widths[columnIndex] = width; + } - columnIndex += colSpan; + columnIndex += colSpan; + }); }); -}); -return widths; + return widths; }; const getLabelColumnWidth = (rows: TopChartTableRow[]) => -rows.map((row) => toCssSize(row.labelWidth)).find(Boolean); + rows.map((row) => toCssSize(row.labelWidth)).find(Boolean); const getColumnKey = (column: DataColumn>) => -String(column.id ?? ("key" in column ? column.key : column.header)); + String(column.id ?? ("key" in column ? column.key : column.header)); const getColumnLabel = (column: DataColumn>) => -typeof column.header === "string" ? column.header : getColumnKey(column); + typeof column.header === "string" ? column.header : getColumnKey(column); export default function TopChartTable({ -title, -rows, -sectionRows = [], -columns, -chart, -chartHeight = CHART_HEIGHTS.DEFAULT, -minWidthPx = TABLE_DIMENSIONS.MIN_WIDTH.STANDARD, -minWidth, -maxWidth, -subLabelHeader = "", -rowHeaderWidth, -categoryColumnWidth, -categoryColumnWidths, -tableClassName, -wrapperClassName, -signStyle, -}: Readonly) { -const resolvedSignStyle = resolveSignStyle(signStyle, { - positiveTextClassName: "kfpa-num-pos", - negativeTextClassName: "kfpa-num-neg", - zeroTextClassName: "text-zero", - arrowWithNumber: true, - valueFormatter: (value) => value.toFixed(KFPA_DECIMAL_POINT), -}); + title, + rows, + sectionRows = [], + columns, + chart, + chartHeight = CHART_HEIGHTS.DEFAULT, + minWidthPx = TABLE_DIMENSIONS.MIN_WIDTH.STANDARD, + minWidth, + maxWidth, + subLabelHeader = "", + rowHeaderWidth, + categoryColumnWidth, + categoryColumnWidths, + tableClassName, + wrapperClassName, + signStyle, + }: Readonly) { + const resolvedSignStyle = resolveSignStyle(signStyle, { + positiveTextClassName: "kfpa-num-pos", + negativeTextClassName: "kfpa-num-neg", + zeroTextClassName: "text-zero", + arrowWithNumber: true, + valueFormatter: (value) => value.toFixed(KFPA_DECIMAL_POINT), + }); -const maxPreAppendCellCount = useMemo( - () => Math.max(0, ...rows.map((row) => row.preAppendCells?.length ?? 0)), - [rows] -); -const leadingColumnCount = maxPreAppendCellCount + 1; -const leadingColumnWidths = useMemo( - () => [...getLeadingColumnWidths(rows, maxPreAppendCellCount), getLabelColumnWidth(rows)], - [maxPreAppendCellCount, rows] -); -const columnLabels = useMemo(() => columns.map(getColumnLabel), [columns]); + const maxPreAppendCellCount = useMemo( + () => Math.max(0, ...rows.map((row) => row.preAppendCells?.length ?? 0)), + [rows] + ); + const leadingColumnCount = maxPreAppendCellCount + 1; + const leadingColumnWidths = useMemo( + () => [...getLeadingColumnWidths(rows, maxPreAppendCellCount), getLabelColumnWidth(rows)], + [maxPreAppendCellCount, rows] + ); + const columnLabels = useMemo(() => columns.map(getColumnLabel), [columns]); -const chartData: ChartData = useMemo( - () => ({ - categories: columnLabels, - series: rows.map((row) => ({ - name: row.label, - data: row.values.map((value) => parseNumber(value) ?? null), - })), - }), - [columnLabels, rows] -); + const chartData: ChartData = useMemo( + () => ({ + categories: columnLabels, + series: rows.map((row) => ({ + name: row.label, + data: row.values.map((value) => parseNumber(value) ?? null), + })), + }), + [columnLabels, rows] + ); -const chartNode = useMemo(() => { - if (!chart) { - return null; - } - return typeof chart === "function" ? chart({ chartData }) : chart; -}, [chart, chartData]); + const chartNode = useMemo(() => { + if (!chart) { + return null; + } + return typeof chart === "function" ? chart({chartData}) : chart; + }, [chart, chartData]); -const rowHeaderStyle = useMemo(() => { - const width = toCssSize(rowHeaderWidth); - return width ? { width, minWidth: width } : undefined; -}, [rowHeaderWidth]); + const rowHeaderStyle = useMemo(() => { + const width = toCssSize(rowHeaderWidth); + return width ? {width, minWidth: width} : undefined; + }, [rowHeaderWidth]); -const hasCategoryHeaderRow = useMemo( - () => subLabelHeader.trim().length > 0 || columns.some((column) => getColumnLabel(column).trim().length > 0), - [columns, subLabelHeader] -); + const hasCategoryHeaderRow = useMemo( + () => subLabelHeader.trim().length > 0 || columns.some((column) => getColumnLabel(column).trim().length > 0), + [columns, subLabelHeader] + ); -return ( -
- + return ( +
+ -
- - - {leadingColumnWidths.map((width, index) => ( - - ))} - {columns.map((column, index) => { - const width = toCssSize(categoryColumnWidths?.[index] ?? column.width ?? categoryColumnWidth); - return ( - - ); - })} - - - - - - - {hasCategoryHeaderRow && ( - - - {columns.map((column) => { +
+
- - {chartNode ?
{chartNode}
: null} -
- {subLabelHeader} -
+ + {leadingColumnWidths.map((width, index) => ( + + ))} + {columns.map((column, index) => { + const width = toCssSize(categoryColumnWidths?.[index] ?? column.width ?? categoryColumnWidth); return ( - - ) + + ); })} + + + + - )} - - - {rows.map((row, rowIndex) => { - const signRow = !!signStyle?.rowSelector?.(row, rowIndex); - const preAppendCells = row.preAppendCells ?? []; - const sectionRowsAfterCurrentRow = sectionRows.filter( - (sectionRow) => sectionRow.afterRowIndex === rowIndex - ); - - return ( - - - {preAppendCells.map(renderPreAppendCell)} + {hasCategoryHeaderRow && ( + - - {columns.map((column, categoryIndex) => { - const rawValue = row.values?.[categoryIndex]; - const decimalPlaces = row.decimalPlaces ?? KFPA_DECIMAL_POINT; - const roundedValue = toRoundedNumber(rawValue, decimalPlaces); - - if (roundedValue === null) { - return ; - } - - if(!signRow) { - return ( - - ); - } - + {columns.map((column) => { return ( - - ); - + {column.header} + + ) })} + )} + - {sectionRowsAfterCurrentRow.map((sectionRow, sectionRowIndex) => ( - - - - ))} - - ); - })} - -
- {column.header} -
+ + {chartNode ?
{chartNode}
: null} +
- {row.label} + {subLabelHeader} - - {roundedValue.toFixed(decimalPlaces)} - - {formatSignedValue(roundedValue, resolvedSignStyle)} -
- {sectionRow.content} - -
-
-
-); + + {rows.map((row, rowIndex) => { + const signRow = !!signStyle?.rowSelector?.(row, rowIndex); + const preAppendCells = row.preAppendCells ?? []; + const sectionRowsAfterCurrentRow = sectionRows.filter( + (sectionRow) => sectionRow.afterRowIndex === rowIndex + ); + + return ( + + + {preAppendCells.map(renderPreAppendCell)} + + {row.label} + + + {columns.map((column, categoryIndex) => { + const rawValue = row.values?.[categoryIndex]; + const decimalPlaces = row.decimalPlaces ?? KFPA_DECIMAL_POINT; + const roundedValue = toRoundedNumber(rawValue, decimalPlaces); + + if (roundedValue === null) { + return -; + } + + if (!signRow) { + return ( + + {roundedValue.toFixed(decimalPlaces)} + + ); + } + + return ( + + {formatSignedValue(roundedValue, resolvedSignStyle)} + + ); + + })} + + + {sectionRowsAfterCurrentRow.map((sectionRow, sectionRowIndex) => ( + + + {sectionRow.content} + + + + ))} + + ); + })} + + +
+ + ); } diff --git a/src/components/kfpa/CommentNote.tsx b/src/components/kfpa/CommentNote.tsx new file mode 100644 index 0000000..dd0e618 --- /dev/null +++ b/src/components/kfpa/CommentNote.tsx @@ -0,0 +1,9 @@ +const CommentNote = () => { + return ( +

+ ▶ : 완료  /  ▷ : 진행 중 +

+ ); +}; + +export default CommentNote; diff --git a/src/components/kfpa/CsiFormulaNote.tsx b/src/components/kfpa/CsiFormulaNote.tsx index 146e826..a14081e 100644 --- a/src/components/kfpa/CsiFormulaNote.tsx +++ b/src/components/kfpa/CsiFormulaNote.tsx @@ -1,9 +1,24 @@ const CsiFormulaNote = () => { return ( -

- ※ 고객만족지수(CSI, Customer Satisfaction Index) = 고객 만족도조사 직접요소 항목 점수 X 가중치 + 고객 - 만족도조사 간접요소 항목 점수 X 가중치 -

+ <> +

+ ※ 고객만족지수(CSI, Customer Satisfaction Index) = 고객 만족도조사 직접요소 항목 점수 X 가중치 + 고객 + 만족도조사 간접요소 항목 점수 X 가중치 +

+

+ ※ 주요 고객 대상 : 안전점검(특수건물 관계자) +  /  UCIS(사원사 등) +  /  Bridge 플랫폼(사원사, 일반회원 등) +  /  방재컨설팅(발주처 관계자 약 20명) +  /  보험업무(보험 계약 담당자 약 300명) +  /  화재조사(사원사 손해사정부서 총 11명) +

+

+ ※ 응답 데이터 업데이트 주기 : 안전점검(매일 실시간) +  /  UCIS, Bridge플랫폼, 보험업무, 화재조사(매월 말) +  /  방재컨설팅(각 용역이 완료되는 하반기에 진행 예정) +

+ ); }; diff --git a/src/components/kfpa/CustomerSatisfactionCommentTable.tsx b/src/components/kfpa/CustomerSatisfactionCommentTable.tsx index bd60084..db5571c 100644 --- a/src/components/kfpa/CustomerSatisfactionCommentTable.tsx +++ b/src/components/kfpa/CustomerSatisfactionCommentTable.tsx @@ -2,7 +2,9 @@ import DataTable from "@/components/table/DataTable"; import type { DataColumn } from "@/components/table/types"; +import { cn } from "@/lib/utils"; import type { CommentColumn, CommentField, CommentValue, DashboardCommentRowConfig } from "@/types/kfpa"; +import CommentNote from "@/components/kfpa/CommentNote"; type CommentTableRow = DashboardCommentRowConfig & Record; @@ -63,12 +65,22 @@ const CustomerSatisfactionCommentTable = ({ const value = String(draft[column.key]?.[row.field] ?? ""); if (!isEditing) { - return
{value || "-"}
; + return ( +
+ {value || "-"} +
+ ); } return (