        </main>
    </div>


<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

<script>
    const appDropdownBtn = document.getElementById("appDropdownBtn");
const appDropdown = document.getElementById("appDropdown");

appDropdownBtn.addEventListener("click", () => {
    appDropdown.classList.toggle("hidden");
});

document.addEventListener("click", (e) => {
    if (
        !appDropdownBtn.contains(e.target) &&
        !appDropdown.contains(e.target)
    ) {
        appDropdown.classList.add("hidden");
    }
});
</script>

<script>

const crmMenu = document.getElementById("crmMenu");
const lockoraMenu = document.getElementById("lockoraMenu");
const puresaasMenu = document.getElementById("puresaasMenu");
const uturnMenu = document.getElementById("uturnMenu");

[crmMenu, lockoraMenu, puresaasMenu, uturnMenu].forEach(menu => {
    if (menu) menu.style.display = "none";
});

let appName = "SIT";

if (window.location.pathname.includes("lockora_")) {

    lockoraMenu.style.display = "block";
    appName = "Lockora";

} else if (window.location.pathname.includes("puresaas_")) {

    puresaasMenu.style.display = "block";
    appName = "PureSaas";

} else if (window.location.pathname.includes("uturn_")) {

    uturnMenu.style.display = "block";
    appName = "U-Turn Media";

} else {

    crmMenu.style.display = "block";

}

if (sidebarTitle) {
    sidebarTitle.innerText = appName;
}

const selectedCompany = document.getElementById("selectedCompany");

if (selectedCompany) {

    if (window.location.pathname.includes("lockora_")) {

        selectedCompany.innerText = "Lockora";

    } else if (window.location.pathname.includes("puresaas_")) {

        selectedCompany.innerText = "PureSaaS";

    } else if (window.location.pathname.includes("uturn_")) {

        selectedCompany.innerText = "U-Turn Media";

    } else {

        selectedCompany.innerText = "SIT";

    }

}
</script>

<script>

    // Sidebar
    const sidebar = document.getElementById('sidebar');
    const overlay = document.getElementById('overlay');
    const openSidebar = document.getElementById('openSidebar');
    const closeSidebar = document.getElementById('closeSidebar');

    openSidebar.addEventListener('click', () => {
        sidebar.classList.remove('-translate-x-full');
        overlay.classList.remove('hidden');
    });

    closeSidebar.addEventListener('click', () => {
        sidebar.classList.add('-translate-x-full');
        overlay.classList.add('hidden');
    });

    overlay.addEventListener('click', () => {
        sidebar.classList.add('-translate-x-full');
        overlay.classList.add('hidden');
    });

    // Modal
    const modal = document.getElementById('modal');
    const openModal = document.getElementById('openModal');
    const closeModal = document.getElementById('closeModal');
    const cancelModal = document.getElementById('cancelModal');
    const modalOverlay = document.getElementById('modalOverlay');

    // Check if modal button exists
    if (openModal) {

        openModal.addEventListener('click', () => {
            modal.classList.remove('hidden');
            modal.classList.add('flex');
            document.body.classList.add('overflow-hidden');
        });

    }

    function closeModalFunction() {

        modal.classList.add('hidden');
        modal.classList.remove('flex');
        document.body.classList.remove('overflow-hidden');

    }

    if (closeModal) {
        closeModal.addEventListener('click', closeModalFunction);
    }

    if (cancelModal) {
        cancelModal.addEventListener('click', closeModalFunction);
    }

    if (modalOverlay) {
        modalOverlay.addEventListener('click', closeModalFunction);
    }

    
    
// Profile Dropdown
const profileBtn = document.getElementById("profileBtn");
const profileDropdown = document.getElementById("profileDropdown");

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

    profileDropdown.classList.toggle("hidden");

});

// Outside Click Close
document.addEventListener("click", (e) => {

    if (
        !profileBtn.contains(e.target) &&
        !profileDropdown.contains(e.target)
    ) {

        profileDropdown.classList.add("hidden");

    }

});

// Notification Dropdown
const notificationBtn =
    document.getElementById("notificationBtn");

const notificationDropdown =
    document.getElementById("notificationDropdown");

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

    notificationDropdown.classList.toggle("hidden");

});

// Outside Click Close
document.addEventListener("click", (e) => {

    if (
        !notificationBtn.contains(e.target) &&
        !notificationDropdown.contains(e.target)
    ) {

        notificationDropdown.classList.add("hidden");

    }

});

// Active Sidebar Menu
const currentUrl = window.location.href;

document.querySelectorAll(".sidebar-link").forEach(link => {

    const linkUrl = link.href;

    if (currentUrl.includes(linkUrl)) {

        link.classList.add("active-link");

        // Master dropdown auto open
        const detailsParent = link.closest("details");

        if (detailsParent) {
            detailsParent.setAttribute("open", true);
        }

    }

});

document.querySelectorAll('.company-link').forEach(link => {

    const href = link.getAttribute('href');

    if (
        (window.location.pathname.includes('lockora_') && href.includes('lockora_')) ||
        (window.location.pathname.includes('puresaas_') && href.includes('puresaas_')) ||
        (window.location.pathname.includes('uturn_') && href.includes('uturn_')) ||
        (
            !window.location.pathname.includes('lockora_') &&
            !window.location.pathname.includes('puresaas_') &&
            !window.location.pathname.includes('uturn_') &&
            href === 'dashboard.php'
        )
    ) {

        link.classList.add(
            'bg-blue-100',
            'border',
            'border-blue-200'
        );

    }

});
</script>

</body>

</html>