

<?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($reservation ?? ''  && $reservation->id): ?>
            <?php echo method_field('PUT'); ?>
            <input type="hidden" name="id" value="<?php echo e($reservation->id); ?>">
        <?php endif; ?>
        <?php echo csrf_field(); ?>

        <div class="form-group col-lg-6">
            <label><?php echo e(meta('doctor', getCurrentLocale()) ?? __('reservations.doctor')); ?> </label>
           <select class="selectpicker form-control  <?php echo e($errors->has('doctor_id') ? 'is-invalid' : ''); ?>" data-show-subtext="true" data-live-search="true" onchange="doctorselection(this)"  name="doctor_id" id="doctor">
               <option selected disabled><?php echo e(__('reservations.select')); ?></option>
               <?php $__currentLoopData = $doctors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
               <option <?php if($reservation ?? ''  && $reservation->id): ?> <?php if($row->id == $reservation->doctor_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">
            <label><?php echo e(meta('branch', getCurrentLocale()) ?? __('reservations.branch')); ?> </label>
           <select class="form-control <?php echo e($errors->has('branch_id') ? 'is-invalid' : ''); ?>"  name="branch_id" id="branch">
               <option selected disabled><?php echo e(__('reservations.selectdoctor')); ?></option>
               
           </select>
            </div>
            
             <div class="form-group col-lg-6">
            <label><?php echo e(meta('patient', getCurrentLocale()) ?? __('reservations.patient')); ?> </label>
           <select class="selectpicker form-control <?php echo e($errors->has('patient_id') ? 'is-invalid' : ''); ?>" data-show-subtext="true" data-live-search="true"  name="patient_id">
               <option selected disabled><?php echo e(__('reservations.select')); ?></option>
               <?php $__currentLoopData = $patients; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
               <option <?php if($reservation ?? ''  && $reservation->id): ?> <?php if($row->id == $reservation->patient_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">
            <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", $reservation->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", $reservation->timing ?? "")); ?>'/>
        </div>
           <div class="form-group col-lg-6">
            <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 selected disabled><?php echo e(__('reservations.select')); ?></option>
               <option <?php if($reservation ?? ''  && $reservation->id): ?> <?php if( $reservation->type =='0'): ?> selected <?php endif; ?> <?php endif; ?> value="0"><?php echo e(__('reservations.offline')); ?></option>
               <option <?php if($reservation ?? ''  && $reservation->id): ?> <?php if( $reservation->type =='1'): ?> selected <?php endif; ?> <?php endif; ?> value="1"><?php echo e(__('reservations.online')); ?></option>
              
           </select>
            </div>
         
         <div id="table" class="text-center mt-4 col-12">
            
         </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 doctorselection(elem){
       var doctor = $('#doctor').val();
     
          var dates = $('#dating').val();
        var data = doctor + ','+ dates;
        
        $.ajax({
          url : urls+data,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#table').html(data);
            
          }
        })
          $.ajax({
          url : url_branch+doctor,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
            $('#branch').html(data);
            
          }
        })  
  }
    
    $(document).on('change','#dating',function(){
      
      var doctor = $('#doctor').val();
     
          var dates = $('#dating').val();
        var data = doctor + ','+ dates;
        if(doctor != null)
        $.ajax({
          url : urls+data,
          type : 'GET',
          data : 'nothing',
          dataType : 'json',
          success:function(data)
          {
              
            $('#table').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/dating')); ?>/",
            url_branch ="<?php echo e(url('admin/branch')); ?>/",
            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/reservations/form.blade.php ENDPATH**/ ?>