<?php

	include 'header.php';
	include 'navbar.php';
	require_once('includes/API_Config.php');
    
	$obj = new API_Config;
	$data = array();
	$data['refer_id'] = $_SESSION['refer_id'];
	$data['user_id'] = $_SESSION['user_id'];
	$response = json_decode($obj->call_API("API_getVoucherListV2.php", $data));

?>


 <div class="card">
            <div class="card-body">
              <h4 class="card-title">My Vouchers</h4>
              <div class="row">
                <div class="col-12 table-responsive">
                  <table id="order-listing" class="table">
                    <thead>
                      <tr>
                          <th>Sr No.</th>
                          <th>Voucher Code</th>
                          <th>Voucher Amount</th>
                          <th>Pending Amount</th>
		                  <th>Date of Issue</th>
						  <th>Status</th>
                      </tr>
                    </thead>
                    <tbody>
					<?php
						if($response->data !=NULL)
						{
							$count = 0;
							foreach($response->data as $row)
							{
								echo "<tr>";
								echo "<td>" . ++$count . "</td>";
								echo "<td>" . $row->voucher_code . "</td>";
								echo "<td>" . $row->voucher_value . "</td>";
								echo "<td>" . $row->current_balance . "</td>";
								echo "<td>" . $row->created_date . "</td>";
								if($row->active)
									echo "<td>Active</td>";
								else
									echo "<td>Inactive</td>";
								echo "</td>";
							}
						}

						else
						{
							echo "<tr><td>No Data Available</td><tr>";

						}

					?>                     
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>


<?php
	include 'footer.php';
?>