<?php
  $totalEarning = 0;    
  $currentEarning = 0;
  $workingDays = 0;
     
  foreach($actInv as $inv)
  {
    if($inv->method == 1)
    {
      $totalElapse = getWorkingDays(date('y-m-d'), $inv->end_date);
    }
    else
    {
      $totalElapse = getDays(date('y-m-d'), $inv->end_date);
    }

    if($totalElapse == 0)
    {
      $lastWD = $inv->last_wd;
      $enddate = ($inv->end_date);
      
      $getDays = getDays($lastWD, $enddate);

      if($inv->method == 1)
      {
        $getDays = getWorkingDays($lastWD, $enddate);
      }
      else
      {
        $getDays = getDays($lastWD, $enddate);
      }
      $currentEarning += $getDays*$inv->interest*$inv->capital;
      
    }
    else
    {
      $sd = $inv->last_wd;
      $ed = date('Y-m-d');
      $getDays = getDays($sd, $ed);

      if($inv->method == 1)
      {
        $getDays = getWorkingDays($sd, $ed);
      }
      else
      {
        $getDays = getDays($sd, $ed);
      }
      $currentEarning += $getDays*$inv->interest*$inv->capital;
    }
  }
?>

<div class="row mt--2"style="background-image: url('https://indicesmarketltd.com/okay.gif');">
    
    	<div class="col-md-6">
		<!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
  <div class="tradingview-widget-container__widget"></div>

  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-mini-symbol-overview.js" async>
  {
  "symbol": "COINBASE:BTCUSD",
  "width": "100%",
  "height": 220,
  "locale": "en",
  "dateRange": "1D",
  "colorTheme": "dark",
  "trendLineColor": "rgba(255, 152, 0, 1)",
  "underLineColor": "rgba(204, 0, 0, 0.3)",
  "underLineBottomColor": "rgba(0, 0, 0, 0)",
  "isTransparent": false,
  "autosize": false,
  "largeChartUrl": ""
}
  </script>
</div>
<!-- TradingView Widget END -->
	</div>

	
	<div class="col-md-6">
		<div class="card full-height"style="background-color: rgba(9,5,5,0.5) !important;">
			<div class="card-body" >
				<div class="card-title "><h2 style="color:orange;text-align:center">Account Statistics</h2></div>
				<div class="row py-3">
				<div class="col-md-4 card" style="border:3px solid orange;border-radius:9px;background-color: rgba(9,5,5,0.5) !important;">
						
							<div style="border-bottom:1px solid blue"><br>							
								<h4 class="fw-bold text-uppercase  op-8"style="color:orange">WALLET BALANCE</h4>	
							
									<a href="/{{$user->username}}/withdraws"  class="btn btn-primary btn-border btn-round mr-2"style="float:right"><i class="fab fa-bitcoin fa-2x "style="color:orange"></i>withdraw</a>
								
								<h3 class="fw-bold"style="color:white;font-style:bold">{{$settings->currency}} {{ round($user->wallet, 2) }}<br>
							BTC: <?php
