@extends('layouts.ecc.main')

@section('content')
<div class="row">
    <div class="col-sm-12">
        @if (count($schedules) == 0)
            <div class="card">
                <div class="content">
                    <div class="alert alert-danger">
                        <span>Aucune activité pour cette journée !</span>
                    </div>
                    <a href="/ecc/calendar" class="btn btn-link btn-block">Retour a l'horaire</a>
                </div>
            </div>
        @endif
        @foreach ($schedules as $schedule)
        <div class="card">
            <div class="content">
                <div class="row">
                    <div class="col-sm-11 col-sx-8">
                        <h5>{{$schedule->data['event_name']}}</h5>
                    </div>
                    <div class="col-sm-1 col-sx-4">
                        <div class="float-right">
                            @if ($schedule->data['is_event_mandatory'] == "on")
                                <span class="label label-warning">Obligatoire</span>
                            @else
                                <span class="label label-primary">Non Obligatoire</span>
                            @endif
                        </div>
                    </div>
                </div>
                {{$schedule->data['event_begin_time']}} à {{$schedule->data['event_end_time']}}<br>{{$schedule->data['event_location']}}<p>{!!$schedule->data['event_desc']!!}</p>
                @if ($schedule->type == "regular")
                    <div>
                        <div class="row">
                            <div class="col-sm-2">
                                Niveau   
                            </div>
                            <div class="col-sm-5">
                                Période 1   
                            </div>
                            <div class="col-sm-5">
                                Période 2   
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-2">
                                1   
                            </div>
                            <div class="col-sm-5">
                                <div class="content">
                                    <div class="row">
                                        <div class="col-sm-6">
                                           {{\App\User::find($schedule->data['n1_p1_instructor'])->fullname()}} 
                                        </div>
                                        <div class="col-sm-6">
                                            @if ($schedule->data['n1_p1_instructor'] == \Auth::User()->id)
                                                @if ($schedule->data['n1_p1_plandone'] == "on")
                                                    <span class="label label-success">Remis</span>
                                                @else
                                                    <span class="label label-danger">Non remis</span>
                                                @endif  
                                            @endif
                                        </div>
                                    </div>
                                    <br>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            {{$schedule->data['n1_p1_ocom']}} - {{$schedule->data['n1_p1_name']}}
                                        </div>
                                        <div class="col-sm-6">
                                            {{\App\Local::find($schedule->data['n1_p1_local'])->name}}
                                        </div>
                                    </div>
                                    <div class="row">
                                        @if ($schedule->data['n1_p1_instructor'] == \Auth::User()->id)
                                            <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/1/1" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                        @endif
                                    </div>
                                </div>
                            </div>
                            <div class="col-sm-5">
                                    <div class="content">
                                        <div class="row">
                                            <div class="col-sm-6">
                                               {{\App\User::find($schedule->data['n1_p2_instructor'])->fullname()}} 
                                            </div>
                                            <div class="col-sm-6">
                                                @if ($schedule->data['n1_p2_instructor'] == \Auth::User()->id)
                                                    @if ($schedule->data['n1_p2_plandone'] == "on")
                                                        <span class="label label-success">Remis</span>
                                                    @else
                                                        <span class="label label-danger">Non remis</span>
                                                    @endif  
                                                @endif
                                            </div>
                                        </div>
                                        <br>
                                        <div class="row">
                                            <div class="col-sm-6">
                                                {{$schedule->data['n1_p2_ocom']}} - {{$schedule->data['n1_p2_name']}}
                                            </div>
                                            <div class="col-sm-6">
                                                {{\App\Local::find($schedule->data['n1_p2_local'])->name}}
                                            </div>
                                        </div>
                                        <div class="row">
                                            @if ($schedule->data['n1_p2_instructor'] == \Auth::User()->id)
                                                <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/1/2" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                        </div>
                        <hr>
                        <div class="row">
                                <div class="col-sm-2">
                                    2 
                                </div>
                                <div class="col-sm-5">
                                    <div class="content">
                                        <div class="row">
                                            <div class="col-sm-6">
                                               {{\App\User::find($schedule->data['n2_p1_instructor'])->fullname()}} 
                                            </div>
                                            <div class="col-sm-6">
                                                @if ($schedule->data['n2_p1_instructor'] == \Auth::User()->id)
                                                    @if ($schedule->data['n2_p1_plandone'] == "on")
                                                        <span class="label label-success">Remis</span>
                                                    @else
                                                        <span class="label label-danger">Non remis</span>
                                                    @endif  
                                                @endif
                                            </div>
                                        </div>
                                        <br>
                                        <div class="row">
                                            <div class="col-sm-6">
                                                {{$schedule->data['n2_p1_ocom']}} - {{$schedule->data['n2_p1_name']}}
                                            </div>
                                            <div class="col-sm-6">
                                                {{\App\Local::find($schedule->data['n2_p1_local'])->name}}
                                            </div>
                                        </div>
                                        <div class="row">
                                            @if ($schedule->data['n2_p1_instructor'] == \Auth::User()->id)
                                                <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/2/1" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-5">
                                        <div class="content">
                                            <div class="row">
                                                <div class="col-sm-6">
                                                   {{\App\User::find($schedule->data['n2_p2_instructor'])->fullname()}} 
                                                </div>
                                                <div class="col-sm-6">
                                                    @if ($schedule->data['n2_p2_instructor'] == \Auth::User()->id)
                                                        @if ($schedule->data['n2_p2_plandone'] == "on")
                                                            <span class="label label-success">Remis</span>
                                                        @else
                                                            <span class="label label-danger">Non remis</span>
                                                        @endif  
                                                    @endif
                                                </div>
                                            </div>
                                            <br>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    {{$schedule->data['n2_p2_ocom']}} - {{$schedule->data['n2_p2_name']}}
                                                </div>
                                                <div class="col-sm-6">
                                                    {{\App\Local::find($schedule->data['n2_p2_local'])->name}}
                                                </div>
                                            </div>
                                            <div class="row">
                                                @if ($schedule->data['n2_p2_instructor'] == \Auth::User()->id)
                                                    <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/2/2" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                                @endif
                                            </div>
                                        </div>
                                    </div>
                            </div>
                        <hr>
                        <div class="row">
                                <div class="col-sm-2">
                                    3 
                                </div>
                                <div class="col-sm-5">
                                    <div class="content">
                                        <div class="row">
                                            <div class="col-sm-6">
                                               {{\App\User::find($schedule->data['n3_p1_instructor'])->fullname()}} 
                                            </div>
                                            <div class="col-sm-6">
                                                @if ($schedule->data['n3_p1_instructor'] == \Auth::User()->id)
                                                    @if ($schedule->data['n3_p1_plandone'] == "on")
                                                        <span class="label label-success">Remis</span>
                                                    @else
                                                        <span class="label label-danger">Non remis</span>
                                                    @endif  
                                                @endif
                                            </div>
                                        </div>
                                        <br>
                                        <div class="row">
                                            <div class="col-sm-6">
                                                {{$schedule->data['n3_p1_ocom']}} - {{$schedule->data['n3_p1_name']}}
                                            </div>
                                            <div class="col-sm-6">
                                                {{\App\Local::find($schedule->data['n3_p1_local'])->name}}
                                            </div>
                                        </div>
                                        <div class="row">
                                            @if ($schedule->data['n3_p1_instructor'] == \Auth::User()->id)
                                                <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/3/1" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                <div class="col-sm-5">
                                        <div class="content">
                                            <div class="row">
                                                <div class="col-sm-6">
                                                   {{\App\User::find($schedule->data['n3_p2_instructor'])->fullname()}} 
                                                </div>
                                                <div class="col-sm-6">
                                                    @if ($schedule->data['n3_p2_instructor'] == \Auth::User()->id)
                                                        @if ($schedule->data['n3_p2_plandone'] == "on")
                                                            <span class="label label-success">Remis</span>
                                                        @else
                                                            <span class="label label-danger">Non remis</span>
                                                        @endif  
                                                    @endif
                                                </div>
                                            </div>
                                            <br>
                                            <div class="row">
                                                <div class="col-sm-6">
                                                    {{$schedule->data['n3_p2_ocom']}} - {{$schedule->data['n3_p2_name']}}
                                                </div>
                                                <div class="col-sm-6">
                                                    {{\App\Local::find($schedule->data['n3_p2_local'])->name}}
                                                </div>
                                            </div>
                                            <div class="row">
                                                @if ($schedule->data['n3_p2_instructor'] == \Auth::User()->id)
                                                    <div class="col-sm-12" style="margin-top:2rem"><a href="/ecc/inventory/{{$schedule->id}}/3/2" name="" id="" class="btn btn-primary btn-block" href="#" >Réserver du matériel</a></div>
                                                @endif
                                            </div>
                                        </div>
                                    </div>
                            </div>
                    </div>
                @else 
                    Autre
                @endif
                </div>
            </div>
        @endforeach
    </div>
</div>  
@endsection

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

@section('custom_scripts')

@endsection