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

<div x-data="{ showProof: false }" class="space-y-6 pb-24">

    <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.danger-alert','data' => []]); ?>
<?php $component->withName('danger-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
    <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.success-alert','data' => []]); ?>
<?php $component->withName('success-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>
    <?php if (isset($component)) { $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4 = $component; } ?>
<?php $component = $__env->getContainer()->make(Illuminate\View\AnonymousComponent::class, ['view' => 'components.error-alert','data' => []]); ?>
<?php $component->withName('error-alert'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4)): ?>
<?php $component = $__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4; ?>
<?php unset($__componentOriginalc254754b9d5db91d5165876f9d051922ca0066f4); ?>
<?php endif; ?>

    <!-- Page Header -->
    <div class="bg-white border border-[#E0E5E5] rounded-xl p-6">
        <div class="flex items-center space-x-4">
            <div class="w-12 h-12 rounded-xl bg-primary-600 flex items-center justify-center">
                <i data-lucide="credit-card" class="w-6 h-6 text-white"></i>
            </div>
            <div>
                <h1 class="text-2xl font-semibold text-[#0D1B23]">
                    <?php if($title == "Complete Payment"): ?>
                        Complete Your Payment
                    <?php else: ?>
                        Make Deposit
                    <?php endif; ?>
                </h1>
                <p class="text-[#7A7A7A] text-sm">Secure payment processing for your account</p>
            </div>
        </div>
    </div>

    <div class="max-w-4xl mx-auto">
        <?php if($title != "Complete Payment"): ?>
            <?php
                if($payment_mode->name == "Bitcoin"){
                    $coin = 'BTC';
                }elseif ($payment_mode->name == "Litecoin") {
                    $coin = 'LTC';
                }else {
                    $coin = 'ETH';
                }
            ?>

            <!-- Payment Amount Card -->
            <div class="bg-white border border-[#E0E5E5] rounded-xl p-6 mb-6">
                <div class="text-center mb-6">
                    <p class="text-[#7A7A7A] text-sm mb-2">Payment Amount</p>
                    <h2 class="text-4xl font-semibold text-[#0D1B23] mb-4">
                        <?php echo e($settings->currency); ?><?php echo e(number_format($amount)); ?>

                    </h2>
                    <div class="inline-flex items-center space-x-2 px-3 py-1.5 rounded-full bg-[#DFE5E5] border border-[#C8D1D1]">
                        <i data-lucide="shield-check" class="w-4 h-4 text-primary-500"></i>
                        <span class="text-sm text-[#4A4A4A]">Secure Payment</span>
                    </div>
                </div>

                <!-- Payment Method Display -->
                <div class="bg-[#F9F9F9] rounded-xl p-6 border border-[#E0E5E5]">
                    <div class="flex items-center justify-between mb-4">
                        <div class="flex items-center space-x-3">
                            <div class="w-10 h-10 rounded-lg bg-[#DFE5E5] flex items-center justify-center">
                                <i data-lucide="banknote" class="w-5 h-5 text-primary-500"></i>
                            </div>
                            <div>
                                <p class="text-sm text-[#7A7A7A]">Payment Method</p>
                                <h3 class="text-xl font-bold text-[#0D1B23]"><?php echo e($payment_mode->name); ?></h3>
                            </div>
                        </div>
                    </div>

                    <?php if($payment_mode->methodtype != 'currency' and !empty($payment_mode->wallet_address)): ?>
                        <div class="flex justify-center py-4">
                            <img src="https://api.qrserver.com/v1/create-qr-code/?size=300x300&data=<?php echo e(urlencode($payment_mode->wallet_address)); ?>" alt="QR Code" class="max-w-xs rounded-xl border border-[#E0E5E5]">
                        </div>
                    <?php endif; ?>
                </div>
            </div>

            <!-- Payment Instructions -->
            <div class="bg-white border border-[#E0E5E5] rounded-xl p-6 mb-6">
                <?php if($settings->deposit_option != "manual"): ?>
                    <?php if($payment_mode->name == "Bitcoin" or $payment_mode->name == "Litecoin" or $payment_mode->name == "Ethereum"): ?>
                        <a href="<?php echo e(url('dashboard/cpay')); ?>/<?php echo e($amount); ?>/<?php echo e($coin); ?>/<?php echo e(Auth::user()->id); ?>/new" 
                           class="w-full px-6 py-4 rounded-xl bg-primary-600 hover:bg-primary-500 text-white font-semibold transition-colors flex items-center justify-center space-x-2 group">
                            <span>Pay Via Coinpayment</span>
                            <i data-lucide="arrow-right" class="w-5 h-5 group-hover:translate-x-1 transition-transform"></i>
                        </a>
                    <?php endif; ?>
                <?php endif; ?>

                <?php if($payment_mode->methodtype != 'currency'): ?>
                    <!-- Crypto Wallet Address -->
                    <div class="space-y-4">
                        <div class="flex items-center space-x-2">
                            <i data-lucide="wallet" class="w-5 h-5 text-[#7A7A7A]"></i>
                            <h3 class="text-lg font-semibold text-[#0D1B23]"><?php echo e($payment_mode->name); ?> Address</h3>
                        </div>
                        
                        <div class="relative">
                            <input class="w-full px-4 py-4 pr-12 rounded-xl bg-[#F9F9F9] border-2 border-[#E0E5E5] text-[#0D1B23] font-mono text-sm transition-all outline-none" 
                                   readonly 
                                   type="text" 
                                   id="myInput" 
                                   value="<?php echo e($payment_mode->wallet_address); ?>">
                            <button onclick="myFunction()" 
                                    type="button"
                                    class="absolute right-2 top-1/2 -translate-y-1/2 p-2 rounded-lg bg-[#DFE5E5] hover:bg-[#C8D1D1] border border-[#C8D1D1] transition-colors group">
                                <i data-lucide="copy" class="w-5 h-5 text-[#4A4A4A]"></i>
                            </button>
                        </div>

                        <div class="flex items-center space-x-2 text-sm text-[#7A7A7A]">
                            <i data-lucide="info" class="w-4 h-4"></i>
                            <span><strong class="text-[#4A4A4A]">Network Type:</strong> <?php echo e($payment_mode->network); ?></span>
                        </div>
                    </div>
                <?php else: ?>
                    <!-- Bank Transfer or Payment Gateway -->
                    <div class="space-y-4">
                        <?php if($payment_mode->defaultpay == 'yes'): ?>
                            <?php if($payment_mode->name == "Paystack"): ?>
                                <?php $payamount = $amount * 100  ?>
                                <div id="paystack">
                                    <form method="POST" action="<?php echo e(route('pay.paystack')); ?>" accept-charset="UTF-8" class="form-horizontal" role="form">
                                        <input type="hidden" name="email" value="<?php echo e(auth::user()->email); ?>">
                                        <input type="hidden" name="amount" value="<?php echo e($payamount); ?>">
                                        <input type="hidden" name="currency" value="<?php echo e($settings->s_currency); ?>">
                                        <input type="hidden" name="metadata" value="<?php echo e(json_encode($array = ['key_name' => 'value',])); ?>"> 
                                        <input type="hidden" name="reference" value="<?php echo e(Paystack::genTranxRef()); ?>"> 
                                        <input type="hidden" name="_token" value="<?php echo e(csrf_token()); ?>">
                                        
                                        <button class="w-full px-6 py-4 rounded-xl bg-primary-600 hover:bg-primary-500 text-white font-semibold transition-colors flex items-center justify-center space-x-2" 
                                                type="submit">
                                            <i data-lucide="credit-card" class="w-5 h-5"></i>
                                            <span>Pay with Paystack</span>
                                        </button>
                                    </form>
                                </div>
                            <?php endif; ?>

                            <?php if($payment_mode->name == "Stripe"): ?>
                                <form id="payment-form" class="sr-payment-form space-y-4">
                                    <?php echo csrf_field(); ?>
                                    <div class="sr-combo-inputs-row">
                                        <div class="sr-input sr-card-element p-4 rounded-xl bg-[#F9F9F9] border-2 border-[#E0E5E5]" id="card-element"></div>
                                    </div>

                                    <button id="stripesubmit"
                                            class="w-full px-6 py-4 rounded-xl bg-primary-600 hover:bg-primary-500 text-white font-semibold transition-colors flex items-center justify-center space-x-2">
                                        <div class="spinner d-none" id="spinner"></div>
                                        <span id="buttontext">Pay Now</span>
                                    </button>
                                </form>
                        
                                <div class="hidden row" id="stripesuccess">
                                    <div class="col-lg-12 text-center p-4 bg-primary-100 rounded-xl border border-primary-300">
                                        <i data-lucide="check-circle" class="w-8 h-8 text-primary-500 mx-auto mb-2"></i>
                                        <span class="text-primary-400">Payment Completed, redirecting.....</span>
                                    </div>
                                </div>
                                
                                <form id="selectform" method="POST" action="javascript:void(0)">
                                    <?php echo csrf_field(); ?>
                                    <input type="hidden" name="amount" value="<?php echo e($amount); ?>">
                                </form>
                            <?php endif; ?>

                            <?php if($payment_mode->name == "Paypal"): ?>
                                <div class="p-4 bg-[#F9F9F9] rounded-xl border border-[#E0E5E5]">
                                    <?php echo $__env->make('includes.paypal', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
                                </div>
                            <?php endif; ?>

                            <?php if($payment_mode->name == "Bank Transfer"): ?>
                                <?php if(!empty($payment_mode->bankname)): ?>
                                <div class="space-y-2">
                                    <label class="text-sm font-semibold text-[#7A7A7A]">Bank Name</label>
                                    <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                        <p class="text-[#0D1B23]"><?php echo e($payment_mode->bankname); ?></p>
                                    </div>
                                </div>
                                <?php endif; ?>

                                <?php if(!empty($payment_mode->account_name)): ?>
                                <div class="space-y-2">
                                    <label class="text-sm font-semibold text-[#7A7A7A]">Account Name</label>
                                    <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                        <p class="text-[#0D1B23]"><?php echo e($payment_mode->account_name); ?></p>
                                    </div>
                                </div>
                                <?php endif; ?>

                                <?php if(!empty($payment_mode->account_number)): ?>
                                <div class="space-y-2">
                                    <label class="text-sm font-semibold text-[#7A7A7A]">Account Number</label>
                                    <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                        <p class="text-[#0D1B23] font-mono"><?php echo e($payment_mode->account_number); ?></p>
                                    </div>
                                </div>
                                <?php endif; ?>

                                <?php if(!empty($payment_mode->swift_code)): ?>
                                <div class="space-y-2">
                                    <label class="text-sm font-semibold text-[#7A7A7A]">Swift Code</label>
                                    <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                        <p class="text-[#0D1B23] font-mono"><?php echo e($payment_mode->swift_code); ?></p>
                                    </div>
                                </div>
                                <?php endif; ?>
                            <?php endif; ?>
                        <?php else: ?>
                            <!-- Manual Bank Transfer Details -->
                            <?php if(!empty($payment_mode->bankname)): ?>
                            <div class="space-y-2">
                                <label class="text-sm font-semibold text-[#7A7A7A]">Bank Name</label>
                                <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                    <p class="text-[#0D1B23]"><?php echo e($payment_mode->bankname); ?></p>
                                </div>
                            </div>
                            <?php endif; ?>

                            <?php if(!empty($payment_mode->account_name)): ?>
                            <div class="space-y-2">
                                <label class="text-sm font-semibold text-[#7A7A7A]">Account Name</label>
                                <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                    <p class="text-[#0D1B23]"><?php echo e($payment_mode->account_name); ?></p>
                                </div>
                            </div>
                            <?php endif; ?>

                            <?php if(!empty($payment_mode->account_number)): ?>
                            <div class="space-y-2">
                                <label class="text-sm font-semibold text-[#7A7A7A]">Account Number</label>
                                <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                    <p class="text-[#0D1B23] font-mono"><?php echo e($payment_mode->account_number); ?></p>
                                </div>
                            </div>
                            <?php endif; ?>

                            <?php if(!empty($payment_mode->swift_code)): ?>
                            <div class="space-y-2">
                                <label class="text-sm font-semibold text-[#7A7A7A]">Swift Code</label>
                                <div class="bg-[#F9F9F9] rounded-xl px-4 py-3 border border-[#E0E5E5]">
                                    <p class="text-[#0D1B23] font-mono"><?php echo e($payment_mode->swift_code); ?></p>
                                </div>
                            </div>
                            <?php endif; ?>
                        <?php endif; ?>
                    </div>
                <?php endif; ?>
            </div>

            <!-- Payment Proof Upload -->
            <?php if($settings->deposit_option == "auto" and $payment_mode->defaultpay != 'yes'): ?>
                <div class="bg-white border border-[#E0E5E5] rounded-xl p-6">
                    <form method="post" action="<?php echo e(route('savedeposit')); ?>" enctype="multipart/form-data" class="space-y-6">
                        <?php echo csrf_field(); ?>
                        
                        <div class="space-y-3">
                            <label class="flex items-center space-x-2 text-[#0D1B23] font-semibold">
                                <i data-lucide="upload" class="w-5 h-5 text-[#7A7A7A]"></i>
                                <span>Upload Payment Proof</span>
                            </label>
                            <div class="relative">
                                <input class="w-full px-4 py-4 rounded-xl bg-[#F9F9F9] border-2 border-dashed border-[#E0E5E5] focus:border-primary-500 text-[#0D1B23] transition-colors outline-none file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-[#DFE5E5] file:text-[#4A4A4A] hover:file:bg-[#C8D1D1]" 
                                       name="proof" 
                                       type="file" 
                                       multiple />
                            </div>
                            <p class="text-sm text-[#7A7A7A] flex items-center space-x-2">
                                <i data-lucide="info" class="w-4 h-4"></i>
                                <span>Please upload a screenshot or photo of your payment confirmation</span>
                            </p>
                        </div>
                        
                        <input type="hidden" name="amount" value="<?php echo e($amount); ?>">
                        <input type="hidden" name="paymethd_method" value="<?php echo e($payment_mode->name); ?>">

                        <button type="submit" 
                                class="w-full px-6 py-4 rounded-xl bg-primary-600 hover:bg-primary-500 text-white font-semibold transition-colors flex items-center justify-center space-x-2 group">
                            <span>Submit Payment</span>
                            <i data-lucide="arrow-right" class="w-5 h-5 group-hover:translate-x-1 transition-transform"></i>
                        </button>
                    </form>
                </div>
            <?php endif; ?>

            <?php if($settings->deposit_option == "manual" and $payment_mode->name != "Paystack" and $payment_mode->name != "Stripe" and $payment_mode->name != "Paypal" and $title !="Complete Payment"): ?>
                <div class="bg-white border border-[#E0E5E5] rounded-xl p-6">
                    <form method="post" action="<?php echo e(route('savedeposit')); ?>" enctype="multipart/form-data" class="space-y-6">
                        <?php echo csrf_field(); ?>

                        <div class="space-y-3">
                            <label class="flex items-center space-x-2 text-[#0D1B23] font-semibold">
                                <i data-lucide="upload" class="w-5 h-5 text-[#7A7A7A]"></i>
                                <span>Upload Payment Proof</span>
                            </label>
                            <div class="relative">
                                <input class="w-full px-4 py-4 rounded-xl bg-[#F9F9F9] border-2 border-dashed border-[#E0E5E5] focus:border-primary-500 text-[#0D1B23] transition-colors outline-none file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-[#DFE5E5] file:text-[#4A4A4A] hover:file:bg-[#C8D1D1]" 
                                       type="file" 
                                       name="proof" 
                                       required 
                                       multiple />
                            </div>
                            <p class="text-sm text-[#7A7A7A] flex items-center space-x-2">
                                <i data-lucide="info" class="w-4 h-4"></i>
                                <span>Please upload a screenshot or photo of your payment confirmation</span>
                            </p>
                        </div>

                        <input type="hidden" name="amount" value="<?php echo e($amount); ?>">
                        <input type="hidden" name="paymethd_method" value="<?php echo e($payment_mode->name); ?>">

                        <button type="submit" 
                                class="w-full px-6 py-4 rounded-xl bg-primary-600 hover:bg-primary-500 text-white font-semibold transition-colors flex items-center justify-center space-x-2 group">
                            <span>Submit Payment</span>
                            <i data-lucide="arrow-right" class="w-5 h-5 group-hover:translate-x-1 transition-transform"></i>
                        </button>
                    </form>
                </div>
            <?php endif; ?>
        <?php endif; ?>

        
        <?php if($title=="Complete Payment"): ?>
            <div class="bg-white border border-[#E0E5E5] rounded-xl p-6">
                <div class="text-center space-y-6">
                    <div class="flex justify-center">
                        <div class="w-12 h-12 rounded-xl bg-primary-600 flex items-center justify-center">
                            <i data-lucide="qr-code" class="w-6 h-6 text-white"></i>
                        </div>
                    </div>

                    <div>
                        <h3 class="text-xl font-semibold text-[#0D1B23] mb-2">Scan QR Code to Pay</h3>
                        <p class="text-[#7A7A7A] mb-6">Send <strong class="text-[#0D1B23]"><?php echo e($amount); ?> <?php echo e($coin); ?></strong> to complete your payment</p>
                    </div>

                    <div class="flex justify-center mb-6">
                        <div class="p-4 bg-white rounded-xl">
                            <img width="220" height="220" alt="Payment QR code" src="<?php echo e($p_qrcode); ?>" class="rounded-lg">
                        </div>
                    </div>

                    <div class="bg-[#F9F9F9] rounded-xl p-4 border border-[#E0E5E5]">
                        <p class="text-sm font-semibold text-[#0D1B23] mb-2">Payment Address</p>
                        <p class="text-sm text-[#4A4A4A] font-mono break-all"><?php echo e($p_address); ?></p>
                    </div>

                    <div class="p-4 bg-[#F9F9F9] rounded-xl border border-[#E0E5E5]">
                        <div class="flex items-start space-x-3">
                            <i data-lucide="info" class="w-5 h-5 text-primary-500 mt-0.5 flex-shrink-0"></i>
                            <p class="text-sm text-[#4A4A4A] text-left">You can exit this page after scanning and completing payment. The system will automatically track your payment and update your account accordingly.</p>
                        </div>
                    </div>
                </div>
            </div>
        <?php endif; ?>
    </div>

</div>

<?php $__env->startPush('scripts'); ?>
<script>
    // Copy function
    function myFunction() {
        var copyText = document.getElementById("myInput");
        copyText.select();
        copyText.setSelectionRange(0, 99999);
        document.execCommand("copy");
        swal("Copied", copyText.value, "success");
    }

    // Initialize Lucide icons
    document.addEventListener('DOMContentLoaded', function() {
        lucide.createIcons();
    });
</script>

<script type="text/javascript">
    var stripe = Stripe("<?php echo e($settings->s_p_k); ?>");
    var elements = stripe.elements();
    var style = {
        base: {
            color: "#0D1B23",
            fontFamily: '"DM Sans", sans-serif',
            fontSize: "16px",
            "::placeholder": {
                color: "#7A7A7A"
            }
        }
    };
    const paybtn = document.querySelector('#stripesubmit');
    if (paybtn) {
        console.log(paybtn);
        paybtn.disabled = true;

        var card = elements.create("card", { style: style });
        card.mount("#card-element");

        function checkcardforerrors() {
            card.on('change', function(event) {
                if (event.error) {
                    swal("Error", event.error.message, "error");
                    paybtn.disabled = true;
                } else {
                    paybtn.disabled = false;
                }
            });
        }
        checkcardforerrors();
        
        var form = document.getElementById('payment-form');

        form.addEventListener('submit', function(ev) {
            paybtn.disabled = true;
            ev.preventDefault();
            checkcardforerrors();
            document.getElementById('spinner').classList.remove('d-none');
            document.getElementById('buttontext').classList.add('d-none');
            
            var clientSecret = "<?php echo e($intent); ?>";
            stripe.confirmCardPayment(clientSecret, {
                payment_method: {
                    card: card,
                    billing_details: {
                        name: "<?php echo e(Auth::user()->name); ?>"
                    }
                }
            }).then(function(result) {
                if (result.error) {
                    swal("Error", 'There was an error processing your payment, Please try deposit again from deposit page', "error");
                    console.log(result.error.message);
                } else {
                    if (result.paymentIntent.status === 'succeeded') {
                        $.ajax({
                            url: "<?php echo e(url('/dashboard/submit-stripe-payment')); ?>",
                            type: 'POST',
                            data:$('#selectform').serialize(),
                            success: function (data) {
                                swal("Success", data.success, "success");
                                setTimeout(function(){window.location.replace("<?php echo e(route('accounthistory')); ?>"); }, 3000);
                            },
                            error: function (error) {
                                alert('Error Submiting Payment Data');
                                console.log(error);
                            },
                        });
                    }
                }
            });
        });
    }
</script>
<?php $__env->stopPush(); ?>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.bankapp', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/elitecha/ccintegrated.online/resources/views/user/payment.blade.php ENDPATH**/ ?>