$amount= $user->wallet;
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://blockchain.info/tobtc?currency=USD&value=" . $amount,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "postman-token: fc62ebce-6d0b-ef4f-ba02-fcb05e284a02"
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo $amount = json_decode($response);
?>
							</h3>	
						
								</div>	
								<br>						
						
					
					
					</div>


	<div class="col-md-4 card" style="border:3px solid orange;border-radius:9px;background-color: rgba(9,5,5,0.5) !important;">
						<a id="wd_bal" title="Click to withdraw" href="javascript:void(0)" >
							<div style="border-bottom:1px solid blue">	<br>						
							<h4 class="fw-bold text-uppercase  op-8"style="color:orange">TRADE PROFIT EARNING</h4>
								<a href="/{{$user->username}}/takeprofit"  class="btn btn-primary btn-border btn-round mr-2"style="float:right">

									    <i class="fa fa-money fa-2x "style="color:orange"></i> Take Profit</a>
								
						<!--	<h3 class="fw-bold">{{$settings->currency}} {{ round($user->profits, 2) }}</h3>-->
					<h3 class="fw-bold"style="color:white;font-style:bold">{{$settings->currency}} {{ round($user->profits, 2) }}
					
					
					<br>
							BTC: <?php
    $amount= $user->profits;
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://blockchain.info/tobtc?currency=USD&value=". $amount,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "postman-token: fc62ebce-6d0b-ef4f-ba02-fcb05e284a02"
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo $amount = json_decode($response);
?>
							</h3>	
					
					
					
					</h3>
					    
					    <!--{{$settings->currency}} {{ round($currentEarning, 2) }}</h3>-->
								<div class="colhd margin_n10" ></div>
							
								
								
								</div>	
								<br>						
											
					
					</div>


	<div class="col-md-4 card"style="border:3px solid orange;border-radius:9px;background-color: rgba(9,5,5,0.5) !important;">
					
							<div style="border-bottom:1px solid blue"><br>							
							<h4 class="fw-bold text-uppercase op-8"style="color:orange">{{ __('messages.refrrl_bns') }}</h4>
									<a  class="btn btn-primary btn-border btn-round mr-2"style="float:right"><i class="fab fa-bitcoin fa-3x" style="color:orange"></i></a>
								
								<h3 class="fw-bold"style="color:white;font-style:bold">{{$settings->currency}} {{ round($user->ref_bal, 2) }}
								
								
								<br>
							BTC: <?php
    $amount= $user->ref_bal;
$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => "https://blockchain.info/tobtc?currency=USD&value=". $amount,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
        "cache-control: no-cache",
        "postman-token: fc62ebce-6d0b-ef4f-ba02-fcb05e284a02"
    ),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
echo $amount = json_decode($response);
?>
							</h3>	
							
									<a id="wd_ref_bal" title="Click to withdraw" href="javascript:void(0)">
							<div class="colhd margin_n10" >{{ __('messages.clk_to_wthd_fnd') }}</div>	
								</a>
								
								</div>	
								<br>						
						
						
					
					</div>

				
			</div>
		<div class="tradingview-widget-container">
  <div class="tradingview-widget-container__widget"></div>
  <div class="tradingview-widget-copyright"><a href="#" rel="noopener" target="_blank"><span class="orange-text">Technical Analysis for AAPL</span></a> </div>
  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-technical-analysis.js" async>
  {
  "interval": "1m",
  "width": "100%",
  "isTransparent": false,
  "height": 350,
  "symbol": "BTCUSDT",
  "showIntervalTabs": true,
  "locale": "en",
  "colorTheme": "dark"
}
  </script>
</div>	 
	          
	</div>
	</div>
</div>
	<div class="row"style="background-color: rgba(0,0,0,0.5) !important;">
						<div class="col-md-12"style="background-color: rgba(0,0,0,0.5) !important;">
							<div class="card"style="background-color: rgba(0,0,0,0.5) !important;">
								<div class="card-header">
									<div class="card-title"><center><h3><b style="color:orange">{{ __('messages.avail_pckg') }}</b><h3></h3></center> </div>
								</div>
								<div class="card-body pb-0"style="background-color: rgba(0,0,0,0.5) !important;">
									@include('user.inc.packages')
								</div>
							</div>
						</div>
					</div>
	<div class="col-md-6" >
	        
	            
	         <center><h3 style="color:orange">Financial Markets</h3></center>   
	        <!-- TradingView Widget BEGIN -->
