<?php include 'header.php'; ?>

<!-- Page Wrapper -->
<div class="px-0 py-3 md:p-2 lg:p-6">
    
<!-- Header -->
<div
    class="flex flex-col md:flex-row md:items-center md:justify-between gap-4 mb-5 bg-white p-4 rounded-lg border border-gray-200">

    <!-- Title -->
    <div>
        <h1 class="text-2xl font-bold text-gray-800">
            Demo
        </h1>
        <p class="text-sm text-gray-500">
            Manage all demo requests from here
        </p>
    </div>

    <!-- Actions -->
    <div class="flex flex-col sm:flex-row gap-3">

        <!-- Search -->
        <div class="relative">
            <input type="text" placeholder="Search here..."
                class="w-full sm:w-[220px] pl-10 pr-4 py-2.5 rounded-xl border border-gray-200 focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none text-sm">

            <i class="ri-search-line absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"></i>
        </div>

        <!-- Filter -->
        <button id="openFilter"
            class="px-4 py-2.5 rounded-xl border border-blue-100 bg-white hover:bg-gradient-to-r hover:from-blue-500 hover:to-indigo-600 hover:text-white transition-all duration-300 text-sm text-blue-600 flex items-center gap-2">
            <i class="ri-filter-3-line"></i>
            Filter
        </button>

        <!-- Add Demo -->
        <a href="add_lockora_demo.php"
            class="px-4 py-2.5 rounded-xl bg-gradient-to-r from-blue-500 to-indigo-600 text-white text-sm font-medium flex items-center gap-2 hover:shadow-lg transition-all duration-300">
            <i class="ri-add-line text-lg"></i>
            Add Demo
        </a>

    </div>

</div>

    <!-- Card -->
    <div class="bg-white rounded-lg border border-gray-200 shadow-sm overflow-x-auto overflow-y-hidden mb-5">
        <!-- Table Header -->
        <div class="p-4 border-b border-gray-200">
            <div class="flex flex-wrap gap-2">
            
                <!-- Pending Demo -->
                <button onclick="lockDemo('pending')"
                    class="flex items-center gap-2 px-4 py-2 rounded-xl border border-orange-200 bg-orange-50 text-orange-600 text-sm font-medium hover:bg-orange-200">
                    Pending Demo
                    <span class="px-2 py-0.5 text-xs rounded-full bg-orange-500 text-white">2</span>
                </button>
            
                <!-- Complete Demo -->
                <button onclick="lockDemo('complete')"
                    class="flex items-center gap-2 px-4 py-2 rounded-xl border border-green-200 bg-green-50 text-green-600 text-sm font-medium hover:bg-green-200">
                    Complete Demo
                    <span class="px-2 py-0.5 text-xs rounded-full bg-green-600 text-white">2</span>
                </button>
            
                <!-- Ongoing Demo -->
                <button onclick="lockDemo('ongoing')"
                    class="flex items-center gap-2 px-4 py-2 rounded-xl border border-cyan-200 bg-cyan-50 text-cyan-600 text-sm font-medium hover:bg-cyan-200">
                    Ongoing Demo
                    <span class="px-2 py-0.5 text-xs rounded-full bg-cyan-600 text-white">0</span>
                </button>
            
                <!-- Re-Demo -->
                <button onclick="lockDemo('redemo')"
                    class="flex items-center gap-2 px-4 py-2 rounded-xl border border-purple-200 bg-purple-50 text-purple-600 text-sm font-medium hover:bg-purple-200">
                    Re-Demo
                    <span class="px-2 py-0.5 text-xs rounded-full bg-purple-600 text-white">0</span>
                </button>
            
                <!-- All Demo -->
                <button onclick="lockDemo('all')"
                    class="flex items-center gap-2 px-4 py-2 rounded-xl border border-blue-200 bg-blue-50 text-blue-600 text-sm font-medium hover:bg-blue-200">
                    All Demo
                    <span class="px-2 py-0.5 text-xs rounded-full bg-blue-600 text-white">4</span>
                </button>
            
            </div>
        </div>
    </div>


        <!-- Table -->
        <div class="overflow-x-auto">

            <table class="w-full min-w-[1000px] whitespace-nowrap">

                <!-- Table Head -->
                <thead class="bg-white border-b border-gray-200">

                    <tr class="text-left">

                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Sr.No
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Full Name
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Mobile No
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            City
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Preferred Date
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Preferred Time
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Demo Status
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Demo Via
                        </th>
                        
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap">
                            Customer Type
                        </th>
                    
                        <th class="px-6 py-4 text-xs font-semibold text-gray-500 uppercase tracking-wider text-center w-40 whitespace-nowrap">
                            Action
                        </th>
                    
                    </tr>

                </thead>

