<section role="main" class="content-body">
					<header class="page-header">
						<h2>Manage Users</h2>
					
						<div class="right-wrapper pull-right">
							<ol class="breadcrumbs">
								<li>
									<a href="<?php echo base_url();?>admin">
										<i class="fa fa-home"></i>
									</a>
								</li>
								<li><span>Manage Users</span></li>
							</ol>
					
						</div>
					</header>
						<section class="panel">
							<header class="panel-heading">
								<h2 class="panel-title">List of All Users</h2>
							</header>
							<div class="panel-body">
								<table class="table table-bordered table-striped mb-none" id="datatable-tabletools" data-swf-path="assets/vendor/jquery-datatables/extras/TableTools/swf/copy_csv_xls_pdf.swf">
       		 <thead>
												<tr>
													<th>S.No.</th><th>Member Since</th>
													<th>Name/Contacts</th>
                                                    <th><i class="fa fa-star"></i> BidCoins</th>
													<th>Action</th>
												</tr>
											</thead>
			<tbody>
                                            <?php  $i=1;foreach($users as $user){?>
                                            <tr>
                                            	<td><?php echo $i;?></td>
                                                <td><?php echo date("d M Y",strtotime($user->created));
												if($user->oauth_provider=="google"){
													echo '<br/><label class="label label-danger"><i class="fa fa-google"></i> Verified</label>';}
													if($user->oauth_provider=="facebook"){
													echo '<br/><label class="label label-primary"><i class="fa fa-facebook"></i> Verified</label>';}
												?></td>
                                                <td><i class="fa fa-user"></i> <?php echo $user->first_name.' '.$user->last_name;?><br/>
                                                <i class="fa fa-envelope"></i> <?php echo $user->email;?></td>
                                                <td><?php   $this->db->order_by("trid","desc");
		$chk=$this->db->get_where("transactions",array("uid"=>$user->id));
		$pre_credits=0;
		if($chk->num_rows()>0){
			$cr=$chk->row();
			$pre_credits=$cr->credits_left;
		}?>
        <a href="<?php echo base_url();?>admin/bids_purchase/<?php echo $user->id;?>" target="_blank" class="btn btn-xs btn-default"><i class="fa fa-star"></i> <?php  echo $pre_credits;?> BidCoins</a></td>
                                                <td><a target="_new" href="<?php echo base_url();?>admin/orders/<?php echo $user->id;?>" class="btn btn-xs btn-success">(<?php echo $this->db->get_where("orders",array("userid"=>$user->id))->num_rows();?>) View Orders</a> 
          <a class="btn btn-xs btn-danger userdel" href="<?php echo $user->id;?>"><i class="fa fa-trash-o"></i></a>
  <a class="btn btn-xs btn-primary" target="_blank" href="<?php echo base_url().'admin/bid_history/'.$user->id;?>"><i class="fa fa-gavel"> Bid History</i></a>
  <a class="btn btn-xs btn-info" target="_blank" href="<?php echo base_url().'admin/win_history/'.$user->id;?>"><i class="fa fa-gavel"></i> Win History</a></td>
                                            </tr>
                                            <?php $i++;}?>
                                            </tbody>
        </table>
							</div>
						</section>
				</section>
                
			</div>

			
		</section>

		<!-- Vendor -->
        <script>
	$(document).ready(function(){
		$('#data-tables').dataTable();
		$(".in_feat").click(function(){
							var id=$(this).val();
							var v="";
							if ($(this).is(':checked')) {
								var v=$(this).val();
							}
							//alert(v);
							$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/in_feat',
							 data: {v:v,id:id},
							 success: function(response){
								// alert(response);
							 }
							 });
						});
		$(".userdel").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			var id=$(this).attr("href");$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/userdel',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>
	<script src="<?php echo base_url();?>admin_assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap/js/bootstrap.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/nanoscroller/nanoscroller.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/magnific-popup/magnific-popup.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
		
		<!-- Specific Page Vendor -->
		<script src="<?php echo base_url();?>admin_assets/vendor/select2/select2.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/media/js/jquery.dataTables.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables/extras/TableTools/js/dataTables.tableTools.min.js"></script>
		<script src="<?php echo base_url();?>admin_assets/vendor/jquery-datatables-bs3/assets/js/datatables.js"></script>
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/theme.init.js"></script>


		<!-- Examples -->
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.default.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.row.with.details.js"></script>
		<script src="<?php echo base_url();?>admin_assets/javascripts/tables/examples.datatables.tabletools.js"></script>
</body>
</html>