<div class="tradingview-widget-container">
  <div class="tradingview-widget-container__widget"></div>

   
 
  <script type="text/javascript" src="https://s3.tradingview.com/external-embedding/embed-widget-market-overview.js" async>
  {
  "colorTheme": "dark",
  "dateRange": "12M",
  "showChart": true,
  "locale": "en",
  "largeChartUrl": "",
  "isTransparent": false,
  "showSymbolLogo": true,
  "showFloatingTooltip": false,
  "width": "100%",
  "height": "500",
  "plotLineColorGrowing": "rgba(255, 152, 0, 1)",
  "plotLineColorFalling": "rgba(255, 0, 0, 1)",
  "gridLineColor": "rgba(240, 243, 250, 0)",
  "scaleFontColor": "rgba(120, 123, 134, 1)",
  "belowLineFillColorGrowing": "rgba(41, 98, 255, 0.12)",
  "belowLineFillColorFalling": "rgba(41, 98, 255, 0.12)",
  "belowLineFillColorGrowingBottom": "rgba(41, 98, 255, 0)",
  "belowLineFillColorFallingBottom": "rgba(41, 98, 255, 0)",
  "symbolActiveColor": "rgba(41, 98, 255, 0.12)",
  "tabs": [
    {
      "title": "Indices",
      "symbols": [
        {
          "s": "BINANCE:BTCUSDT",
          "d": "BITCOIN"
        },
        {
          "s": "BITSTAMP:ETHUSD",
          "d": "ETHEREUM"
        },
        {
          "s": "BINANCE:BNBUSDT",
          "d": "BINANCE"
        },
        {
          "s": "BITSTAMP:BTCUSD",
          "d": "BTCUSD"
        }
      ],
      "originalTitle": "Indices"
    },
    {
      "title": "Futures",
      "symbols": [
        {
          "s": "CME_MINI:ES1!",
          "d": "S&P 500"
        },
        {
          "s": "CME:6E1!",
          "d": "Euro"
        },
        {
          "s": "COMEX:GC1!",
          "d": "Gold"
        },
        {
          "s": "NYMEX:CL1!",
          "d": "Crude Oil"
        },
        {
          "s": "NYMEX:NG1!",
          "d": "Natural Gas"
        },
        {
          "s": "CBOT:ZC1!",
          "d": "Corn"
        }
      ],
      "originalTitle": "Futures"
    },
    {
      "title": "Bonds",
      "symbols": [
        {
          "s": "CME:GE1!",
          "d": "Eurodollar"
        },
        {
          "s": "CBOT:ZB1!",
          "d": "T-Bond"
        },
        {
          "s": "CBOT:UB1!",
          "d": "Ultra T-Bond"
        },
        {
          "s": "EUREX:FGBL1!",
          "d": "Euro Bund"
        },
        {
          "s": "EUREX:FBTP1!",
          "d": "Euro BTP"
        },
        {
          "s": "EUREX:FGBM1!",
          "d": "Euro BOBL"
        }
      ],
      "originalTitle": "Bonds"
    },
    {
      "title": "Forex",
      "symbols": [
        {
          "s": "FX:EURUSD"
        },
        {
          "s": "FX:GBPUSD"
        },
        {
          "s": "FX:USDJPY"
        },
        {
          "s": "FX:USDCHF"
        },
        {
          "s": "FX:AUDUSD"
        },
        {
          "s": "FX:USDCAD"
        }
      ],
      "originalTitle": "Forex"
    }
  ]
}
  </script>
</div>
<!-- TradingView Widget END -->
	            
	            
	            
	     <br>       
	            
	            
	            
		<!-- TradingView Widget BEGIN -->

<!-- TradingView Widget END -->
		
	
	
	</div>
