<?php  $i=$page+1;foreach($users as $user){?>

                                            <tr>



                                            	<td><?php echo $i;?></td><td width="100px">#<?php echo $user->id;?><br/>

                                                <a class="btn btn-sm btn-warning trades_list" data-toggle="modal" data-target="#trade_modal" href="#" id="<?php echo $user->id;?>"><i class="fa fa-list"></i> Trade List</a>
                                                <br/>
                                                <?php if($user->usertrade==""){$st="Disable";}else{$st="Enable";}?>
<a href="<?php echo $user->id;?>" class="btn btn-sm btn-danger tenable"><?php echo $st;?></a>
                                                </td>



                                                <td><?php echo date("d M Y",strtotime($user->created));?>



                                               



                                                </td>



                                                <td><form action="" method="post" class="trade_limit_form">



                                                <input type="hidden" name="userid" value="<?php echo $user->id;?>" />



                                    Trade Limit<br/>



                                    <input type="text" style="width:80px;" name="amt" class="trade_limit" value="<?php echo $user->trade_limit;?>" />





                                    <!-- <label class="label label-default">brokarage</label><br/>



                                    <input type="text" style="width:80px;" name="brk" class="trade_limit" value="<?php //echo $user->brokarage;?>" /><br/>-->

                                    

<br/>Max Lot<br/>



                                    <input type="text" style="width:80px;" name="max_lot" class="trade_limit" value="<?php echo $user->max_lot;?>" />



                                                </form></td>



                                                </td>



                                                <td><b><?php echo $user->first_name.' '.$user->last_name;?></b><br/><?php echo $user->email;?><br/>

												<?php echo $user->mobile;?><br/>

                                                <label class="badge badge-info">PIN- <?php echo $user->act_link;?></label>
<label class="badge badge-warning">AADHAR- <?php echo $user->aadhar;?></label>
<label class="badge badge-danger">PAN- <?php echo $user->pan_no;?></label>



                                                <!--<label><input type="checkbox" name="in_trend" <?php //if($user->mega_lot!=""){echo "checked";}?> value="<?php //echo $user->id;?>" class="in_feat" /> <?php //if($user->mega_lot!=""){?><span class="label label-warning">Mega Lot</span><?php //}else{echo "Mega Lot";}?></span></label><br/>-->



                                                <!--<label><input type="checkbox" name="sq_off_user" <?php //if($user->sq_off_user!=""){echo "checked";}?> value="<?php //echo $user->id;?>" class="sq_off_user" /> <?php //if($user->sq_off_user!=""){?><span class="label label-warning">Sq Off Hide</span><?php //}else{echo "Sq Off Hide";}?></span></label>--></td>	



                                                <td><?php echo $user->address.' '.$user->country.' '.$user->state.' '.$user->city.' '.$user->zipcode;?></td>



                                                  <td><a href="#" title="<?php echo $user->first_name.' '.$user->last_name;?>" id="<?php echo $user->id;?>" class="btn btn-primary btn-sm open_popup" data-toggle="modal" data-target="#myModalp"><i class="fa fa-lock"></i></a>

<!--<a href="<?php //echo $user->expo_token;?>" title="<?php //echo $user->first_name.' '.$user->last_name;?>" id="<?php //echo $user->id;?>" class="btn btn-info btn-sm notif_popup" data-toggle="modal" data-target="#notif_popup"><i class="fa fa-bell"></i></a>
-->

<a class="btn btn-sm btn-success addmoney" title="Add Money to customer wallet" href="#" data-toggle="modal" data-target="#myModal" id="<?php echo $user->id;?>"><i class="fa fa-money"></i> Balance</a>
<a class="btn btn-sm btn-dark kycdocs" title="Customer Documents" href="#" data-toggle="modal" data-target="#kycModal" id="<?php echo $user->id;?>"><i class="fa fa-files"></i> KYC</a>
<a class="btn btn-sm btn-danger userdelete" title="delete"  href="#" id="<?php echo $user->id;?>"><i class="fa fa-trash"></i></a>
<a class="btn btn-sm btn-warning" href="<?php echo base_url().'mcxadmin/user_report/'.$user->id;?>" target="_blank"><i class="fa fa-table"></i> Report</a>
<?php if($user->admin_approve==""){$st="Disable";}else{$st="Enable";}?>
<a href="<?php echo $user->id;?>" class="btn btn-sm btn-danger enable"><?php echo $st;?></a>

                                                      </td>
                                            </tr>

                                            <?php $i++;}?>

											<script>



	$(document).ready(function(){
		
		

		$(".enable").click(function(e){e.preventDefault();

			var st=$(this).text();

			var id=$(this).attr("href");

			if(st=="Enable"){

			$(this).text("Disable");

			}else{

			$(this).text("Enable");	

			}

			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>mcxadmin/userenable',
				 data: {id:id,st:st},
				 success: function(response){
					 //alert(response);
				 }
			});
		});
		$(".tenable").click(function(e){e.preventDefault();

			var st=$(this).text();

			var id=$(this).attr("href");

			if(st=="Enable"){

			$(this).text("Disable");

			}else{

			$(this).text("Enable");	

			}

			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>mcxadmin/usertenable',
				 data: {id:id,st:st},
				 success: function(response){
					 //alert(response);
				 }
			});
		});

		$(".trades_list").click(function(e){e.preventDefault();

			var id=$(this).attr("id");

			//alert(id);

			$.ajax({

				 type: "POST",

				 url: '<?php echo base_url();?>mcxadmin/ajax_trades_list',

				 data: {id:id},

				 success: function(res){

					// alert(res);

					$(".trades_list_div").html(res);

				 }

			});

		});



		$(".sq_off_user").click(function(){



							var id=$(this).val();



							var v="";



							if ($(this).is(':checked')) {



								var v='yes';



							}



							//alert(v);



							$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>mcxadmin/sq_off_user',



							 data: {v:v,id:id},



							 success: function(response){



								// alert(response);



							 }



							 });



						});



		$(".in_feat").click(function(){



							var id=$(this).val();



							var v="";



							if ($(this).is(':checked')) {



								var v='yes';



							}



							//alert(v);



							$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>mcxadmin/mega_trade',



							 data: {v:v,id:id},



							 success: function(response){



								// alert(response);



							 }



							 });



						});



		$(".open_popup").click(function(e){e.preventDefault();



			var name=$(this).attr("title");//alert(name);



			var id=$(this).attr("id");



			$("#agentid").val(id);



			$("#agentname").text(name);



		});
		
		$(".notif_popup").click(function(e){e.preventDefault();



			var name=$(this).attr("title");//alert(name);



			var id=$(this).attr("id");
			var token=$(this).attr("href");



			$("#agentid2").val(id);
			$("#token").val(token);



			$("#agentname2").text(name);



		});



	$("#changepass").submit(function(e){e.preventDefault();//alert("Asdf"); 



								var formdata=$(this).serialize();



								$.ajax({



								 type: "POST",



								 url: '<?php echo base_url();?>mcxadmin/agent_change_pass',



								 data: {formdata:formdata},



								 success: function(res){



								//alert(res);



								$("#passch").html(res);



								}



								 }); 



							});



	    

	   $(".addmoney").click(function(e){e.preventDefault();



			var id=$(this).attr("id");



			$("#userid").val(id);



			 $("#bankdetails").html("Loading Details...");



			$.ajax({



					 type: "POST",



					 url: '<?php echo base_url();?>mcxadmin/bankdetails',



					 data: {id:id},



					 success: function(response){

							

						 $(".bank_div").html(response);



						}



					 });



		});
		
		$("#notif_form").submit(function(e){e.preventDefault();
			var formdata=$(this).serialize();
			$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>mcxadmin/ajax_send_notification',
				 data: {formdata:formdata},
				 success: function(response){
					 alert(response);
				 }
			});
		});
		
		$(".kycdocs").click(function(e){e.preventDefault();



			var id=$(this).attr("id");



			//$("#userid").val(id);



			 $(".kycdocs_div").html("Loading Details...");



			$.ajax({



					 type: "POST",



					 url: '<?php echo base_url();?>mcxadmin/ajax_kyc',



					 data: {id:id},



					 success: function(response){

							

						 $(".kycdocs_div").html(response);



						}



					 });



		});



		



		$(".trade_limit_form").submit(function(e){e.preventDefault();



						var formdata=$(this).serialize();



						//alert(formdata);



						$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>mcxadmin/trade_limit_form_submit',



							 data: {formdata:formdata},



							 success: function(response){//alert(response);



								//$("#quick_view").html(response);



								}



							 });



						});



					$(".trade_limit").change(function(){



						$(this).closest("form").trigger("submit");



					});
					



	$(".userdelete").click(function(e){e.preventDefault();



		if (!confirm("Sure you want to delete?")){



				  return false;



				}



			var id=$(this).attr("id");



			$(this).closest("tr").remove();



			$.ajax({



							 type: "POST",



							 url: '<?php echo base_url();?>mcxadmin/userdelete',



							 data: {id:id},



							 success: function(response){



								 //alert(response);



							 }



							 });



		});



	});



</script>