@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">Accept Training Schedule</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">Organisation</label><br>
                                  {{$schedules->organisation->organisation_name}}
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Department</label><br>
                                  @if(isset($schedules->department_id))
                                    {{$schedules->department->department_name}}
                                  @endif
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Section</label><br>
                                  @if(isset($schedules->section_id))
                                    {{$schedules->section->section_name}}
                                  @endif
                              </div>
                              <div class="col-3">
                                <label for="exampleInputEmail1">Material Type</label><br>
                                  {{$schedules->material_type->material_type_name}}
                              </div>
                          </div>
                          <div class="form-group row">
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Training Title</label><br>
                                  {{$schedules->training_title}}
                                  <input type="hidden" name="schedule_id" id="schedule_id" value="{{$schedules->id}}">
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Venue</label><br>
                                  {{$schedules->venue}}
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Training Period</label><br>
                                  @php
                                    $period_from = $schedules->period_from;
                                    $period_to = $schedules->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 = $schedules->min_seat_training;
                                    $max_seat_training = $schedules->max_seat_training;
                                    
                                    echo $min_seat_training." & ".$max_seat_training;
                                  @endphp 
                              </div>
                          </div>
                          <div class="form-group row">
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Roles</label><br>
                                  {{$schedules->training_title}}
                              </div>
                          </div>
                          <div class="form-group row">
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Whether Registration is Needed?</label><br>
                                  @if($schedules->registration_status==1)
                                    @php
                                      echo "Yes";
                                    @endphp
                                  @else
                                    @php
                                      echo "No";
                                    @endphp
                                  @endif
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Question and Answers for Training</label><br>
                                  @if($schedules->question_answer_status==1)
                                    @php
                                      echo "Yes";
                                    @endphp
                                  @else
                                    @php
                                      echo "No";
                                    @endphp
                                  @endif
                              </div>
                              <div class="col-3">
                                  <label for="exampleInputEmail1">Reviews and Feedback Needed?</label><br>
                                  @if($schedules->review_status==1)
                                    @php
                                      echo "Yes";
                                    @endphp
                                  @else
                                    @php
                                      echo "No";
                                    @endphp
                                  @endif                                  
                              </div>
                              <div class="col-3">
                                <label for="exampleInputEmail1">Training Certificates Needed?</label><br>
                                  @if($schedules->training_certificates==1)
                                    @php
                                      echo "Yes";
                                    @endphp
                                  @else
                                    @php
                                      echo "No";
                                    @endphp
                                  @endif   
                              </div>
                          </div>
                          <div class="form-group row">
                            <div class="col-3">
                                <label for="exampleInputEmail1">Training Fees</label><br>
                                @if(isset($schedules->training_fees))
                                    {{$schedules->training_fees}}
                                @endif
                            </div>
                            <div class="col-3">
                                <label for="exampleInputEmail1">Training Allowance</label><br>
                                @if(isset($schedules->training_allowance))
                                    {{$schedules->training_allowance}}
                                @endif
                            </div>
                            <div class="col-3">
                                <label for="exampleInputEmail1">Remarks</label><br>
                                @if(isset($schedules->remarks))
                                    {{$schedules->remarks}}
                                @endif
                            </div>
                          </div>  
                          <div class="form-group row">
                            <div class="col-8">
                              @if(!$accept_training_count)
                                <input id="check" name="check" type="checkbox" onclick="show_accept_button();">
                                <label class="col-md-5 control-label" for="name" ><center><span style="color: red;">*</span>I hereby accept the invitation for training</center></label>
                                <div id="accept_div" style="display: none;">
                                  <button type="submit" class="btn btn-responsive btn-primary btn-sm">Accept Invitation</button>
                                </div>
                              @else
                                <span style="color: blue;">You have already accept the invitation</span>
                              @endif
                            </div>
                          </div>
                      </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>
    <script type="text/javascript">
      function show_accept_button()   
      {
        var checkobj=document.getElementById("check");

        if(checkobj.checked)
        {
          document.getElementById("accept_div").style.display="block";
        }
        else
        {
          document.getElementById("accept_div").style.display="block";
        }
      }
    </script>
@stop
