@using CD67.FicheCollege.MVC.Models
@model ImportCollegeViewModel

@{
    ViewBag.Title = "Les Collèges " + Model.Annee_Lib;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@*Selection de colleges à importer*@
<div>

    @if(Model.colleges_ids.Count == 0)
    {
        <span> Aucun collège à importer </span>
        <div>
            @Html.ActionLink("Annuler", "Index", new { annee_id = Model.Annee_Id })
        </div>
    }
    else
    {
        using (Html.BeginForm())
        {
            @Html.AntiForgeryToken()
            @Html.HiddenFor(model => Model.Annee_Id)

            <table id="table-college-import" class="datatable table">
                <thead>
                </thead>
                <tbody>
                    @*@foreach (ImportCollegeItem item in Model.liste)*@
                    @for(int i=0; i < Model.selection.Count; i++)
                    {
                        <tr>
                            <td>
                                @Html.EditorFor(model => Model.selection[i])
                                @Html.HiddenFor(model => Model.colleges_ids[i])
                            </td>
                            <td>
                                @Html.DisplayFor(model => Model.colleges_rnes[i])
                            </td>
                            <td>
                                @Html.DisplayFor(model => Model.colleges_libs[i])
                            </td>
                        </tr>
                    }
                </tbody>
            </table>

            <div class="form-group btn-bar">
                <a href=@Url.Action("Index", new { annee_id = Model.Annee_Id }) class="btn btn-default">Annuler</a>
                <input type="submit" value="Importer" class="btn btn-primary" />
            </div>
        }
    }

</div>