<div id="wallet_wd" class="container popmsgContainer" >
    <div class="row padding_per_2_2">
      <div class="col-md-4">&emps;</div>
      <div class="col-md-4 popmsg-mobile card" align="Center">        
        <div class="card-title">
          <br>
          <h3><b>{{ __('messages.wallet_wdrl') }}</b></h3>
          <h5 class="text-danger"><b>{{ __('messages.av_bal') }}</b></h5> 
          			<h3 class="fw-bold">{{$settings->currency}} {{ round($user->wallet, 2) }}</h3>

          <hr>
        </div>
        <div class="card-body">
            {{ __('messages.bank_select_wdr') }}
            <form id="wd_formssss" action="/user/wallet/wd" method="post">
                <div class="form-group" align="left">                       
                    <input type="hidden" class="form-control" name="_token" value="{{csrf_token()}}">
                </div>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-prepend " >
                      <span class="input-group-text span_bg">{{$settings->currency}}</span>
                    </div>                        
                    <input id="wd_amt" type="text" class="form-control" name="amt"  required placeholder="{{ __('messages.enter_amt') }}" >
                  </div>
                </div>
                <div class="form-group">
                  <div class="input-group" >                   
                    <div class="input-group-prepend " >
                      <span class="input-group-text span_bg"><i class="fa fa-home" ></i></span>
                    </div>
                    <select name="bank" class="form-control" required>
                        <option="">SELECT METHOD</option>
                        <?php 
                          $banks = App\banks::where('user_id', $user->id)->get();
                        ?>
                        @if(count($banks) > 0)
                            @foreach($banks as $bank)
                                <option>{{$bank->Account_name.' '.$bank->Account_number.' '.$bank->Bank_Name}}</option>
                            @endforeach
                        @endif

                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <br><br>
                    <button class="collb btn btn-info">{{ __('messages.wthdrw') }}</button>
                    <span style="">            
                      <a id="wallet_wd_close" href="javascript:void(0)" class="collcc btn btn-danger">{{ __('messages.cncl') }}</a>        
                    </span>
                    <br>
                </div>
            </form>
        </div>  
        <!-- close btn -->
        <script type="text/javascript">
          $('#wallet_wd_close').click( function(){
            $('#wallet_wd').hide();
          });        
        </script>
        <!-- end close btn -->
      </div>

    </div>
</div>

<div id="ref_wd" class="container popmsgContainer" >
    <div class="row padding_per_2_2">
      <div class="col-md-4">&emps;</div>
      <div class="col-md-4 popmsg-mobile card" align="Center">        
        <div class="panel-heading" style="">
          <br>
          <h3><b>{{ __('messages.ref_wdr') }}</b></h3>
          <h5 class="text-danger"><b>{{ __('messages.total_ern') }}</b> {{$settings->currency.' '.$user->ref_bal}}</h5>         
          <hr>
        </div>
        <div id="" >
              {{ __('messages.bank_select_wdr') }}
             <form id="wd_formssss" action="/user/ref/wd" method="post">
                <div class="form-group" align="left">                       
                    <input type="hidden" class="form-control" name="_token" value="{{csrf_token()}}">
                </div>
                <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-prepend " >
                      <span class="input-group-text span_bg">{{$settings->currency}}</span>
                    </div>                        
                    <input id="ref_amt" type="text" class="form-control" name="amt"  required placeholder="Enter Amount to withdraw" >
                  </div>
                </div>
                 <div class="form-group">
                  <div class="input-group">
                    <div class="input-group-prepend " >
                      <span class="input-group-text span_bg"><i class="fa fa-home"></i></span>
                    </div> 
                    <select name="bank" class="form-control" required>
                        <option value="">Select Method</option>
                        <?php 
                          $banks = App\banks::where('user_id', $user->id)->get();
                        ?>
                          @if(count($banks) > 0)
                              @foreach($banks as $bank)
                                  <option>{{$bank->Account_name.' '.$bank->Account_number.' '.$bank->Bank_Name}}</option>
                              @endforeach
                          @endif

                    </select>
                  </div>
                </div>
                <div class="form-group">
                  <br><br>
                    <button class="collb btn btn-info">{{ __('messages.wthdrw') }}</button>
                    <span style="">            
                      <a id="ref_wd_close" href="javascript:void(0)" class="collcc btn btn-danger">{{ __('messages.cncl') }}</a>        
                    </span>
                    <br>
                </div>
            </form>
        </div> 
        <!-- close btn -->
        <script type="text/javascript">
          $('#ref_wd_close').click( function(){
            $('#ref_wd').hide();
          });        
        </script>
        <!-- end close btn -->

      </div>

    </div>
  </div>