From cbb4c7fe0b94459162ad5e998bc05cd293e0ff96 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 11 Aug 2025 09:02:00 +0000 Subject: (대표님) 입찰, EDP 변경사항 대응, spreadJS 오류 수정, 벤더실사 수정 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/form-data/sedp-compare-dialog.tsx | 233 ++++++++++++++------------- 1 file changed, 121 insertions(+), 112 deletions(-) (limited to 'components/form-data/sedp-compare-dialog.tsx') diff --git a/components/form-data/sedp-compare-dialog.tsx b/components/form-data/sedp-compare-dialog.tsx index 647f2810..1a9938bd 100644 --- a/components/form-data/sedp-compare-dialog.tsx +++ b/components/form-data/sedp-compare-dialog.tsx @@ -11,6 +11,8 @@ import { DataTableColumnJSON } from "./form-data-table-columns"; import { ExcelDownload } from "./sedp-excel-download"; import { Switch } from "../ui/switch"; import { Card, CardContent } from "@/components/ui/card"; +import { useTranslation } from "@/i18n/client" +import { useParams } from "next/navigation" interface SEDPCompareDialogProps { isOpen: boolean; @@ -56,85 +58,6 @@ const DisplayValue = ({ value, uom, isSedp = false }: { value: any; uom?: string ); }; -// 범례 컴포넌트 -const ColorLegend = () => { - return ( -
-
- - 범례: -
-
-
-
- 로컬 값 -
-
-
- SEDP 값 -
-
-
- ); -}; - -// 확장 가능한 차이점 표시 컴포넌트 -const DifferencesCard = ({ - attributes, - columnLabelMap, - showOnlyDifferences -}: { - attributes: ComparisonResult['attributes']; - columnLabelMap: Record; - showOnlyDifferences: boolean; -}) => { - const attributesToShow = showOnlyDifferences - ? attributes.filter(attr => !attr.isMatching) - : attributes; - - if (attributesToShow.length === 0) { - return ( -
- 모든 속성이 일치합니다 -
- ); - } - - return ( -
- {attributesToShow.map((attr) => ( - - -
- {attr.label} - {attr.uom && ({attr.uom})} -
- {attr.isMatching ? ( -
- -
- ) : ( -
-
- 로컬: - - - -
-
- SEDP: - - - -
-
- )} -
-
- ))} -
- ); -}; export function SEDPCompareDialog({ isOpen, @@ -145,6 +68,92 @@ export function SEDPCompareDialog({ formCode, fetchTagDataFromSEDP, }: SEDPCompareDialogProps) { + + const params = useParams() || {} + const lng = params.lng ? String(params.lng) : "ko" + const { t } = useTranslation(lng, "engineering") + + // 범례 컴포넌트 + const ColorLegend = () => { + return ( +
+
+ + {t("labels.legend")}: +
+
+
+
+ {t("labels.localValue")} +
+
+
+ {t("labels.sedpValue")} +
+
+
+ ); + }; + + // 확장 가능한 차이점 표시 컴포넌트 + const DifferencesCard = ({ + attributes, + columnLabelMap, + showOnlyDifferences + }: { + attributes: ComparisonResult['attributes']; + columnLabelMap: Record; + showOnlyDifferences: boolean; + }) => { + const attributesToShow = showOnlyDifferences + ? attributes.filter(attr => !attr.isMatching) + : attributes; + + if (attributesToShow.length === 0) { + return ( +
+ {t("messages.allAttributesMatch")} +
+ ); + } + + return ( +
+ {attributesToShow.map((attr) => ( + + +
+ {attr.label} + {attr.uom && ({attr.uom})} +
+ {attr.isMatching ? ( +
+ +
+ ) : ( +
+
+ 로컬: + + + +
+
+ SEDP: + + + +
+
+ )} +
+
+ ))} +
+ ); + }; + + const [isLoading, setIsLoading] = React.useState(false); const [comparisonResults, setComparisonResults] = React.useState([]); const [activeTab, setActiveTab] = React.useState("all"); @@ -181,7 +190,7 @@ export function SEDPCompareDialog({ // Filter and search results const filteredResults = React.useMemo(() => { let results = comparisonResults; - + // Filter by tab switch (activeTab) { case "matching": @@ -198,8 +207,8 @@ export function SEDPCompareDialog({ // Apply search filter if (searchTerm.trim()) { const search = searchTerm.toLowerCase(); - results = results.filter(r => - r.tagNo.toLowerCase().includes(search) || + results = results.filter(r => + r.tagNo.toLowerCase().includes(search) || r.tagDesc.toLowerCase().includes(search) ); } @@ -291,7 +300,7 @@ export function SEDPCompareDialog({ // Compare attributes const attributeComparisons = columnsJSON - .filter(col => col.key !== "TAG_NO" && col.key !== "TAG_DESC"&& col.key !== "status") + .filter(col => col.key !== "TAG_NO" && col.key !== "TAG_DESC" && col.key !== "status") .map(col => { const localValue = localItem[col.key]; const sedpValue = sedpItem.attributes.get(col.key); @@ -370,7 +379,7 @@ export function SEDPCompareDialog({ - SEDP 데이터 비교 + {t("dialogs.sedpDataComparison")}
@@ -380,22 +389,22 @@ export function SEDPCompareDialog({ id="show-differences" />
- + {/* 검색 입력 */}
setSearchTerm(e.target.value)} className="pl-8 w-64" />
- +
{matchingTags} / {totalTags} 일치 {totalMissingTags > 0 ? `(${totalMissingTags} 누락)` : ''} @@ -411,7 +420,7 @@ export function SEDPCompareDialog({ ) : ( )} - 새로고침 + {t("buttons.refresh")}
@@ -424,11 +433,11 @@ export function SEDPCompareDialog({ - 전체 태그 ({totalTags}) - 차이 있음 ({nonMatchingTags}) - 일치함 ({matchingTags}) + {t("tabs.allTags")} ({totalTags}) + {t("tabs.differences")} ({nonMatchingTags}) + {t("tabs.matching")} ({matchingTags}) 0 ? "text-red-500" : ""}> - 누락된 태그 ({totalMissingTags}) + {t("tabs.missingTags")} ({totalMissingTags}) @@ -436,19 +445,19 @@ export function SEDPCompareDialog({ {isLoading ? (
- 데이터 비교 중... + {t("messages.dataComparing")}
) : activeTab === "missing" ? ( // Missing tags tab content
{missingTags.localOnly.length > 0 && (
-

로컬에만 있는 태그 ({missingTags.localOnly.length})

+

{t("sections.localOnlyTags")} ({missingTags.localOnly.length})

- Tag Number - Tag Description + {t("labels.tagNo")} + {t("labels.description")} @@ -465,12 +474,12 @@ export function SEDPCompareDialog({ {missingTags.sedpOnly.length > 0 && (
-

SEDP에만 있는 태그 ({missingTags.sedpOnly.length})

+

{t("sections.sedpOnlyTags")} ({missingTags.sedpOnly.length})

- Tag Number - Tag Description + {t("labels.tagNo")} + {t("labels.description")} @@ -487,7 +496,7 @@ export function SEDPCompareDialog({ {totalMissingTags === 0 && (
- 모든 태그가 양쪽 시스템에 존재합니다 + {t("messages.allTagsExistInBothSystems")}
)} @@ -498,9 +507,9 @@ export function SEDPCompareDialog({ - Tag Number - Tag Description - 상태 + {t("labels.tagNo")} + {t("labels.description")} + {t("labels.status")} 차이점 개수 @@ -508,7 +517,7 @@ export function SEDPCompareDialog({ {filteredResults.map((result) => ( {/* 메인 행 */} - toggleRowExpansion(result.tagNo)} > @@ -533,29 +542,29 @@ export function SEDPCompareDialog({ {result.isMatching ? ( - 일치 + {t("labels.matching")} ) : ( - 차이 + {t("labels.different")} )} {!result.isMatching && ( - {result.attributes.filter(attr => !attr.isMatching).length}개 속성이 다름 + {result.attributes.filter(attr => !attr.isMatching).length}{t("sections.differenceCount")} )} - + {/* 확장된 차이점 표시 행 */} {expandedRows.has(result.tagNo) && ( - ) : (
- {searchTerm ? "검색 결과가 없습니다" : "현재 필터에 맞는 태그가 없습니다"} + {searchTerm ? t("messages.noSearchResults") : t("messages.noMatchingTags")}
)} @@ -583,7 +592,7 @@ export function SEDPCompareDialog({ formCode={formCode} disabled={isLoading || (nonMatchingTags === 0 && totalMissingTags === 0)} /> - + -- cgit v1.2.3