<div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <div class="img-profile ml-3">

                    </div>
                    <h1 class="m-0 text-dark"><?php echo (isset($promotions)) ? 'Edit  Promotions' : 'Add  Promotions' ?>
                    </h1>

                </div><!-- /.col -->
            
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <?php
       // var_dump($promotions);
      if(!isset($promotions)){
        $endpoint = 'addpromodata';
      }else{
        $endpoint = 'updatepromodata';
      }
    ?>
    <form method="post" id="add_driver" class="card" action="<?php echo base_url() . "Promotion/".$endpoint; ?>">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
               


                    <div class="row">
                        <input type="hidden" name="id" id="id" value="<?=$id?>">

                        <div class="col-sm-12 col-md-12">
                            <label class="form-label">Title<span class="form-required">*</span></label>
                            <div class="form-group">
                                <input type="text" name="title" id="title" class="form-control" placeholder="Promo Title"
                                 value="<?php echo $promotions['title'];?>" required>
                            </div>
                                                    <br><br>
                            <div class="form-group">
  <label class="input-title">Code</label>
  <input type="text" class="form-control" name="code" required value="<?php echo ($promotions['code']); ?>" id="code">
</div>
                        <br><br>

                            <div class="form-group">
  <label class="input-title">type</label>
  <select  class="form-control" name="type" required id="type">
    <option <?php if($promotions['type']=="Percentage"){
      echo 'checked';
    } ?> value="Percentage">Percentage</option>
    <option value="Flat" <?php if($promotions['type']=="Flat"){
      echo 'checked';
    } ?>>Flat</option>
      

</select>
  

</div>
                        <br><br>
                        <?php /*
                            <div class="form-group">
  <label class="input-title">Give Away Item</label>
  <input type="text" class="form-control" name="gift"  value="<?php echo ($promotions['gift']); ?>" id="code">
</div>
                        <br><br>
*/ ?>



                            <div class="form-group">
  <label class="input-title">Percentage/Flat </label>
  <input type="number" step="0.01" class="form-control" name="Percentage" required value="<?php echo ($promotions['Percentage']); ?>" id="Percentage">
</div>
                        <br><br>


                                                    <div class="form-group">
  <label class="input-title">Start Date </label>
  <input type="date" class="form-control" name="startTime" required value="<?php echo convertTimeinMonth($promotions['startTime']); ?>" id="startdate">
</div>
                        <br><br>

<div class="form-group">
  <label class="input-title">End Date</label>
  <input type="date" class="form-control" name="endTime" required value="<?php echo convertTimeinMonth($promotions['endTime']); ?>" id="enddate">
</div>
                        <br><br>

<div class="form-group">
  <label class="input-title">Message</label>
  <textarea class="form-control d-block"  rows="3" name="message" id="message" required><?php echo $promotions['message']; ?></textarea>
</div>

                        </div>

              
                        <br><br>

                        <div class=" col-sm-12 col-md-12 text-right">
                        <br><br>
                        <button type="submit" class="btn btn-primary"> <?php echo (isset($promotions)) ? 'Edit Promotions' : 'Add Promotions' ?></button>
                        <br><br>
                        </div>

                      </div>

         

            </div>
        </section>
        <!-- /.content -->


    </form>