<?php $__env->startSection('content'); ?>
<?php echo $__env->make('closer.closerheader', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

    <div class='container'>
            <div class='row d-flex justify-content-center'>
                <div class='col-md-10 pb-3 pt-5 mt-5 text-end'>
                <?php if(Session::has('success')): ?>
                <div class='text-center alert-dismissible fade show' role='alert'>
                  <b class='text-success'><?php echo e(Session::get('success')); ?></b>
                </div>
                <?php endif; ?>
                <?php if($errors->any()): ?>
                <div class="alert w-50 m-auto">
                <ul class='m-0 text-center ' style='list-style-type:none;'>
                <?php $__currentLoopData = $errors->all(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <li class='text-danger'><?php echo e($error); ?></li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </ul>
                </div>
                <?php endif; ?>
                    <a  data-bs-toggle="modal" data-bs-target="#addcouponmodal" class='btn btn-primary text-white'><i class="fa fa-plus-circle" aria-hidden="true"></i>
                        Add New Coupon</a>    
                </div>
            </div>

        <div class='row d-flex justify-content-center'>
            <div class='col-md-10'>
            <table id="example" class="table table-striped data-table" style="width:100%">
        <thead>
            <tr class='dt-row'>
                <th>ID</th>
                <th>Coupon Code</th>
                <th>Discount Price</th> 
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
            </div>
        </div>
    </div>

    <!-- Modal -->
<div class="modal fade" id="addcouponmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Add New Coupon</h5>
      </div>
      <div class="modal-body">
      <form method='post' action="<?php echo e(route('insertcoupon')); ?>">
        <?php echo csrf_field(); ?>

        <div class="form-group my-3">
             <input type="text" class="form-control py-2" name="code" placeholder="Enter Coupon Name">
        </div>   
        <div class="form-group my-3">
            <input type="text" class="form-control py-2" name="discount_price" placeholder="Enter Discount Price">
        </div>  
            <div class="form-group">   
            <?php $__currentLoopData = $closer; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $clsr): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <input  type="text" hidden class="form-control" id="clsrid" name='closer_id' value='<?php echo e($clsr->id); ?>'>
            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>     
            </div>
    
    
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
        <button type='submit' class='btn btn-primary'>Save Changes</button>
        
    </form>
      </div>
    </div>
  </div>
</div>

    <script type="text/javascript">
  $(function () {
      
    var table = $('.data-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: "<?php echo e(route('closer-dashboard')); ?>",
        columns: [
            {data: 'id'},
            {data: 'code'},
            {
                data: 'discount_price',
                render: function (data, type, row) {
                    return '$' + data;
                }
            },
        ]
    });
      
  });
</script>

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

  
<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /Applications/XAMPP/xamppfiles/htdocs/tprproject/get-myaio-app/resources/views/closer/closerdashboard.blade.php ENDPATH**/ ?>