 @extends('include.dashboard')
@section('content')

                 <div class="nk-content">
                        <div class="container-fluid">
                            <div class="nk-content-inner">
                    <br>
                        <div class="nk-block-head nk-block-head-xs text-center">
                            
                        </div>
                        <div class="nk-block">
                            <div class="buysell-overview">
                                <ul class="buysell-overview-list">
                                    <li class="buysell-overview-item">
                                        <span class="pm-title">Pay with</span><span class="pm-currency"><em class="icon ni ni-{{App\Gateway::whereId($data->gateway_id)->first()->val7}}"></em> <span>@if($data->gateway_id == 0)
                                        Bank Transfer
                                        @else
                                        {{App\Gateway::whereId($data->gateway_id)->first()->name}}.
                                        @endif</span></span>
                                    </li>
                                    <li class="buysell-overview-item"><span class="pm-title">Amount</span><span class="pm-currency">{{$basic->currency_sym}}{{number_format($data->amount, $basic->decimal)}}</span></li>
                                     <li class="buysell-overview-item"><span class="pm-title">Our Fee</span><span class="pm-currency">{{$basic->currency_sym}}{{number_format($basic->depositcharge, $basic->decimal)}}</span></li>
                                    <li class="buysell-overview-item"><span class="pm-title">Total</span><span class="pm-currency">{{$basic->currency_sym}}{{number_format($data->amount+$basic->depositcharge, $basic->decimal)}}</span></li>
                                    
                            <!--  <li class="buysell-overview-item"><span class="pm-title">USSD</span><span class="pm-currency">${{number_format($data->usd, $basic->decimal)}}</span></li> -->
                             </ul>
                              <!--  <div class="sub-text-sm">* Payment gateway may charge you . <a href="#">transaction fee</a></div> -->
                            </div>

                            <div class="buysell-field form-action text-center">
                                <div>@if($data->gateway_id == 101)

<div class="alert alert-warning">
                                        <div class="alert-cta flex-wrap flex-md-nowrap">
                                            <div class="alert-text"><p> {{Auth::User()->username}}!, Kindly Make Payments to any of <b>{{$basic->sitename}}</b> Accounts below & Upload your payment prove.</p>
                                            
                                       <hr>     
                                            Note that this method take upto 20 to 30 minutes, as we have to confirm your Payment before it reflect on your wallet. For instant Funding kindly use the Card Payment, Thanks...
                                            
                                            
                                             </div>
                                               </div>
                                    </div>

<? $bank = DB::table('banks')->orderBy('name','asc')->get(); ?>
</div></div></div>

 @foreach($bank as $gate)
<div class="buysell-overview">
    
<ul class="buysell-overview-list">
<li class="buysell-overview-item"><span class="pm-title">{{$gate->name}}</span><span class="pm-currency">{{$gate->account}}</span></li>
</ul>

</div>
<div class="input-item input-with-label"><div class="relative"></div></div>

@endforeach

@elseif($data->gateway_id == 513)
 <form method="POST" action="{{route('deposit.confirm')}}" enctype="multipart/form-data">
                            {{csrf_field()}}


To complete deposit, please select a cryptocurrency and proceed with your deposit. You will be redirected to Coin Payments page for your secure crypto payment process.
<select name="currency" required class="form-control form-lg" data-placeholder="Select A Cryptocurrency">
														<option>Select Currency</option>

															<option value="BTC">BTC (BitCoin) </option>
                                                            <option value="BCH">Bitcoin Cash (BCH) </option>
                                                            <option value="LTC">LiteCoin (LTC) </option>
                                                            <option value="ETH">Ethereum (ETH) </option>
                                                            <option value="ZEC">Zcash (ZEC) </option>
                                                            <option value="DASH">Dash (DASH) </option>
                                                            <option value="XRP">Ripple (XRP) </option>
                                                            <option value="XMR">Monero (XMR) </option>
                                                            <option value="NEO">NEO (NEO) </option>
                                                            <option value="ADA">Cardano (ADA) </option>
                                                            <option value="EOS">EOS (EOS) </option>
													</optgroup>
													</select><br>

@else

@endif

<div class="pay-buttons"><div class="pay-button">
 <form method="POST" action="{{route('deposit.confirm')}}" enctype="multipart/form-data">
                            {{csrf_field()}}

@if($data->gateway_id == 101) 

