

<script src="https://prodstorage.azureedge.net/Scripts/jquery.signalR-2.4.0.min.js" defer></script>
<script src="https://dashboard.acuitytrading.com/Widgets/lib/@1.0.0/widget-core-oanda.js" defer></script>
        


<div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                
                <ol class="breadcrumb">
                    <li><a href="<?php echo base_url();?>admin"><i class="fa fa-home"></i>Home</a></li>
                    <li class="active">Dashboard</li>
                </ol>
            </section>
            <!-- Main content -->
            <div class="content">
			
                <div class="row">
                    <div class="col-md-12">
                    	<div class="panel">
                            <div class="panel-body">
                            	<ul class="nav nav-tabs">
          <li  class="active"><a data-toggle="tab" href="#menu1">ACTIVE TRADES</a></li>
          <!-- <li><a data-toggle="tab" href="#menu3"  id="pending_orders">PENDING TRADES</a></li> -->
          <li><a data-toggle="tab" href="#menu2" id="exit_trades">CLOSED TRADES</a></li>
        </ul>
        
        <div class="tab-content">
         
          <div id="menu1" class="tab-pane fade  in active" style="padding:5px;">
            <table class="table table-bordered table-striped" id="live_trades">
            	
            </table>
          </div>
          <div id="menu3" class="tab-pane fade" style="padding:5px;">
            <table class="table table-bordered table-striped pending_orders">
            	
            </table>
          </div>
          <div id="menu2" class="tab-pane fade" style="padding:5px;">
            <table class="table table-bordered table-striped exit_trades">
            	
            </table>
          </div>
        </div>
                            </div>
                        </div>
                    </div>	
                    <div class="col-md-4">
                        <div class="panel login-panel">
                            <div class="panel-heading ">
                                <h3>Change Password</h3>
                            </div>
                            <div class="panel-body">
                                <form class="form-horizontal" action="" method="post" id="changepass">
                                    
                                    <div class="form-group">
                                        <label for="inputPassword2"  class="col-sm-2 control-label">
                                            <i class="fa fa-lock"></i>
                                        </label>
                                        <div class="col-sm-10">
                                            <input type="password"  name="npass" required class="form-control" id="inputPassword2" placeholder="New Password">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">
                                            <i class="fa fa-lock"></i>
                                        </label>
                                        <div class="col-sm-10">
                                            <input type="password"  name="cpass" required class="form-control" id="inputPassword3" placeholder="Confirm Password">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                     <b class="text-warning" id="passch"></b>
                                        <button type="submit" class="btn btn-primary btn-block">Change Password</button>
                                    </div>
                                </form>
                            </div>


                            	<?php $admin=$this->db->get("admin")->row();?>
                            <div class="panel-heading ">
                                <h3>Bonus Offer</h3>
                            </div>
                            <div class="panel-body">
                                <form class="form-horizontal" action="" method="post" id="bonus_form">
                                    
                                    <div class="form-group">
                                        <label for="inputPassword2"  class="col-sm-2 control-label">
                                            <i class="fa fa-usd"></i>
                                        </label>
                                        <div class="col-sm-10">
                                            <label>Bonus on Deposite</label>
                                            <input type="number"  value="<?php echo $admin->bonus_amt;?>"  name="bonus_amt"  class="form-control">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="inputPassword3" class="col-sm-2 control-label">
                                            <i class="fa fa-usd"></i>
                                        </label>
                                        
                                        <div class="col-sm-10">
                                            <label>Bonus Extra %</label>
                                            <input type="number"   value="<?php echo $admin->bonus_extra;?>"  name="bonus_extra"  class="form-control">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                     <b class="text-warning" id="passch"></b>
                                        <button type="submit" class="btn btn-primary btn-block">Update</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="panel login-panel">
                            <div class="panel-heading">
                                <h3>Deposite QR</h3>
                            </div>
                            <div class="panel-body">
                                <form class="form-horizontal" action="<?php echo base_url().'admin/update_qr';?>" method="post" enctype="multipart/form-data">
                                    
                                        <label for="inputPassword2"  class="col-sm-2 control-label">Upload Images</label>
                                        <input type="file" name="file" class="btn btn-primary" />
                                        <input type="hidden" name="oldfile" value="<?php echo $admin->qr_code;?>" />
                                        <img class="img" id="upimg" src="<?php echo base_url().'eassets/'.$admin->qr_code;?>" width="100px" />
                                        <button type="button" id="delete_code" class="btn btn-sm btn-danger">DELETE</button>
                                        <div class="form-group">
                                        <label>UPI ID</label>
                                        <input type="text" name="upi_id" class="form-control" value="<?php echo $admin->upi_id;?>" />
                                        </div>
                                        <div class="form-group">
                                        <label>USD RATE</label>
                                        <input type="text" name="exchg_rate" class="form-control" value="<?php echo $admin->exchg_rate;?>" />
                                        </div>
                                    <div class="form-group">
                                     <b class="text-warning" id="passch"></b>
                                        <button type="submit" class="btn btn-info btn-block">Update</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    </div>
                    <div class="row">
                    <?php if($this->session->userdata("type")=="admin"){?>
                    
                    <div class="col-md-4">
                        <div class="panel login-panel">
                            <div class="panel-heading ">
                                <h3>Bank Details</h3>
                            </div>
                            <div class="panel-body">
                                <form action="<?php echo base_url();?>admin/admin_banking" method="post" enctype="multipart/form-data">
                                <div class="form-group">
                                    <label>Bank Name</label>
                                    <input type="text" name="bank_name"  required class="form-control" />
                                </div>
                                <div class="form-group">
                                    <label>A/c Holder Name</label>
                                    <input type="text" name="acc_holder"  required class="form-control" />
                                </div>
                                <div class="form-group">
                                    <label>A/c  Number</label>
                                    <input type="number" name="acc_no"  required class="form-control" />
                                </div>
                                
                                <div class="form-group">
                                    <label>IFSC Code</label>
                                    <input type="text" name="ifsc"  required class="form-control" />
                                </div>
                                <div class="form-group">
                                    <label>A/c  Type</label>
                                    <select class="form-control" name="acc_type">
                                        <option value="">Select Type</option>
                                        <option value="Current Account">Current Account</option>
                                        <option value="Savings Account">Savings Account</option>
                                    </select>	
                                </div>
                                <button class="btn btn-warning btn-block" type="submit">ADD BANK</button>
                            </form>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="panel login-panel">
                            <div class="panel-heading ">
                                <h3>List Bank Accounts</h3>
                            </div>
                            <div class="panel-body">
                            	<table class="table table-bordered">
                                	<thead><tr><th>Bank Name</th><th>A/c. Details</th></tr></thead>
                                    <tbody>
                                    <?php $banks=$this->db->get("banks")->result();
									foreach($banks as $b){?>
                                    <tr><td><?php echo $b->bank_name;?></td>
                                    	<td><?php echo 'A/c. Name - '.$b->acc_name.'<br/>A/c. Number - '.$b->acc_number.'<br/>IFSC - '.$b->ifsc_code.'<br/>A/c. Type - '.$b->acc_type;?><br/><a class="btn btn-xs btn-danger bankdelete" title="delete"  href="#" id="<?php echo $b->bid;?>"><i class="fa fa-trash"></i> Remove</a></td></tr>
                                    <?php }?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <?php }?>
                    <!-- End Chat Room -->
                </div>
                <!-- end Fifth row -->
                <!-- sixth row -->
                
                <!-- ens sixth row -->
            </div>
            <!-- /.content -->
        </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">Edit Trade</h4>
              </div>
              <div class="modal-body trade_data">
                <p>Loading Data...</p>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              </div>
            </div>
        
          </div>
        </div>
        <div id="myModal1" 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">Exit Trade</h4>
              </div>
              <div class="modal-body trade_data">
                <form action="" method="post" id="exit_trade_now">
                	<!--<div class="form-group">
                    	<label>Select Profit/Loss</label>
                        <select class="form-control" name="proloss" required>
                        	<option value="Credit">Profit</option>
                        	<option value="Debit">Loss</option>
                        </select>
                    </div>-->
                    <div class="form-group">
                    	<label>Profit/Loss</label>
                        <input type="text" class="form-control" name="proloss" id="proloss"/>
                        <input type="hidden" id="trade_id" class="form-control" name="id"/>
                    </div> 
                     
                    <button type="button" id="setloss" class="btn btn-warning">SET LOSS</button>
                    <button type="submit" class="btn btn-danger pull-right">EXIT TRADE</button>
                    <hr/>
                    <div class="row">
                    <div class="form-group col-md-4">
                    	<label>Qty</label>
                        <input type="text" class="form-control" id="trd_lot" name="lotsize"/>
                    </div>
                    <div class="form-group col-md-8">
                    	<label>Time</label>
                        <input type="datetime" class="form-control" id="trade_start_time" name="trade_start_time"/>
                    </div>
                    </div>

                    <div class="form-group">
                    	<label>Buy Price</label>
                        <input type="text" class="form-control" id="buy_pricee" name="buy_price"/>
                    </div>
                    <button type="button" id="setlot" class="btn btn-warning">UPDATE</button>
                </form>
              </div>
              <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
              </div>
            </div>
        
          </div>
        </div>
        <!-- /.content-wrapper -->
        <!-- Main Footer -->
        <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; 2025 <a href="#">AuroFx</a>.</strong> All rights reserved.
        </footer>
    </div>
    <script>
				window.addEventListener('load', function(){
					AcuityWidgets.globals({
						apikey: '4b12e6bb-7ecd-49f7-9bbc-2e03644ce41f',
						locale: 'en-GB'
					});
				
					AcuityWidgets.CreateWidget(
						'OandaLiveRates',
						document.getElementById('live-rates-4bccd9b2e8354173a4a7e026865a9709'),
						{
							
							
							instruments: [<?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));?>"<?php echo $curname;?>",<?php }?>]//, "AUD_CHF", "AUD_JPY", "AUD_NZD", "AUD_USD", "CAD_CHF", "CAD_JPY", "CHF_JPY", "CN50_USD", "XCU_USD", "EUR_AUD", "EUR_CAD", "EUR_CHF", "EUR_GBP", "EUR_TRY", "EUR_JPY", "EUR_NOK", "EUR_NZD", "EUR_SEK", "EUR_USD", "EU50_EUR", "FR40_EUR", "GBP_AUD", "GBP_CAD", "GBP_CHF", "GBP_JPY", "GBP_NZD", "GBP_USD", "DE30_EUR", "XAU_USD", "HK50_HKD", "IN50_USD", "JP225_USD", "NATGAS_USD", "NL25_EUR", "NZD_CAD", "NZD_CHF", "NZD_JPY", "NZD_USD", "SGD_JPY", "XAG_USD", "SG30_SGD", "TWIX_USD", "UK100_GBP", "NAS100_USD", "US2000_USD", "SPX500_USD", "US30_USD", "NAS100_USD", "USD_CAD", "USD_CHF", "USD_CNH", "USD_HKD", "USD_TRY", "USD_JPY", "USD_MXN", "USD_NOK", "JPY225Y_JPY", "USD_SEK", "USD_SGD", "USD_ZAR", "TRY_JPY", "WTICO_USD"]
						}
					).mount();
				});
		</script>
	<script src="<?php echo base_url();?>newadminassets/plugins/js/jquery.sparkline.min.js"></script>
    
    <script>
	
	$(document).ready(function(){
		$("#setloss").click(function(){
		var loss=$("#proloss").val();
		var trd=$("#trade_id").val();
		if(loss==''){alert("Please enter value");return false;}
		$.ajax({
			 type: "POST",
			 url: '<?php echo base_url();?>home/ajax_setloss',
			 data: {loss:loss,trd:trd},
			 success: function(res){
				// $("#switch").text(res);
				 alert(res);
				 console.log(res);
				 //$(".exit_trades").html(res);
			 }
		 });
	});
	$("#setlot").click(function(){
		var trd=$("#trade_id").val();
		var lotsize=$("#trd_lot").val();
		var trade_start_time=$("#trade_start_time").val();
		var buy_price=$("#buy_pricee").val();
		if(lotsize==''){alert("Please enter value");return false;}
		$.ajax({
			 type: "POST",
			 url: '<?php echo base_url();?>home/ajax_setlot',
			 data: {trd:trd,lotsize:lotsize,buy_price:buy_price,trade_start_time:trade_start_time},
			 success: function(res){
				// $("#switch").text(res);
				 alert(res);
				 console.log(res);
				 //$(".exit_trades").html(res);
			 }
		 });
	});
	$("#exit_trade_now").submit(function(e){e.preventDefault();
		var formdata=$(this).serialize();
		$.ajax({
			 type: "POST",
			 url: '<?php echo base_url();?>home/ajax_exit_trade2',
			 data: {formdata:formdata},
			 success: function(res){
				// $("#switch").text(res);
				 alert(res);
				 console.log(res);
				 //$(".exit_trades").html(res);
			 }
		 });
	});
		$("#delete_code").click(function(e){e.preventDefault();
		if (!confirm("Sure you want to delete?")){
				  return false;
				}
			$.ajax({
							 type: "POST",
							 url: '<?php echo base_url();?>admin/ajax_upi_delete',
							 data: {upi:0},
							 success: function(response){
			$("#upimg").remove();
							 }
							 });
		});
		$("#bonus_form").submit(function(e){e.preventDefault();//alert("Asdf"); 

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

								$.ajax({

								 type: "POST",

								 url: '<?php echo base_url();?>admin/bonus_form_submit',

								 data: {formdata:formdata},

								 success: function(res){

								alert(res);

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

								}

								 }); 

										});

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

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

								$.ajax({

								 type: "POST",

								 url: '<?php echo base_url();?>admin/change_pass2',

								 data: {formdata:formdata},

								 success: function(res){

								//alert(res);

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

								}

								 }); 

										});
		$(".bankdelete").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();?>admin/bankdelete',
							 data: {id:id},
							 success: function(response){
								 //alert(response);
							 }
							 });
		});
		$("#pending_orders").click(function(){
			$.ajax({
					 type: "POST",
					 url: '<?php echo base_url();?>home/ajax_pending_trades',
					 data: {trd:'pending'},
					 success: function(res){
						 //console.log(res);z
						 $(".pending_orders").html(res);
					 }
				 });
		});
		$("#exit_trades").click(function(){
			$.ajax({
					 type: "POST",
					 url: '<?php echo base_url();?>home/ajax_exit_trades',
					 data: {trd:'exit'},
					 success: function(res){
						 //console.log(res);z
						 $(".exit_trades").html(res);
					 }
				 });
		});
		setInterval(function(){ 
		$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>home/ajax_live_trades',
				 data: {alldata:'alldata'},
				 success: function(res){
					 //console.log(res);
					 $("#live_trades").html(res);
				 }
			 });
		},1000);
	});
	</script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/countUp.min.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/Chart.bundle.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/plugins/js/jquery.slimscroll.min.js"></script>
    <script src="<?php echo base_url();?>newadminassets/js/dashboard.js"></script>
    <script src="<?php echo base_url();?>newadminassets/js/widgets.js"></script>
    <script src="<?php echo base_url();?>newadminassets/js/app.js"></script>

    <!-- Color Switcher -->
    
    <!-- END Skin switcher -->


</body>

