<!-- <footer class="d-footer">-->
<!--     <div class="row align-items-center justify-content-between">-->
<!--        <div class="col-auto">-->
<!--            <p class="mb-0">© <span id="currentYear"></span> Society Management System. All Rights Reserved.</p>-->
<!--        </div>-->
<!--        <div class="col-auto">-->
<!--            <p class="mb-0">-->
<!--                Proudly Powered By-->
<!--                <a href="https://successinnovativetechnologiespvtltd.com/" target="_blank" class="text-primary-600 text-decoration-none">-->
<!--                    Success Innovative Technologies Pvt. Ltd.-->
<!--                </a>-->
<!--            </p>-->
<!--        </div>-->
<!--      </div>-->
<!--</footer>-->

</main>

<script>
document.addEventListener('DOMContentLoaded', function () {
  const role = localStorage.getItem('activeRole');
  const menuItems = document.querySelectorAll('#sidebar-menu > li');
  const backBtn = document.getElementById('backToMainBtn');

  // No role → show all
  if (!role) {
    menuItems.forEach(item => item.style.display = 'block');
    if (backBtn) backBtn.style.display = 'none';
    return;
  }

  // Role selected → filter menus
  menuItems.forEach(item => {
    if (
      item.classList.contains(role) ||
      item.classList.contains('always-show')
    ) {
      item.style.display = 'block';
    } else {
      item.style.display = 'none';
    }
  });

  if (backBtn) backBtn.style.display = 'block';
});

// Back button action
function goToMainDashboard() {
  localStorage.removeItem('activeRole');
  window.location.href = 'Dashboard_Main.php';
}
</script>

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

    const selectAll = document.querySelector("thead input[type='checkbox']");
    const checkboxes = document.querySelectorAll("tbody input[type='checkbox']");

    // Select All
    if(selectAll){
        selectAll.addEventListener("change", function(){

            checkboxes.forEach(function(checkbox){
                checkbox.checked = selectAll.checked;
            });

        });
    }

    // Individual Checkbox
    checkboxes.forEach(function(checkbox){

        checkbox.addEventListener("change", function(){

            let total = checkboxes.length;
            let checked = document.querySelectorAll("tbody input[type='checkbox']:checked").length;

            if(selectAll){
                selectAll.checked = (total === checked);
            }

        });

    });

});
</script>

  <!-- jQuery library js -->
  <script src="assets/js/lib/jquery-3.7.1.min.js"></script>
  <!-- Bootstrap js -->
  <script src="assets/js/lib/bootstrap.bundle.min.js"></script>
  <!-- Apex Chart js -->
  <!--<script src="assets/js/lib/apexcharts.min.js"></script>-->
  <!-- Data Table js -->
  <script src="assets/js/lib/dataTables.min.js"></script>                                                                                            
  <!-- Iconify Font js -->
  <script src="assets/js/lib/iconify-icon.min.js"></script>
  <!-- jQuery UI js -->
  <script src="assets/js/lib/jquery-ui.min.js"></script>
  <!-- Vector Map js -->
  <script src="assets/js/lib/jquery-jvectormap-2.0.5.min.js"></script>
  <script src="assets/js/lib/jquery-jvectormap-world-mill-en.js"></script>
  <!-- Popup js -->
  <script src="assets/js/lib/magnifc-popup.min.js"></script>
  <!-- Slick Slider js -->
  <script src="assets/js/lib/slick.min.js"></script>
  <!-- prism js -->
  <script src="assets/js/lib/prism.js"></script>
  <!-- file upload js -->
  <script src="assets/js/lib/file-upload.js"></script>
  <!-- audioplayer -->
  <script src="assets/js/lib/audioplayer.js"></script>
  <!-- main js -->
  <script src="assets/js/app.js"></script>


BULK DELETE

<script>
const checkAll = document.getElementById('checkAll');
const bulkWrapper = document.getElementById('bulkDeleteWrapper');
const selectedCount = document.getElementById('selectedCount');

function getVisibleRowCheckboxes() {
    return Array.from(
        document.querySelectorAll('#userTable tbody tr')
    ).filter(row => row.style.display !== 'none')
     .map(row => row.querySelector('.row-check'))
     .filter(Boolean);
}

function getCheckedRowCheckboxes() {
    return Array.from(
        document.querySelectorAll('#userTable tbody .row-check:checked')
    );
}

function updateBulkUI() {
    const checked = getCheckedRowCheckboxes();
    const count = checked.length;

    if (count > 0) {
        bulkWrapper.style.display = '';
        selectedCount.textContent = count;
    } else {
        bulkWrapper.style.display = 'none';
        selectedCount.textContent = 0;
    }

    const visibleBoxes = getVisibleRowCheckboxes();
    const visibleChecked = visibleBoxes.filter(cb => cb.checked).length;

    checkAll.checked =
        visibleBoxes.length > 0 &&
        visibleChecked === visibleBoxes.length;

    checkAll.indeterminate =
        visibleChecked > 0 &&
        visibleChecked < visibleBoxes.length;
}

checkAll.addEventListener('change', function () {
    getVisibleRowCheckboxes().forEach(cb => {
        cb.checked = this.checked;
    });

    updateBulkUI();
});

document.getElementById('userTable').addEventListener('change', function(e) {
    if (e.target.matches('.row-check')) {
        updateBulkUI();
    }
});

document.getElementById('bulkDeleteBtn').addEventListener('click', function () {

    const checked = getCheckedRowCheckboxes();

    Swal.fire({
        title: 'Delete Selected Bills?',
        text: 'This action cannot be undone!',
        icon: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#d33',
        cancelButtonColor: '#6c757d',
        confirmButtonText: 'Delete'
    }).then((result) => {

        if (result.isConfirmed) {

            checked.forEach(cb => {
                cb.closest('tr').remove();
            });

            updateBulkUI();

            document.querySelectorAll('#userTable tbody tr')
                .forEach((row, index) => {
                    row.querySelector('td:nth-child(2)').textContent = index + 1;
                });

            Swal.fire(
                'Deleted!',
                'Selected bills have been deleted.',
                'success'
            );
        }
    });
});
</script>

</body>
</html>