<div class="buysell-overview"><ul class="buysell-overview-list">
    
  <div class="col-md-12"><div class="input-item input-with-label"><br>
  <label class="input-item-label text-exlight">Name of the Account you Transfer From.</label><input   name="code" class="form-control" required type="text"><label class="input-item-label text-exlight"><small> (Please enter your payment transaction name,)</small></label></div>
<hr>
<input name="bank" value="bank" hidden >


<div class="input-item input-with-label"><label class="input-item-label text-exlight">Attachment Upload</label><div class="relative"><em class="input-file-icon fas fa-upload"></em><input type="file" name="image" required class="form-control" id="file-01"><label for="file-01"> (Please attach a screenshot of your bank transfer of payment slip)</label>
</div>

</div> </ul></div>
<button  type="submit" id="btn-confirm" class="btn btn-primary btn-lg">Proceed To Pay <em class="ti ti-wallet"></em></button>
</form> 


@endif



@if($data->gateway_id == 100)
<script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>

    <script>
			const API_publicKey = "{{ $data->gateway->val1 }}";
			function payWithRave() {
			var x = getpaidSetup({
			PBFPubKey: API_publicKey,
			customer_email: "{{ Auth::user()->email }}",
			amount: "{{ round($data->amount+$basic->depositcharge, 2)}}",
			customer_phone: "{{ Auth::user()->mobile }}",
			currency: "NGN",
			txref: "rave-123456",
		    payment_options: "card",
			meta: [{
			metaname: "flightID",
			metavalue: "AP1234"
			}],
			onclose: function() {},
			callback: function(response) {
			var txref = response.tx.txRef; // collect txRef returned and pass to a 					server page to complete status check.
			console.log("This is the response returned after a charge", response);
			if (
			response.tx.chargeResponseCode == "00" ||
			response.tx.chargeResponseCode == "0"
			) {

			  swal("Deposit successful",{

                closeOnClickOutside: false,
                title: 'Successful!',
                     icon: 'success',
                }).then(function() {
                    window.location = "{{route('cardpay', $data->trx)}}";
                });


			} else {
			// redirect to a failure page.
			}

			x.close(); // use this to close the modal immediately after payment.
			}
			});
			}
			</script>


<badge  onClick="payWithRave()" class="btn btn-primary btn-lg">Pay Flutterwave (1.5% Fee)<em class="ti ti-wallet"></em></badge>
@elseif($data->gateway_id == 107)

 <script>
						function payWithPaystack(){
						var handler = PaystackPop.setup({
						key: "{{ $data->gateway->val1 }}",
						email: "{{ Auth::user()->email }}",
						amount: "{{ round($data->amount+$basic->depositcharge, 2)*100 }}",
						currency: "NGN",
						ref: ''+Math.floor((Math.random() * 1000000000) + 1), // generates a pseudo-unique reference. Please replace with a reference you generated. Or remove the line entirely so our API will generate one for you
						firstname: '',
						lastname: '',
						// label: "Optional string that replaces customer email"
						metadata: {
						custom_fields: [
						{
						display_name: "Mobile Number",
						variable_name: "",
						value: "+2348012345678"
						}
						]
						},
						callback: function(response){
						 swal("Deposit successful. Your paystack transaction reference number is " + response.reference,{

                closeOnClickOutside: false,
                title: 'Successful!',
                     icon: 'success',
                }).then(function() {
                    window.location = "{{route('cardpay', $data->trx)}}";
                });

						},
						onClose: function(){
						alert('window closed');
						}
						});
						handler.openIframe();
						}
						</script>


<script src="https://js.paystack.co/v1/inline.js"></script>
<badge onclick="payWithPaystack()" class="btn btn-primary btn-lg">Deposit With Paystack <em class="ti ti-wallet"></em></badge>
                </div>
                </div>
                </div>
@elseif($data->gateway_id == 109)
<script src="http://www.remitademo.net/payment/v1/remita-pay-inline.bundle.js"></script>
<badge onclick="makePayment()"  class="btn btn-primary btn-lg">Pay Remitta <em class="ti ti-wallet"></em></badge>
@else

</form>@endif</div>
                                <div class="pt-3"><center><a href="{{ route('depositfiat') }}"  class="link link-danger">Cancel Deposit</a></center></div>
                                <br>
                            </div>
                        </div>
                    </div>
                </div>


@endsection