<tbody class="divide-y divide-gray-100 bg-white">

    <!-- Complete -->
    <tr class="hover:bg-gray-50 transition" data-status="complete">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">1</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Rajesh Patel</td>
        <td class="px-6 py-4 text-sm text-gray-700">9876543210</td>
        <td class="px-6 py-4 text-sm text-gray-600">Surat</td>
        <td class="px-6 py-4">10-06-2026</td>
        <td class="px-6 py-4">10:00 AM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-600">
                Completed
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-700">
                Home Visit
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700">
                Dealer Customer
            </span>
        </td>
        <td class="px-6 py-4">
            <div class="flex items-center justify-center gap-2">
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                    <i class="ri-eye-line"></i>
                </a>
                <button onclick="deleteRow(this)"
                    class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                    <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

    <!-- Pending -->
    <tr class="hover:bg-gray-50 transition" data-status="pending">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">2</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Raj Patel</td>
        <td class="px-6 py-4 text-sm text-gray-700">9876543210</td>
        <td class="px-6 py-4 text-sm text-gray-600">Bardoli</td>
        <td class="px-6 py-4">10-06-2026</td>
        <td class="px-6 py-4">4:00 PM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-orange-100 text-orange-600">
                Pending
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700">
                Office Visit
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-700">
                Website Customer
            </span>
        </td>
        <td class="px-6 py-4">
            <div class="flex items-center justify-center gap-2">
                <button onclick="toggleDemoStatus(this)"
                     class="w-9 h-9 rounded-lg bg-blue-50 text-blue-600 flex items-center justify-center">
                    <i class="ri-check-line"></i>
                </button>
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                    <i class="ri-eye-line"></i>
                </a>
                 <button onclick="deleteRow(this)"
                    class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                    <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

    <!-- Complete -->
    <tr class="hover:bg-gray-50 transition" data-status="complete">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">3</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Amit Shah</td>
        <td class="px-6 py-4 text-sm text-gray-700">9898989898</td>
        <td class="px-6 py-4 text-sm text-gray-600">Navsari</td>
        <td class="px-6 py-4">12-06-2026</td>
        <td class="px-6 py-4">11:30 AM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-600">
                Completed
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-purple-100 text-purple-700">
                Video Call
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-purple-100 text-purple-700">
                Sales Customer
            </span>
        </td>
        <td class="px-6 py-4">
              <div class="flex items-center justify-center gap-2">
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                        <i class="ri-eye-line"></i>
                    </a>
                <button onclick="deleteRow(this)"
                    class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                    <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

    <!-- Pending -->
    <tr class="hover:bg-gray-50 transition" data-status="pending">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">4</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Priya Desai</td>
        <td class="px-6 py-4 text-sm text-gray-700">9876541234</td>
        <td class="px-6 py-4 text-sm text-gray-600">Ahmedabad</td>
        <td class="px-6 py-4">15-06-2026</td>
        <td class="px-6 py-4">2:00 PM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-orange-100 text-orange-600">
                Pending
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-cyan-100 text-cyan-700">
                Call
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700">
                Company Customer
            </span>
        </td>
        <td class="px-6 py-4">
             <div class="flex items-center justify-center gap-2">
                <button onclick="toggleDemoStatus(this)"
                     class="w-9 h-9 rounded-lg bg-blue-50 text-blue-600 flex items-center justify-center">
                    <i class="ri-check-line"></i>
                </button>
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                    <i class="ri-eye-line"></i>
                </a>
                <button onclick="deleteRow(this)"
                        class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                        <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

    <!-- Ongoing -->
    <tr class="hover:bg-gray-50 transition" data-status="ongoing">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">5</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Karan Mehta</td>
        <td class="px-6 py-4 text-sm text-gray-700">9876500001</td>
        <td class="px-6 py-4 text-sm text-gray-600">Vapi</td>
        <td class="px-6 py-4">18-06-2026</td>
        <td class="px-6 py-4">5:30 PM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-cyan-100 text-cyan-700">
                Ongoing
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-cyan-100 text-cyan-700">
                Video Call
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-blue-100 text-blue-700">
                Dealer Customer
            </span>
        </td>
        <td class="px-6 py-4">
            <div class="flex items-center justify-center gap-2">
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                    <i class="ri-eye-line"></i>
                </a>
                <button onclick="deleteRow(this)"
                    class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                    <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

    <!-- Re-Demo -->
    <tr class="hover:bg-gray-50 transition" data-status="redemo">
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">6</td>
        <td class="px-6 py-4 text-sm font-semibold text-indigo-600">Nilesh Patel</td>
        <td class="px-6 py-4 text-sm text-gray-700">9876500002</td>
        <td class="px-6 py-4 text-sm text-gray-600">Surat</td>
        <td class="px-6 py-4">20-06-2026</td>
        <td class="px-6 py-4">3:00 PM</td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-purple-100 text-purple-700">
                Re-Demo
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-700">
                Home Visit
            </span>
        </td>
        <td class="px-6 py-4">
            <span class="px-3 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-700">
                Company Customer
            </span>
        </td>
        <td class="px-6 py-4">
            <div class="flex items-center justify-center gap-2">
                <button onclick="toggleDemoStatus(this)"
                    class="w-9 h-9 rounded-lg bg-blue-50 text-blue-600 flex items-center justify-center">
                    <i class="ri-check-line"></i>
                </button>
                <a href="view_lockora_demo.php" class="w-9 h-9 rounded-lg bg-green-50 text-green-600 flex items-center justify-center">
                    <i class="ri-eye-line"></i>
                </a>
                <button onclick="deleteRow(this)"
                    class="w-9 h-9 rounded-lg bg-red-50 text-red-600 hover:bg-red-100 flex items-center justify-center">
                    <i class="ri-delete-bin-line"></i>
                </button>
            </div>
        </td>
    </tr>

