<!DOCTYPE html>
<html lang="bn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Button Test</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container mt-5">
        <h2>Button Test</h2>
        
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>Test</th>
                    <th>Actions</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Test Assignment</td>
                    <td>
                        <button class="btn btn-sm btn-primary" data-assignment-id="1">সম্পাদনা</button>
                        <button class="btn btn-sm btn-info" data-assignment-id="1">জমা দেখুন</button>
                        <button class="btn btn-sm btn-danger delete-assignment" data-assignment-id="1">মুছুন</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const table = document.querySelector('table.table');
            
            if (table) {
                table.addEventListener('click', function(e) {
                    const button = e.target.closest('button');
                    if (!button) return;
                    
                    const assignmentId = button.getAttribute('data-assignment-id');
                    console.log('Button clicked:', button.textContent, 'Assignment ID:', assignmentId);
                    
                    // Handle edit buttons
                    if (button.classList.contains('btn-primary') && (button.textContent.trim() === 'সম্পাদনা' || button.innerText.trim() === 'সম্পাদনা')) {
                        console.log('Edit button clicked');
                        alert('Edit button clicked for assignment ' + assignmentId);
                    }
                    
                    // Handle view submission buttons
                    else if (button.classList.contains('btn-info') && (button.textContent.trim() === 'জমা দেখুন' || button.innerText.trim() === 'জমা দেখুন')) {
                        console.log('View submission button clicked');
                        alert('View submission button clicked for assignment ' + assignmentId);
                    }
                    
                    // Handle delete buttons
                    else if (button.classList.contains('delete-assignment') || (button.classList.contains('btn-danger') && (button.textContent.trim() === 'মুছুন' || button.innerText.trim() === 'মুছুন'))) {
                        console.log('Delete button clicked');
                        alert('Delete button clicked for assignment ' + assignmentId);
                    }
                });
            }
        });
    </script>
</body>
</html>