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

@{
    ViewBag.Title = "Les Actions Educatives " + Model.Annee_Lib;
    Layout = "~/Views/Shared/_Layout.cshtml";
    ActionEdu actionEdu = Model.Obj;
}

<header>
    <h2>@actionEdu.Nom</h2>
    <div>
        <a href=@Url.Action("Index", new { annee_id = actionEdu.AnneeId })>
            <i class="fa fa-list-ul"></i> Retour à l'index
        </a>
    </div>
</header>

@if(Model.Acces==ModeAcces.Suppression) {
    <h2 class="text-danger">Voulez-vous vraiment supprimer cet élément?</h2>
    <p class="text-danger">
        Le collège ainsi que toutes les informations liées seront supprimées.
    </p>
}

<fieldset style="margin-bottom: 3em;">
    <legend>
        Descriptif
        @if (Model.Acces == ModeAcces.Lecture)
        {
            <span class="mask-ss pull-right">
                @Html.ActionLink("Modifier", "Edit", "ActionsEdu", new { Id = actionEdu.Id }, new { @class = "btn btn-primary" })
                @Html.ActionLink("Supprimer", "Delete", "ActionsEdu", new { Id = actionEdu.Id }, new { @class = "btn btn-default" })
            </span>
        }
    </legend>
    <dl class="dl-horizontal">
        <dt>@Html.DisplayNameFor(model => actionEdu.ActionEduStatut.Nom)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.ActionEduStatut.Nom)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.ActionEduThematique.ActionEduAxe.Nom)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.ActionEduThematique.ActionEduAxe.Nom)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.ActionEduThematique.Nom)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.ActionEduThematique.Nom)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.Numero)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.Numero)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.Nom)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.Nom)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.Montant)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.Montant)</dd>
        
        <dt>Elèves concernés </dt>
        <dd>@actionEdu.totalEleves</dd>
                
        <dt>@Html.DisplayNameFor(model => actionEdu.Description)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.Description)</dd>
        
        <dt>@Html.DisplayNameFor(model => actionEdu.CommentairePublic)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.CommentairePublic)</dd>
        
        <dt>@Html.DisplayNameFor(model => actionEdu.CommentaireInterne)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.CommentaireInterne)</dd>

        <dt>@Html.DisplayNameFor(model => actionEdu.Neutralise)</dt>
        <dd>@Html.DisplayFor(model => actionEdu.Neutralise)</dd>
    </dl>
</fieldset>

<legend>
    Acteurs
    <span class="mask-ss pull-right">
        <a class="btn btn-primary" href="@Url.Action("Create", "ActionsEduActeurs", new { actionEdu_id = actionEdu.Id })">
            <i class="fa fa-plus"></i> Ajouter un Acteur
        </a>
    </span>
</legend>

<table class="table simple-datatable">
    <thead>
        <tr>
            <th data-priority="1">Acteur</th>
            <th data-priority="2">Rôle</th>
            <th>Commentaire</th>
            <th width="1px"></th> @*'width=1px' >> force the minimum width*@ 
            <th width="1px"></th>
        </tr>
    </thead>
    <tbody>
        @foreach (ActionEduActeur item in Model.Obj.ActionEduActeurs)
        {
            <tr>
                <td>@Html.DisplayFor(model => item.Nom)</td>
                <td>@Html.DisplayFor(model => item.ActionEduActeurRole.Libelle)</td>
                <td>@Html.DisplayFor(model => item.Commentaire)</td>
                <td>
                    <a class="btn btn-primary btn-xs" href="@Url.Action("Edit", "ActionsEduActeurs", new { Id = item.Id })" title="Modifier l'acteur">
                        <i class="glyphicon glyphicon-pencil"></i> 
                    </a>
                </td>
                <td>
                    <a class="btn btn-danger btn-xs" href="@Url.Action("Delete", "ActionsEduActeurs", new { Id = item.Id })" title="Retirer l'acteur">
                        <i class="glyphicon glyphicon-remove"></i>
                    </a>
                </td>
            </tr>
        }
    </tbody>
</table>

<br/> <br/>

<legend>
    Collège(s) concerné(s)
    <span class="mask-ss pull-right">
        <a class="btn btn-primary" href="@Url.Action("Create", "ActionsEduCollege", new { actionEdu_id = actionEdu.Id })">
            <i class="fa fa-plus"></i> Ajouter un Collège
        </a>
    </span>
</legend>

<table class="table datatable">
    <thead>
        <tr>
            <th data-priority="1">Collège</th>
            <th>Commune</th>
            <th data-priority="2">Elèves concernés</th>
            <th>Commentaire</th>
            <th width="1px"></th> @*'width=1px' >> force the minimum width*@ 
            <th width="1px"></th>
        </tr>
    </thead>
    <tbody>
        @foreach (ActionEduCollege item in Model.Obj.ActionsEduColleges.OrderBy(a=>a.College.Libelle))
        {
        <tr>
            <td>@item.College.Libelle <a href=@Url.Action("Details", "Colleges", new { Id = item.College.Id }) target="_blank" title="Voir le collège"><i class="glyphicon glyphicon-new-window"></i></a></td>
            <td>@Html.DisplayFor(model => item.College.Commune)</td>
            <td>@Html.DisplayFor(model => item.NbEleves)</td>
            <td>@Html.DisplayFor(model => item.Commentaire)</td>
            <td>
                <a class="btn btn-primary btn-xs" href="@Url.Action("Edit", "ActionsEduCollege", new { Id = item.Id })" title="Modifier l'affectation">
                    <i class="glyphicon glyphicon-pencil"></i> 
                </a>
            </td>
            <td>
                <a class="btn btn-danger btn-xs" href="@Url.Action("Delete", "ActionsEduCollege", new { Id = item.Id })" title="Retirer le collège">
                    <i class="glyphicon glyphicon-remove"></i>
                </a>
            </td>
        </tr>
        }
    </tbody>
</table>

@if (Model.Acces == ModeAcces.Suppression)
{
    using (Html.BeginForm())
    {
        @Html.AntiForgeryToken()

        <div class="form-actions no-color">
            <input type="submit" value="@Model.Acces.EnumDisplayNameFor(MvcHtmlHelpers.DisplayValue.Prompt)" class="btn btn-danger" />
        </div>

        <br/>
        <div>@Html.ActionLink("Annuler", "Details", new { Id = actionEdu.Id })</div>
    }

}


