<?php 

	include 'header.php';
    include 'navbar.php';
  //$result = $adminAPI->userListAPI();
  //$datalist = json_decode($result['userlist'],true);
     //print_r($datalist);exit;

?>
<style type="text/css">

 .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td{
                border-top :0px;
              }

</style>
    
        

        <div class="content">
            <div class="doc data-table-doc page-layout simple full-width">

    

 <div class="card">
            <div class="card-body">
              <h4 class="card-title">Users Details</h4>
              <div class="row">
                <div class="col-12 table-responsive">
                  <table id="users-listing"  class="table table-hover data-table">
                                 <thead>
                                    <tr>
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Sr No</span>
                                        </div>
                                      </th>
                                       <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Member ID</span>
                                        </div>
                                      </th>
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Name</span>
                                        </div>
                                      </th>
									  <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Date</span>
                                        </div>
                                      </th>
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Purchase(PV)</span>
                                        </div>
                                      </th>
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Sponsor ID</span>
                                        </div>
                                      </th>
									  <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Placement ID</span>
                                        </div>
                                      </th>
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Mobile Number</span>
                                        </div>
                                      </th>
									
                                      <th class="secondary-text">
                                        <div class="table-header">
                                            <span class="column-title">Actions</span>
                                        </div>
                                      </th>
                                    </tr>
                                 </thead>
                                 <tbody>
                                 
                                 </tbody>
                              </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
        </div>

    </div>

    <?php include 'footer.php' ;?>
    <!-- <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script> -->
    <!-- <script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> -->

    
    <script type="text/javascript">
        
        $(document).ready(function(){
         
          var dataTables = $('#users-listing tbody');

          $('#users-listing').DataTable({
              "responsive": true,
              "serverSide": true,
              // "searching": true,
              order: [[0, 'desc']],
              "processing": true,
              "language": {
                  "processing": "Hang on. Waiting for response... <img src=\"spinner.gif\" />" //add a loading image,simply putting <img src="loader.gif" /> tag.
              },
              
              "pagingType": "simple_numbers",
               "columnDefs": [ {

                  "targets": [4,5], // column or columns numbers

                  "orderable": false,  // set orderable for selected columns

                  "sortable": false,

              }],
             
			   
				"columns": [
                  { "name": "date_entered" },
                  { "name": "refer_id" },
                  { "name": "name" },
                  { "name": "date_entered" },
         
                ],

              "ajax":function (data, callback, settings) {

                  data['action']='userProfileList';

                  $.ajax({
                      url: 'includes/ajax.php',
                      type: 'POST',
                      data: data,
                      dataType: 'json', 
                      encode: true,
                  }).done(function(data){

                    callback(data);
                    var html ='';
                    var htmlData = data.data;

                    if(data.data!=''){
                      $.each(htmlData , function(i, item){
                        html += "<tr>";
                        html += "<td>"+item[0]+"</td>";
                        html += "<td>"+item[2]+"</td>";
                        html += "<td>"+item[3]+"</td>";
                        html += "<td>"+item[8]+"</td>";
                        html += "<td>"+item[4]+"</td>";
                        html += "<td>"+item[5]+"</td>";
                        html += "<td>"+item[6]+"</td>";
                        html += "<td>"+item[7]+"</td>";
                        html += "<td><a href=\"edit-member-profile.php?id="+item[1]+"&refer_id="+item[2]+"&customer_id="+item[9]+"\" target=\"_blank\"><i class=\"icon icon-pencil s-4\">Edit</i></a></td>";
                        html += "</tr>";
                    });
                    }
                    else
                      html = "<tr> <td colspan=\"7\">No record found</td></tr>";
                    
                    
                    dataTables.html(html);
                    
                  });

              },
            });   
        });

        </script>

    </body>
</html>