    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0 text-dark"><?php echo (isset($coupon))?'Edit Coupon':'Add Coupon' ?>
          </h1>
        </div><!-- /.col -->
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="<?= base_url(); ?>/Coupon/list">Coupon</a></li>
            <li class="breadcrumb-item active"><?php echo (isset($coupon))?'Edit Coupon':'Add Coupon' ?></li>
          </ol>
        </div><!-- /.col -->
      </div><!-- /.row -->
    </div><!-- /.container-fluid -->
  </div>
  <!-- Main content -->
  <section class="content">
    <div class="container-fluid">
      <form method="post" id="customer_add" class="card" action="<?php echo base_url();?>Coupon/<?php echo (isset($coupon))?'updatecoupon':'updatecoupon'; ?>">  
        <div class="card-body"> 

          <div class="row">
           <?php if(isset($coupon)) { ?>
             <input type="hidden" name="cu_id" id="cu_id" value="<?php echo (isset($coupon)) ? $coupon[0]['cu_id']:'' ?>" >
           <?php } ?>
           <div class="col-sm-6 col-md-3">
            <div class="form-group">
              <label class="form-label">Coupon Name<span class="form-required">*</span></label>
              <input type="text" required="true" class="form-control" value="<?php echo (isset($coupon)) ? $coupon[0]['cu_name']:'' ?>" id="cu_name" name="cu_name" placeholder="Coupon Name"onkeydown="return /[a-z]/i.test(event.key)">
            </div>
          </div>
          <div class="col-sm-6 col-md-3">
            <div class="form-group">
             <label class="form-label">Coupon Description<span class="form-required">*</span></label>
             <textarea class="form-control" onkeydown="return /[a-z]/i.test(event.key)" required="true" id="cu_description" autocomplete="off" placeholder="Address"  name="cu_description"><?php echo (isset($coupon)) ? $coupon[0]['cu_description']:'' ?></textarea>
           </div>
         </div>

         <div class="col-sm-6 col-md-3 my-auto">
          <div class="d-flex">

            <div class="form-check d-flex form-group row col-md-6" style="align-items: center;">

             <input type="radio" name="cu_type" value="Percentage" <?php if($coupon[0]['cu_type']=="Percentage") ?> checked=checked />
             <label class="form-check-label px-2" for="flexCheckDefault11">
              %
            </label>
          </div>
          <div class="form-check d-flex form-group row col-md-6" style="align-items: center;">
            <input type="radio" name="cu_type" value="Rupees" <?php 
            echo set_value('cu_type', $coupon[0]['cu_type']) == "Rupees" ? "checked" : ""; 
          ?> />

          <label class="form-check-label px-2" for="flexCheckDefault22">
            Rs
          </label>
        </div>
      </div>
    </div>
    <div class="col-sm-6 col-md-3">
      <div class="form-group">
       <label class="form-label">Coupon Discount</label>
       <input type="text" required="true" class="form-control" value="<?php echo (isset($coupon)) ? $coupon[0]['discount']:'' ?>" id="discount" name="discount" placeholder="Coupon Price"oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"
    type = "number"
    maxlength = "5">

     </div>
   </div>  

 </div>
 <div class="row">
  <div class="col-sm-6 col-md-3">
    <div class="form-group">
     <label class="form-label">Coupon Start Time</label>
     <input type="date" required="true" min="<?php echo date('Y-m-d'); ?>" max="<?phpecho date('d', strtotime('+1 day'));?>"class="form-control" value="<?php echo (isset($coupon)) ? $coupon[0]['cu_start_date']:'' ?>" id="cu_start_date" name="cu_start_date" placeholder="Coupon Price">

   </div>
 </div>   
 <div class="col-sm-6 col-md-3">
  <div class="form-group">
   <label class="form-label">Coupon End Time</label>
   <input type="date" required="true" min="<?php echo date('Y-m-d'); ?>" max="<?php echo date('Y-m-d', strtotime('+1 year')); ?>" class="form-control" value="<?php echo (isset($coupon)) ? $coupon[0]['cu_end_date']:'' ?>" id="cu_end_date" name="cu_end_date" placeholder="Coupon Price">

 </div>
</div>   

</div>

<div class="modal-footer">

  <button type="submit" class="btn btn-primary"> <?php echo (isset($coupon))?'Update Coupon':'Add Coupon' ?></button>
</div>
</div>
</form>
</div>
</section>
<!-- /.content -->

