@extends('admin.layouts.container')

@section('content')
<div class="side-title">
    <h3>{{ $head ?? '' }}</h3>
</div>

<div class="border-item">
   
        <div class="form-group col-lg-12">
        <label>{{__('trainreservations.patient_details')}}</label>
        <br><br>
        @foreach($systemfoods as $data)
          <label>#{{$data->name}}</label>
            <table id="pricing-list-container" style="width:100%;word-break:break-all">
                <thead>
                    <th >{{__('trainreservations.meal_name')}}</th>
                    <th >{{__('trainreservations.meal_type')}}</th>
                    <th >{{__('trainreservations.meal_calories')}}</th>
                    <th >{{__('trainreservations.meal_fats')}}</th>
                    <th >{{__('trainreservations.meal_carbohydrates')}}</th>
                    <th >{{__('trainreservations.meal_protein')}}</th>
                    <th >{{__('trainreservations.meal_glycemic')}}</th>
                    
                </thead>
                <tbody>
                      @foreach($data->meals->sortBy('type') as $row)
                    <tr>
                    <td>{{$row->name}}</td>
                    <td>@if($row->type == '1'){{__('trainreservations.breakfast')}} @elseif($row->type == '2') {{__('trainreservations.launch')}} @elseif($row->type == '3') {{__('trainreservations.dinner')}}  @else {{__('trainreservations.snakes')}} @endif</td>
                    <td>{{$row->calories}}</td>
                    <td>{{$row->fats}}</td>
                    <td>{{$row->Carbohydrates}}</td>
                    <td>{{$row->Protein}}</td>
                    <td>{{$row->glycemic}}</td>
                    </tr>
                    @endforeach
                </tbody>
            </table> 
            <br><br>
            @endforeach
            @if(count($reservations)>0)
          
            <h3>{{__('trainreservations.continue_reservation')}}</h3>
            @php $all = $reservation->count ;
                 $remain = $all - $reserved;
            @endphp
            <h5>{{__('trainreservations.remain_reservation') .' : ' }} @if($remain != '0') {{$remain}} @else {{__('trainreservations.notcontinue')}} @endif</h5>
            <br><br>
            <label>{{__('trainreservations.compare')}}</label>
            <table id="pricing-list-container" style="width:100%;">
                <thead>
                    <th>#</th>
                    <th>{{__('trainreservations.height')}}</th>
                    <th>{{__('trainreservations.width')}}</th>
                    <th>{{__('trainreservations.wight')}}</th>
                    <th>{{__('trainreservations.train')}}</th>
                    <th>{{__('trainreservations.trainner')}}</th>
                    <th>{{__('trainreservations.day')}}</th>
                </thead>
                <tbody>
                    @foreach($reservations as $key=>$row)
                    <tr>
                    <td>{{$key+1}}</td>
                    <td>{{$row->height}}</td>
                    <td>{{$row->width}}</td>
                    <td>{{$row->weight}}</td>
                    <td>{{$row->system_physic['name']}}</td>
                    <td>{{$row->trainner->name}}</td>
                    <td>{{date("Y-m-d", strtotime($row->created_at) )}}</td>
                </tr>
                    @endforeach
                </tbody>
            </table> 
            <br><br>
            
          
            
        
            
            
              
            @else
            <h3>{{__('trainreservations.new_reservation')}}</h3>
            @endif
       
        </div>
        @if(count($answers) > 0)
        
         <div class="form-group col-lg-12">
              <label>{{__('trainreservations.compare_questions')}}</label>
            <table id="pricing-list-container" style="width:100%;">
                <thead>
                    <th>#</th>
                    <th>{{__('trainreservations.question')}}</th>
                    <th>{{__('trainreservations.answer')}}</th>
                   
                </thead>
                <tbody>
                    @foreach($answers as $key=>$row)
                    <tr>
                    <td>{{$key+1}}</td>
                    <td>{{$row->question->question}}</td>
                    <td>{{$row->answer}}</td>
                    </tr>
                    @endforeach
                </tbody>
            </table> 
            <br><br>
         </div>
         @endif
<div class="row">
@foreach(physical($systemphysic->id) as $key=>$system)
<div class="col-lg-12"><h2>{{__('physicals.physical')}} : {{$key+1}}</h2></div>
 <div class="form-group col-lg-6">
            <label>{{  __('physicals.name') }} </label>
            <input type="text" class="form-control " disabled   value='{{$system->name }}'/>
        </div>

    
           <div class="form-group col-lg-6">
            <label>{{ meta('description', getCurrentLocale()) ?? __('physicals.description') }} </label>
            <input type="text" class="form-control " disabled value='{{$system->description }}' />
        </div>
          {{--Start image container--}}
        <div class="form-group col-lg-12">
        @if(!is_null($system->image))<img style="
    width: 70%;
    height: 250px;
    margin-right:150px;
" src="{{asset($system->image)}}">@endif
        </div>
        {{--End image container--}}
        
         {{--Start video container--}}
          <div class="form-group col-lg-12">
           @if(!is_null($system->video))
<video style="
    width: 70%;
    height: 250px; margin-right:150px;
" controls>
  <source src="{{asset($system->video)}}" type="video/mp4">
</video>
@endif
        </div>
        {{--End video container--}}
      


@endforeach
  </div>
</div>

@endsection

@section('inner_js')
    <!-- Editor JS files -->
    <script type="text/javascript">
    $(document).ready(function(){
    $(document).on('change','#dating',function(){
      
      var doctor = $('#doctor').val();
     
          var dates = $('#dating').val();
        var data = doctor + ','+ dates;
        if(doctor != null)
        $.ajax({
          url : urldating+data,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
            $('#table').html(data);
            
          }
        })
    });
    $(document).on('change','#system_food',function(){
     
      var data = $('#system_food').val();
      
        
        if(doctor != null)
        $.ajax({
          url : urlfood+data,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
            $('#tablefood').html(data);
            
          }
        })
    });
       $(document).on('change','#system_physical',function(){
      
      var data = $('#system_physical').val();
    
        
        if(doctor != null)
        $.ajax({
          url : urlphysical+data,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {

            $('#tablephysical').html(data);
            
          }
        })
    });
  });
    function addanatomy(elem) {
    
  
      var datarow =$(elem).attr('counter');
      
      var newdata = parseInt(datarow)+1; 
      
      $(elem).attr('counter', newdata);
        
        $.ajax({
          url : urlanatomy +datarow,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#anatomy').append(data);
          }
        })
}
</script>
<script type="text/javascript">
    function addprescription(elem) {
    
  
      var datarow =$(elem).attr('counter');
      
      var newdata = parseInt(datarow)+1; 
      
      $(elem).attr('counter', newdata);
        
        $.ajax({
          url : urlprescription +datarow,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#prescription').append(data);
          }
        })
}
</script>

{{--    <script src="{{ asset('/assets/admin/js/lib/tinymce.min.js') }}"></script>--}}
            <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        let route_prefix = "{{ url(config('lfm.prefix')) }}",
            url = "{{url('/')}}/",
            urlanatomy = "{{url('admin/anatomy')}}/",
            urlprescription = "{{url('admin/prescription')}}/",
            urldating = "{{url('admin/datingtrain')}}/",
            urlfood = "{{url('admin/systemfood')}}/",
            urlphysical = "{{url('admin/systemphysical')}}/",
            imagePath = "{{asset('')}}";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
@endsection