</tbody>

            </table>

        </div>

        <!-- Footer -->
        <div class="bg-white px-4 py-4 border-t border-gray-100 flex flex-col md:flex-row items-center justify-between gap-4">

            <!-- Left -->
            <p class="text-sm text-gray-500">
                Showing 1 to 4 of 62 tasks
            </p>

            <!-- Pagination -->
            <div class="flex items-center gap-2">

                <button class="w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:bg-gray-100 transition">
                    <i class="ri-arrow-left-s-line"></i>
                </button>

                <button
                    class="w-9 h-9 rounded-xl bg-gradient-to-r from-blue-500 to-indigo-600 text-white font-medium shadow-md">
                    1
                </button>

                <button class="w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 transition">
                    2
                </button>

                <button class="w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 transition">
                    3
                </button>

                <button class="w-9 h-9 rounded-lg border border-gray-200 text-gray-600 hover:bg-gray-100 transition">
                    4
                </button>

                <button class="w-9 h-9 rounded-lg border border-gray-200 text-gray-500 hover:bg-gray-100 transition">
                    <i class="ri-arrow-right-s-line"></i>
                </button>

            </div>

        </div>

    </div>

</div>

<!-- Filter Sidebar -->
<div id="filterSidebar"
    class="fixed top-0 right-[-400px] w-[320px] h-full bg-white shadow-2xl z-50 transition-all duration-300 border-l border-gray-200">
    <!-- Header -->
    <div class="flex items-center justify-between p-5 border-b border-gray-100">
        <h2 class="text-lg font-bold text-gray-800">
            Filters
        </h2>
        <button id="closeFilter" class="w-9 h-9  text-black  flex items-center justify-center">

            <i class="ri-close-line text-xl"></i>

        </button>
    </div>
    <!-- Body -->
    <div class="p-5 space-y-5 pb-28 overflow-y-auto">
        <!-- From Date -->
        <div class="w-full">
            <label class="mb-1 block text-sm font-medium text-slate-700">
                From Date
            </label>
            <div class="relative">
                <i class="ri-calendar-line absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"></i>
                <input type="date" id="fromDate"
                    class="h-11 w-full rounded-md border border-slate-200 bg-slate-50 pl-10 pr-4 text-sm text-slate-700 outline-none transition focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-100">
            </div>
        </div>
        <!-- To Date -->
        <div class="w-full">
            <label class="mb-1 block text-sm font-medium text-slate-700">
                To Date
            </label>
            <div class="relative">
                <i class="ri-calendar-line absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"></i>
                <input type="date" id="toDate"
                    class="h-11 w-full rounded-md border border-slate-200 bg-slate-50 pl-10 pr-4 text-sm text-slate-700 outline-none transition focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-100">
            </div>
        </div>


        <!-- City -->
        <div class="w-full">
            <label class="mb-1 block text-sm font-medium text-slate-700">
                City
            </label>

            <div class="relative">
                <i class="ri-map-pin-line absolute left-3 top-1/2 -translate-y-1/2 text-slate-400 z-10"></i>

                <select id="citySelect">
                    <option value="">Select City</option>
                    <option value="Surat">Surat</option>
                    <option value="Bardoli">Bardoli</option>
                    <option value="Navsari">Navsari</option>
                    <option value="Vapi">Vapi</option>
                    <option value="Ahmedabad">Ahmedabad</option>
                </select>
            </div>
        </div>

        <!-- Demo For -->
        <div class="w-full">
            <label class="mb-1 block text-sm font-medium text-slate-700">
                Demo For
            </label>

            <div class="relative">
                <i class="ri-home-gear-line absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"></i>

                <select
                    class="h-11 w-full rounded-md border border-slate-200 bg-slate-50 pl-10 pr-4 text-sm text-slate-700 outline-none transition focus:border-blue-500 focus:bg-white focus:ring-2 focus:ring-blue-100">

                    <option value="">Select Demo Type</option>
                    <option value="Home">Home</option>
                    <option value="Office">Office</option>

                </select>
            </div>
        </div>

    </div>
    <!-- Bottom Fixed Buttons -->
    <div class="absolute bottom-0 left-0 w-full border-t border-gray-200 bg-white p-4">
        <div class="flex flex-row items-center justify-center gap-3 whitespace-nowrap">
            <!-- Reset Button -->
            <button
                class="w-1/2 h-11 rounded-md border border-slate-200 bg-slate-100 text-sm font-medium text-slate-700 transition hover:bg-slate-200">
                Reset
            </button>
            <!-- Apply Filter Button -->
            <button
                class="w-1/2 h-11 rounded-md bg-gradient-to-r from-blue-500 to-indigo-600 text-sm font-medium text-white shadow-md transition hover:from-blue-600 hover:to-indigo-700">
                Apply Filter
            </button>
        </div>
    </div>
