diff --git a/package.json b/package.json index 61ed6f5..f2cf594 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev -p 6102", + "clean:next": "powershell -NoProfile -Command \"Remove-Item -Recurse -Force .next -ErrorAction SilentlyContinue\"", + "dev": "npm run clean:next && next dev -p 6102", "build": "next build", "start": "next start -p 6102", "lint": "eslint" diff --git a/src/app/(pages)/(main)/bridge-platform/page.tsx b/src/app/(pages)/(main)/bridge-platform/page.tsx index 4ae9636..20b20a3 100644 --- a/src/app/(pages)/(main)/bridge-platform/page.tsx +++ b/src/app/(pages)/(main)/bridge-platform/page.tsx @@ -3,11 +3,18 @@ import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext"; import CustomerSatisfactionTotal from "@/components/kfpa/CustomerSatisfactionTotal"; import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDetail"; +import { COMMENT_TABLE_TITLE } from "@/config/kfpa.config"; const BridgePlatformPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" + ? + : ; }; export default BridgePlatformPage; diff --git a/src/app/(pages)/(main)/ucis/page.tsx b/src/app/(pages)/(main)/ucis/page.tsx index 35600a1..edc4313 100644 --- a/src/app/(pages)/(main)/ucis/page.tsx +++ b/src/app/(pages)/(main)/ucis/page.tsx @@ -3,11 +3,18 @@ import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext"; import CustomerSatisfactionTotal from "@/components/kfpa/CustomerSatisfactionTotal"; import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDetail"; +import { COMMENT_TABLE_TITLE } from "@/config/kfpa.config"; const UcisPage = () => { const { selectedDiv } = useLayoutFilter(); - return selectedDiv === "-1" ? : ; + return selectedDiv === "-1" + ? + : ; }; export default UcisPage; diff --git a/src/app/globals.css b/src/app/globals.css index 3514fc1..8ae7729 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -90,6 +90,7 @@ --kfpa-black-400: #555152; --kfpa-black-300: #7b7879; --kfpa-black-200: #a7a4a5; + --kfpa-black-150: #a6a6a6; --kfpa-black-100: #d4d2d3; --kfpa-gray-600: #d1d2d2; @@ -355,6 +356,8 @@ .border-border { border-color: var(--border); } +.text-zero { color: var(--kfpa-black-150) !important; } + /* KFPA neutral scale */ .bg-black-600 { background-color: var(--kfpa-black-600) !important; } .bg-black-500 { background-color: var(--kfpa-black-500) !important; } @@ -530,7 +533,7 @@ .kfpa-table tbody th, .kfpa-table tbody td { - padding: 7px 12px; + padding: 6px 12px; } .kfpa-table thead tr.kfpa-table__chart-row > th, @@ -595,12 +598,11 @@ } .kfpa-detail-table { - --kfpa-detail-table-height: 500px; --kfpa-detail-table-head-height: 56px; - height: var(--kfpa-detail-table-height); } .kfpa-detail-rank-table { + --kfpa-detail-table-row-height: 56px; min-width: 285px !important; } @@ -612,6 +614,7 @@ .kfpa-detail-table tbody th, .kfpa-detail-table tbody td { vertical-align: middle; + height: var(--kfpa-detail-table-row-height); } .kfpa-detail-comment-table tbody td { diff --git a/src/components/combo/TopChartTable.tsx b/src/components/combo/TopChartTable.tsx index eb64cd0..9b36cd4 100644 --- a/src/components/combo/TopChartTable.tsx +++ b/src/components/combo/TopChartTable.tsx @@ -18,7 +18,7 @@ TopChartTableSectionRow import {ChartData} from "../chart/types"; import {CHART_HEIGHTS, TABLE_DIMENSIONS} from "../chart/chart.config"; import type {DataColumn, SignStyle} from "@/components/table/types"; -import { CUSTOMER_SATISFACTION_DECIMAL_PLACES } from "@/config/kfpaConfig"; +import { KFPA_DECIMAL_POINT } from "@/config/kfpa.config"; export type TopChartTableProps = { title?: string; @@ -120,9 +120,9 @@ signStyle, const resolvedSignStyle = resolveSignStyle(signStyle, { positiveTextClassName: "kfpa-num-pos", negativeTextClassName: "kfpa-num-neg", - zeroTextClassName: "", + zeroTextClassName: "text-zero", arrowWithNumber: true, - valueFormatter: (value) => value.toFixed(CUSTOMER_SATISFACTION_DECIMAL_PLACES), + valueFormatter: (value) => value.toFixed(KFPA_DECIMAL_POINT), }); const maxPreAppendCellCount = useMemo( @@ -248,7 +248,7 @@ return ( {columns.map((column, categoryIndex) => { const rawValue = row.values?.[categoryIndex]; - const decimalPlaces = row.decimalPlaces ?? CUSTOMER_SATISFACTION_DECIMAL_PLACES; + const decimalPlaces = row.decimalPlaces ?? KFPA_DECIMAL_POINT; const roundedValue = toRoundedNumber(rawValue, decimalPlaces); if (roundedValue === null) { diff --git a/src/components/common/SectionSubTitle.tsx b/src/components/common/SectionSubTitle.tsx new file mode 100644 index 0000000..a7ff96d --- /dev/null +++ b/src/components/common/SectionSubTitle.tsx @@ -0,0 +1,10 @@ +const SectionSubTitle = ({title}:{title:string}) => { + return ( +
+ + {title} +
+ ); +} + +export default SectionSubTitle; diff --git a/src/components/kfpa/CsiFormulaNote.tsx b/src/components/kfpa/CsiFormulaNote.tsx index 3f6b041..146e826 100644 --- a/src/components/kfpa/CsiFormulaNote.tsx +++ b/src/components/kfpa/CsiFormulaNote.tsx @@ -1,8 +1,8 @@ const CsiFormulaNote = () => { return ( -

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

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

); }; diff --git a/src/components/kfpa/CustomerSatisfactionDetail.tsx b/src/components/kfpa/CustomerSatisfactionDetail.tsx index 4bcff47..4b3bb18 100644 --- a/src/components/kfpa/CustomerSatisfactionDetail.tsx +++ b/src/components/kfpa/CustomerSatisfactionDetail.tsx @@ -16,10 +16,12 @@ import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext"; import { useAuth } from "@/hooks/useAuth"; import { cn } from "@/lib/utils"; import { + COMMENT_TABLE_TITLE, getDashboardCommentRows, getDashboardRankRows, getSideMenuLabel, -} from "@/config/kfpaConfig"; + RANK_TABLE_TITLE, +} from "@/config/kfpa.config"; import CustomerSatisfactionRankTable from "./CustomerSatisfactionRankTable"; import CustomerSatisfactionCommentTable from "./CustomerSatisfactionCommentTable"; import { @@ -28,12 +30,19 @@ import { getCommentColumns, getSelectedDetail, } from "@/lib/kfpa-util"; +import SectionSubTitle from "@/components/common/SectionSubTitle"; export type CustomerSatisfactionDetailProps = { selectedDiv: string; + sectionTitleSuffix?: string; + viewSubTitle?: boolean; }; -const CustomerSatisfactionDetail = ({ selectedDiv }: CustomerSatisfactionDetailProps) => { +const CustomerSatisfactionDetail = ({ + selectedDiv, + sectionTitleSuffix, + viewSubTitle = true, +}: CustomerSatisfactionDetailProps) => { const searchParams = useSearchParams(); const queryClient = useQueryClient(); const { auth } = useAuth(); @@ -58,6 +67,7 @@ const CustomerSatisfactionDetail = ({ selectedDiv }: CustomerSatisfactionDetailP }, [commentColumns, detail?.commentValues, selectedDiv]); const canEdit = hasAdminRouteParam(searchParams) && !!auth.user; + const tableHeaderClassName = "mb-1 flex min-h-9 items-center gap-3 [&>div]:mb-0"; const updateDraft = (columnKey: string, field: CommentField, value: string) => { setDraft((prev) => ({ @@ -113,49 +123,59 @@ const CustomerSatisfactionDetail = ({ selectedDiv }: CustomerSatisfactionDetailP return (
- + -
- {shouldShowRankTable && } +
+ {shouldShowRankTable && ( +
+
+ {viewSubTitle && } +
+ +
+ )} -
- {canEdit && ( -
- - {isEditing && ( +
+
+ {viewSubTitle && } + {canEdit && ( +
- )} -
- )} + {isEditing && ( + + )} +
+ )} +
- - column.key === "type" ? row.headerClassName : undefined - } - /> -
+ + column.key === "type" ? row.headerClassName : undefined + } + /> ); }; diff --git a/src/components/kfpa/CustomerSatisfactionSummary.tsx b/src/components/kfpa/CustomerSatisfactionSummary.tsx index 3f65a9b..5280982 100644 --- a/src/components/kfpa/CustomerSatisfactionSummary.tsx +++ b/src/components/kfpa/CustomerSatisfactionSummary.tsx @@ -6,16 +6,20 @@ import TopChartTable from "@/components/combo/TopChartTable"; import type { TopChartTableRow } from "@/components/combo/types"; import VerticalBar from "@/components/chart/VerticalBar"; import type { DataColumn } from "@/components/table/types"; -import { GAP_WORDING } from "@/const/kfpa.const"; + import { - CUSTOMER_SATISFACTION_DECIMAL_PLACES, - CUSTOMER_SATISFACTION_GAP_SIGN_STYLE, + KFPA_DECIMAL_POINT, + KFPA_GAP_SIGN_STYLE, DASHBOARD_METRIC_GROUP_LABEL_MAP, - DASHBOARD_TOTAL_TITLE_BY_CATEGORY, getDashboardTotalTableLayout, -} from "@/config/kfpaConfig"; + DASHBOARD_TOTAL_TITLE_BY_CATEGORY, + DIV_KEYS, + SUMMARY_CATEGORY_KEYS, + getDashboardTotalTableLayout, GAP_WORDING, SUMMARY_AVERAGE_GAP_WORDING, REGION_KEY_MAP, +} from "@/config/kfpa.config"; import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext"; import { useCsiSummaryQuery } from "@/query/statistics"; import { + getAverageGapValue, getSummaryColumnLabel, getSummaryCsiValue, getSummaryDataKey, @@ -25,16 +29,13 @@ import { } from "@/lib/kfpa-util"; import CsiFormulaNote from "@/components/kfpa/CsiFormulaNote"; -const SUMMARY_REGION_KEYS = ["-1", "1", "3", "2", "5", "6", "4"] as const; -const SUMMARY_CATEGORY_KEYS = ["2604005_E", "2604005_D", "2604005_C", "2604005_A", "2604005_B"] as const; -const SUMMARY_COLUMNS = [...SUMMARY_REGION_KEYS, ...SUMMARY_CATEGORY_KEYS] as const; - const CustomerSatisfactionSummary = () => { const { statisticsParams } = useLayoutFilter(); const { data, isLoading, isError } = useCsiSummaryQuery({ dt: statisticsParams.dt }); - const tableLayout = useMemo(() => getDashboardTotalTableLayout("-1"), ["-1"]); + const tableLayout = getDashboardTotalTableLayout("-1"); const { columns, categories, rows, chartData } = useMemo(() => { + const summaryColumns = [...DIV_KEYS, ...SUMMARY_CATEGORY_KEYS]; const waves = Array.from( new Set( Object.values(data ?? {}) @@ -46,25 +47,23 @@ const CustomerSatisfactionSummary = () => { const latestWave = waves.at(-1); const selectedWaves = latestWave == null ? [] : [latestWave - 1, latestWave]; - const currentWave = selectedWaves.at(-1); - - const columns: DataColumn>[] = SUMMARY_COLUMNS.map((key) => ({ + const columns: DataColumn>[] = summaryColumns.map((key) => ({ key, header: getSummaryColumnLabel(key), - headerClassName: key === "-1" || SUMMARY_CATEGORY_KEYS.includes(key as (typeof SUMMARY_CATEGORY_KEYS)[number]) + headerClassName: key === "-1" || SUMMARY_CATEGORY_KEYS.includes(key) ? "bg-summary" : undefined, align: "center", })); - const categories = SUMMARY_COLUMNS.map(getSummaryColumnLabel); + const categories = summaryColumns.map(getSummaryColumnLabel); const rows: TopChartTableRow[] = - selectedWaves.length === 0 || currentWave == null + selectedWaves.length === 0 || latestWave == undefined ? [] : [ { label: "응답건수", - values: SUMMARY_COLUMNS.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), currentWave)), + values: summaryColumns.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), latestWave)), preAppendCells: [ { content: "", @@ -74,38 +73,47 @@ const CustomerSatisfactionSummary = () => { ], labelClassName: "bg-gray-300 text-center font-bold", cellClassName: "bg-gray-300", - labelWidth: 90, decimalPlaces: 0, }, { label: GAP_WORDING, - values: SUMMARY_COLUMNS.map((key) => - getSummaryGapValue(data, getSummaryDataKey(key), selectedWaves[0], currentWave) + values: summaryColumns.map((key) => + getSummaryGapValue(data, getSummaryDataKey(key), selectedWaves[0], latestWave) ?? 0 ), preAppendCells: [ { content: DASHBOARD_METRIC_GROUP_LABEL_MAP.csi, - rowSpan: selectedWaves.length + 1, + rowSpan: selectedWaves.length + 2, width: 140, className: "bg-csi text-center align-middle font-bold content-text-base", }, ], labelClassName: "bg-csi text-center font-bold", - labelWidth: 80, + cellClassName: "h-12", }, ...selectedWaves.map((wave) => ({ label: getWaveLabel(wave), - values: SUMMARY_COLUMNS.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave)), + values: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? 0), labelClassName: "bg-csi text-center font-bold", - labelWidth: 80, + cellClassName: "h-12", })), + { + label: SUMMARY_AVERAGE_GAP_WORDING, + values: summaryColumns.map((key) => + REGION_KEY_MAP[key] + ? getAverageGapValue(data, getSummaryDataKey(DIV_KEYS[0]), getSummaryDataKey(key), latestWave) + : null + ), + labelClassName: "bg-csi text-center font-bold", + cellClassName: "h-12", + } ]; const chartData: ChartData = { categories, series: selectedWaves.map((wave) => ({ name: getWaveLabel(wave), - data: SUMMARY_COLUMNS.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? null), + data: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? 0), })), }; @@ -135,7 +143,7 @@ const CustomerSatisfactionSummary = () => { title={DASHBOARD_TOTAL_TITLE_BY_CATEGORY["-1"] ?? "화재보험협회 주요 고객 만족도"} columns={columns} rows={rows} - signStyle={CUSTOMER_SATISFACTION_GAP_SIGN_STYLE} + signStyle={KFPA_GAP_SIGN_STYLE} minWidth={tableLayout.tableWidth} maxWidth={tableLayout.tableWidth} chartHeight={180} @@ -144,11 +152,11 @@ const CustomerSatisfactionSummary = () => { data={chartData} height="100%" paletteVarNames={["--chart-5", "--chart-7"]} - valueFormatter={(value) => value.toFixed(CUSTOMER_SATISFACTION_DECIMAL_PLACES)} + valueFormatter={(value) => value.toFixed(KFPA_DECIMAL_POINT)} barMaxWidth={30} showFocusLabel="all" labelOptions={{ position: "top", distance: 4 }} - grid={{ left: 0, right: 0, top: 40, bottom: 5 }} + grid={{ left: 0, right: 0, top: 20, bottom: 5 }} xAxis={{ type: "category", data: categories, diff --git a/src/components/kfpa/CustomerSatisfactionTotal.tsx b/src/components/kfpa/CustomerSatisfactionTotal.tsx index a9ffaae..0aef827 100644 --- a/src/components/kfpa/CustomerSatisfactionTotal.tsx +++ b/src/components/kfpa/CustomerSatisfactionTotal.tsx @@ -9,22 +9,23 @@ import { useCsiDataQuery } from "@/query/statistics"; import type { DashboardMetricConfig, DashboardMetricGroup } from "@/types/kfpa"; import VerticalBar from "@/components/chart/VerticalBar"; import type { DataColumn } from "@/components/table/types"; -import { GAP_WORDING } from "@/const/kfpa.const"; + import { - CUSTOMER_SATISFACTION_GAP_SIGN_STYLE, + KFPA_GAP_SIGN_STYLE, DASHBOARD_METRIC_GROUP_LABEL_MAP, DASHBOARD_TOTAL_TITLE_BY_CATEGORY, REGION_KEY_MAP, getDashboardMetricConfigs, getDashboardTotalColumnEntries, - getDashboardTotalTableLayout, -} from "@/config/kfpaConfig"; -import type { DashboardTotalTableLayout } from "@/config/kfpaConfig"; + getDashboardTotalTableLayout, GAP_WORDING, AVERAGE_GAP_WORDING, DIV_KEYS, +} from "@/config/kfpa.config"; +import type { DashboardTotalTableLayout } from "@/config/kfpa.config"; import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext"; import { + getAverageGapValue, getCsiDataByWave, getCsiMetricGapValue, - getCsiMetricValue, + getCsiMetricValue, getSummaryDataKey, getWaveLabel, } from "@/lib/kfpa-util"; @@ -95,7 +96,9 @@ const CustomerSatisfactionTotal = () => { [categoryKey] ); - const { categoryColumns, categories, rows, verticalChartData } = useMemo(() => { + const addAverageGapRow = useMemo(() => categoryKey === "2601009_A", [categoryKey]); + + const { categoryColumns, categories, rows, chartData } = useMemo(() => { const waves = Array.from( new Set( Object.values(data ?? {}) @@ -116,7 +119,7 @@ const CustomerSatisfactionTotal = () => { const categories = divisionColumns.map((div) => div.label); const rows: TopChartTableRow[] = - selectedWaves.length === 0 + selectedWaves.length === 0 || latestWave == undefined ? [] : metrics.flatMap((metric, metricIndex) => [ @@ -130,6 +133,13 @@ const CustomerSatisfactionTotal = () => { label: getWaveLabel(wave), values: divisionColumns.map((div) => getCsiMetricValue(data, div.key, wave, metric.key)), })), + ...(addAverageGapRow && metric.group === "csi" + ? [{ + label: AVERAGE_GAP_WORDING, + values: divisionColumns.map((div) => getAverageGapValue(data, DIV_KEYS[0], div.key, latestWave)), + }] + : [] + ), ].map((row, rowIndex) => ({ ...row, preAppendCells: getPreAppendCells( @@ -137,7 +147,7 @@ const CustomerSatisfactionTotal = () => { metric, metricIndex, rowIndex, - selectedWaves.length + 1, + selectedWaves.length + (addAverageGapRow && metric.group === "csi"? 2 : 1), tableLayout ), labelClassName: cn(`bg-${metric.group}`, "text-center", row.label !== GAP_WORDING && "font-bold"), @@ -145,7 +155,7 @@ const CustomerSatisfactionTotal = () => { })) ); - const verticalChartData: ChartData = { + const chartData: ChartData = { categories, series: selectedWaves.map((wave) => ({ name: getWaveLabel(wave), @@ -157,7 +167,7 @@ const CustomerSatisfactionTotal = () => { categoryColumns, categories, rows, - verticalChartData, + chartData, }; }, [data, divisionColumns, metrics, tableLayout]); @@ -197,26 +207,26 @@ const CustomerSatisfactionTotal = () => { rows={rows} sectionRows={[ { - afterRowIndex: 2, + afterRowIndex: addAverageGapRow? 3 : 2, content: "고객만족지수 세부 항목", className: "bg-gray-400 text-center font-bold", bodyClassName: "bg-gray-400 text-center", }, ]} - signStyle={CUSTOMER_SATISFACTION_GAP_SIGN_STYLE} + signStyle={KFPA_GAP_SIGN_STYLE} minWidth={divisionColumns.length > 1 ? 1120 : 900} maxWidth={tableLayout.tableWidth} chartHeight={200} chart={ value.toFixed(2)} barMaxWidth={30} showFocusLabel="all" labelOptions={{ position: "top", distance: 4 }} - grid={{ left: 0, right: 0, top: 40, bottom: 5 }} + grid={{ left: 0, right: 0, top: 20, bottom: 5 }} xAxis={{ type: "category", data: categories, diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index a63c744..ba985d4 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -4,7 +4,7 @@ import Image from "next/image"; import {Button} from "@/components/ui/button"; import {LogIn, LogOut} from "lucide-react"; import {cn} from "@/lib/utils"; -import {SITE_TITLE} from "@/config/kfpaConfig"; +import {SITE_TITLE} from "@/config/kfpa.config"; import {TopMenuItem} from "@/config/menu.type"; import {usePathname} from "next/navigation"; @@ -38,7 +38,7 @@ const Header = ({