<?php

	include 'header.php';
	include 'navbar.php';
	include 'includes/admin_API_Config.php';

	$obj = new API_Config;
	$data = array();
	$data['admin_username'] = $_SESSION['admin_username'];
	$data['typeRequest'] = 1;
	$response = json_decode($obj->call_API2("API_purchase_list.php", $data));
	error_reporting(0);
	//var_dump($response->purchaseList);

?>

	 <div class="card">
            <div class="card-body">
              <h4 class="card-title">Power Leg Purchase List</h4>
              <div class="row">
                <div class="col-12 table-responsive">
                  <table id="order-listing" class="table">
                    <thead>
                      <tr>
                          <th>Sr. #</th>
                          <th>Member Name</th>
                          <th>Member ID</th>
                          <th>Purchase Date</th>
                          <th>Total PV</th>
                       </tr>
                    </thead>
                    <tbody>
					 <?php
					 if(!empty($response->purchaseList))
					  {
							$count = 0;
							foreach($response->purchaseList as $row)
							{
								echo "<tr>";
								echo "<td>" . ++$count . "</td>";
								echo "<td>" . ucwords($row->name) . " " . ucwords($row->last_name) . "</td>";
								echo "<td>" . $row->refer_id . "</td>";
								echo "<td>" .  date('d-m-Y H:i:s',strtotime($row->date_entered)) . "</td>";
								echo "<td>" . $row->total_PV . "</td>";
								echo "</tr>";
							}
						}

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

						}

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

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

 
   <script type="text/javascript">
        
 

        </script>


    </body>
</html>
