      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1> Channellimo <small>Preview</small> </h1>

          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Forms</a></li>
            <li class="active">Promotion Code</li>
          </ol>
        </section>


        <section class="content">
           <div class="box">
             <div class="box-header">
               <h3 class="box-title"><a href="<?php echo site_url("admin/promotioncode/add");?>">ADD Promotion Code</a></h3>
             </div><!-- /.box-header -->

             <div class="box-body">
                <table id="example1" class="table table-bordered table-striped" style="text-align:center;">
                    <thead>
                      <tr>
                        <th>ID</th>
                        <th></th>
                        <th></th>
                        <th>Code</th>
						<th>Title</th>
                        <th>Amount</th>
                        <th>From date</th>
                        <th>To date</th>
						<th>Limited PRCode</th>
						<th style="display:none;">Payment</th>
                        <th>Status</th>
                        <th>Remark</th>
                        <th>Createby</th>
                        <th>Createdate</th>
                      </tr>
                    </thead>
                    <tbody>

                    <?php 
					$i = 1;
					foreach($result as $v)
					{
						if(!empty($v['username'])){
							$username = $v['fullname'];	
						}else{
							$username = "Null";
						}
						
						if($v['coupon_used']== 0){
							$usage = 'Not usage';	
						}elseif($v['coupon_used']== 1){
							$usage = 'Usage';
						}else{
							$usage = "NULL";
						}
					
						if($v['status'] == "1"){$authorize = "Active";}
						elseif($v['status'] == "0"){$authorize = "Not active";}
						else{$authorize = "Null";};
						$payment = json_decode($v['payment_method'],true);
						
					 	echo'<tr>
						  <td>'.$i.'</td>
						  <td><a href="'.site_url("admin/promotioncode/edit/".$v['id']."").'"><i class="fa fa-edit"></i>EDIT</a></td>
						  <td><a href="'.site_url("admin/promotioncode/delete/".$v['id']."").'"><i class="fa fa-remove"></i>Delete</a></td>
						  <td>'.$v['coupon_code'].'</td>
						  <td>'.$v['coupon_title'].'</td>
						  <td>'.$v['coupon_value'].'</td>
						  <td>'.$v['from_date'].'</td>
						  <td>'.$v['to_date'].'</td>
						  <td>'.$v['coupon_limit'].'</td>
						  <td style="display:none;">';
						  /*foreach($payment as $w){
						  	echo paymentMethod($w).', ';
						  }*/
						  echo'</td>
						  <td>'.$authorize.'</td>
						  <td>'.$v['remark'].'</td>
						  <td>'.$username.'</td>
						  <td>'.$v['createddate'].'</td>';
						echo'</tr>';
						$i++;
					}
					?>
                    </tbody>
                  </table>
                </div><!-- /.box-body -->
             </div><!-- /.box -->
        </section>
       </div>

