@model IEnumerable<Model.Response>

@{
    ViewData["Title"] = "Response";
}


<div class="container mt-5">

    <partial name="_Notification" />
   

    <div class="card bg-default mb-3 ">
        <div class="card-header">User Reponse</div>
        <div class="card-body">
            <h4 class="card-title">User response list</h4>
           

            <form asp-action="DeleteMultiple" method="post">
                
                    <table class="table table-responsive w-100 d-block d-md-table ">
                        <thead class="w-100">
                            <tr>
                                <th><input type="checkbox" onclick="selectAll(this)" /></th> <!-- Master checkbox -->
                                <th>Id</th>
                                <th>Questionnaire</th>
                                <th>UserName</th>
                                <th>UserEmail</th>
                                <th>Submission Date</th>
                            <th class="text-end">Action</th>
                            </tr>
                        </thead>
                        <tbody class="w-100">
                            @foreach (var item in Model)
                            {
                                <tr>
                                    <td><input type="checkbox" name="ids" value="@item.Id" /></td>
                                    <td>@item.Id</td>
                                    <td>@item.Questionnaire.Title</td>
                                    <td>@item.UserName</td>
                                    <td>@item.UserEmail</td>
                                    <td>@item.SubmissionDate</td>
                                <td class="text-end">
                                    <a asp-action="ViewResponse" asp-route-id="@item.Id" class="btn btn-info btn-sm"><i class="bi bi-graph-up-arrow"></i> Details</a>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
               
                <button type="submit" class="btn btn-danger">Delete Selected</button>
            </form>

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


@section Scripts{
    <script>
        function selectAll(source) {
            checkboxes = document.getElementsByName('ids');
            for (var i = 0, n = checkboxes.length; i < n; i++) {
                checkboxes[i].checked = source.checked;
            }
        }
    </script>

}

