     <link rel="stylesheet" href="<?php echo base_url();?>newadminassets/plugins/datatables/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>newadminassets/plugins/datatables/responsive.bootstrap.min.css">
<div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>
                   Manage Users
                </h1>
              <ol class="breadcrumb">
                    <li><a href="<?php echo base_url();?>admin"><i class="fa fa-home"></i>Home</a></li>
                    <li class="active">Manage Users</li><li class="active">All Users</li>
                </ol>
            </section>
            <!-- Main content -->
            <div class="content">
           
                <div class="container-fluid">
                 
                    <!-- Tabs -->
                    <!-- third row  -->
                    <div class="row"> 
                       <div class="col-md-12 col-sm-12">
                       <?php if($this->session->flashdata("msg")!==""){?>
                          <!--<div class="alert alert-info">
                                            <strong><?php echo $this->session->flashdata("msg");?>!</strong> 
                                        </div>--><?php }?>
                            <div class="panel panel-primary">
							
      <div class="panel-heading">Listing All Report

      <a class="btn btn-xs btn-info pull-right"  href="#" data-toggle="modal" data-target="#myModal"><i class="fa fa-money"></i> Add Trade Trans</a>
      </div>
      <div class="panel-body">
        <table class="table table-striped table-responsive table-bordered dataTable" id="example-2">
        	<thead>
												<tr><td>S.No.</td>
                                                    <th>Date</th>
                                                    <th>Trade.Type</th>
                                                    <th>LMT/SL/TGT</th>
                                                    <th>Amount</th>
                                                    <th>Credit/Debit</th>
                                                    <th>Balance</th>
													<th>Action</th>
												</tr>
											</thead>
			<tbody>
                                            <?php  $i=1;foreach($report as $r){?>
                                            <tr>
                                              <td><?php echo $i;?></td>
                                            	<td><?php echo $r->tr_date;?></td>
                                            	<td><?php if($r->buysell_id!=""){echo $r->cpair.'<br/><span class="badge badge-dark">'.$r->trade_type.' '.$r->lotsize.' Lot</span><br/><span class="badge badge-dark">Exit @ ';
                                              if($r->trade_type=='BUY'){echo $r->sell_price;}else{echo $r->buy_price.'</span>';}}else{echo $r->tr_desc;}?></td>
                                            	<td><?php echo $r->trade_price.'--'.$r->stoploss.'--'.$r->target;?></td>
                                              <td><?php echo $r->tr_amt;?></td>                                                
                                            	<td><?php echo $r->tr_type;?><br/>
                                              <span class="badge badge-dark"><?php echo $r->tr_desc;?></span></td>
                                            	<td><?php echo $r->left_amt;?></td>
                                            	<td>
                                                
                                              <a href="<?php echo $r->buysell_id;?>" class="btn btn-danger btn-xs userdelete" id="<?php echo $r->trid;?>"><i class="fa fa-trash-o"></i></a></td>
                                            </tr>
                                            <?php $i++;}?>
                                            </tbody>
        </table>
      </div>
    </div>
                        </div>
                        
                        
                    </div>
                    
                    
                </div>
            </div>
            <!-- /.content -->
        </div><div class="modal fade" id="myModalp" role="dialog">
                    <div class="modal-dialog modal-sm">
                      <div class="modal-content">
                        <div class="modal-header">
                          <button type="button" class="close" data-dismiss="modal">&times;</button>
                          <h4 class="modal-title"><b id="agentname" class="text-success"></b> Password</h4>
                        </div>
                        <div class="modal-body">
                          <form class="form" action="" method="post" id="changepass">
                          <input type="hidden" name="agentid" id="agentid" value="" />
                          
                          	<div class="form-group label-floating">
                            <label class="control-label">Password</label>
                                <input type="password" name="npass" required id="edit_pass" class="form-control" >
                            </div>
                            <div class="form-group label-floating">
                            <label class="control-label">Password Confirm </label>
                                <input type="password" name="cpass" required id="edit_pass_change" class="form-control">
                            </div>
                            <b class="text-danger" id="passch"></b>
                            <button type="submit" class="btn btn-warning">Change Password</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </form>
                        </div>
                      </div>
                    </div>
                  </div>
        <div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog modal-sm">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Customer Account</h4>
      </div>
      <div class="modal-body">
      
        	<form action="" method="post" id="addtrade">
        	<input type="hidden" name="userid" value="<?php echo $this->uri->segment(3);?>" id="userid" />
            
            <div class="row">
              <div class="form-group col-md-6">
                    	<label>Trade Type</label>
                        <select class="form-control" name="trade_type" required>
                            <option value="BUY">BUY</option>
                            <option value="SELL">SELL</option>
                        </select>
                    </div>
              <div class="form-group col-md-6">
                    	<label>Pair</label>
              <select class="form-control" name="cpair" required>
                  <option value="">Pair</option>
                  <?php
                  $currs=$this->db->get_where("curr_pips",array("curr_status"=>"yes"))->result();
                  $i=1;foreach($currs as $cur){$curname=strtoupper(str_replace("-","_",$cur->curr_code));?>
                  <option value="<?php echo $curname;?>"><?php echo strtoupper($cur->curr_code);?></option>
                  <?php }?>
              </select>
            </div>
              <div class="form-group col-md-6">
                    	<label>Buy Price</label>
                <input type="text" class="form-control" placeholder="Buy Value"  required  name="buy_price">
              </div>
              <div class="form-group col-md-6">
                    	<label>Sell Price</label>
                <input type="text" class="form-control" placeholder="Sell Value" required name="sell_price">
              </div>
              <div class="form-group col-md-6">
                    	<label>Target</label>
                        <input type="text" class="form-control" name="target">
                    </div>
                    <div class="form-group col-md-6">
                    	<label>Stop Loss</label>
                        <input type="text" class="form-control" name="stoploss">
                    </div> 
            <div class="form-group col-md-6">
            	<label>Trade Price</label>
                <input type="text" required value="" name="trade_price" class="form-control" />
            </div> 
            <div class="form-group col-md-6">
            	<label>Lotsize</label>
                <input type="text" required value="" name="lotsize" class="form-control" />
            </div>
            <div class="form-group col-md-12">
            	<label>Amount(Profit/Loss)</label>
                <input type="text" required value="" name="profit_loss" class="form-control" />
            </div>
            <div class="form-group col-md-12">
            	<label>Start DateTime</label>
                <input type="datetime-local" required value="" name="trade_start_time" class="form-control" />
            </div>
            
            <div class="form-group col-md-12">
            	<label>Close DateTime</label>
                <input type="datetime-local" required value="" name="trade_exit_time" class="form-control" />
            </div>
            </div>
        	  
                  
            <button type="submit" name="submit" class="btn btn-success">Submit</button>
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </form>
      </div>
    </div>

  </div>
