@extends('admin.layouts.containers')

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

<div class="border-item">
     <div class="row">
     <div class="form-group col-lg-5"></div>
     <div class="form-group col-lg-1">
       <a onclick="window.print()" class="btn btn-primary" style="background-color:#1561cb;border-color:#1561cb;color:white"><i class="fas fa-print"></i></a>
       </div>
    </div>
        <h1>{{$system->name}}</h1>
        <hr>
         
    @foreach($codes as $key=>$code)
    <h3>{{$key+1}}#-{{$code->name}}</h3>
    <hr>
    <div class="row">
         <div class="form-group col-lg-12">
        <h2>{{__("meals.breakfast")}}</h2>
        </div>
        <hr>@php $x = 1; @endphp
    @foreach($code->meals as $row)
    @if($row->type == "0")
       
        <div class="form-group col-lg-12">
            <label>{{$x}}#</label>
            <input type="text" class="form-control {{ $errors->has('description') ? 'is-invalid' : '' }}" disabled value='{{  $row->description }}'/>
        </div>
        @php $x = $x+1; @endphp
        @endif
        
      
@endforeach


      <div class="form-group col-lg-12">
        <h2>{{__("meals.snack_breakfast")}}</h2>
        </div>
        <hr> @php $y = 1; @endphp
    @foreach($code->meals as $row)
   
    @if($row->type == "1")
        
        <div class="form-group col-lg-12">
            <label>{{$y}}#</label>
            <input type="text" class="form-control {{ $errors->has('description') ? 'is-invalid' : '' }}" disabled value='{{  $row->description }}'/>
        </div>
        @php $y = $y+1; @endphp
        @endif
        
      
@endforeach



      <div class="form-group col-lg-12">
        <h2>{{__("meals.launch")}}</h2>
        </div>
        <hr> @php $z = 1; @endphp
    @foreach($code->meals as $row)
   
    @if($row->type == "2")
        
        <div class="form-group col-lg-12">
            <label>{{$z}}#</label>
            <input type="text" class="form-control {{ $errors->has('description') ? 'is-invalid' : '' }}" disabled value='{{  $row->description }}'/>
        </div>
        @php $z = $z+1; @endphp
        @endif
        
      
@endforeach


      <div class="form-group col-lg-12">
        <h2>{{__("meals.snack_launch")}}</h2>
        </div>
        <hr>@php $a = 1; @endphp
    @foreach($code->meals as $row)
    
    @if($row->type == "3")
    
        <div class="form-group col-lg-12">
            <label>{{$a}}#</label>
            <input type="text" class="form-control {{ $errors->has('description') ? 'is-invalid' : '' }}" disabled value='{{  $row->description }}'/>
        </div>
        @php $a = $a+1; @endphp
        @endif
        
      
@endforeach

      <div class="form-group col-lg-12">
        <h2>{{__("meals.dinner")}}</h2>
        </div>
        <hr>@php $b = 1; @endphp
    @foreach($code->meals as $row)
    
    @if($row->type == "4")
      
        <div class="form-group col-lg-12">
            <label>{{$b}}#</label>
            <input type="text" class="form-control {{ $errors->has('description') ? 'is-invalid' : '' }}" disabled value='{{  $row->description }}'/>
        </div>
        @php $b = $b+1; @endphp
        @endif
        
      
@endforeach
</div>
    @endforeach
                


        
   
</div>

@endsection

@section('inner_js')
<script>
    function addmeal(elem){
        $("#meals").css("display", "block");
        var num = $(elem).attr('data-id');
        
        var newrow = parseInt(num)+1; 
        $(elem).attr('data-id', newrow);
        
         $.ajax({
          url : urls+'/'+num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#meals').append(data);
          }
        })
    }
     function remove(elem){
            $(elem).closest('.row').remove();
        }
</script>
    <!-- Editor JS files -->
{{--    <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('/')}}/",
            urls = "{{url('/')}}/admin/addmeal",
            imagePath = "{{asset('')}}";
    </script>
    <script src="{{ asset('assets/admin/js/editor.js') }}"></script>
    <script src="{{ asset('assets/admin/js/lfm.js') }}"></script>
@endsection
