<?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($insulin ?? ''  && $insulin->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()) ?? __('insulins.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(__('insulins.select')); ?></option>
               <?php $__currentLoopData = $patients; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
               <option <?php if($insulin ?? ''  && $insulin->id): ?> <?php if($row->id == $insulin->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($insulin ?? ''  && $insulin->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($insulin ?? ''  && $insulin->id): ?>   <?php else: ?>  style="display:none" <?php endif; ?>  id="insulins">
                   
                   <?php if($insulin ?? ''  && $insulin->id): ?>
                    <div  class=" pricing-list-item border-item mb-4 col-12" style="display:none"  id="insulinshow" >
                    <?php $__currentLoopData = $insulins; $__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="insulin[<?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('fasting_blood', getCurrentLocale()) ?? __('insulins.fasting_blood')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('fasting_blood') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][fasting_blood]" value="<?php echo e($row->fasting_blood); ?>"  placeholder="<?php echo e(meta('fasting_blood', getCurrentLocale()) ??__('insulins.fasting_blood')); ?>" value='<?php echo e(old("fasting_blood", $insulin->fasting_blood ?? "")); ?>'/>
        </div>
<div class="form-group col-lg-1" style="font-size: 30px;margin-top:30px;" onclick="remove(this)"><i class="fas fa-times-circle"></i></div>
   
           
      
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('fasting_insulin', getCurrentLocale()) ?? __('insulins.fasting_insulin')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('fasting_insulin') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][fasting_insulin]" value="<?php echo e($row->fasting_insulin); ?>" placeholder="<?php echo e(meta('fasting_insulin', getCurrentLocale()) ??__('insulins.fasting_insulin')); ?>" value='<?php echo e(old("fasting_insulin", $insulin->fasting_insulin ?? "")); ?>'/>
        </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('homa_ir', getCurrentLocale()) ?? __('insulins.homa_ir')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('homa_ir') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][homa_ir]" value="<?php echo e($row->homa_ir); ?>" placeholder="<?php echo e(meta('homa_ir', getCurrentLocale()) ??__('insulins.homa_ir')); ?>" value='<?php echo e(old("homa_ir", $insulin->homa_ir ?? "")); ?>'/>
        </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('tg_hdl', getCurrentLocale()) ?? __('insulins.tg_hdl')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('tg_hdl') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][tg_hdl]" value="<?php echo e($row->tg_hdl); ?>" placeholder="<?php echo e(meta('tg_hdl', getCurrentLocale()) ??__('insulins.tg_hdl')); ?>" value='<?php echo e(old("tg_hdl", $insulin->tg_hdl ?? "")); ?>'/>
        </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('hgbaic', getCurrentLocale()) ?? __('insulins.hgbaic')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('hgbaic') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][hgbaic]" value="<?php echo e($row->hgbaic); ?>" placeholder="<?php echo e(meta('hgbaic', getCurrentLocale()) ??__('insulins.hgbaic')); ?>" value='<?php echo e(old("hgbaic", $insulin->hgbaic ?? "")); ?>'/>
        </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('waist_circ', getCurrentLocale()) ?? __('insulins.waist_circ')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('waist_circ') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][waist_circ]" value="<?php echo e($row->waist_circ); ?>" placeholder="<?php echo e(meta('waist_circ', getCurrentLocale()) ??__('insulins.waist_circ')); ?>" value='<?php echo e(old("waist_circ", $insulin->waist_circ ?? "")); ?>'/>
        </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('resistance', getCurrentLocale()) ?? __('insulins.resistance')); ?> </label>
            <input type="text" class="form-control <?php echo e($errors->has('resistance') ? 'is-invalid' : ''); ?>" name="insulin[<?php echo e($data); ?>][resistance]" value="<?php echo e($row->resistance); ?>" placeholder="<?php echo e(meta('resistance', getCurrentLocale()) ??__('insulins.resistance')); ?>" value='<?php echo e(old("resistance", $insulin->resistance ?? "")); ?>'/>
        </div>
</div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </div>
                  <?php endif; ?>
                 </div>
         <div class="col-lg-12">
       <a style="cursor: pointer;" <?php if($insulin ?? ''  && $insulin->id): ?> data-id="<?php echo e(count($insulins)); ?>" <?php else: ?>   data-id="0" <?php endif; ?> onclick="addinsulin(this)" class="btn_1 gray "><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__("insulins.add_insulin")); ?></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 addinsulin(elem){
        $("#insulins").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)
          {
            $('#insulins').append(data);
          }
        })
    }
    function showdata(elem){
        let data = $(elem).val();
        if ($('input.checkbox_check').is(':checked')) {
            $('#insulinshow').css('display','block');
        }
        else{
            
            $('#insulinshow').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/addinsulin",
            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/insulins/form.blade.php ENDPATH**/ ?>