From f7f5069a2209cfa39b65f492f32270a5f554bed0 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 23 Oct 2025 10:10:21 +0000 Subject: (대표님) EDP 해양 관련 개발 사항들 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/form-data-plant/sedp-components.tsx | 193 +++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 components/form-data-plant/sedp-components.tsx (limited to 'components/form-data-plant/sedp-components.tsx') diff --git a/components/form-data-plant/sedp-components.tsx b/components/form-data-plant/sedp-components.tsx new file mode 100644 index 00000000..869f730c --- /dev/null +++ b/components/form-data-plant/sedp-components.tsx @@ -0,0 +1,193 @@ +"use client"; + +import * as React from "react"; +import { useParams } from "next/navigation"; +import { useTranslation } from "@/i18n/client"; +import { Button } from "@/components/ui/button"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle +} from "@/components/ui/dialog"; +import { Loader, Send, AlertTriangle, CheckCircle } from "lucide-react"; +import { Badge } from "@/components/ui/badge"; +import { Progress } from "@/components/ui/progress"; + +// SEDP Send Confirmation Dialog +export function SEDPConfirmationDialog({ + isOpen, + onClose, + onConfirm, + formName, + tagCount, + isLoading +}: { + isOpen: boolean; + onClose: () => void; + onConfirm: () => void; + formName: string; + tagCount: number; + isLoading: boolean; +}) { + const params = useParams(); + const lng = (params?.lng as string) || "ko"; + const { t } = useTranslation(lng, "engineering"); + + return ( + + + + {t("sedp.sendDataTitle")} + + {t("sedp.sendDataDescription")} + + + +
+
+
{t("sedp.formName")}:
+
{formName}
+ +
{t("sedp.totalTags")}:
+
{tagCount}
+
+ +
+ +
+ {t("sedp.warningMessage")} +
+
+
+ + + + + +
+
+ ); +} + +// SEDP Status Dialog - shows the result of the SEDP operation +export function SEDPStatusDialog({ + isOpen, + onClose, + status, + message, + successCount, + errorCount, + totalCount +}: { + isOpen: boolean; + onClose: () => void; + status: 'success' | 'error' | 'partial'; + message: string; + successCount: number; + errorCount: number; + totalCount: number; +}) { + const params = useParams(); + const lng = (params?.lng as string) || "ko"; + const { t } = useTranslation(lng, "engineering"); + + // Calculate percentage for the progress bar + const percentage = Math.round((successCount / totalCount) * 100); + + const getStatusTitle = () => { + switch (status) { + case 'success': + return t("sedp.dataSentSuccessfully"); + case 'partial': + return t("sedp.partiallySuccessful"); + case 'error': + default: + return t("sedp.failedToSendData"); + } + }; + + return ( + + + + + {getStatusTitle()} + + + +
+ {/* Status Icon */} +
+ {status === 'success' ? ( +
+ +
+ ) : status === 'partial' ? ( +
+ +
+ ) : ( +
+ +
+ )} +
+ + {/* Message */} +

{message}

+ + {/* Progress Stats */} +
+
+ {t("sedp.progress")} + {percentage}% +
+ +
+
+ + {t("sedp.successfulCount", { count: successCount })} + +
+ {errorCount > 0 && ( +
+ + {t("sedp.failedCount", { count: errorCount })} + +
+ )} +
+
+
+ + + + +
+
+ ); +} \ No newline at end of file -- cgit v1.2.3