Path : /home/vishqocm/pcib.in/admin/includes/
File Upload :
Current File : /home/vishqocm//pcib.in/admin/includes/footer.php

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

<!-- jQuery (must be loaded before Bootstrap) -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<!-- Custom Sidebar Script -->
<script src="./assets/js/sidebar.js"></script>

<!-- Initialize Bootstrap components -->
<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Fix for Bootstrap 5 modals
        var modalTriggers = document.querySelectorAll('[data-bs-toggle="modal"]');
        modalTriggers.forEach(function(button) {
            button.addEventListener('click', function() {
                var target = this.getAttribute('data-bs-target');
                var modalElement = document.querySelector(target);
                
                if (modalElement) {
                    var modal = new bootstrap.Modal(modalElement);
                    modal.show();
                }
            });
        });
    });
</script>

<!-- Custom JavaScript -->
<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Apply animation classes to elements
        const animateElements = () => {
            // Stat cards
            document.querySelectorAll('.stat-card').forEach((el, index) => {
                setTimeout(() => {
                    el.classList.add('fadeIn');
                }, 100 * index);
            });
            
            // Tables
            document.querySelectorAll('.table').forEach(el => {
                el.classList.add('fadeIn');
            });
            
            // Charts
            document.querySelectorAll('.chart-container').forEach((el, index) => {
                setTimeout(() => {
                    el.classList.add('slideInUp');
                }, 300 + (100 * index));
            });
        };
        
        // Call animation function
        animateElements();
        
        // User Dropdown
        const userDropdownToggle = document.getElementById('userDropdownToggle');
        const userDropdownMenu = document.getElementById('userDropdownMenu');
        
        if (userDropdownToggle) {
            userDropdownToggle.addEventListener('click', () => {
                userDropdownMenu.classList.toggle('show');
            });
            
            // Close dropdown when clicking outside
            document.addEventListener('click', (e) => {
                if (!userDropdownToggle.contains(e.target) && !userDropdownMenu.contains(e.target)) {
                    userDropdownMenu.classList.remove('show');
                }
            });
        }
        
        // Initialize Bootstrap tooltips and popovers
        const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
        tooltipTriggerList.map(function (tooltipTriggerEl) {
            return new bootstrap.Tooltip(tooltipTriggerEl);
        });
        
        const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
        popoverTriggerList.map(function (popoverTriggerEl) {
            return new bootstrap.Popover(popoverTriggerEl);
        });
        
        // Custom file input
        document.querySelectorAll('.custom-file-input').forEach(inputElement => {
            inputElement.addEventListener('change', (e) => {
                let fileName = e.target.files[0].name;
                let nextSibling = e.target.nextElementSibling;
                nextSibling.innerText = fileName;
            });
        });
        
        // Form validation styles
        const forms = document.querySelectorAll('.needs-validation');
        Array.from(forms).forEach(form => {
            form.addEventListener('submit', event => {
                if (!form.checkValidity()) {
                    event.preventDefault();
                    event.stopPropagation();
                }
                form.classList.add('was-validated');
            }, false);
        });
        
        // Initialize Charts if elements exist
        // Revenue Chart
        const initRevenueChart = () => {
            const revenueChartEl = document.getElementById('revenueChart');
            if (revenueChartEl) {
                const revenueChart = new ApexCharts(revenueChartEl, {
                    series: [{
                        name: 'Revenue',
                        data: [15000, 18000, 22500, 19000, 26000, 30000, 35000, 32000, 40000, 42000, 45000, 50000]
                    }],
                    chart: {
                        height: 300,
                        type: 'area',
                        toolbar: {
                            show: false
                        },
                        zoom: {
                            enabled: false
                        }
                    },
                    dataLabels: {
                        enabled: false
                    },
                    stroke: {
                        curve: 'smooth',
                        width: 2
                    },
                    colors: ['#4e73df'],
                    fill: {
                        type: 'gradient',
                        gradient: {
                            shadeIntensity: 1,
                            opacityFrom: 0.7,
                            opacityTo: 0.3
                        }
                    },
                    grid: {
                        borderColor: '#f1f1f1',
                        row: {
                            colors: ['transparent', 'transparent'],
                            opacity: 0.5
                        }
                    },
                    xaxis: {
                        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
                        labels: {
                            style: {
                                colors: '#858796'
                            }
                        }
                    },
                    yaxis: {
                        labels: {
                            style: {
                                colors: '#858796'
                            },
                            formatter: function (value) {
                                return '₹' + value.toLocaleString();
                            }
                        }
                    },
                    tooltip: {
                        y: {
                            formatter: function (value) {
                                return '₹' + value.toLocaleString();
                            }
                        }
                    }
                });
                revenueChart.render();
            }
        };
        
        // Enrollments Pie Chart
        const initEnrollmentsPieChart = () => {
            const enrollmentsPieChartEl = document.getElementById('enrollmentsPieChart');
            if (enrollmentsPieChartEl) {
                const enrollmentsPieChart = new ApexCharts(enrollmentsPieChartEl, {
                    series: [35, 25, 20, 15, 5],
                    chart: {
                        width: '100%',
                        height: 300,
                        type: 'pie'
                    },
                    labels: ['Web Development', 'Design', 'Programming', 'Marketing', 'Other'],
                    colors: ['#4e73df', '#1cc88a', '#36b9cc', '#f6c23e', '#e74a3b'],
                    legend: {
                        position: 'bottom'
                    },
                    responsive: [{
                        breakpoint: 480,
                        options: {
                            chart: {
                                width: 200
                            },
                            legend: {
                                position: 'bottom'
                            }
                        }
                    }],
                    dataLabels: {
                        dropShadow: {
                            enabled: false
                        }
                    }
                });
                enrollmentsPieChart.render();
            }
        };
        
        // Initialize all charts
        initRevenueChart();
        initEnrollmentsPieChart();
    });
