@extends('adminlte::page')
@section('content_header')
    @notifyCss
    @notifyJs
@stop
@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card card-primary">
                <div class="card-header">
                    <h3 class="card-title">View Training Details</h3>
                </div>
                @include('notify::messages')
                <!-- /.card-header -->
                <!-- form start -->
                <form id="userregform" class="form-horizontal" action="#" method="post" autocomplete="off" enctype="multipart/form-data">
                  {{ csrf_field() }}
                  <div class="card-body">
                      <div class="col-12">
                          <div class="form-group row">
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Training Title</label><br>
                                  {{$schedule_trainings->schedule->training_title}}
                                  <input type="hidden" name="schedule_id" id="schedule_id" value="{{$schedule_trainings->schedule_id}}">
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Venue</label><br>
                                  {{$schedule_trainings->schedule->venue}}
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Training Period</label><br>
                                  @php
                                    $period_from = $schedule_trainings->schedule->period_from;
                                    $period_to = $schedule_trainings->schedule->period_to;
                                    if($period_from)
                                    {
                                        $period_from = date("d-M-Y", strtotime($period_from));
                                    }
                                    if($period_to)
                                    {
                                        $period_to = date("d-M-Y", strtotime($period_to));
                                    }
                                    echo $period_from." to ".$period_to;
                                  @endphp 
                                  
                              </div>
                              <div class="col-3">
                                <label for="exampleInputEmail1">Min & Max seats for training</label><br>
                                  @php
                                    $min_seat_training = $schedule_trainings->schedule->min_seat_training;
                                    $max_seat_training = $schedule_trainings->schedule->max_seat_training;
                                    
                                    echo $min_seat_training." & ".$max_seat_training;
                                  @endphp 
                              </div>
                          </div>
                      </div>
                      <div id="listroledata" style="padding: 10px;">
                        <table class="table table-hover table-bordered table-striped datatable" id="dept_details" width="100%">
                            <thead>
                              <tr class="success">
                                <th>Training Date</th>
                                <th>Topic</th>
                                <th>Attendance</th>
                              </tr>  
                            </thead>
                            <tbody>
                              @php
                                $att_status ="";
                              @endphp
                              @foreach($topic_schedule_date_arr as $topic_schedule_date)
                                <tr>
                                  <td>{{date("d-M-Y", strtotime($topic_schedule_date))}}</td>
                                  <td>{{$schedule_topic_name_arr[$topic_schedule_date]}}</td>
                                  <td>
                                    @php
                                      if(isset($attendance_status[$topic_schedule_date]))
                                      {
                                        if($attendance_status[$topic_schedule_date]==1)
                                        {
                                          $att_status = "Present";
                                        }
                                        else
                                        {
                                          $att_status = "Absent";
                                        }
                                      }
                                    @endphp
                                    {{$att_status}}
                                  </td>
                                </tr>
                              @endforeach
                            </tbody>
                        </table>             
                      </div>
                  </div>
                  <!-- /.card-body -->
                  <div class="card-footer">
                    <a href="{{URL::to('/active_trainings')}}" class="btn btn-primary pull-right">Back</a>
                  </div>
                </form>
            </div>
        </div>        
    </div>
    
@stop
