<?php $__env->startSection('content'); ?>
<div class="side-title">
    <h3><?php echo e($head ?? ''); ?></h3>
</div>

<div class="border-item">
    <form class="form-row" method="post" action="<?php echo e($action); ?>">
        <?php if($food ?? ''  && $food->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>

             <div class="form-group col-lg-6">
            <label><?php echo e(meta('patient', getCurrentLocale()) ?? __('foods.patient')); ?> </label>
           <select class="selectpicker form-control <?php echo e($errors->has('user_id') ? 'is-invalid' : ''); ?>"  data-show-subtext="true" data-live-search="true"  name="user_id">
               <option selected disabled><?php echo e(__('foods.select')); ?></option>
               <?php $__currentLoopData = $patients; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
               <option <?php if($food ?? ''  && $food->id): ?> <?php if($row->id == $food->id): ?> selected <?php endif; ?> <?php endif; ?> value="<?php echo e($row->id); ?>"><?php echo e($row->name); ?></option>
               <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
           </select>
            </div>
               <div class="form-group col-lg-6">
                     <?php if($food ?? ''  && $food->id): ?>
                     <input type="checkbox" class="checkbox_check" onclick="showdata(this)" style="
    margin-top: 3pc;
    margin-right: 4pc;
">عرض واخفاء 
                     <?php endif; ?>
                 </div>
           
          
   
   
       <div class="row pricing-list-item border-item mb-4 col-12" <?php if($food ?? ''  && $food->id): ?>   <?php else: ?>  style="display:none" <?php endif; ?>  id="foods">
                    <?php if($food ?? ''  && $food->id): ?>
                    <div  class="row pricing-list-item border-item mb-4 col-12" style="display:none"  id="foodshow" >
                    <?php $__currentLoopData = $foods; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data=>$row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                   
                    <div class="row pricing-list-item border-item mb-4 col-12">
                       <div class="form-group col-lg-6">
            <label><?php echo e(meta('dating', getCurrentLocale()) ?? __('insulins.dating')); ?> </label>
            <input type="date" class="form-control <?php echo e($errors->has('dating') ? 'is-invalid' : ''); ?>" name="food[<?php echo e($data); ?>][dating]" value="<?php echo e($row->dating); ?>" id="dating" placeholder="<?php echo e(meta('dating', getCurrentLocale()) ??__('insulins.dating')); ?>" value='<?php echo e(old("dating", $insulin->dating ?? "")); ?>'/>
        </div>
                <div class="form-group col-lg-5">
            <label><?php echo e(meta('name', getCurrentLocale()) ?? __('foods.name')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('name') ? 'is-invalid' : ''); ?>" value="<?php echo e($row->name); ?>" name="food[<?php echo e($data); ?>][name]" placeholder="<?php echo e(meta('name', getCurrentLocale()) ??__('foods.name')); ?>" value='<?php echo e(old("name", $food->name ?? "")); ?>'/>
        </div>
 <div class="form-group col-lg-1" style="font-size: 30px;margin-top:30px;" onclick="removeread(this)"><i class="fas fa-times-circle"></i></div>
   
      <div class="form-group col-lg-6">
            <label><?php echo e(__('foods.type')); ?> </label>
            <select class="form-control" name="food[<?php echo e($data); ?>][type]">
                <option selected disabled><?php echo e(__("foods.select")); ?></option>
                <option <?php if($row->type == '0'): ?> selected <?php endif; ?> value="0"><?php echo e(__("foods.dislike")); ?></option>
                <option <?php if($row->type == '1'): ?> selected <?php endif; ?> value="1"><?php echo e(__("foods.like")); ?></option>
               
            </select>
        </div>
       
          </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                    <?php endif; ?>
                    
                </div>
<div class="col-lg-12">
       <a style="cursor: pointer;" <?php if($food ?? ''  && $food->id): ?> data-id="<?php echo e(count($foods)); ?>" <?php else: ?>   data-id="0" <?php endif; ?> onclick="addfood(this)" class="btn_1 gray "><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__("foods.add_food")); ?></a>
                   
</div>


        <div class="text-center mt-5 col-12">
            <button class="butn"><span><?php echo e(__('dashboard.save')); ?></span></button>
        </div>
    </form>
</div>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('inner_js'); ?>

<script>
    function addfood(elem){
        $("#foods").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',
          success:function(data)
          {
            $('#foods').append(data);
          }
        })
    }
    function showdata(elem){
        let data = $(elem).val();
        if ($('input.checkbox_check').is(':checked')) {
            $('#foodshow').css('display','block');
        }
        else{
            
            $('#foodshow').css('display','none');
        }
    } 
     function remove(elem){
            $(elem).closest('.row').remove();
        }
        </script>
    <!-- Editor JS files -->

            <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
    <script>
        let route_prefix = "<?php echo e(url(config('lfm.prefix'))); ?>",
            url = "<?php echo e(url('/')); ?>/",
            urls = "<?php echo e(url('/')); ?>/admin/addfood",
            url_question = "<?php echo e(url('/')); ?>/admin/questiondata",
            imagePath = "<?php echo e(asset('')); ?>";
    </script>
    <script src="<?php echo e(asset('assets/admin/js/editor.js')); ?>"></script>
    <script src="<?php echo e(asset('assets/admin/js/lfm.js')); ?>"></script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/omaralyomhost/public_html/green_apple/resources/views/admin/foods/form.blade.php ENDPATH**/ ?>