<?php $__env->startSection('content'); ?>

                <div class="modal-content">
                    <a href="#" class="close" data-dismiss="modal"><em class="icon ni ni-cross-sm"></em></a>
                    <div class="modal-body modal-body-lg">
                    <br><br>
                        <div class="nk-block-head nk-block-head-xs text-center">
                            <h5 class="nk-block-title">Make Payment</h5>
                            <div class="nk-block-text">
                                <div class="caption-text">Your order of <?php echo e(number_format($data->amount, $basic->decimal)); ?>USD worth of <?php echo e(App\Currency::whereId($data->currency_id)->first()->name); ?> <br> with transaction number <a href="#"><?php echo e($data->trx); ?></a> has been placed <strong></strong></div>
                                 <?php if($data->gateway): ?> <?php else: ?><span class="sub-text-sm">Please make payment into bank account below</span> <?php endif; ?>

                            </div>
                        </div>
                        <div class="nk-block">
                            <div class="buysell-overview">
                                <ul class="buysell-overview-list">
                                    <li class="buysell-overview-item">
                                        <span class="pm-title">Currency</span><span class="pm-currency" id="icon" ><em class="icon ni ni-<?php echo e(App\Currency::whereId($data->currency_id)->first()->icon); ?>"></em> <span>
                                        <?php echo e(App\Currency::whereId($data->currency_id)->first()->name); ?>

                                        </span></span>
                                    </li>

                              <li class="buysell-overview-item"><span class="pm-title">Units</span><span class="pm-currency"><?php if($data->currency->symbol == "PM"): ?>
<?php echo e($data->currency->symbol); ?><?php echo e(number_format($data->getamo, 2)); ?>

<?php else: ?>
<?php echo e($data->currency->symbol); ?><?php echo e(number_format($data->getamo, 8)); ?>

<?php endif; ?></span></li>
                              <li class="buysell-overview-item"><span class="pm-title">Amount Payable</span><span class="pm-currency"><?php echo e($basic->currency_sym); ?><?php echo e(number_format($data->main_amo, $basic->decimal)); ?></span></li>

<?php if($data->gateway): ?>
               <li class="buysell-overview-item"><span class="pm-title">Payment Method</span><span class="pm-currency">

<?php if($data->gateway == 99): ?>
Self Serviced
<?php else: ?>
Credit/Debit Card
<?php endif; ?>
</span></li>
<?php else: ?>

               <li class="buysell-overview-item"><span class="pm-title">Payment Method</span><span class="pm-currency">

<?php echo e(App\PaymentMethod::whereId($data->method)->first()->name); ?>

</span></li>

 <li class="buysell-overview-item"><span class="pm-title">Bank Name</span><span class="pm-currency">

<?php echo e(App\Bank::whereId($data->bank)->first()->name); ?>

</span></li>

 <li class="buysell-overview-item"><span class="pm-title">Account Name</span><span class="pm-currency">

<?php echo e(App\Bank::whereId($data->bank)->first()->accname); ?>

</span></li>

 <li class="buysell-overview-item"><span class="pm-title">Account Number</span><span class="pm-currency">

<?php echo e(App\Bank::whereId($data->bank)->first()->account); ?>

</span></li>

<?php endif; ?>





                                </ul>

                            </div>

                            <div class="buysell-field form-action text-center">


<div class="pay-buttons"><div class="pay-button">

 </div>
 <?php if($data->gateway == 107): ?>
<script src="https://js.paystack.co/v1/inline.js"></script>
<button  onclick="payWithPaystack()" class="btn btn-primary ">Pay With Paystack <em class="ti ti-credit-card"></em></button>


<script>
function payWithPaystack(){
var handler = PaystackPop.setup({
key: "<?php echo e(App\Gateway::whereId($data->gateway)->first()->val1); ?>",
email: "<?php echo e(Auth::user()->email); ?>",
amount: "<?php echo e(($data->main_amo)  * 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: "<?php echo e(Auth::user()->phone); ?>"
						}
						]
						},
						callback: function(response){
						alert('Deposit successful. transaction refference number is ' + response.reference);
						window.location='javascript: submitform()';
						},
						onClose: function(){
						alert('window closed');
						}
						});
						handler.openIframe();
						}
						</script>



			 <script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>
			<form id="myform"  action="<?php echo e(route('buy.paystack')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
			</form>


<?php elseif($data->gateway == 100): ?>
 <script src="https://api.ravepay.co/flwv3-pug/getpaidx/api/flwpbf-inline.js"></script>
