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

@{
    ViewBag.Title = "Modification " + Model.Annee_Lib;
    Layout = "~/Views/Shared/_Layout.cshtml";
    RestaurationParametre param = Model.Obj;
    List<CheckBoxListItem> repasCBList = ViewBag.repasCBList;
}

<header>
    @if (Model.Acces == ModeAcces.Modification)
    {
        <h2>Modification</h2>
    }
    else
    {
        <h2>Création</h2>
    }
</header>

@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    
<div class="form-horizontal">
    <h4>Paramètres</h4>
    <hr />
    @Html.ValidationSummary(true, "", new { @class = "text-danger" })
    @if (Model.Acces == ModeAcces.Modification)
    {
        @Html.HiddenFor(model => param.Id)
    }
    @Html.HiddenFor(model => param.Annee_Id)
    @Html.HiddenFor(model => param.Campagne)

    <div class="form-group">
        @Html.LabelFor(model => param.Prix_Mini, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => param.Prix_Mini, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => param.Prix_Mini, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => param.Prix_ATC, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => param.Prix_ATC, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => param.Prix_ATC, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => param.Prix_AgentC, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => param.Prix_AgentC, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => param.Prix_AgentC, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => param.Prix_MiniAutres, htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @Html.EditorFor(model => param.Prix_MiniAutres, new { htmlAttributes = new { @class = "form-control" } })
            @Html.ValidationMessageFor(model => param.Prix_MiniAutres, "", new { @class = "text-danger" })
        </div>
    </div>

    <div class="form-group">
        @Html.Label("Types de repas", htmlAttributes: new { @class = "control-label col-md-2" })
        <div class="col-md-10">
            @for (int i = 0; i < repasCBList.Count; i++)
            {
                @Html.HiddenFor(x => repasCBList[i].ID)
                @Html.CheckBoxFor(x => repasCBList[i].IsChecked)
                <text> </text>
                @repasCBList[i].Display
                @Html.HiddenFor(x => repasCBList[i].Display)
                <br />
            }
        </div>
    </div>

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

</div>
}
