develop #1
@@ -3,7 +3,7 @@
|
||||
import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext";
|
||||
import CustomerSatisfactionTotal from "@/components/kfpa/CustomerSatisfactionTotal";
|
||||
import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDetail";
|
||||
import { COMMENT_TABLE_TITLE } from "@/config/kfpaConfig";
|
||||
import { COMMENT_TABLE_TITLE } from "@/config/kfpa.config";
|
||||
|
||||
const BridgePlatformPage = () => {
|
||||
const { selectedDiv } = useLayoutFilter();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext";
|
||||
import CustomerSatisfactionTotal from "@/components/kfpa/CustomerSatisfactionTotal";
|
||||
import CustomerSatisfactionDetail from "@/components/kfpa/CustomerSatisfactionDetail";
|
||||
import { COMMENT_TABLE_TITLE } from "@/config/kfpaConfig";
|
||||
import { COMMENT_TABLE_TITLE } from "@/config/kfpa.config";
|
||||
|
||||
const UcisPage = () => {
|
||||
const { selectedDiv } = useLayoutFilter();
|
||||
|
||||
@@ -530,7 +530,7 @@
|
||||
|
||||
.kfpa-table tbody th,
|
||||
.kfpa-table tbody td {
|
||||
padding: 7px 12px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
.kfpa-table thead tr.kfpa-table__chart-row > th,
|
||||
|
||||
@@ -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 { CUSTOMER_SATISFACTION_DECIMAL_PLACES } from "@/config/kfpa.config";
|
||||
|
||||
export type TopChartTableProps = {
|
||||
title?: string;
|
||||
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
getDashboardRankRows,
|
||||
getSideMenuLabel,
|
||||
RANK_TABLE_TITLE,
|
||||
} from "@/config/kfpaConfig";
|
||||
} from "@/config/kfpa.config";
|
||||
import CustomerSatisfactionRankTable from "./CustomerSatisfactionRankTable";
|
||||
import CustomerSatisfactionCommentTable from "./CustomerSatisfactionCommentTable";
|
||||
import {
|
||||
|
||||
@@ -6,7 +6,7 @@ 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,
|
||||
@@ -14,11 +14,12 @@ import {
|
||||
DASHBOARD_TOTAL_TITLE_BY_CATEGORY,
|
||||
DIV_KEYS,
|
||||
SUMMARY_CATEGORY_KEYS,
|
||||
getDashboardTotalTableLayout,
|
||||
} from "@/config/kfpaConfig";
|
||||
getDashboardTotalTableLayout, GAP_WORDING, SUMMARY_AVERAGE_GAP_WORDING,
|
||||
} from "@/config/kfpa.config";
|
||||
import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext";
|
||||
import { useCsiSummaryQuery } from "@/query/statistics";
|
||||
import {
|
||||
getAverageGapValue,
|
||||
getSummaryColumnLabel,
|
||||
getSummaryCsiValue,
|
||||
getSummaryDataKey,
|
||||
@@ -46,8 +47,6 @@ const CustomerSatisfactionSummary = () => {
|
||||
|
||||
const latestWave = waves.at(-1);
|
||||
const selectedWaves = latestWave == null ? [] : [latestWave - 1, latestWave];
|
||||
const currentWave = selectedWaves.at(-1);
|
||||
|
||||
const columns: DataColumn<Record<string, unknown>>[] = summaryColumns.map((key) => ({
|
||||
key,
|
||||
header: getSummaryColumnLabel(key),
|
||||
@@ -59,12 +58,12 @@ const CustomerSatisfactionSummary = () => {
|
||||
const categories = summaryColumns.map(getSummaryColumnLabel);
|
||||
|
||||
const rows: TopChartTableRow[] =
|
||||
selectedWaves.length === 0 || currentWave == null
|
||||
selectedWaves.length === 0 || latestWave == undefined
|
||||
? []
|
||||
: [
|
||||
{
|
||||
label: "응답건수",
|
||||
values: summaryColumns.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), currentWave)),
|
||||
values: summaryColumns.map((key) => getSummarySampleCount(data, getSummaryDataKey(key), latestWave)),
|
||||
preAppendCells: [
|
||||
{
|
||||
content: "",
|
||||
@@ -74,38 +73,40 @@ const CustomerSatisfactionSummary = () => {
|
||||
],
|
||||
labelClassName: "bg-gray-300 text-center font-bold",
|
||||
cellClassName: "bg-gray-300",
|
||||
labelWidth: 90,
|
||||
decimalPlaces: 0,
|
||||
},
|
||||
{
|
||||
label: GAP_WORDING,
|
||||
values: summaryColumns.map((key) =>
|
||||
getSummaryGapValue(data, getSummaryDataKey(key), selectedWaves[0], currentWave)
|
||||
getSummaryGapValue(data, getSummaryDataKey(key), selectedWaves[0], latestWave)
|
||||
),
|
||||
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,
|
||||
},
|
||||
...selectedWaves.map((wave) => ({
|
||||
label: getWaveLabel(wave),
|
||||
values: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave)),
|
||||
labelClassName: "bg-csi text-center font-bold",
|
||||
labelWidth: 80,
|
||||
})),
|
||||
{
|
||||
label: SUMMARY_AVERAGE_GAP_WORDING,
|
||||
values: summaryColumns.map((key) => getAverageGapValue(data, getSummaryDataKey(DIV_KEYS[0]), getSummaryDataKey(key), latestWave)),
|
||||
labelClassName: "bg-csi text-center font-bold",
|
||||
}
|
||||
];
|
||||
|
||||
const chartData: ChartData = {
|
||||
categories,
|
||||
series: selectedWaves.map((wave) => ({
|
||||
name: getWaveLabel(wave),
|
||||
data: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? null),
|
||||
data: summaryColumns.map((key) => getSummaryCsiValue(data, getSummaryDataKey(key), wave) ?? 0),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -148,7 +149,7 @@ const CustomerSatisfactionSummary = () => {
|
||||
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,
|
||||
|
||||
@@ -9,7 +9,7 @@ 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,
|
||||
DASHBOARD_METRIC_GROUP_LABEL_MAP,
|
||||
@@ -17,14 +17,15 @@ import {
|
||||
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,7 +207,7 @@ 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",
|
||||
@@ -209,14 +219,14 @@ const CustomerSatisfactionTotal = () => {
|
||||
chartHeight={200}
|
||||
chart={
|
||||
<VerticalBar
|
||||
data={verticalChartData}
|
||||
data={chartData}
|
||||
height="100%"
|
||||
paletteVarNames={["--chart-5", "--chart-7"]}
|
||||
valueFormatter={(value) => 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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
import type { TopChartTableRow } from "@/components/combo/types";
|
||||
import type { SignStyle } from "@/components/table/types";
|
||||
import { GAP_WORDING } from "@/const/kfpa.const";
|
||||
|
||||
export const SITE_TITLE = "고객 관계 성과측정 실시간 대시보드";
|
||||
|
||||
export const CUSTOMER_SATISFACTION_DECIMAL_PLACES = 2;
|
||||
|
||||
export const RANK_TABLE_TITLE = "물건 유형별 고객만족지수";
|
||||
|
||||
export const COMMENT_TABLE_TITLE = "고객 관점의 성과분류";
|
||||
export const COMMENT_TABLE_TITLE = "고객 관점 성과 분류";
|
||||
|
||||
export const CUSTOMER_SATISFACTION_DECIMAL_PLACES = 2;
|
||||
|
||||
export const VIEW_DECIMAL_POINT = 0;
|
||||
|
||||
export const GAP_WORDING = "전년 대비";
|
||||
|
||||
export const SUMMARY_AVERAGE_GAP_WORDING = "지역본부 평균 대비";
|
||||
|
||||
export const AVERAGE_GAP_WORDING = "평균 대비";
|
||||
|
||||
export const CUSTOMER_SATISFACTION_GAP_SIGN_STYLE: SignStyle<TopChartTableRow> = {
|
||||
rowSelector: (row) => row.label === GAP_WORDING,
|
||||
rowSelector: (row) =>
|
||||
[GAP_WORDING, AVERAGE_GAP_WORDING, SUMMARY_AVERAGE_GAP_WORDING].includes(row.label),
|
||||
display: "arrow",
|
||||
arrowWithNumber: true,
|
||||
paint: "text",
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
CATEGORY_PATH_MAP,
|
||||
SIDE_MENU_KEY_MAP_BY_CATEGORY,
|
||||
SIDE_MENU_KEYS_BY_CATEGORY
|
||||
} from "./kfpaConfig";
|
||||
} from "./kfpa.config";
|
||||
import { Building } from 'lucide-react';
|
||||
|
||||
export const TOP_MENUS: TopMenuItem[] = Object.entries(CATEGORY_KEY_MAP).map(
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export const VIEW_DECIMAL_POINT = 0;
|
||||
export const GAP_WORDING = "전년 대비";
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
DASHBOARD_COMMENT_COLUMNS,
|
||||
DIV_KEY_MAP,
|
||||
REGION_KEY_MAP,
|
||||
} from "@/config/kfpaConfig";
|
||||
} from "@/config/kfpa.config";
|
||||
import type {
|
||||
CommentColumn,
|
||||
CommentValue,
|
||||
@@ -72,6 +72,21 @@ export const getSummaryGapValue = (
|
||||
return currentValue - previousValue;
|
||||
};
|
||||
|
||||
export const getAverageGapValue = (
|
||||
dataMap: CsiSummaryMap | undefined,
|
||||
averageKey: string,
|
||||
key: string,
|
||||
wave: number,
|
||||
) => {
|
||||
if(averageKey === key) return null;
|
||||
|
||||
const averageValue = getSummaryCsiValue(dataMap, averageKey, wave);
|
||||
const currentValue = getSummaryCsiValue(dataMap, key, wave);
|
||||
|
||||
if (averageValue == null || currentValue == null) return null;
|
||||
return currentValue - averageValue;
|
||||
};
|
||||
|
||||
export const getSelectedDetail = (data: Record<string, DivDetailData> | undefined, selectedDiv: string) => {
|
||||
if (!data) return undefined;
|
||||
return data[selectedDiv] ?? Object.values(data)[0];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { clsx, type ClassValue } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
import {VIEW_DECIMAL_POINT} from "@/const/kfpa.const";
|
||||
import {VIEW_DECIMAL_POINT} from "@/config/kfpa.config";
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
|
||||
@@ -2,7 +2,7 @@ import type {
|
||||
CATEGORY_KEY_MAP,
|
||||
DASHBOARD_COMMENT_ROWS_BY_CATEGORY,
|
||||
DASHBOARD_METRICS_BY_CATEGORY,
|
||||
} from "@/config/kfpaConfig";
|
||||
} from "@/config/kfpa.config";
|
||||
|
||||
export type CategoryKey = keyof typeof CATEGORY_KEY_MAP;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user