</div>



<script>
    document.addEventListener("DOMContentLoaded", function () {

        const citySelect = new TomSelect("#citySelect", {
            create: false,
            maxOptions: 50,
            placeholder: "Search City...",
            openOnFocus: false,

            onType: function (str) {
                if (str.trim().length > 0) {
                    this.open();
                } else {
                    this.close();
                }
            }
        });

        // Prevent open on click
        citySelect.control.addEventListener("click", function (e) {
            if (citySelect.control_input.value.trim() === "") {
                citySelect.close();
            }
        });

    });


    // Control Style
    citySelect.control.classList.add(
        "flex",
        "items-center",
        "h-11",
        "w-full",
        "rounded-md",
        "border",
        "border-slate-200",
        "bg-slate-50",
        "pl-10",
        "pr-4",
        "text-sm",
        "text-slate-700"
    );

    // Dropdown Style
    citySelect.dropdown.classList.add(
        "z-[99999]",
        "overflow-hidden",
        "rounded-xl",
        "border",
        "border-gray-200",
        "bg-white",
        "shadow-xl"
    );

    // Input Style
    citySelect.control_input.classList.add(
        "w-full",
        "bg-transparent",
        "text-sm",
        "text-gray-700",
        "placeholder:text-gray-400",
        "focus:outline-none"
    );
