<section class="breadcrumb_area">
    <div class="container">
        <div class="banner_content">
            <h2 class="br_title">xGlobalTrading</h2>
            <ul class="bread_cumb list_style">
                <li><a href="<?php echo base_url();?>">Home</a></li>
                <li>Dashboard</li>
            </ul>
        </div>
    </div>
</section>

<section class="expertise_area_two">
    <div class="container">
    
	<div class="row">
    <div class="col-md-3">
    <?php $this->db->order_by("trid","desc");
              $chk=$this->db->get_where("transaction",array("userid"=>$this->session->userdata("user")));
                if($chk->num_rows()>0){
                    $l=$chk->row();
                    //print_r($l);
                    $wallet=$l->left_amt;}else{$wallet=0;}?>
                <div class="card bg-success text-white">
                    <div class="card-body">
                    <p><strong> <i class="fa fa-credit-card"></i> Wallet Bal.</strong></p>
                    <h3> <i class="fa fa-inr"></i> <b id="walletamt"><?php echo $wallet;?></b><br/>
    				<a href="#" class="btn btn-warning btn-sm" id="refresh_bal"><i class="fa fa-refresh"></i> Refresh</a>
                    </h3>
                    </div>
                </div><br/>
                 <?php $this->db->select_sum('dep_amt');  
								  $this->db->where("dep_status",""); 
								  $this->db->where("userid",$this->session->userdata("user")); 
       							  $pending=$this->db->get('deposites')->row();
								  ?>
                <div class="card bg-danger text-white">
                    <div class="card-body">
                    <p><strong> <i class="fa fa-credit-card"></i> Pending Bal.</strong></p>
                    <h3> <i class="fa fa-inr"></i> <b id="walletamt"><?php echo $pending->dep_amt;?></b><br/>
                    <a href="<?php echo base_url().'home/deposite';?>" class="btn btn-warning btn-sm"><i class="fa fa-list"></i> Deposite</a></h3>
                    </div>
                </div>
    </div>
    <div id="recent-transactions" class="col-12 col-md-9">
    	<ul class="nav nav-pills" id="pills-tab" role="tablist">
              <li class="nav-item">
<a class="nav-link active linkin" id="pills-home-tab" data-toggle="pill" href="#pills-home" role="tab" aria-controls="pills-home" aria-selected="true">WATCHLIST</a>
              </li>
              <li class="nav-item">
<a class="nav-link linkin" id="pills-profile-tab" data-toggle="pill" href="#pills-profile" role="tab" aria-controls="pills-profile" aria-selected="false">ACTIVE TRADES</a>
              </li>
              <li class="nav-item">
<a class="nav-link linkin exits" id="pills-contact-tab" data-toggle="pill" href="#pills-contact" role="tab" aria-controls="pills-contact" aria-selected="false">CLOSED TRADES</a>
              </li>
        </ul>
        <div class="tab-content" id="pills-tabContent" style="margin-top:10px;">
          <div class="tab-pane fade show active" id="pills-home" style="background:#FC3;" role="tabpanel" aria-labelledby="pills-home-tab">
          	<!--<div id="live-rates-4bccd9b2e8354173a4a7e026865a9709" class="live-rates__table"></div>-->
              <iframe src="https://vibeapps.in/ftxsr/home/forex2" width="100%" height="500px" title="Forex"></iframe>
          </div>
          <script>
		    $("#refresh_bal").click(function(){
				$.ajax({
						 type: "POST",
						 url: '<?php echo base_url();?>home/wallet_refresh',
						 data: {bal:'refresh'},
						 success: function(res){
							 //console.log(res);z
							 $("#walletamt").text(res);
						 }
					 }); 
			});
		    $("#pills-contact-tab").click(function(){
				$.ajax({
						 type: "POST",
						 url: '<?php echo base_url();?>home/ajax_user_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_user_trades',
				 data: {trd:'Market'},
				 success: function(res){
					 //console.log(res);
					 $("#live_trades").html(res);
				 }
			 });
		  },1000);
		  </script>
          <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab">
         	<table class="table table-bordered table-striped" id="live_trades">
            	
            </table>
          </div>
          <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab">
          	<table class="table table-bordered table-striped exit_trades">
            	
            </table>
          </div>
        </div>
    </div>
    <div id="edit_modal" class="modal fade" role="dialog">
          <div class="modal-dialog modal-sm">
        
            <!-- Modal content-->
            <div class="modal-content">
              <div class="modal-header">
                <h4 class="modal-title">Edit Trade</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
              </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>
    </div>
</section>
