<?php  $this->load->view('master/common/header.php',$data);
$base_name = $data['base_name'];
?>

    <div class="content">
        
        <!-- Start Content-->
        <div class="container-fluid">
            
            <!-- start page title -->
            <div class="row">
                <div class="col-12">
                    <div class="page-title-box">
                        <div class="page-title-right">
                            <ol class="breadcrumb m-0">
                                <li class="breadcrumb-item"><a class="btn btn-success btn-sm" href="<?=base_url().'master/customer/create/0';?>">CREATE CUSTOMER</a></li>
                                
                            </ol>
                        </div>
                        <h4 class="page-title text-uppercase"><?= $page;?></h4>
                    </div>
                </div>
            </div>     
            <!-- end page title --> 

            <div class="row">
                <div class="col-md-12 col-xl-12">
                    <div class="card-box">
                        <div class="row">
                            <div class="col-sm-12">
							    <table id="key-table" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                                    <thead>
                                        <tr>
                                            <th>#</th>
        									<th>Photo</th>
        									<th>Name</th>
        								
        									<th>Mobile Number </th>
        									<th>Sponsor Mobile</th>
        									<!--<th>State </th>-->
        									<!--<th>District </th>-->
        									<!--<th>Address </th>-->
        									<th>Registration </th>
        									<th>Status</th>
        									<th>Action</th>
                                        </tr>
                                    </thead>


                                        <tbody>
                                        
								<?php if (!empty($customer)) {
								    $i=0;
								?>
								
									<?php foreach ($customer as $row) {
									$i++;
									?>
								        <tr>
                                            <td><?=$i;?></td>
        									<td>
        									    <?php
        									        if(file_exists('./uploads/website/customer/'.$row['cust_image'])  && !empty($row['cust_image'])){
        									            ?>
        									            <img src="<?=base_url('./uploads/website/customer/'.$row['cust_image']);?>" class="img-fluid" style="width:60px;" alt="<?=$row['cust_name'];?>" title="<?=$row['cust_name'];?>" />
        									            <?php
        									        } else{
        									            ?>
        									            <img src="<?=base_url('./uploads/website/customer/customer.png');?>" class="img-fluid" style="width:60px;" alt="<?=$row['cust_name'];?>" title="<?=$row['cust_name'];?>" />
        									            <?php
        									        }
        									    ?>
        									    
        									</td>
        									<td><?=$row['cust_name'];?></td>
        								
        									<td><?=$row['cust_phone'];?></td>
        									<td><?php if(!empty($row['sponsor_id'])){ echo $row['sponsor_id']; }else{ echo 'N/A';};?></td>
        									<!--<td><?=$row['cust_state'];?></td>-->
        									<!--<td><?=$row['cust_city'];?></td>-->
        									<!--<td><?=$row['cust_address'];?></td>-->
        									<td><?=date('d-m-Y',strtotime($row['cust_datetime']))   ;?></td>
        									<td>
        										<?php if ($row['cust_status'] == 1) {?>
        											<span class="badge badge-success">Active</span>
        										<?php } else {?>
        											<span class="badge badge-danger">Block</span>
        										<?php }?>
        									</td>
        									<td>
        									    <a href="<?=base_url().'master/customer/cust_status/'.$row['cust_id'];?>" class="btn btn-success btn-sm" title="Change Status"><i class="far fa-edit"></i> Change Status</a>
        									    <a href="<?=base_url().'master/customer/view/'.$row['cust_id'];?>" class="btn btn-info btn-sm" title="View"><i class="far fa-eye"></i> View</a>
        									    <a href="<?=base_url().'master/customer/send_message/'.$row['cust_id'];?>" class="btn btn-warning btn-sm" title="Send Message"><i class="far fa-chat"></i> Send Message</a>
        									    <a href="<?=base_url().'master/customer/create/'.$row['cust_id'];?>" class="btn btn-success btn-sm" title="Update"><i class="far fa-chat"></i> Update</a>
        									        <!--<div class="col-sm-6 text-left">
        									            <form class="form-horizontal" onsubmit="return deletecustomer();" action="<?= base_url('master/action/delete');?>" method="post" enctype="multipart/form-data">
                                                            <input type="hidden" name="table" value="tbl_customer" />
                                                            <input type="hidden" name="page" value="customer" />
                                                            <input type="hidden" name="id" value="<?=$row['cust_id'];?>" />
                                                            <input type="hidden" name="column" value="cust_id" />
                                                            
                                                            <button type="submit" class="btn btn-danger btn-sm" title="Delete">Delete</button>
                										</form>
        									        </div>-->
        									</td>
        								</tr>
								<?php }?>
								<?php } else {?>
								<tr>
									<td colspan="7" class="text-center">Records Not Found</td>
								</tr>
								<?php }?>
							</tbody>
							</table>
							</div>
					    </div>
					</div>
				</div>
				<!-- /.col-md-6 -->
			</div>
			<!-- /.row -->
		</div>
		<!-- /.container-fluid -->
	</div>
	<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<?php $this->load->view('master/common/footer.php'); ?>

<script type="text/javascript">
	function deletecustomer() {
		if (confirm("Are You Sure You Want TO Delete Shipping Cost ?")) {
            return true;
		}
		return false;
	}
</script>