<?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'];
	$response = json_decode($obj->call_API("API_payment_list.php", $data));
	error_reporting(0);
	//var_dump($response->paymentList);

?>

	 <div class="card">
            <div class="card-body">
              <h4 class="card-title">Payment List</h4>
              <div class="row">
                <div class="col-12 table-responsive">
                  <table id="users-listing" class="table">
                    <thead>
                      <tr>
                          <th>Sr. #</th>
                          <th>Username</th>
                          <th>Member ID</th>
                          <th>Order ID</th>
                          <th>Payment Date</th>
                          <th>Total Amount</th>
                          <th>Amount Paid</th>
                          <th>Cheque No</th>
                          <th>Txn No</th>
                          <th>Actions</th>
                      </tr>
                    </thead>
                    <tbody>
					 <?php
					 if(!empty($response->paymentList))
					  {
							$count = 0;
							foreach($response->paymentList 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>" . $row->order_id . "</td>";
								echo "<td>" . $row->payment_date . "</td>";
								echo "<td>" . $row->total_amount . "</td>";
								echo "<td>" . $row->amount_received . "</td>";
								echo "<td>" . $row->cheque_no . "</td>";
								echo "<td>" . $row->txn_no . "</td>";
                                echo "<td><a href=\"edit-payment.php?payment_id=". $row->id ."&name=". ucwords($row->name) . " " . ucwords($row->last_name)    ."\"><i class=\"icon icon-pencil s-4\">Edit</i></a></td>";
								echo "</tr>";
							}
						}

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

						}

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

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

   <script type="text/javascript">
        
        $(document).ready(function(){

         
          var dataTables = $('#users-listing tbody');

	
        });

        </script>

    </body>
</html>
