<?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_getSponsorList.php", $data));
	error_reporting(0);


?>





 <div class="card">
            <div class="card-body">
              <h4 class="card-title">My Direct Reference</h4>
              <div class="row">
                <div class="col-12 table-responsive">
                  <table id="order-listing" class="table">
                    <thead>
                      <tr>
                          <th>Sr No.</th>
                          <th>Member Name</th>
                          <th>Member ID</th>
                          <th>Purchased Price</th>
						  <th>Total PV</th>
                          <th>PV Commission</th>
                      </tr>
                    </thead>
                    <tbody>
                     <?php
						if($response->data!=NULL)
						{
							$count = 0;
							foreach($response->data as $row)
							{
								echo "<tr>";
								echo "<td>" . ++$count . "</td>";
								echo "<td>" . ucwords($row->name . " " . $row->last_name) . "</td>";
								echo "<td>" . $row->refer_id . "</td>";
								echo "<td>" . $row->purchase . "</td>";
								echo "<td>" . $row->totalPV . "</td>";
								echo "<td>" . $row->incentive . "</td>";

					
							}
						}

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

						}

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


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