@extends('layouts.ecc.main')

@section('content')
<div class="row">
    <div class="col-lg-6 col-sm-6">
        <div class="card">
            <div class="content">
                <div class="row">
                    <div class="col-xs-2">
                        <div class="icon-big icon-warning text-center">
                            <i class="ti-book"></i>
                        </div>
                    </div>
                    <div class="col-xs-10">
                        <div class="numbers">
                            <p>Cours a venir</p>
                            {{count($AlluserClasse)}}
                        </div>
                    </div>
                </div>
                <hr>
                <div class="row">
                    @if(count($AlluserClasse) == 0)
                        <div class="col-sm-12">
                            <div class="alert alert-info alert-with-icon">
                                <span data-notify="icon" class="ti-alert"></span>
                                <span data-notify="message">Aucun cours a venir</span>
                            </div>
                        </div>
                    @endif
                    @foreach ($userClasse as $classe)
                        <div class="col-sm-12">
                            @if ($classe['plan_done'] == "on")
                            <div class="alert alert-success alert-with-icon">
                                <span data-notify="icon" class="ti-crown"></span>
                                <span data-notify="message">Le cours {{$classe['ocom']}} - {{$classe['name']}} du {{$classe['date']}} est remis.<br>
                                @if ($classe['material'] != "")
                                    - Vous avez réservé 
                                    @foreach (\App\Item::explodeItems($classe['material']) as $item)
                                        @if (\App\Item::explodeItems($classe['material'])->last() == $item && \App\Item::explodeItems($classe['material'])->first() != $item)
                                            et
                                        @endif
                                        {{$item->name}}
                                    @endforeach
                                @else
                                    - Aucun matériel réservé
                                @endif
                                </span>
                            </div>
                            @else
                            <div class="alert alert-warning alert-with-icon">
                                <span data-notify="icon" class="ti-alert"></span>
                                <span data-notify="message">Le cours {{$classe['ocom']}} - {{$classe['name']}} du {{$classe['date']}} n'est pas remis.<br>
                                @if ($classe['material'] != "")
                                    - Vous avez réservé 
                                    @foreach (\App\Item::explodeItems($classe['material']) as $item)
                                        @if (\App\Item::explodeItems($classe['material'])->last() == $item && \App\Item::explodeItems($classe['material'])->first() != $item)
                                            et
                                        @endif
                                        {{$item->name}}
                                    @endforeach
                                @else
                                    - Aucun matériel réservé
                                @endif
                                </span>
                            </div>
                            @endif
                        </div>
                    @endforeach
                </div>
                <div class="footer">
                    <hr />
                    <div class="stats">
                        <i class="ti-reload"></i> Updated now
                    </div>
                </div>
            </div>
        </div>
        <div class="card">
            <div class="content">
                <div class="row">
                    <div class="col-xs-2">
                        <div class="icon-big icon-info text-center">
                            <i class="ti-book"></i>
                        </div>
                    </div>
                    <div class="col-xs-10">
                        <div class="numbers">
                            <p>Guide pédagogique et plan de cours</p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="text-center">
                        <div class="col-sm-6" style="padding:3rem;">
                            <p>Guide pédagogique et de qualification du niveau 1<br><br><div class="row"><div class="col-sm-12">
                                <a href="https://drive.google.com/uc?export=download&id=1tZhDqCvMor9p6lXxYek7Q0Xc8c2o5pG7" target="_blank" class="btn btn-block btn-info">Guide pédagogique</a></div></div></p>
                        </div>
                        <div class="col-sm-6" style="padding:3rem;">
                            <p>Guide pédagogique et de qualification du niveau 2<br><br><div class="row"><div class="col-sm-12">
                                <a href="https://drive.google.com/uc?export=download&id=1oLTavI1AQsXMdhZ4QqEkbecfV4j1LKDx" target="_blank" class="btn btn-block btn-success">Guide pédagogique</a></div></div></p>
                        </div>
                        <div class="col-sm-6" style="padding:3rem;">
                            <p>Guide pédagogique et de qualification du niveau 3<br><br><div class="row"><div class="col-sm-12">
                                <a href="https://drive.google.com/uc?export=download&id=1FrczHmiGCeONlHCuuxHNx-BZ-qEfEBK8" target="_blank" class="btn btn-block btn-warning">Guide pédagogique</a></div></div></p>
                        </div>
                        <div class="col-sm-6" style="padding:3rem;">
                            <p>Guide pédagogique et de qualification du niveau 4<br><br><div class="row"><div class="col-sm-12">
                                <a href="https://drive.google.com/uc?export=download&id=1EeibjlytdzEpRdzs-eg0pGL8TBv_ZCsu" target="_blank" class="btn btn-block btn-secondary">Guide pédagogique</a></div></div></p>
                        </div>
                    </div>
                </div>
                <hr>
                <p class="text-center">Plan de cours vierge</p>
                <a href="https://drive.google.com/uc?export=download&id=1i1a0sjI8I3nzt4mlcLvznjqYF-12JgfQ" target="_blank" class="btn btn-block btn-info">Télécharger</a>
            </div>
        </div>    
    </div>
    <div class="col-lg-6 col-sm-12">
        <div class="row">
            <div class="col-md-6 col-sm-12">
                <div class="card" style="height:320px;">
                    <div class="content">
                        <div class="row">
                            <div class="col-xs-12">
                                <div class="card-user" style="height:320px;">
                                    <div class="container-fluid">
                                        <div class="author">
                                            <img class="avatar border-white" src="/assets/admin/images/avatar/user-{{\Auth::User()->avatar}}.jpg" alt="..." style="width:100px;height:100px;margin-top:90px;">
                                            <h4 class="title">{{\Auth::User()->fullname()}}<br>
                                                <small>{{\App\Rank::find(\Auth::User()->rank)->name}}</small>
                                            </h4>
                                        </div>
                                    </div>
                                    <hr>
                                    <div class="text-center">
                                        <div class="row">
                                            <div class="col-xs-6">
                                                <h5>{{\Auth::User()->age}}<br><small>Âge</small></h5>
                                            </div>
                                            <div class="col-xs-6">
                                                <h5>{{strtoupper(\Auth::User()->sexe)}}<br><small>Sexe</small></h5>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="row">
                    <div class="col-sm-12">
                        <div class="card" style="height: 130px;">
                            <div class="content">
                                <div class="row">
                                    <div class="col-xs-5">
                                        <div class="icon-big icon-danger text-center">
                                            <i class="ti-pulse"></i>
                                        </div>
                                    </div>
                                    <div class="col-xs-7">
                                        <div class="numbers">
                                            <p>Activité sur le site</p>
                                            {{\Auth::User()->countActivity()}}
                                        </div>
                                    </div>
                                </div>
                                <div class="footer">
                                    <hr>
                                    <div class="stats">
                                        <i class="ti-timer"></i> Dans la dernière année
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12">
                        <div class="card" style="height: 170px;">
                            <div class="content">
                                <div class="row">
                                    <div class="col-xs-5">
                                        <div class="icon-big icon-success text-center">
                                            <i class="ti-pulse"></i>
                                        </div>
                                    </div>
                                    <div class="col-xs-7">
                                        <div class="numbers">
                                            <p>Nombre de cours à données</p>
                                            {{\Auth::User()->countClasse()}}
                                        </div>
                                    </div>
                                </div>
                                <div class="footer">
                                    <hr>
                                    <div class="stats">
                                        <i class="ti-timer"></i>Jusqu'a la fin de l'année
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-12">
                <div class="card">
                    <div class="content">
                        <div class="row">
                            <div class="col-xs-2">
                                <div class="icon-big icon-info text-center">
                                    <i class="ti-email"></i>
                                </div>
                            </div>
                            <div class="col-xs-10">
                                <div class="numbers">
                                    <p>Messages</p>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            @foreach ($messages as $message)
                                <div class="col-md-6 col-sx-12 text-center" style="margin-top:15px;margin-bottom:10px;">
                                    <p>{{$message->title}}<br><h5><small>par {{\App\User::find($message->user_id)->fullname()}}</small></h5></p>
                                    <div style="height:250px;overflow:hidden;">{!! $message->body !!}</div>
                                    <a href="/ecc/message/{{$message->id}}" class="btn btn-primary">Afficher plus</a>
                                </div>
                            @endforeach
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>  
@endsection

@section('active_page')
    <?php $active_page = "dashboard" ?>
@endsection