</script>

<!-- Modal Backdrop Fix Script -->
<script>
    document.addEventListener('DOMContentLoaded', function() {
        // Fix for modal backdrops not being removed properly in admin panel
        const handleModalHidden = function() {
            // Check if there are any open modals
            const openModals = document.querySelectorAll('.modal.show');
            if (openModals.length === 0) {
                // Remove any lingering backdrops
                const backdrops = document.querySelectorAll('.modal-backdrop');
                backdrops.forEach(backdrop => {
                    if (backdrop.parentNode) {
                        backdrop.parentNode.removeChild(backdrop);
                    }
                });
                
                // Restore body scrolling
                document.body.classList.remove('modal-open');
                document.body.style.overflow = '';
                document.body.style.paddingRight = '';
            }
        };
        
        // Add event listeners to all modals
        document.querySelectorAll('.modal').forEach(modal => {
            modal.addEventListener('hidden.bs.modal', handleModalHidden);
        });
        
        // Add event listeners to all close buttons
        document.querySelectorAll('.btn-close, [data-bs-dismiss="modal"]').forEach(button => {
            button.addEventListener('click', function() {
                setTimeout(handleModalHidden, 300);
            });
        });
        
        // Also handle the case when ESC key is pressed
        document.addEventListener('keydown', function(e) {
            if (e.key === 'Escape') {
                setTimeout(handleModalHidden, 300);
            }
        });
        
        // Add a global click handler to ensure backdrop is cleaned up
        document.addEventListener('click', function(e) {
            if (e.target.classList.contains('modal')) {
                setTimeout(handleModalHidden, 300);
            }
        });
        
        // Periodic check as additional safety measure
        setInterval(function() {
            const openModals = document.querySelectorAll('.modal.show');
            if (openModals.length === 0 && document.body.classList.contains('modal-open')) {
                handleModalHidden();
            }
        }, 1000);
    });
</script>

<!-- Page Specific Scripts -->
<?php if (strpos($_SERVER['REQUEST_URI'], 'dashboard') !== false || basename($_SERVER['PHP_SELF']) === 'index.php'): ?>
<!-- Dashboard specific scripts already included above -->
<?php endif; ?>

</body>
</html>