<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54 = $attributes; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('app-layout'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\AppLayout::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <div class="portal-container service-page-wrap">
        <?php
            $money = function ($amount, $currency) {
                $currency = strtoupper((string) $currency);
                $value = number_format((float) $amount, 2);
                return $currency === 'USD' ? '$'.$value.' USD' : 'PKR '.$value;
            };
        ?>

        <div class="service-topbar">
            <a class="service-back-link" href="<?php echo e(route('client.add-funds')); ?>">← Back to Add Funds</a>
        </div>

        <section class="service-hero-card">
            <div class="service-hero-main">
                <span class="service-eyebrow">Secure Credit Deposit</span>
                <h1>Redirecting to PayFast</h1>
                <p>Deposit #<?php echo e($deposit->id); ?></p>
            </div>
            <div class="service-hero-status">
                <span class="status-pill unpaid"><?php echo e(strtoupper($payment['mode'] ?? 'sandbox')); ?></span>
                <strong><?php echo e($money($payment['payfast_amount'], $payment['payfast_currency'])); ?></strong>
                <small>Account credit: <?php echo e($money($payment['credit_amount'], $payment['credit_currency'])); ?></small>
                <?php if(($payment['credit_currency'] ?? '') !== ($payment['payfast_currency'] ?? '')): ?>
                    <small>1 <?php echo e($payment['credit_currency']); ?> = <?php echo e(number_format((float) ($payment['conversion_rate'] ?? 0), 5)); ?> PKR</small>
                <?php endif; ?>
            </div>
        </section>

        <section class="service-panel">
            <div class="service-panel-head">
                <div>
                    <span class="service-eyebrow">Next Step</span>
                    <h2>Opening payment page</h2>
                </div>
                <p>Do not refresh while the signed payment form is being submitted.</p>
            </div>

            <form id="payfastCreditForm" method="POST" action="<?php echo e($payment['action']); ?>">
                <?php $__currentLoopData = ($payment['fields'] ?? []); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $name => $value): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <input type="hidden" name="<?php echo e($name); ?>" value="<?php echo e($value); ?>">
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                <button class="primary-btn" type="submit">Continue to PayFast</button>
            </form>

            <p class="service-muted" style="margin-top:14px;">If the page does not open automatically, click the button above.</p>
        </section>
    </div>

    <script>
        window.setTimeout(function () {
            var form = document.getElementById('payfastCreditForm');
            if (form) form.submit();
        }, 700);
    </script>
 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $attributes = $__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__attributesOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH /home/ovbopdha/public_html/ztcart.eagale.xyz/resources/views/client/payfast-credit-redirect.blade.php ENDPATH**/ ?>