<button  onclick="payWithRave()" class="btn btn-primary" >Pay With Flutterwave <em class="ti ti-credit-card"></em></button>



    <script>
			const API_publicKey = "<?php echo e(App\Gateway::whereId($data->gateway)->first()->val1); ?>";
			function payWithRave() {
			var x = getpaidSetup({
			PBFPubKey: API_publicKey,
			customer_email: "<?php echo e(Auth::user()->email); ?>",
			amount: "<?php echo e(round($data->main_amo, 2)); ?>",
			customer_phone: "<?php echo e(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"
			) {
			window.location='javascript: submitform()';
			} else {
			// redirect to a failure page.
			}

			x.close(); // use this to close the modal immediately after payment.
			}
			});
			}
			</script>
			 <script type="text/javascript">
			function submitform()
			{
			document.forms["myform"].submit();
			}
			</script>
			<form id="myform"  action="<?php echo e(route('buy.rave')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
			</form>



<?php elseif($data->gateway == 103): ?>
<button  data-toggle="modal" data-target="#get-pay-address" class="btn btn-primary ">Pay With Stripe<em class="ti ti-credit-card"></em></button>


<!-- Modal End --><div class="modal fade" id="get-pay-address" tabindex="-1"><div class="modal-dialog modal-dialog-md modal-dialog-centered"><div class="modal-content"><a href="#" class="modal-close" data-dismiss="modal" aria-label="Close"><em class="ti ti-close"></em></a><div class="popup-body"><h4 class="popup-title">Pay With Stripe</h4><p>Please Enter Your Credit Card Details Below.  <strong>USD<?php echo e(number_format($data->main_amo/$basic->rate, $basic->decimal)); ?></strong> will be charged from your card and <strong><?php echo e($data->get_amount); ?> <?php echo e($data->currency->symbol); ?></strong> will be credited to your <strong><?php echo e($data->currency->name); ?> Wallet</strong> once we recevied payment.</p><div class="gaps-1x"></div><h6 class="font-bold">Name Written On Card</h6><div class="copy-wrap mgb-0-5x"><span class="copy-feedback"></span>
<form role="form" id="payment-form" method="POST" action="<?php echo e(route('buy.stripe')); ?>">
<?php echo csrf_field(); ?>

<input type="text" name="name" placeholder="Card Name" class="copy-address"><button class="copy-trigger copy-clipboard" ><em class="ti ti-user"></em></button></div>


<div class="gaps-1x"></div><h6 class="font-bold">Card Number</h6><div class="copy-wrap mgb-0-5x"><span class="copy-feedback"></span>

<input type="tel" name="cardNumber" placeholder="Valid Card Number" class="copy-address"><button class="copy-trigger copy-clipboard" ><em class="ti ti-credit-card"></em></button></div>


<div class="gaps-1x"></div><h6 class="font-bold">Card Expiry Date</h6><div class="copy-wrap mgb-0-5x"><span class="copy-feedback"></span>

<input type="tel" name="cardExpiry" placeholder="MM / YYYY" autocomplete="off" required  class="copy-address"><button class="copy-trigger copy-clipboard" ><em class="ti ti-calendar"></em></button></div>

<div class="gaps-1x"></div><h6 class="font-bold">CCV</h6><div class="copy-wrap mgb-0-5x"><span class="copy-feedback"></span>

<input type="numbert"  name="cardCVC"  placeholder="CVC"  class="copy-address"><button class="copy-trigger copy-clipboard" ><em class="ti ti-credit-card"></em></button></div>

<!-- .copy-wrap --><!-- .pay-info-list --><div class="pdb-2-5x pdt-1-5x"><input type="checkbox"  required class="input-checkbox input-checkbox-md" id="agree-term"><label for="agree-term">I hereby agree to the <strong><?php echo e($basic->sitename); ?> purchase aggrement &amp; payment terms</strong>.</label></div><button class="btn btn-primary" type="submit">Pay USD<?php echo e(number_format($data->main_amo/$basic->rate, $basic->decimal)); ?><em class="ti ti-credit-card mgl-4-5x"></em></button></form><div class="gaps-3x"></div><div class="note note-plane note-light mgb-1x"><em class="fas fa-info-circle"></em><p>Ensure you have confirmed your <?php echo e($data->currency->name); ?> wallet address before proceeding with payment.</p></div><div class="note note-plane note-danger"><em class="fas fa-info-circle"></em><p><?php echo e($basic->sitename); ?> will not be liable to any loss arising from you providing a wrong walletaddress.</p></div></div></div><!-- .modal-content --></div><!-- .modal-dialog --></div><!-- Modal End -->



