// Test script to verify assignment buttons JavaScript functionality
console.log("=== Verifying Assignment Buttons JavaScript Functionality ===");

// Simulate DOM loaded event
document.addEventListener('DOMContentLoaded', function() {
    console.log("DOM loaded, checking button event listeners...");
    
    // Check edit buttons
    const editButtons = document.querySelectorAll('button.btn-primary');
    console.log("Found " + editButtons.length + " edit buttons");
    
    editButtons.forEach(button => {
        if (button.textContent.trim() === 'সম্পাদনা') {
            console.log("Edit button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    // Check view submission buttons
    const viewButtons = document.querySelectorAll('button.btn-info');
    console.log("Found " + viewButtons.length + " view submission buttons");
    
    viewButtons.forEach(button => {
        if (button.textContent.trim() === 'জমা দেখুন') {
            console.log("View submission button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    // Check submit buttons
    const submitButtons = document.querySelectorAll('button.btn-success');
    console.log("Found " + submitButtons.length + " submit buttons");
    
    submitButtons.forEach(button => {
        if (button.textContent.trim() === 'জমা দিন') {
            console.log("Submit button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    // Check preview/analysis buttons
    const previewButtons = document.querySelectorAll('button.btn-secondary');
    console.log("Found " + previewButtons.length + " preview/analysis buttons");
    
    previewButtons.forEach(button => {
        const text = button.textContent.trim();
        if (text === 'প্রিভিউ' || text === 'বিশ্লেষণ') {
            console.log("Preview/analysis button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    // Check view results buttons
    const resultsButtons = document.querySelectorAll('button.btn-outline-info');
    console.log("Found " + resultsButtons.length + " view results buttons");
    
    resultsButtons.forEach(button => {
        if (button.textContent.trim() === 'ফলাফল দেখুন') {
            console.log("View results button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    // Check disabled submit buttons
    const disabledButtons = document.querySelectorAll('button.btn-outline-secondary');
    console.log("Found " + disabledButtons.length + " disabled submit buttons");
    
    disabledButtons.forEach(button => {
        if (button.textContent.trim() === 'জমা দিন') {
            console.log("Disabled submit button has data-assignment-id: " + button.getAttribute('data-assignment-id'));
        }
    });
    
    console.log("✓ Button verification completed");
});