import React, { useState } from 'react';
import { useForm, router, usePage } from '@inertiajs/react';
import { AdminLayout } from '../AdminLayout';
import { SEOHead } from '@/Components/SEOHead';
import { Pagination } from '@/Components/Pagination';
import { ConfirmDeleteModal } from '@/Components/ConfirmDeleteModal';
import { formatCustomDate } from '@/lib/utils';
import { Mail, CheckCircle2, Trash2, Send, CornerUpLeft, X, Clock, Sparkles, Eye, User, Phone, Building, Calendar, Globe, Shield } from 'lucide-react';

interface ContactsIndexProps {
    messages: any;
    filters: any;
}

export default function Index({ messages, filters }: ContactsIndexProps) {
    const { globalSettings } = usePage().props as any;
    const siteName = globalSettings?.site_name || 'Tech in Soul';
    const contactPhone = globalSettings?.contact_phone || '+880 1710-503837';

    const [deleteId, setDeleteId] = useState<number | null>(null);
    const [viewingMsg, setViewingMsg] = useState<any | null>(null);
    const [replyingMsg, setReplyingMsg] = useState<any | null>(null);
    const [replySubject, setReplySubject] = useState('');
    const [replyContent, setReplyContent] = useState('');
    const [replyLoading, setReplyLoading] = useState(false);
    const [replySuccess, setReplySuccess] = useState<string | null>(null);


    const handleStatusChange = (id: number, status: string) => {
        router.put(`/admin/contacts/${id}`, { status }, { preserveScroll: true });
    };

    const handleDelete = () => {
        if (deleteId) {
            router.delete(`/admin/contacts/${deleteId}`);
        }
    };

    const openReplyModal = (msg: any) => {
        setReplyingMsg(msg);
        setReplySubject(`Re: ${msg.subject || `Your inquiry at ${siteName}`}`);
        setReplyContent(`Hi ${msg.name},\n\nThank you for reaching out to ${siteName}. We have reviewed your inquiry and would love to assist you with your project requirements.\n\nBest regards,\nEngineering Team | ${siteName}`);
        setReplySuccess(null);
    };

    const applyTemplate = (type: 'discovery' | 'questionnaire' | 'emergency' | 'quote') => {
        if (!replyingMsg) return;

        if (type === 'discovery') {
            setReplySubject(`Discovery Call Invitation — ${siteName}`);
            setReplyContent(`Hi ${replyingMsg.name},\n\nThank you for reaching out! We'd love to explore your project requirements in depth.\n\nCould you let us know your availability for a brief 15-20 minute discovery video call this week?\n\nAlternatively, you can book directly on our calendar: /contact\n\nLooking forward to speaking with you!\n\nBest regards,\n${siteName} Team`);
        } else if (type === 'questionnaire') {
            setReplySubject(`Project Scoping Questionnaire — ${siteName}`);
            setReplyContent(`Hi ${replyingMsg.name},\n\nThank you for contacting ${siteName}. To prepare an accurate scope, timeline, and architectural proposal for you, could you share a few details:\n\n1. Target timeline & launch date\n2. Key user roles and critical integrations\n3. Any preferred tech stack or design references\n\nBest regards,\n${siteName} Team`);
        } else if (type === 'emergency') {
            setReplySubject(`Urgent Incident Response Support — ${siteName}`);
            setReplyContent(`Hi ${replyingMsg.name},\n\nWe have received your urgent security / technical recovery inquiry and have escalated it to our engineering triage desk.\n\nPlease share any server error logs or hosting details so we can assist immediately.\n\nDirect Hotline / WhatsApp: ${contactPhone}\n\nBest regards,\nIncident Response Team | ${siteName}`);
        } else if (type === 'quote') {
            setReplySubject(`Custom Engineering Quote & Proposal — ${siteName}`);
            setReplyContent(`Hi ${replyingMsg.name},\n\nThank you for your interest in ${siteName}'s engineering services. We have prepared an initial scoping overview based on your message.\n\nLet's connect to review the architectural deliverables and milestone sprint schedule.\n\nBest regards,\n${siteName} Team`);
        }
    };


    const handleSendReply = async (e: React.FormEvent) => {
        e.preventDefault();
        if (!replyingMsg || !replySubject.trim() || !replyContent.trim()) return;

        setReplyLoading(true);
        try {
            const csrfToken = (document.querySelector('meta[name="csrf-token"]') as HTMLMetaElement)?.content;
            const res = await fetch(`/admin/contacts/${replyingMsg.id}/reply`, {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                    'Accept': 'application/json',
                    'X-CSRF-TOKEN': csrfToken || '',
                },
                body: JSON.stringify({
                    reply_subject: replySubject,
                    reply_content: replyContent,
                }),
            });

            const result = await res.json();
            if (result.success) {
                setReplySuccess(result.message);
                setTimeout(() => {
                    setReplyingMsg(null);
                    router.reload({ only: ['messages'] });
                }, 1500);
            }
        } catch (err) {
            console.error('Error sending reply', err);
        } finally {
            setReplyLoading(false);
        }
    };

    const messagesList = messages.data ? messages.data : messages;

    return (
        <AdminLayout title="Client Leads & Contact Submissions">
            <SEOHead title="Contact Leads | Tech in Soul Admin" description="Review incoming project inquiries, client leads, and deal pipeline status." />

            <div className="space-y-6">
                <div className="flex items-center justify-between">
                    <div>
                        <h2 className="text-xl font-bold text-white">Lead Inbox</h2>
                        <p className="text-xs text-slate-400">Review incoming project inquiries and send direct email replies via SMTP.</p>
                    </div>
                </div>

                <div className="glass-card rounded-2xl overflow-hidden border border-slate-800">
                    <table className="w-full text-left text-sm text-slate-300">
                        <thead className="bg-[#060B18] text-xs font-bold text-slate-400 uppercase border-b border-slate-800">
                            <tr>
                                <th className="px-6 py-4">Client Name</th>
                                <th className="px-6 py-4">Email / Phone</th>
                                <th className="px-6 py-4">Submitted Date</th>
                                <th className="px-6 py-4">Message / Reply History</th>
                                <th className="px-6 py-4">Status</th>
                                <th className="px-6 py-4 text-right">Actions</th>
                            </tr>
                        </thead>
                        <tbody className="divide-y divide-slate-800/80">
                            {messagesList.length === 0 ? (
                                <tr>
                                    <td colSpan={6} className="px-6 py-12 text-center text-slate-500">
                                        <div className="flex flex-col items-center gap-2">
                                            <p className="text-sm font-semibold text-slate-400">No lead submissions received yet</p>
                                            <p className="text-xs text-slate-500">Inquiries submitted via the public contact form will appear here.</p>
                                        </div>
                                    </td>
                                </tr>
                            ) : (
                                messagesList.map((msg: any) => (
                                    <tr key={msg.id} className="hover:bg-[#060B18]/40 transition-colors">
                                        <td className="px-6 py-4 font-bold text-white">
                                            {msg.name}
                                            {msg.company && <span className="text-xs text-slate-400 block font-normal">{msg.company}</span>}
                                        </td>
                                        <td className="px-6 py-4 text-xs">
                                            <div className="text-[#00F2FE] font-mono">{msg.email}</div>
                                            <div className="text-slate-500">{msg.phone || 'N/A'}</div>
                                        </td>
                                        <td className="px-6 py-4 text-xs font-mono text-slate-400">
                                            {formatCustomDate(msg.created_at)}
                                        </td>
                                        <td className="px-6 py-4 text-xs text-slate-300 max-w-xs">
                                            <p className="truncate" title={msg.message}>{msg.message}</p>
                                            {msg.replied_at && (
                                                <div className="mt-1 flex items-center gap-1 text-[10px] text-emerald-400 font-mono">
                                                    <CheckCircle2 className="w-3 h-3 shrink-0" />
                                                    <span>Replied {formatCustomDate(msg.replied_at)}</span>
                                                </div>
                                            )}
                                        </td>
                                        <td className="px-6 py-4">
                                            <select
                                                value={msg.status}
                                                onChange={(e) => handleStatusChange(msg.id, e.target.value)}
                                                className="bg-[#060B18] border border-slate-800 rounded-lg px-2.5 py-1 text-xs text-[#00F2FE] focus:outline-none capitalize"
                                            >
                                                <option value="new">New</option>
                                                <option value="contacted">Contacted</option>
                                                <option value="in_progress">In Progress</option>
                                                <option value="qualified">Qualified</option>
                                                <option value="converted">Converted</option>
                                                <option value="closed">Closed</option>
                                                <option value="spam">Spam</option>
                                            </select>
                                        </td>
                                        <td className="px-6 py-4 text-right">
                                            <div className="flex items-center justify-end gap-1.5">
                                                <button
                                                    type="button"
                                                    onClick={() => setViewingMsg(msg)}
                                                    className="inline-flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-semibold bg-[#0B132B] hover:bg-[#1C2541] text-slate-300 hover:text-white border border-slate-800 transition-all"
                                                    title="View Full Message & Lead Details"
                                                >
                                                    <Eye className="w-3.5 h-3.5 text-[#00F2FE]" />
                                                    View
                                                </button>

                                                <button
                                                    type="button"
                                                    onClick={() => openReplyModal(msg)}
                                                    className="inline-flex items-center gap-1 px-2.5 py-1 rounded-lg text-xs font-bold bg-[#00F2FE]/10 hover:bg-[#00F2FE]/20 text-[#00F2FE] border border-[#00F2FE]/30 transition-all shadow-sm"
                                                    title="Send Email Reply via SMTP"
                                                >
                                                    <CornerUpLeft className="w-3.5 h-3.5" />
                                                    Reply
                                                </button>

                                                <button
                                                    onClick={() => setDeleteId(msg.id)}
                                                    className="inline-flex items-center justify-center p-1.5 rounded-lg text-rose-400 hover:text-rose-300 hover:bg-rose-500/10 transition-colors"
                                                    title="Delete Lead Record"
                                                >
                                                    <Trash2 className="w-4 h-4" />
                                                </button>
                                            </div>
                                        </td>
                                    </tr>
                                ))
                            )}
                        </tbody>
                    </table>

                    {messages.links && (
                        <Pagination links={messages.links} from={messages.from} to={messages.to} total={messages.total} />
                    )}
                </div>
            </div>

            {/* View Lead & Message Details Modal */}
            {viewingMsg && (
                <div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 sm:p-6">
                    <div className="w-full max-w-4xl bg-[#0B132B] border border-cyan-500/40 rounded-3xl shadow-2xl overflow-hidden animate-in fade-in zoom-in-95 flex flex-col max-h-[90vh]">
                        {/* Modal Header */}
                        <div className="p-6 border-b border-slate-800 flex items-center justify-between bg-[#060B18]">
                            <div className="flex items-center gap-3">
                                <div className="p-2.5 rounded-2xl bg-[#00F2FE]/10 border border-[#00F2FE]/30 text-[#00F2FE] shadow-sm">
                                    <Eye className="w-5 h-5" />
                                </div>
                                <div>
                                    <h3 className="text-base font-bold text-white">Lead & Message Details</h3>
                                    <p className="text-xs text-slate-400 font-mono">
                                        Received on {formatCustomDate(viewingMsg.created_at)}
                                    </p>
                                </div>
                            </div>
                            <button
                                type="button"
                                onClick={() => setViewingMsg(null)}
                                className="text-slate-400 hover:text-white p-2 rounded-xl hover:bg-slate-800/80 transition-colors"
                            >
                                <X className="w-5 h-5" />
                            </button>
                        </div>

                        {/* Modal Body */}
                        <div className="p-6 sm:p-8 overflow-y-auto space-y-6 flex-1 text-xs">
                            {/* Client Summary Bar */}
                            <div className="grid grid-cols-1 sm:grid-cols-2 gap-4 p-5 rounded-2xl bg-[#060B18] border border-slate-800">
                                <div className="space-y-1.5">
                                    <span className="text-slate-500 font-bold uppercase text-[10px] tracking-wider flex items-center gap-1.5">
                                        <User className="w-3.5 h-3.5 text-[#00F2FE]" /> Client Profile
                                    </span>
                                    <div className="text-base font-bold text-white">{viewingMsg.name}</div>
                                    {viewingMsg.company && (
                                        <div className="text-xs text-slate-400 flex items-center gap-1.5">
                                            <Building className="w-3.5 h-3.5 text-slate-500" /> {viewingMsg.company}
                                        </div>
                                    )}
                                </div>

                                <div className="space-y-1.5">
                                    <span className="text-slate-500 font-bold uppercase text-[10px] tracking-wider flex items-center gap-1.5">
                                        <Mail className="w-3.5 h-3.5 text-[#00F2FE]" /> Direct Contact Channels
                                    </span>
                                    <div>
                                        <a href={`mailto:${viewingMsg.email}`} className="text-sm text-[#00F2FE] hover:underline font-mono font-medium">
                                            {viewingMsg.email}
                                        </a>
                                    </div>
                                    <div className="text-xs text-slate-300 font-mono flex items-center gap-1.5">
                                        <Phone className="w-3.5 h-3.5 text-slate-500" />
                                        {viewingMsg.phone ? (
                                            <a href={`tel:${viewingMsg.phone}`} className="hover:text-[#00F2FE] transition-colors">
                                                {viewingMsg.phone}
                                            </a>
                                        ) : (
                                            <span className="text-slate-600">No phone provided</span>
                                        )}
                                    </div>
                                </div>
                            </div>

                            {/* Service / Subject & Status */}
                            <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
                                <div className="p-4 rounded-2xl bg-[#060B18] border border-slate-800 space-y-1.5">
                                    <span className="text-slate-500 font-bold uppercase text-[10px] tracking-wider">Service / Subject</span>
                                    <div className="text-sm text-white font-semibold">
                                        {viewingMsg.subject || viewingMsg.service || 'General Inquiry'}
                                    </div>
                                    {viewingMsg.service && (
                                        <span className="inline-block mt-1 px-2.5 py-1 rounded-lg text-xs font-bold bg-[#00F2FE]/10 text-[#00F2FE] border border-[#00F2FE]/20">
                                            {viewingMsg.service}
                                        </span>
                                    )}
                                </div>

                                <div className="p-4 rounded-2xl bg-[#060B18] border border-slate-800 space-y-1.5">
                                    <span className="text-slate-500 font-bold uppercase text-[10px] tracking-wider">Lead Status Pipeline</span>
                                    <div>
                                        <select
                                            value={viewingMsg.status}
                                            onChange={(e) => {
                                                const newStatus = e.target.value;
                                                setViewingMsg({ ...viewingMsg, status: newStatus });
                                                handleStatusChange(viewingMsg.id, newStatus);
                                            }}
                                            className="w-full bg-[#0B132B] border border-slate-700 rounded-xl px-3.5 py-2 text-xs text-[#00F2FE] font-bold focus:outline-none capitalize shadow-sm"
                                        >
                                            <option value="new">New Lead</option>
                                            <option value="contacted">Contacted</option>
                                            <option value="in_progress">In Progress</option>
                                            <option value="qualified">Qualified</option>
                                            <option value="converted">Converted Client</option>
                                            <option value="closed">Closed / Solved</option>
                                            <option value="spam">Spam</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            {/* Full Message Body */}
                            <div className="space-y-2">
                                <span className="text-slate-400 font-bold uppercase text-[10px] tracking-wider block">
                                    Message Content:
                                </span>
                                <div className="p-5 rounded-2xl bg-[#060B18] border border-slate-800 text-slate-200 leading-relaxed whitespace-pre-wrap font-sans text-xs sm:text-sm selection:bg-[#00F2FE]/20">
                                    {viewingMsg.message}
                                </div>
                            </div>

                            {/* Reply History (if replied) */}
                            {viewingMsg.replied_at && (
                                <div className="p-5 rounded-2xl bg-emerald-950/20 border border-emerald-500/30 space-y-3">
                                    <div className="flex items-center justify-between text-emerald-400">
                                        <span className="font-bold text-xs flex items-center gap-1.5">
                                            <CheckCircle2 className="w-4 h-4" /> Email Reply Sent via SMTP
                                        </span>
                                        <span className="font-mono text-xs">{formatCustomDate(viewingMsg.replied_at)}</span>
                                    </div>
                                    {viewingMsg.reply_subject && (
                                        <div className="text-xs text-white font-semibold">
                                            Subject: {viewingMsg.reply_subject}
                                        </div>
                                    )}
                                    {viewingMsg.reply_content && (
                                        <div className="p-4 rounded-xl bg-[#060B18] text-slate-300 whitespace-pre-wrap font-mono text-xs border border-emerald-500/20 leading-relaxed">
                                            {viewingMsg.reply_content}
                                        </div>
                                    )}
                                </div>
                            )}

                            {/* Metadata */}
                            <div className="p-3.5 rounded-2xl bg-[#060B18]/50 border border-slate-800 text-[11px] text-slate-500 flex flex-wrap gap-5 font-mono">
                                <div><span className="text-slate-600">IP:</span> {viewingMsg.ip || '127.0.0.1'}</div>
                                <div className="truncate max-w-md"><span className="text-slate-600">User Agent:</span> {viewingMsg.user_agent || 'Standard Web'}</div>
                            </div>
                        </div>

                        {/* Modal Footer */}
                        <div className="p-5 border-t border-slate-800 bg-[#060B18] flex items-center justify-between">
                            <button
                                type="button"
                                onClick={() => {
                                    setDeleteId(viewingMsg.id);
                                    setViewingMsg(null);
                                }}
                                className="px-4 py-2.5 rounded-xl text-xs font-bold bg-rose-500/15 hover:bg-rose-600 text-rose-300 hover:text-white border border-rose-500/40 hover:border-rose-600 transition-all flex items-center gap-2 shadow-sm shadow-rose-950/20"
                            >
                                <Trash2 className="w-4 h-4" /> Delete Lead
                            </button>

                            <div className="flex items-center gap-3">
                                <button
                                    type="button"
                                    onClick={() => setViewingMsg(null)}
                                    className="px-5 py-2.5 rounded-xl text-xs font-semibold bg-[#0B132B] hover:bg-[#1C2541] text-slate-300 hover:text-white border border-slate-700 transition-all"
                                >
                                    Close
                                </button>
                                <button
                                    type="button"
                                    onClick={() => {
                                        const target = viewingMsg;
                                        setViewingMsg(null);
                                        openReplyModal(target);
                                    }}
                                    className="px-6 py-2.5 rounded-xl text-xs font-bold bg-gradient-to-r from-[#00F2FE] to-[#4FACFE] text-[#060B18] hover:opacity-95 flex items-center gap-2 shadow-lg shadow-cyan-500/20"
                                >
                                    <CornerUpLeft className="w-4 h-4" /> Reply via Email
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            )}


            {/* Email Reply Modal */}
            {replyingMsg && (
                <div className="fixed inset-0 z-50 bg-black/80 backdrop-blur-sm flex items-center justify-center p-4 sm:p-6">
                    <div className="w-full max-w-4xl bg-[#0B132B] border border-cyan-500/40 rounded-3xl shadow-2xl overflow-hidden animate-in fade-in zoom-in-95">
                        <div className="p-6 border-b border-slate-800 flex items-center justify-between bg-[#060B18]">
                            <div className="flex items-center gap-3">
                                <div className="p-2.5 rounded-2xl bg-[#00F2FE]/10 border border-[#00F2FE]/30 text-[#00F2FE] shadow-sm">
                                    <Mail className="w-5 h-5" />
                                </div>
                                <h3 className="text-base font-bold text-white">
                                    Send Email Reply to <span className="text-[#00F2FE]">{replyingMsg.name}</span> ({replyingMsg.email})
                                </h3>
                            </div>
                            <button
                                type="button"
                                onClick={() => setReplyingMsg(null)}
                                className="text-slate-400 hover:text-white p-2 rounded-xl hover:bg-slate-800 transition-colors"
                            >
                                <X className="w-5 h-5" />
                            </button>
                        </div>


                        <form onSubmit={handleSendReply} className="p-6 space-y-4">
                            {replySuccess ? (
                                <div className="p-4 rounded-xl bg-emerald-500/10 border border-emerald-500/30 text-emerald-400 text-sm flex items-center gap-2">
                                    <CheckCircle2 className="w-5 h-5 shrink-0" />
                                    <span>{replySuccess}</span>
                                </div>
                            ) : (
                                <>
                                    {/* Original Inquiry Card */}
                                    <div className="p-3.5 rounded-xl bg-[#060B18] border border-slate-800 text-xs">
                                        <p className="text-slate-400 font-bold uppercase text-[10px] mb-1">Inquiry from Client:</p>
                                        <p className="text-slate-300 italic font-mono text-[11px]">"{replyingMsg.message}"</p>
                                    </div>

                                    {/* Template Chips */}
                                    <div>
                                        <label className="text-[11px] font-bold text-slate-400 uppercase block mb-1.5 flex items-center gap-1">
                                            <Sparkles className="w-3 h-3 text-[#00F2FE]" /> Quick Response Templates:
                                        </label>
                                        <div className="flex flex-wrap gap-1.5">
                                            <button
                                                type="button"
                                                onClick={() => applyTemplate('discovery')}
                                                className="px-2.5 py-1 rounded-lg text-[11px] bg-[#060B18] hover:bg-[#1C2541] text-cyan-300 border border-cyan-500/20 transition-all"
                                            >
                                                Discovery Call Invite
                                            </button>
                                            <button
                                                type="button"
                                                onClick={() => applyTemplate('questionnaire')}
                                                className="px-2.5 py-1 rounded-lg text-[11px] bg-[#060B18] hover:bg-[#1C2541] text-cyan-300 border border-cyan-500/20 transition-all"
                                            >
                                                Project Scoping Questions
                                            </button>
                                            <button
                                                type="button"
                                                onClick={() => applyTemplate('emergency')}
                                                className="px-2.5 py-1 rounded-lg text-[11px] bg-[#060B18] hover:bg-[#1C2541] text-cyan-300 border border-cyan-500/20 transition-all"
                                            >
                                                Incident Response Triage
                                            </button>
                                            <button
                                                type="button"
                                                onClick={() => applyTemplate('quote')}
                                                className="px-2.5 py-1 rounded-lg text-[11px] bg-[#060B18] hover:bg-[#1C2541] text-cyan-300 border border-cyan-500/20 transition-all"
                                            >
                                                Custom Quote Follow-up
                                            </button>
                                        </div>
                                    </div>

                                    <div>
                                        <label className="text-xs font-bold text-slate-300 uppercase block mb-1">Email Subject *</label>
                                        <input
                                            type="text"
                                            required
                                            value={replySubject}
                                            onChange={(e) => setReplySubject(e.target.value)}
                                            className="w-full bg-[#060B18] border border-slate-800 rounded-xl px-4 py-2 text-xs text-white focus:outline-none focus:border-[#00F2FE]"
                                        />
                                    </div>

                                    <div>
                                        <label className="text-xs font-bold text-slate-300 uppercase block mb-1">Reply Message Body (Branded HTML Template will wrap this) *</label>
                                        <textarea
                                            rows={6}
                                            required
                                            value={replyContent}
                                            onChange={(e) => setReplyContent(e.target.value)}
                                            className="w-full bg-[#060B18] border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-white focus:outline-none focus:border-[#00F2FE] font-mono leading-relaxed"
                                        />
                                    </div>

                                    <div className="flex items-center justify-end gap-2 pt-2 border-t border-slate-800">
                                        <button
                                            type="button"
                                            onClick={() => setReplyingMsg(null)}
                                            className="px-4 py-2 rounded-xl text-xs font-semibold bg-[#060B18] text-slate-400 hover:text-white border border-slate-800"
                                        >
                                            Cancel
                                        </button>

                                        <button
                                            type="submit"
                                            disabled={replyLoading}
                                            className="px-5 py-2 rounded-xl text-xs font-bold bg-gradient-to-r from-[#00F2FE] to-[#4FACFE] text-[#060B18] hover:opacity-95 shadow-md flex items-center gap-1.5"
                                        >
                                            <Send className="w-3.5 h-3.5" />
                                            {replyLoading ? 'Sending Email Reply...' : 'Send Branded Reply'}
                                        </button>
                                    </div>
                                </>
                            )}
                        </form>
                    </div>
                </div>
            )}

            <ConfirmDeleteModal
                isOpen={deleteId !== null}
                title="Delete Contact Lead Record?"
                message="Are you sure you want to delete this lead submission? This action cannot be undone."
                onConfirm={handleDelete}
                onClose={() => setDeleteId(null)}
            />
        </AdminLayout>
    );
}

