@model IEnumerable<ResponseQuestionnaireWithUsersViewModel>

@{
    ViewData["Title"] = "Survey Analysis";
}
<div class="container mt-5">

    <partial name="_Notification" />


    <div class="card bg-default mb-3 ">
        <div class="card-header">Survey analysis</div>
        <div class="card-body">
            <h4 class="card-title">Survey analysis list</h4>


            <form asp-action="DeleteMultiple" method="post">

                <table class="table table-responsive w-100 d-block d-md-table table-hover ">
                    <thead class="w-100">
                        <tr>
                            <th><input type="checkbox" onclick="selectAll(this)" /></th> <!-- Master checkbox -->
                            <th>Id</th>
                            <th>Questionnaire</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.Title</td>

                                <td class="text-end">
                                    <a asp-action="Analysis" asp-route-id="@item.Id" class="btn btn-info btn-sm"><i class="bi bi-graph-up-arrow"></i> Analyzer</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>

}
