"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")} {t("buttons.cancel")} {isLoading ? ( <> {t("sedp.sending")} > ) : ( <> {t("sedp.sendToSEDP")} > )} ); } // 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 })} )} {t("buttons.close")} ); }
{message}