<?php $__env->startSection('script'); ?>
    <script type="text/javascript" src="https://rawgit.com/jessepollak/card/master/dist/card.js"></script>

    <script>
        (function ($) {
            $(document).ready(function () {
                var card = new Card({
                    form: '#payment-form',
                    container: '.card-wrapper',
                    formSelectors: {
                        numberInput: 'input[name="cardNumber"]',
                        expiryInput: 'input[name="cardExpiry"]',
                        cvcInput: 'input[name="cardCVC"]',
                        nameInput: 'input[name="name"]'
                    }
                });
            });
        })(jQuery);
    </script>
<?php $__env->stopSection(); ?>
<?php elseif($data->gateway == 99): ?>
<form id="myform"  action="<?php echo e(route('buy.wallet')); ?>" method="post">
			<?php echo e(csrf_field()); ?>

			<input type="hidden" name="trx" value="<?php echo e($data->trx); ?>" />
<button  type="submit" class="btn btn-primary ">Pay With Deposit Wallet  &nbsp;<em class="ti ti-wallet"></em></button>

			</form>


<?php else: ?>






 <a href="#" data-toggle="modal" data-target="#pay-confirm"><span class="btn btn-primary">Confirm Payment</span></a>
<?php endif; ?>
                                <div class="pt-3"><a href="<?php echo e(route('ebuydel',$data->trx)); ?>" data-dismiss="modal" class="link link-danger">Cancel Order</a></div>
                            </div>
                        </div>
                    </div>
                </div>

<!-- Modal End --><div class="modal fade" id="pay-confirm" tabindex="-1"><div class="modal-dialog modal-dialog-centered modal-md" role="document">
<div class="modal-content"><a href="#" class="close" data-dismiss="modal"><em class="icon ni ni-cross-sm"></em></a>
<div class="modal-body modal-body-lg"><div class="nk-block-head nk-block-head-xs text-center"><p class="lead text-primary">Confirm Your Payment </p><p>In case you sent below <?php echo e($basic->currency_sym); ?><?php echo e(number_format($data->main_amo, $basic->decimal)); ?>, send us a message, <?php echo e($basic->sitename); ?> will credit accordingly</p>


<form role="form" method="POST" action="<?php echo e(route('ebuyupload')); ?>" enctype="multipart/form-data">
<?php echo e(csrf_field()); ?>

<div class="row">
<input name="trx" hidden value="<?php echo e($data->trx); ?>">
<div class="col-md-6"><div class="form-label-group"><label class="form-label" for="buysell-amount">Amount Paid</label></div><input name="amount" placeholder="Enter Amount Paid" class="form-control" type="text"></div>
<br>
<div class="col-md-6"> <div class="form-label-group"><label class="form-label" for="buysell-amount">Depositor's Name</label></div><input   placeholder="Enter Depositor's Name'" class="form-control" name="payer" type="text"></div></div>

<br>
<div class="row">
<div class="col-md-12"> <div class="form-label-group"><label class="form-label" for="buysell-amount">Transaction Number</label></div><input name="tnum" placeholder="Enter Payment Trasaction NUmber " class="form-control" type="text"></div>

<div class="col-md-12"> <br><div class="form-label-group"><label class="form-label" for="buysell-amount">Upload Payment Screenshot</label></div><div class="custom-file">
                                                                        <input type="file" multiple class="custom-file-input" name="photo" id="customFile">
                                                                        <label class="custom-file-label" for="customFile">Select file</label>
                                                                    </div></div>
</div>




<br>
<div class="form-label-group"><label class="form-label" for="buysell-amount">Select Payment Method</label></div>
<select required  class="form-control" name="method">
<option selected>Choose...</option>
<?php $__currentLoopData = $method; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($data->id); ?>"><?php echo e($data->name); ?> </option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<br>

 <!-- .input-item --><ul class="d-flex flex-wrap align-items-center guttar-30px"><li><button type="submit" class="btn btn-primary">Confirm Payment</button></form></li></ul> </div></div></div><!-- .modal-content --></div><!-- .modal-dialog --></div><!-- Modal End -->
<?php $__env->stopSection(); ?>

<?php echo $__env->make('include.dashboard', \Illuminate\Support\Arr::except(get_defined_vars(), array('__data', '__path')))->render(); ?>