260518_01_ENH: 순위 테이블, 코멘트 테이블에 타이틀 추가 및

섹션 타이틀에 SUFFIX 추가
This commit is contained in:
2026-05-18 09:22:08 +09:00
parent c197fbcde9
commit eddf9da03e
6 changed files with 100 additions and 54 deletions

View File

@@ -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/kfpaConfig";
const BridgePlatformPage = () => {
const { selectedDiv } = useLayoutFilter();
return selectedDiv === "-1" ? <CustomerSatisfactionTotal /> : <CustomerSatisfactionDetail selectedDiv={selectedDiv} />;
return selectedDiv === "-1"
? <CustomerSatisfactionTotal />
: <CustomerSatisfactionDetail
selectedDiv={selectedDiv}
viewSubTitle={false}
sectionTitleSuffix={COMMENT_TABLE_TITLE}
/>;
};
export default BridgePlatformPage;

View File

@@ -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/kfpaConfig";
const UcisPage = () => {
const { selectedDiv } = useLayoutFilter();
return selectedDiv === "-1" ? <CustomerSatisfactionTotal /> : <CustomerSatisfactionDetail selectedDiv={selectedDiv} />;
return selectedDiv === "-1"
? <CustomerSatisfactionTotal />
: <CustomerSatisfactionDetail
selectedDiv={selectedDiv}
viewSubTitle={false}
sectionTitleSuffix={COMMENT_TABLE_TITLE}
/>;
};
export default UcisPage;

View File

@@ -0,0 +1,10 @@
const SectionSubTitle = ({title}:{title:string}) => {
return (
<div className="font-semibold flex items-center gap-2 content-text-lg mb-1">
<span className="w-3 h-3 bg-black-600" />
{title}
</div>
);
}
export default SectionSubTitle;

View File

@@ -16,9 +16,11 @@ import { useLayoutFilter } from "@/components/layout/LayoutCategoryContext";
import { useAuth } from "@/hooks/useAuth";
import { cn } from "@/lib/utils";
import {
COMMENT_TABLE_TITLE,
getDashboardCommentRows,
getDashboardRankRows,
getSideMenuLabel,
RANK_TABLE_TITLE,
} from "@/config/kfpaConfig";
import CustomerSatisfactionRankTable from "./CustomerSatisfactionRankTable";
import CustomerSatisfactionCommentTable from "./CustomerSatisfactionCommentTable";
@@ -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 (
<div className="w-full">
<SectionTitle title={`${getSideMenuLabel(categoryKey, selectedDiv)} 상세 내역`} />
<SectionTitle title={`${getSideMenuLabel(categoryKey, selectedDiv)} ${sectionTitleSuffix ?? '상세 내역'}`} />
<div className={cn("mt-6 flex w-full items-start gap-16 overflow-x-auto pb-2", canEdit && "pt-10")}>
{shouldShowRankTable && <CustomerSatisfactionRankTable detail={detail} rankRows={rankRows} />}
<div className="mt-4 flex w-full items-start gap-16 overflow-x-auto pb-2">
{shouldShowRankTable && (
<div className="shrink-0 w-[285px]">
<div className={tableHeaderClassName}>
{viewSubTitle && <SectionSubTitle title={RANK_TABLE_TITLE} />}
</div>
<CustomerSatisfactionRankTable detail={detail} rankRows={rankRows} />
</div>
)}
<div className={cn("relative min-w-[760px] flex-1", !shouldShowRankTable && "w-full")}>
{canEdit && (
<div className="absolute -top-10 right-0 flex justify-end gap-2">
<Button
type="button"
className={
isEditing
? "gap-2 border border-transparent bg-red-600 text-white w-25 shadow-sm hover:bg-red-500 hover:text-white"
: "gap-2 border border-transparent bg-green-600 text-white w-25 shadow-sm hover:bg-green-500 hover:text-white"
}
disabled={writeMutation.isPending}
onClick={handleEditToggle}
>
{isEditing ? (
<>
<Save className="w-4 h-4" />
<span className="hidden sm:inline">저장</span>
</>
) : (
<>
<Pencil className="w-4 h-4" />
<span className="hidden sm:inline">수정</span>
</>
)}
</Button>
{isEditing && (
<div className={cn("min-w-[760px] flex-1", !shouldShowRankTable && "w-full")}>
<div className={cn(tableHeaderClassName, viewSubTitle ? "justify-between" : "justify-end")}>
{viewSubTitle && <SectionSubTitle title={COMMENT_TABLE_TITLE} />}
{canEdit && (
<div className="flex shrink-0 justify-end gap-2">
<Button
type="button"
className="gap-2 border border-transparent bg-black-400 text-white w-25 shadow-sm hover:bg-black-200 hover:text-white"
className={
isEditing
? "gap-2 border border-transparent bg-red-600 text-white w-25 shadow-sm hover:bg-red-500 hover:text-white"
: "gap-2 border border-transparent bg-green-600 text-white w-25 shadow-sm hover:bg-green-500 hover:text-white"
}
disabled={writeMutation.isPending}
onClick={handleCancelEdit}
onClick={handleEditToggle}
>
<X className="w-4 h-4" />
<span className="hidden sm:inline">취소</span>
{isEditing ? (
<>
<Save className="w-4 h-4" />
<span className="hidden sm:inline">저장</span>
</>
) : (
<>
<Pencil className="w-4 h-4" />
<span className="hidden sm:inline">수정</span>
</>
)}
</Button>
)}
</div>
)}
{isEditing && (
<Button
type="button"
className="gap-2 border border-transparent bg-black-400 text-white w-25 shadow-sm hover:bg-black-200 hover:text-white"
disabled={writeMutation.isPending}
onClick={handleCancelEdit}
>
<X className="w-4 h-4" />
<span className="hidden sm:inline">취소</span>
</Button>
)}
</div>
)}
</div>
<CustomerSatisfactionCommentTable
columns={commentColumns}

View File

@@ -43,18 +43,16 @@ const CustomerSatisfactionRankTable = ({ detail, rankRows }: CustomerSatisfactio
}, [detail?.csiRanks, rankRows]);
return (
<div className="shrink-0 w-[285px]">
<DataTable
columns={rankColumns}
rows={rows}
tableClassName="kfpa-table kfpa-detail-table kfpa-detail-rank-table"
wrapperClassName="w-full"
minWidth={285}
getCellClassName={(row, column) =>
column.key === "type" ? row.headerClassName : undefined
}
/>
</div>
<DataTable
columns={rankColumns}
rows={rows}
tableClassName="kfpa-table kfpa-detail-table kfpa-detail-rank-table"
wrapperClassName="w-full"
minWidth={285}
getCellClassName={(row, column) =>
column.key === "type" ? row.headerClassName : undefined
}
/>
);
};

View File

@@ -1,11 +1,15 @@
export const SITE_TITLE = "고객 관계 성과측정 실시간 대시보드";
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 CUSTOMER_SATISFACTION_GAP_SIGN_STYLE: SignStyle<TopChartTableRow> = {
rowSelector: (row) => row.label === GAP_WORDING,
display: "arrow",
@@ -70,7 +74,7 @@ const SIDE_MENU_ENTRIES_BY_CATEGORY = {
],
"2604005_D": [
["-1", CATEGORY_KEY_MAP["2604005_D"]],
["21", "손해데이터팀"],
["21", "인슈데이터팀"],
],
"2604005_C": [["-1", CATEGORY_KEY_MAP["2604005_C"]]],
"2604005_A": [["-1", CATEGORY_KEY_MAP["2604005_A"]]],