import { Badge } from "@/components/ui/badge"; import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Separator } from "@/components/ui/separator"; import type { Audits } from "@/types/audit"; function JsonDisplay({ value }: { value: string | null | undefined }) { if (!value) return ; try { return (
        {JSON.stringify(JSON.parse(value), null, 2)}
      
); } catch { return {value}; } } interface AuditDetailDialogProps { audit: Audits | null; open: boolean; onClose: () => void; } export function AuditDetailDialog({ audit, open, onClose, }: AuditDetailDialogProps) { if (!audit) return null; return ( !o && onClose()}> Chi tiết audit #{audit.id}

Thời gian

{audit.dateTime ? new Date(audit.dateTime).toLocaleString("vi-VN") : "—"}

User

{audit.username}

API Call

{audit.apiCall ?? "—"}

Kết quả

{audit.isSuccess == null ? ( ) : audit.isSuccess ? ( Thành công ) : ( Thất bại )}

Hành động

{audit.action}

URL

{audit.url ?? "—"}

Bảng

{audit.tableName ?? "—"}

Entity ID

{audit.entityId ?? "—"}

Lỗi

{audit.errorMessage ?? "—"}

Nội dung request

Giá trị cũ

Giá trị mới

Kết quả

{audit.isSuccess == null ? "—" : audit.isSuccess ? "Thành công" : "Thất bại"}

); }