@model IEnumerable<Activity>

@{
    ViewData["Title"] = @SR["Page d'accueil"];
    int i=0;
    bool multipleact = Model.Count()>1;
}
@section scripts { 
    <script>
        $(document).ready(function(){
           var car = $('.carousel').first();
           var fi = car.children('.carousel-inner').first()
           .children('.item').first();
           var capt = fi.children('.carousel-caption-s');
         
            fi.addClass('active');
           car.animate({'background-color':'rgba(0, 0, 0, .5)'},500,function() {
               car.animate({'background-color':'rgba(0, 0, 0, 0)'},500)
           })
        })
    </script>
}
@section subbanner {

<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
    @if (multipleact) {
           
    <ol class="carousel-indicators">
        @{
            
            foreach (var act in Model) { 
                if (i==0) {
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
                } else {
        <li data-target="#myCarousel" data-slide-to="@i"></li>
                }
                i++;
            }
        }
    </ol> }
    <div class="carousel-inner" role="listbox"> 
        @{
            string cls = "item";
            i=0;
            foreach (var act in Model) { 
        <div class="@cls"  style="background-image: url('@act.Photo'); background-repeat: no-repeat; ">
         
            <div class="carousel-caption-s" >

                @if (act.Children.Count>0) {
                <p><em>@act.Name</em><br/>
                @act.Description </p>
                    <a asp-route-id="@act.Code" class="btn btn-default">
                        @foreach (Activity c in act.Children) {
                            @if (!c.Hidden) { @Html.DisplayFor(subact=>c) }
                        }
                </a>
                    }
                    else {
                <p><em>@act.Name</em><br/>
                @act.Description </p>

                    }

                @foreach (var frm in act.Forms) {
                    <a class="btn btn-primary" asp-controller="FrontOffice" asp-action="@frm.ActionName" asp-route-id="@act.Code">
                    @frm.Title
                    </a>
                }
            </div>
        </div>
            i++;
            cls = "item";
            }
        }
    </div>
    @if (multipleact) {
    <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Précédent</span>
    </a>
    <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Suivant</span>
    </a>
    }
</div>
}

@section ctxmenu {
    @if ((bool)ViewData["HasHaircutCommand"]) {
    <li><a asp-controller="HairCutCommand" class="badge" >
        <img src="~/images/shoppingcart.svg" alt="basket" /></a></li>
    }
}