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

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


<header>
    <h2>@college.Libelle</h2>
    <div>
        <a href=@Url.Action("Index", new { annee_id = college.Annee_Id })>
            <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>
    <legend>
        Informations générales
        @if (Model.Acces == ModeAcces.Lecture)
        {
            <div class="mask-ss pull-right">
                @Html.ActionLink("Modifier", "Edit", "Colleges", new { Id = college.Id }, new { @class = "btn btn-primary" })
                @Html.ActionLink("Supprimer", "Delete", "Colleges", new { Id = college.Id }, new { @class = "btn btn-default" })
            </div>
        }
    </legend>
    <dl class="dl-horizontal">
        <dt>
            @Html.DisplayNameFor(model => college.CodeRne)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.CodeRne)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.TypeCollege.Libelle)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.TypeCollege.Libelle)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Adresse)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.AdresseComplete)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Tel)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.Tel)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Fax)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.Fax)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Email)
        </dt>
        <dd>
            @Html.DisplayFor(model => college.Email)
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Commune)
        </dt>

        <dd>
            @if (college.Commune != null)
            {
                <div class="col-sm-8 col-md-4">
                    <div class="panel panel-default">
                        <div class="panel-heading clearfix">
                            <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
                                <i class="fa fa-map-marker color1" aria-hidden="true"></i>
                                Localisation (commune)
                            </h4>
                        </div>
                        <div class="panel-body" style="text-align: center;">
                            <span style="white-space: pre-line;"><b>@college.Commune</b>
                                Canton : @college.Canton
                                TAD : @college.TAD
                                CDC : @college.CDC
                            </span>
                        </div>
                    </div>
                </div>
            }
        </dd>

        <dt>
            @Html.DisplayNameFor(model => college.Code_Postal)
        </dt>

        <dd>
            @Html.DisplayFor(model => college.Code_Postal)
        </dd>
    </dl>
</fieldset>

<legend>
    Personnel
</legend>
<div class="flex-list">
    @if (!String.IsNullOrEmpty(college.PrincipalSid))
    {
        <div style="width:400px !important">
            <div class="panel panel-default" style="overflow: hidden;">
                <div class="panel-heading clearfix">
                    <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
                        <i class="fa fa-user color1" aria-hidden="true"></i>
                        @Html.LabelFor(model => college.PrincipalSid)
                    </h4>
                </div>
                <div class="panel-body" style="text-align: center;">
                    <b>@Html.DisplayFor(model => college.principal.Prenom) @Html.DisplayFor(model => college.principal.Nom)</b><br />
                    @Html.DisplayFor(model => college.principal.Organisation)<br />
                    @Html.DisplayFor(model => college.principal.Mail)<br />
                    Tel : @Html.DisplayFor(model => college.principal.Telephone)<br />
                </div>
            </div>
        </div>
    }
    @if (!String.IsNullOrEmpty(college.AdjointSid))
    {
        <div style="width:400px !important">
            <div class="panel panel-default" style="overflow: hidden;">
                <div class="panel-heading clearfix">
                    <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
                        <i class="fa fa-user color1" aria-hidden="true"></i>
                        @Html.LabelFor(model => college.AdjointSid)
                    </h4>
                </div>
                <div class="panel-body" style="text-align: center;">
                    <b>@Html.DisplayFor(model => college.adjoint.Prenom) @Html.DisplayFor(model => college.adjoint.Nom)</b><br />
                    @Html.DisplayFor(model => college.adjoint.Organisation)<br />
                    @Html.DisplayFor(model => college.adjoint.Mail)<br />
                    Tel : @Html.DisplayFor(model => college.adjoint.Telephone)<br />
                </div>
            </div>
        </div>
    }
    @if (!String.IsNullOrEmpty(college.Gestionnaire1Sid))
    {
        <div style="width:400px !important">
            <div class="panel panel-default" style="overflow: hidden;">
                <div class="panel-heading clearfix">
                    <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
                        <i class="fa fa-user color1" aria-hidden="true"></i>
                        @Html.LabelFor(model => college.Gestionnaire1Sid)
                    </h4>
                </div>
                <div class="panel-body" style="text-align: center;">
                    <b>@Html.DisplayFor(model => college.gestionnaire1.Prenom) @Html.DisplayFor(model => college.gestionnaire1.Nom)</b><br />
                    @Html.DisplayFor(model => college.gestionnaire1.Organisation)<br />
                    @Html.DisplayFor(model => college.gestionnaire1.Mail)<br />
                    Tel : @Html.DisplayFor(model => college.gestionnaire1.Telephone)<br />
                </div>
            </div>
        </div>
    }
    @if (!String.IsNullOrEmpty(college.Gestionnaire2Sid))
    {
        <div style="width:400px !important">
            <div class="panel panel-default" style="overflow: hidden;">
                <div class="panel-heading clearfix">
                    <h4 class="panel-title pull-left" style="padding-top: 7.5px;">
                        <i class="fa fa-user color1" aria-hidden="true"></i>
                        @Html.LabelFor(model => college.Gestionnaire2Sid)
                    </h4>
                </div>
                <div class="panel-body" style="text-align: center;">
                    <b>@Html.DisplayFor(model => college.gestionnaire2.Prenom) @Html.DisplayFor(model => college.gestionnaire2.Nom)</b><br />
                    @Html.DisplayFor(model => college.gestionnaire2.Organisation)<br />
                    @Html.DisplayFor(model => college.gestionnaire2.Mail)<br />
                    Tel : @Html.DisplayFor(model => college.gestionnaire2.Telephone)<br />
                </div>
            </div>
        </div>
    }
</div>

<legend>
    Educ'Facile
</legend>

<div>
    <table class="table">
        @foreach(KeyValuePair<string, string> entry in college.educfData){
            <tr>
                <th>@entry.Key</th>
                <td>@entry.Value</td>
            </tr>
        }
    </table>
</div>

<br/>

<legend>
    Actions Educatives
</legend>

<table class="simple-datatable table" data-order="[[ 2, &quot;asc&quot; ]]">
    <thead>
        <tr>
            <th data-priority="1">Action</th>
            <th data-priority="2">Nb.Elèves</th>
            <th>Axe</th>
            <th>Commentaire</th>
        </tr>
    </thead>
    <tbody>
        @foreach (ActionEduCollege item in college.ActionsEduColleges)
        {
            <tr>
                <td>@Html.DisplayFor(model => item.ActionEdu.Nom)</td>
                <td>@Html.DisplayFor(model => item.NbEleves)</td>
                <td>@Html.DisplayFor(model => item.ActionEdu.ActionEduThematique.ActionEduAxe.Nom)</td>
                <td>@Html.DisplayFor(model => item.Commentaire)</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 = college.Id })</div>

    }

}