</div>
  <footer class="main-footer">
            <!-- To the right -->
           <!-- <div class="pull-right hidden-xs">
                Developed by <i class="fa fa-heart"></i> Floatin
            </div>-->
            <!-- Default to the left -->
            <strong>Copyright &copy; 2022 <a href="#">Money Forex</a>.</strong> All rights reserved.
        </footer>
    </div>
   <script>
	$(document).ready(function(){
    $("#addtrade").submit(function(e){e.preventDefault();
      var formdata=$(this).serialize();
      $.ajax({
								 type: "POST",
								 url: '<?php echo base_url();?>admin/ajax_addtrade',
								 data: {formdata:formdata},
								 success: function(res){
								alert(res);
								//$("#passch").html(res);
								}
						}); 
    });
    $(".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);
		});
		$(".in_trend").click(function(){
							var id=$(this).val();
							//alert(id);
							var v="";
							if ($(this).is(':checked')) {
								var v=$(this).val();
							}
							//alert(v);
							$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/mega_trade',
							 data: {v:v,id:id},
							 success: function(response){
								// alert(response);
							 }
							 });
						});
	$("#changepass").submit(function(e){e.preventDefault();//alert("Asdf"); 
								var formdata=$(this).serialize();
								$.ajax({
								 type: "POST",
								 url: '<?php echo base_url();?>admin/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();?>admin/bankdetails',
					 data: {id:id},
					 success: function(response){
						 $("#bankdetails").html(response);
						}
					 });
		});
		$("#addmoney").submit(function(e){e.preventDefault();
			var formdata=$(this).serialize();
			$.ajax({
					 type: "POST",
					 url: '<?php echo base_url();?>admin/add_money_submit',
					 data: {formdata:formdata},
					 success: function(response){
						 alert(response);
						}
					 });
				});
		$(".trade_limit_form").submit(function(e){e.preventDefault();
						var formdata=$(this).serialize();
						//alert(formdata);
						$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/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();
	
			var id=$(this).attr("id");
			var bsid=$(this).attr("href");
			$(this).closest("tr").remove();
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/userdelete2',
							 data: {id:id,bsid:bsid},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
	});
</script>
   <!-- <script>
	$(document).ready(function(){
   function readURL(input,id) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            
            reader.onload = function (e) {alert("asfda");
                $('#i'+id).attr('src', e.target.result);
            }
            
            reader.readAsDataURL(input.files[0]);
        }
    }
	$("#imgInp").change(function(){
        readURL(this,"front");
    });
	});
</script>-->
    <script src="<?php echo base_url();?>newadminassets/plugins/js/jquery-3.1.1.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/bootstrap.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/material.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/ripples.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/jquery.slimscroll.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/dataTables.responsive.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/dataTables.buttons.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/jszip.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/pdfmake.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/vfs_fonts.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/buttons.html5.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/buttons.print.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/datatables/buttons.colVis.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/js/datatables.js"></script>
    <script src="<?php echo base_url();?>newadminassets/js/app.js"></script>
</body>

