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/update-form-sheet.tsx | 55 ++++++++++++++++++------------ 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'components/form-data/update-form-sheet.tsx') diff --git a/components/form-data/update-form-sheet.tsx b/components/form-data/update-form-sheet.tsx index 5666a116..91cb7a07 100644 --- a/components/form-data/update-form-sheet.tsx +++ b/components/form-data/update-form-sheet.tsx @@ -45,6 +45,8 @@ import { import { DataTableColumnJSON } from "./form-data-table-columns"; import { updateFormDataInDB } from "@/lib/forms/services"; import { cn } from "@/lib/utils"; +import { useParams } from "next/navigation"; +import { useTranslation } from "@/i18n/client"; /** ============================================================= * 🔄 UpdateTagSheet with grouped fields by `head` property @@ -86,6 +88,10 @@ export function UpdateTagSheet({ const [isPending, startTransition] = React.useTransition(); const router = useRouter(); + const params = useParams(); + const lng = (params?.lng as string) || "ko"; + const { t } = useTranslation(lng, "engineering"); + /* ---------------------------------------------------------------- * 1️⃣ Editable‑field helpers (unchanged) * --------------------------------------------------------------*/ @@ -105,17 +111,17 @@ export function UpdateTagSheet({ const isFieldReadOnly = React.useCallback((column: DataTableColumnJSON) => !isFieldEditable(column), [isFieldEditable]); const getReadOnlyReason = React.useCallback((column: DataTableColumnJSON) => { - if (column.shi) return "SHI‑only field (managed by SHI system)"; + if (column.shi) return t("updateTagSheet.readOnlyReasons.shiOnly"); if (column.key !== "TAG_NO" && column.key !== "TAG_DESC") { if (!rowData?.TAG_NO || !editableFieldsMap.has(rowData.TAG_NO)) { - return "No editable fields information for this TAG"; + return t("updateTagSheet.readOnlyReasons.noEditableFields"); } if (!editableFields.includes(column.key)) { - return "Not editable for this TAG class"; + return t("updateTagSheet.readOnlyReasons.notEditableForTag"); } } - return "Read‑only field"; - }, [rowData?.TAG_NO, editableFieldsMap, editableFields]); + return t("updateTagSheet.readOnlyReasons.readOnly"); + }, [rowData?.TAG_NO, editableFieldsMap, editableFields, t]); /* ---------------------------------------------------------------- * 2️⃣ Zod dynamic schema & form state (unchanged) @@ -220,7 +226,7 @@ export function UpdateTagSheet({ return; } - toast.success("Updated successfully!"); + toast.success(t("updateTagSheet.messages.updateSuccess")); const updatedData = { ...rowData, ...finalValues, TAG_NO: rowData?.TAG_NO }; onUpdateSuccess?.(updatedData); @@ -228,7 +234,7 @@ export function UpdateTagSheet({ onOpenChange(false); } catch (error) { console.error("Error updating form data:", error); - toast.error("An unexpected error occurred while updating"); + toast.error(t("updateTagSheet.messages.updateError")); } }); } @@ -243,15 +249,18 @@ export function UpdateTagSheet({ - Update Row – {rowData?.TAG_NO || "Unknown TAG"} + {t("updateTagSheet.title")} – {rowData?.TAG_NO || t("updateTagSheet.unknownTag")} - Modify the fields below and save changes. Fields with - are read‑only. + {t("updateTagSheet.description")} + + {t("updateTagSheet.readOnlyIndicator")}
- {editableFieldCount} of {columns.length} fields are editable for - this TAG. + {t("updateTagSheet.editableFieldsCount", { + editableCount: editableFieldCount, + totalCount: columns.length + })}
@@ -303,7 +312,7 @@ export function UpdateTagSheet({ value={field.value ?? ""} className={cn( isReadOnly && - "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", + "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", )} /> @@ -337,17 +346,20 @@ export function UpdateTagSheet({ "w-full justify-between", !field.value && "text-muted-foreground", isReadOnly && - "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", + "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", )} > - {field.value ? col.options?.find((o) => o === field.value) : "Select an option"} + {field.value ? + col.options?.find((o) => o === field.value) : + t("updateTagSheet.selectOption") + } - - No option found. + + {t("updateTagSheet.noOptionFound")} {col.options?.map((opt) => ( @@ -391,7 +403,7 @@ export function UpdateTagSheet({ {...field} className={cn( isReadOnly && - "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", + "bg-gray-100 text-gray-600 cursor-not-allowed border-gray-300", )} /> @@ -415,11 +427,12 @@ export function UpdateTagSheet({ @@ -427,4 +440,4 @@ export function UpdateTagSheet({
); -} +} \ No newline at end of file -- cgit v1.2.3