

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

<div class="border-item">
    <form class="form-row" enctype="multipart/form-data" method="post" action="<?php echo e($action); ?>">
        
        <?php if($anatomy ?? ''  && $anatomy->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?>
         
         <div class="form-group col-lg-6">
                <label><?php echo e(meta('user', getCurrentLocale()) ?? __('anatomies.user')); ?> </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(__('anatomies.select')); ?></option>
                    <?php $__currentLoopData = $users; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option  <?php if($anatomy ?? ''  && $anatomy->id): ?> <?php if($anatomy->id == $row->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($anatomy ?? ''  && $anatomy->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($anatomy ?? ''  && $anatomy->id): ?>   <?php else: ?>  style="display:none" <?php endif; ?>  id="anatomies">
                    <?php if($anatomy ?? ''  && $anatomy->id): ?>
                    <div  class="row pricing-list-item border-item mb-4 col-12" style="display:none"  id="anatomieshow" >
                    <?php $__currentLoopData = $anatomies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data=>$anatomys): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                   
                    <div class="row pricing-list-item border-item mb-4 col-12">
                         <div class="form-group col-lg-6">
               <input type="hidden" name="anatomy[<?php echo e($data); ?>][id]" value="<?php echo e($anatomys->id); ?>">
            <label>الانواع </label>
            <select class="form-control"onchange="anantomyoption(this)" data-id="<?php echo e($data); ?>" name="anatomy[<?php echo e($data); ?>][category_id]">
                <?php $__currentLoopData = $categories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option <?php if($row->id == $anatomys->category_id): ?> selected <?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-5">
               <input type="hidden" name="anatomy[<?php echo e($data); ?>][id]"  value="<?php echo e($anatomys->id); ?>">
            <label>التحاليل </label>
            <select class="form-control" id="anantomy_id<?php echo e($data); ?>" name="anatomy[<?php echo e($data); ?>][anatomy_id]" >
                <?php $__currentLoopData = anatomycats($anatomys->category_id); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <option <?php if($row->id == $anatomys->anatomy_id): ?> selected <?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-1" style="font-size: 30px;margin-top:35px;">
    	<i class="fas fa-times-circle" onclick="remove(this)"></i></div>
                          
   <div class="form-group col-lg-6">
            <label><?php echo e(__("reservations.description")); ?></label>
            <input type="text" class="form-control" name="anatomy[<?php echo e($data); ?>][description]" placeholder="<?php echo e(__("reservations.description")); ?>" value="<?php echo e($anatomys->description); ?>" />
        </div>
        
        <div class="form-group col-lg-6">
            <label><?php echo e(__("reservations.cost")); ?> </label>
            <input type="number" min="0" step=".01" class="form-control" name="anatomy[<?php echo e($data); ?>][cost]" placeholder="<?php echo e(__('reservations.cost')); ?>" value="<?php echo e($anatomys->cost); ?>" />
        </div>
          <div class="form-group col-lg-6">
            <label><?php echo e(__("reservations.result")); ?> </label>
            <input type="text" class="form-control" name="anatomy[<?php echo e($data); ?>][result]" placeholder="<?php echo e(__('reservations.result')); ?>" value="<?php echo e($anatomys->result); ?>" />
        </div>
        
        <div class="form-group col-lg-12">
            <label><?php echo e(__('reservations.image_anatomy')); ?> </label>
            <input  class="image_anatomy_thumbnail" type="file" name="anatomy[<?php echo e($data); ?>][image_anatomy]" />

          <hr>
          
          </div>
          </div>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>
                    <?php endif; ?>
                    
                </div>
<div class="col-lg-12">
       <a style="cursor: pointer;" <?php if($anatomy ?? ''  && $anatomy->id): ?> data-id="<?php echo e(count($anatomies)); ?>" <?php else: ?>   data-id="0" <?php endif; ?> onclick="addanatomy(this)" class="btn_1 gray "><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__("anatomies.add_anatomy")); ?></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 addanatomy(elem){
        $("#anatomies").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)
          {
            $('#anatomies').append(data);
          }
        })
    }
    function showdata(elem){
        let data = $(elem).val();
        if ($('input.checkbox_check').is(':checked')) {
            $('#anatomieshow').css('display','block');
        }
        else{
            
            $('#anatomieshow').css('display','none');
        }
    } 
     function remove(elem){
            $(elem).closest('.row').remove();
        }
      function anantomyoption(elem){
          
          var num = $(elem).val();
         var number= $(elem).attr('data-id');
        
        
         $.ajax({
          url : urls_anatomy+'/'+num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#anantomy_id'+number).html(data);
          }
        })
      }

</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/addanatomytypes",
            urls_anatomy = "<?php echo e(url('/')); ?>/admin/anantomyoption",
            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/anatomies/form.blade.php ENDPATH**/ ?>