<div class="content-header">
   <div class="container-fluid">
      <div class="row mb-2">
         <div class="col-sm-6">
            <h1 class="m-0 text-dark">Coupons
            </h1>
         </div>
         <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
               <li class="breadcrumb-item"><a href="<?= base_url(); ?>/dashboard">Dashboard</a></li>
               <li class="breadcrumb-item active">Coupons</li>
            </ol>
         </div>
      </div>
      <?php if(userpermission('lr_vech_group_action')) { ?>
         <button type="button" class="btn btn-info" data-toggle="modal" data-target="#modal-add">
            Add Coupons
         </button>
      <?php } ?>
   </div>
</div>
<section class="content">
   <div class="container-fluid">
      <div class="card">
         <div class="card-body p-0">
            <div class="table-responsive">
               <table id="vehiclelisttbl" class="table card-table table-vcenter text-nowrap">
                  <thead>
                     <tr>
                        <th class="w-1">S.No</th>
                        <th>Coupon Name</th>
                        <th>Coupon Discount</th>
                        <th>Coupon Description</th>
                        <th>Coupon End date</th>
                        <th>Action</th>

                     </tr>
                  </thead>
                  <tbody>
                     <?php if(!empty($coupon)){  $count=1;
                        foreach($coupon as $coupon){
                           ?>
                           <tr>
                              <td> <?php echo output($count); $count++; ?></td>
                              <td> <?php echo output($coupon['cu_name']); ?></td>
                              <?php if($coupon['cu_type'] !='Percentage'){ ?>
                         <td> <?php echo output($coupon['discount'].' '.'Rs'); ?></td>
                         <?php } ?>
                         <?php if($coupon['cu_type'] =='Percentage'){ ?>
                         <td> <?php echo output($coupon['discount'].' '.'%'); ?></td>
                         <?php } ?>
                              <td><?php echo output($coupon['cu_description']); ?></td>
                              <td><?php echo output($coupon['cu_end_date']); ?></td>


                              <td>

                                 <a class="icon" href="<?php echo base_url(); ?>Coupon/Coupon_delete/<?php echo output($coupon['cu_id']); ?>">
                                    <i class="fa fa-trash text-danger"></i>
                                 </a>|  
                         <a class="icon" href="<?php echo base_url(); ?>Coupon/Coupon_edit/<?php echo output($coupon['cu_id']); ?>">
                           <i class="fa fa-edit"></i>
                        </a>
                     </td>

                  </tr>
               <?php } } ?>
            </tbody>
         </table>
      </div>
   </div>
</div>
</div>
</section>
<div class="modal fade show" id="modal-add" aria-modal="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <h4 class="modal-title">Add Coupons</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
               <span aria-hidden="true">×</span>
            </button>
         </div>
         <div class="modal-body">
            <form id="geofencesave" method="post" enctype="multipart/form-data" action="<?php echo base_url(); ?>Coupon/addcoupon">
               <div class="card-body">
                  <div class="form-group row">
                     <label for="cu_name" class="col-sm-4 col-form-label">Coupon Name</label>
                     <div class="form-group col-sm-8">
                        <input type="text" class="form-control" name="cu_name" id="cu_name" required="true" placeholder="Enter Coupons Name" autofocus>
                     </div>
                  </div>
                  <div class="form-group row">
                     <label for="geo_name" class="col-sm-4 col-form-label">Coupon Description</label>
                     <div class="form-group col-sm-8">
                        <textarea class="form-control" name="cu_description" id="cu_description"  placeholder="Enter Coupon Description"  required></textarea> 
                        

                     </div>
                  </div>
                  
                  <div class="offset-md-5 input-group" style=" display: flex;">

                  <div class="form-check d-flex form-group row col-md-2">
                   <input class="form-check-input" type="radio" name='cu_type' value="Percentage" id="cu_type" autocomplete="off">
                    <label class="form-check-label" for="flexCheckDefault11">
                      %
                    </label>
                  </div>
                  <div class="form-check d-flex form-group row col-md-2">
                   

                  <input class="form-check-input" name='cu_type' type="radio" value="Rupees" id="cu_type" autocomplete="off">


                    <label class="form-check-label" for="flexCheckDefault22">
                      Rs
                    </label>
                  </div>
                     
                  </div>
                  
                  <div class="form-group row">
                     <label for="geo_name" class="col-sm-4 col-form-label">Coupon Discount</label>
                     <div class="form-group col-sm-8">
                      <input type="text" class="form-control" name="discount" id="discount" required="true" placeholder="Enter Coupon Discount in %">
                   </div>
                </div>

                <div class="form-group row">
                  <label for="geo_name" class="col-sm-4 col-form-label">Coupon Start Date</label>
                  <div class="form-group col-sm-8">
                     <input type="date" class="form-control"  name="cu_start_date" id="cu_start_date" required="true" placeholder="Enter Type Name">
                  </div>
               </div>


               <div class="form-group row">
                  <label for="geo_name" class="col-sm-4 col-form-label">Coupon End Date</label>
                  <div class="form-group col-sm-8">
                     <input type="date" class="form-control"   name="cu_end_date" id="cu_end_date" required="true" placeholder="Enter Type Name">
                  </div>
               </div>
            </div>
         </div>
         <div class="modal-footer justify-content-between">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            <button type="submit" id="geofenvaluesave" class="btn btn-primary">Save</button>
         </div>
      </form>
   </div>
</div>
</div>