</script>

<script>

    const openFilter = document.getElementById("openFilter");
    const closeFilter = document.getElementById("closeFilter");
    const filterSidebar = document.getElementById("filterSidebar");
    const sidebarOverlay = document.getElementById("sidebarOverlay");

    openFilter.addEventListener("click", () => {

        filterSidebar.style.right = "0";
        sidebarOverlay.classList.remove("hidden");

    });

    closeFilter.addEventListener("click", () => {

        filterSidebar.style.right = "-400px";
        sidebarOverlay.classList.add("hidden");

    });

    sidebarOverlay.addEventListener("click", () => {

        filterSidebar.style.right = "-400px";
        sidebarOverlay.classList.add("hidden");

    });

</script>


<script>
    function deleteRow(button) {

        Swal.fire({

            title: "Delete Record?",
            text: "This row will be deleted.",
            icon: "warning",

            width: "350px",
            padding: "1rem",

            showCancelButton: true,
            scrollbarPadding: false,
            confirmButtonText: "Delete",
            cancelButtonText: "Cancel",

            confirmButtonColor: "#2563eb",
            cancelButtonColor: "#ef4444",

            customClass: {

                popup: "rounded-2xl",
                title: "text-lg font-semibold",
                htmlContainer: "text-sm text-gray-500",
                confirmButton: "px-4 py-2 rounded-lg text-sm",
                cancelButton: "px-4 py-2 rounded-lg text-sm"

            }

        }).then((result) => {

            if (result.isConfirmed) {

                button.closest("tr").remove();

                Swal.fire({

                    icon: "success",
                    title: "Deleted!",
                    text: "Record removed successfully.",

                    width: "350px",
                    padding: "1rem",

                    showConfirmButton: false,
                    timer: 1400

                });

            }

        });

    }

</script>

<script>
function lockDemo(status) {

    const rows = document.querySelectorAll("tbody tr");

    rows.forEach(row => {

        if (status === "all") {
            row.style.display = "";
        } else {
            row.style.display =
                row.dataset.status === status ? "" : "none";
        }

    });

}


function toggleDemoStatus(btn) {

    const row = btn.closest("tr");
    const statusBadge = row.querySelector("td:nth-child(7) span");

    row.dataset.status = "complete";

    statusBadge.className =
        "px-3 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-600 whitespace-nowrap";

    statusBadge.textContent = "Completed";

    // Button hide/remove
    btn.remove();

    Swal.fire({
        icon: "success",
        title: "Demo Completed",
        text: "Demo completed successfully.",
        timer: 1500,
        width: "350px",
        padding: "1rem",
        showConfirmButton: false
    });
}
</script>



<?php include 'footer.php'; ?>