

<?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); ?>" enctype="multipart/form-data">
        <?php if($reservation ?? ''  && $reservation->id): ?>
            <?php echo method_field('PUT'); ?>
        <?php endif; ?>
        <?php echo csrf_field(); ?> 
       <input type="hidden" name="id" value="<?php echo e($reservation->id); ?>">
       <input type="hidden" name="doctor_id" id="doctor" value="<?php echo e(\Auth::user()->id); ?>">
       
        <div class="form-group col-lg-12">
        <label><?php echo e(__('reservations.reservation_details')); ?></label>
            <?php if(count($reservations)>0): ?>
            <div class="row">
             <div class="form-group col-lg-4">
            <a href="<?php echo e(route ('doctorreservations.anatomyshow', $reservation->id)); ?>"  class="butn"><span><?php echo e(__('reservations.anatomyshow')); ?></span></a>
        </div>
           <div class="form-group col-lg-4">
              <a style="float:right;" href="<?php echo e(route ('doctorreservations.prescriptionshow', $reservation->id)); ?>"  class="butn"><span><?php echo e(__('reservations.prescriptionshow')); ?></span></a>
        </div>
        <div class="form-group col-lg-4">
              <a style="float:right;" href="<?php echo e(route ('doctorreservations.ultrasoundshow', $reservation->id)); ?>"  class="butn"><span>ultrasound</span></a>
        </div>
        </div>
            <h3><?php echo e(__('reservations.continue_reservation')); ?></h3>
            <?php $all = $reservation->count + 1;
                 $remain = $all - $reserved;
            ?>
            <h5><?php echo e(__('reservations.remain_reservation') .' : '); ?> <?php if($remain != '0'): ?> <?php echo e($remain); ?> <?php else: ?> <?php echo e(__('reservations.notcontinue')); ?> <?php endif; ?></h5>
            <br><br>
            <label><?php echo e(__('reservations.compare')); ?></label>
            <table id="pricing-list-container" style="width:100%;">
                <thead>
                    <th>#</th>
                <th><?php echo e(__('histories.date')); ?></th>
                <th><?php echo e(__('histories.weight')); ?></th>
                <th><?php echo e(__('histories.fat')); ?></th>
                <th><?php echo e(__('histories.muscle')); ?></th>
                <th><?php echo e(__('histories.liquid')); ?></th>
                <th><?php echo e(__('histories.bone')); ?></th>
                <th><?php echo e(__('histories.trust')); ?></th>
                <th><?php echo e(__('histories.sport')); ?></th>
                <th><?php echo e(__('histories.recommend')); ?></th>
                <th><?php echo e(__('histories.complain')); ?></th>
                <th><?php echo e(__('histories.system')); ?></th>
                <th><?php echo e(__('histories.note')); ?></th>
                </thead>
                <tbody>
                    <?php $__currentLoopData = $histories; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                    <td><?php echo e($key+1); ?></td><td><?php echo e($row->date); ?></td>
                    <td><?php echo e($row->weight); ?></td>
                    <td><?php echo e($row->fat); ?></td>
                    <td><?php echo e($row->muscle); ?></td>
                    <td><?php echo e($row->liquid); ?></td>
                    <td><?php echo e($row->bone); ?></td>
                    <td><?php echo e($row->trust); ?></td>
                    <td><?php echo e($row->sport); ?></td>
                    <td><?php echo e($row->recommend); ?></td>
                    <td><?php echo e($row->complain); ?></td>
                    <td><?php echo e($row->system); ?></td>
                    <td><?php echo e($row->note); ?></td>
                </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table> 
            <br><br>
            
             <div class="form-group col-lg-12">
                 <textarea class="my-editor" disabled><?php echo e($meal->description); ?></textarea>
             </div>
        
              
            <?php else: ?>
            <h3><?php echo e(__('reservations.new_reservation')); ?></h3>
            <?php endif; ?>
       
        </div>
        <!--
       
         -->
        <label><?php echo e(__('reservations.patient_details')); ?></label>
         <div class="row">
              
              <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php echo e($patient->name); ?>'/>
              </div>
               <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_email')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php echo e($patient->email); ?>'/>
              </div>
                 <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_phone')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php echo e($patient->phone); ?>'/>
              </div>
              
                 <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_status')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php if(!is_null($patient->details["status"])): ?><?php echo e($patient->details->status); ?><?php endif; ?>'/>
              </div>
             <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_job')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php if(!is_null($patient->details["job"])): ?><?php echo e($patient->details->job); ?><?php endif; ?>'/>
              </div>
              
             <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_gender')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php if(!is_null($patient->details["gender"])): ?><?php if($patient->details->gender == "1"): ?> <?php echo e(__("reservations.male")); ?>  <?php else: ?> <?php echo e(__("reservations.female")); ?> <?php endif; ?> <?php endif; ?>'/>
              </div>
            <div class="form-group col-lg-6">
                   <label><?php echo e(__('reservations.patient_date_of_birth')); ?> </label>
            <input type="text" disabled class="form-control"  value='<?php if(!is_null($patient->details["date_of_birth"])): ?><?php echo e($patient->details->date_of_birth); ?><?php endif; ?>'/>
              </div>
         </div>
         
        <?php if(count($reservations)==0): ?>
         <div class="form-group col-lg-6">
            <label><?php echo e(meta('count', getCurrentLocale()) ?? __('reservations.count')); ?> </label>
            <input type="number" min="0"  class="form-control <?php echo e($errors->has('count') ? 'is-invalid' : ''); ?>" name="count" placeholder="<?php echo e(meta('count', getCurrentLocale()) ??__('reservations.count')); ?>" value='<?php echo e(old("count", $reservation->count ?? "")); ?>'/>
        </div>
        <div class="form-group col-lg-6"></div>
        <?php else: ?>
          <div class="form-group col-lg-12">
            <label><?php echo e(meta('type', getCurrentLocale()) ?? __('reservations.type')); ?> </label>
          <select class="form-control <?php echo e($errors->has('type') ? 'is-invalid' : ''); ?>" name="type">
              <option value="1"><?php echo e(__('reservations.arrived')); ?></option>
                    <option value="0"><?php echo e(__('reservations.notarrived')); ?></option>
                    </select>
           </div>
        <?php endif; ?>
         <div class="form-group col-lg-6">
            <label><?php echo e(meta('dating', getCurrentLocale()) ?? __('reservations.dating')); ?> </label>
            <input type="date"  class="form-control <?php echo e($errors->has('dating') ? 'is-invalid' : ''); ?>" name="dating" id="dating" placeholder="<?php echo e(meta('dating', getCurrentLocale()) ??__('reservations.dating')); ?>" value='<?php echo e(old("dating")); ?>'/>
        </div>
         <div class="form-group col-lg-6">
            <label><?php echo e(meta('timing', getCurrentLocale()) ?? __('reservations.timing')); ?> </label>
            <input type="time"  class="form-control <?php echo e($errors->has('timing') ? 'is-invalid' : ''); ?>" name="timing" placeholder="<?php echo e(meta('timing', getCurrentLocale()) ??__('reservations.timing')); ?>" value='<?php echo e(old("timing")); ?>'/>
        </div>
         <div id="table" class="text-center mt-4 col-12">
            
         </div>
          <div class="form-group col-lg-6">
            <label>يحتاج الي تدريب  </label>
             
            <select class="form-control" name="physcal">
                
                <option <?php if(count($reservations)!=0): ?> <?php if($last->type == '0'): ?> selected <?php endif; ?> <?php endif; ?> value="0">لا يحتاج</option>
                <option <?php if(count($reservations)!=0): ?> <?php if($last->type == '1'): ?> selected <?php endif; ?> <?php endif; ?> value="1">يحتاج</option>
                
            </select>
            </div>
        
        <div class="form-group col-lg-12">
            <label><?php echo e(meta('image', getCurrentLocale()) ?? __('reservations.image')); ?> </label>
            <input id="image_thumbnail" class="image_thumbnail" type="hidden" name="image" value="<?php echo e(old("image", $reservation->image ?? "")); ?>"/>

            <div class="images main_image <?php echo e(old('image', $reservation->image ?? '') ? ' wow fadeInUp' : 'hide'); ?>">
                <div class="col-lg-4">
                    <div class="items">
                        <div class="img">
                            <a href="#" id="lfm" data-input=".image_thumbnail" data-preview=".image_holder" class="lfm" data-hide=".pick_button">
                                <img src="<?php echo e(asset(old('image', $reservation->image ?? ''))); ?> "  id="image_holder" class="image_holder"/>
                            </a>
                        </div>
                        <a href="#" class="showHide resetImage close" data-empty=".image_thumbnail" data-hide=".main_image" data-show=".pick_button"><i class="fas fa-times"></i></a>
                    </div>
                </div>
            </div>

            <div class="clearfix"></div>
            <span class="input-group-btn pick_button <?php echo e(old('image', $reservation->image ?? '') ? 'hide' : ''); ?> ">
                <a id="lfm" data-input=".image_thumbnail" data-preview=".image_holder" data-show=".main_image" data-hide=".pick_button" class="lfm btn btn-primary text-light">
                    <i class="fas fa-camera-retro"></i> Choose
                </a>
            </span>
        </div>
         <div class="form-group col-lg-12" >
        <div  class="row">
            
        
        <div class="form-group col-lg-6">
            <label><?php echo e(meta('system_food_id', getCurrentLocale()) ?? __('reservations.system_food_id')); ?> </label>
          <select onchange="foodcodes(this)" class="form-control <?php echo e($errors->has('system_food_id') ? 'is-invalid' : ''); ?>" name="system_food_id" id="system_food">
              <option selected  value=""><?php echo e(__('reservations.select')); ?></option>
                    <?php $__currentLoopData = $systemfoods; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <option 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" id="categories">
           
       </div>
       <div class="form-group col-lg-6" id="calories">
           
       </div>
       <div class="form-group col-lg-6" id="codes">
           
       </div>
       
       <div class="form-group col-lg-12" id="desc">
           
       </div>
         
       
            </div>
           
            
            
              
             </div>
               
                
                
             
               

            
       <a style="cursor: pointer;"   counter="0"  onclick="addanatomy(this)" class="btn_1 gray"><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__('reservations.addanatomy')); ?></a>
              <table  style="width:100%;" >
                <tbody id="anatomy"> 
                  </tbody>

            </table>
            <br>
              <a style="cursor: pointer;"   counter="0"  onclick="addprescription(this)" class="btn_1 gray"><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__('reservations.addprescription')); ?></a>
              <table  style="width:100%;" >
                <tbody id="prescription"> 
                  </tbody>

            </table>
            <a style="cursor: pointer;"   counter="0"  onclick="addultra(this)" class="btn_1 gray"><i class="fa fa-fw fa-plus-circle"></i><?php echo e(__('reservations.addultrasound')); ?></a>
              <table  style="width:100%;" >
                <tbody id="ultra"> 
                  </tbody>

            </table>
       

        <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 src="<?php echo e(asset('/assets/admin/js/lib/tinymce.min.js')); ?>"></script>
 
    <!-- 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);
            
          }
        })
    });
    });
    function codemeal(elem)
    {
        
        var num = $(elem).val();
        
        
         $.ajax({
          url : urlmealcode +num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              $('#removing').attr('data-id',data.counting);
              $('#tablefood').html(data.outs);
          }
        })
    }
    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)
          {
            $('#tablefood').append(data);
          }
        })
    }
    
     function fooddesc(elem){
         var num = $(elem).val();
         
         $.ajax({
          url : urlfooddesc +num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              $('#desc').html(`
         
       
          <label>الوجبة </label>
                <textarea name="description" class="appended_text_area">`+data+`</textarea>
               
            `);
            tinymce.init({
                selector: '.appended_text_area',
                init_instance_callback: function (editor) {
                    editor.on('click', function (e) {
                        console.log('Element clicked:', e.target.nodeName);
                    });
                }
            });
              
          }
        })
    
     }
     
     
    function foodcoding(elem){
         var num = $(elem).val();
        
        
         $.ajax({
          url : urlfoodcoding +num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
              $('#codes').html(data);
          }
        })
    }
    function foodcals(elem){
        var num = $(elem).val();
        
        
         $.ajax({
          url : urlfoodcal +num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
              $('#calories').html(data);
          }
        })
    }
    function foodcodes(elem){
        var num = $(elem).val();
        
        
         $.ajax({
          url : urlfoodcode +num,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
              $('#categories').html(data);
          }
        })
    }
    function physcalcode(elem){}
    
    
    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 addultra(elem){
    var datarow =$(elem).attr('counter');
      
      var newdata = parseInt(datarow)+1; 
      
      $(elem).attr('counter', newdata);
        
        $.ajax({
          url : urlultra +datarow,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#ultra').append(data);
          }
        })
}
    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);
          }
        })
}
function remove(elem){
            $(elem).closest('#mealrow').remove();
        }
</script>

   <script>
        let route_prefix = "<?php echo e(url(config('lfm.prefix'))); ?>",
            url = "<?php echo e(url('/')); ?>/",
            urls = "<?php echo e(url('/')); ?>/admin/addmealtypes",
            urlanatomy = "<?php echo e(url('admin/anatomy')); ?>/",
            urlprescription = "<?php echo e(url('admin/prescription')); ?>/",
            urldating = "<?php echo e(url('admin/dating')); ?>/",
            urlfood = "<?php echo e(url('admin/systemfood')); ?>/",
            urlfoodcode = "<?php echo e(url('admin/foodcode')); ?>/",
            urlfoodcoding = "<?php echo e(url('admin/foodcoding')); ?>/",
            urlfooddesc = "<?php echo e(url('admin/fooddesc')); ?>/",
            urlfoodcal = "<?php echo e(url('admin/foodcalories')); ?>/",
            urlmealcode = "<?php echo e(url('admin/mealcode')); ?>/",
            urlultra = "<?php echo e(url('admin/addultra')); ?>/",
            urlphysical = "<?php echo e(url('admin/systemphysical')); ?>/",
            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/doctorreservations/form.blade.php ENDPATH**/ ?>