<?php $__env->startSection('page_title'); ?>
Booking
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_header_title'); ?>
Manage Booking
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_body'); ?>
<?php echo e(Breadcrumbs::render('booking')); ?>


<div class="row row-cards row-deck">
  <div class="col-12">                

    <div class="card">
      <div class="card-status card-status-left bg-blue"></div>
     <div class="card-header"> 
       
      <div class="col-md-3">
        <?php if(Auth::user()->hasAnyPermission(['All','Make Booking'])): ?>

           <button style="float: left;"  class="btn btn-sm btn-outline-primary"  onclick="showModal('form_add_booking','md_make_booking')"><i class="fa fa-plus"></i></button> 
         <?php endif; ?>
         <h3 style="float: left; margin-left: 4%;" class="card-title">Book / Reserve</h3>
     </div>

      <div class="col-md-5"></div>

      <div class="col-md-3" style="margin-left: 90px;">
          
          <select name="branch" class="form-control form-control-sm branch" onclick="renderBookingsTable();">
            <option value="<?php echo e(Crypt::encrypt(0)); ?>">Select <?php echo e(ucwords(str_replace('_',' ',EF::branchWhiteLabel()['module']))); ?></option>

            <?php $__currentLoopData = $branch; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rows): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
              <option value="<?php echo e(Crypt::encrypt($rows->id)); ?>"><?php echo e($rows->name); ?> (<?php echo e($rows->code); ?>)</option>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
          </select>
      </div>

    </div>

    
    <div class="table-responsive table-height">
      <table id="bookings_table" class="table table-hover table-outline table-vcenter text-nowrap card-table cls_datatable" style = "padding:3px;">
        <thead>
          <tr >

            <th>Sr #</th>
            <th>Reg #</th>
            <th>File #</th>
            <th>Name</th>
            <th>Booking Details</th>
            <th>Status</th> 
            <th><?php echo e(ucwords(str_replace('_',' ',EF::branchWhiteLabel()['module']))); ?></th>
            <th>Salesperson</th>
            <th>Booking Date</th>
              <?php if(Auth::user()->hasAnyPermission(['All','Tag Booking'])): ?>
            <th>Tags</th>
            <?php endif; ?>
            <th style="text-align: center;"><i class="dropdown-icon fa fa-cogs"></i></th>                          
          </tr>
        </thead>

        <tbody id="show_bookings" >
          
        </tbody>

       
   </table>
 </div>                               
</div>              
</div>         
</div>

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

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

  <?php echo $__env->make('booking.modals.make_booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <?php echo $__env->make('inventory.modals.add_inventory', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

  <?php echo $__env->make('booking.modals.approve_booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <?php echo $__env->make('user.modals.add_customer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <?php echo $__env->make('user.modals.add_employee', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <?php echo $__env->make('user.modals.add_dealer', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <div id="document_model"></div>
  <?php echo $__env->make('accounts.modals.bookingwise_ledger', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  
  
<?php $__env->stopSection(); ?>

<?php $__env->startSection('page_script'); ?>
  <?php echo $__env->make('scripts.booking', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> 
  <?php echo $__env->make('scripts.user', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> 
  <?php echo $__env->make('scripts.validation', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
  <?php echo $__env->make('scripts.inventory', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> 

  <script type="text/javascript">
   var table = $('#bookings_table');

  function renderBookingsTable()
  {
    table.DataTable().clear();
    table.DataTable().destroy();

    var branch  = $(".branch").val();
    
    table.DataTable( {
      "columnDefs": [
                { "type": "numeric-comma", targets: 0 }
            ],
            cache:true,
        responsive: true,
        bProcessing: true,
        bServerSide: true,
        processing: true,
        serverSide: true,
        deferRender: true,
        select: true,
        stateSave: true,
        responsive: true,
        pageLength:10,
        "ajax": {
          "url" : "<?php echo e(route('datatable-bookings')); ?>",
          "type": "GET",
          'data': {
            'branch': branch,
          },
        },
        
        "columns": [
           {
    name: 'count',
    data: 'count'
   },
   {
    name: 'ms',
    data: 'ms'
   },
   {
    name: 'file_number',
    data: 'file_number'
   },
   {
    name: 'name',
    data: 'name'
   },
   {
    name: 'booking_details',
    data: 'booking_details'
   },
  
   {
    name: 'status',
    data: 'status'
   },
    {
      name: 'branch_name',
      data: 'branch_name'
    },
    {
      name: 'salesperson',
      data: 'salesperson'
    },

   {
    name: 'created_at',
    data: 'created_at'
   },
   {
    name: 'tags',
    data: 'tags'
   },
   {
    name: 'action',
    data: 'action'
   }
        ],
       
    });
  }
  
    

  $(document).ready(function(){
   

    renderBookingsTable();
  });
  </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/ubuntu/rebmgisplus/skylite/resources/views/booking/manage_booking.blade.php ENDPATH**/ ?>