<?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 if(session('status')): ?>
            <div class="alert alert-success"><?php echo e(session('status')); ?></div>
        <?php endif; ?>
        <?php if(session('error')): ?>
            <div class="alert alert-error"><?php echo e(session('error')); ?></div>
        <?php endif; ?>
        <?php if($errors->any()): ?>
            <div class="alert alert-error"><?php echo e($errors->first()); ?></div>
        <?php endif; ?>

        <?php
            $currency = strtoupper((string) $snapshot['currency']);
            $money = function ($amount, $code = null) use ($currency) {
                $code = strtoupper((string) ($code ?: $currency));
                $value = number_format((float) $amount, 2);
                return $code === 'USD' ? '$'.$value.' USD' : 'PKR '.$value;
            };
        ?>

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

        <section class="service-hero-card">
            <div class="service-hero-main">
                <span class="service-eyebrow">Account Credit</span>
                <h1>Add Funds</h1>
                <p>Your account credit uses your billing currency: <strong><?php echo e($currency); ?></strong>.</p>
            </div>
            <div class="service-hero-status">
                <span class="status-pill active">Available Credit</span>
                <strong><?php echo e($money($snapshot['balance'])); ?></strong>
</div>
        </section>

        <div class="service-dashboard-grid">
            <main class="service-dashboard-main">
                <section class="service-panel">
                    <div class="service-panel-head">
                        <div>
                            <span class="service-eyebrow">Secure Deposit</span>
                            <h2>Choose the credit amount</h2>
                        </div>
                        <p>PayFast charges in PKR. USD amounts are converted using the current billing rate at checkout.</p>
                    </div>

                    <?php if($payfastEnabled): ?>
                        <form method="POST" action="<?php echo e(route('client.add-funds.store')); ?>" style="display:grid; gap:16px; max-width:520px;">
                            <?php echo csrf_field(); ?>
                            <label>
                                <strong>Amount to add in <?php echo e($currency); ?></strong>
                                <input
                                    class="input"
                                    type="number"
                                    name="amount"
                                    value="<?php echo e(old('amount')); ?>"
                                    step="0.01"
                                    inputmode="decimal"
                                    required
                                    style="margin-top:8px; width:100%;"
                                >
                            </label>

                            <button class="primary-btn" type="submit">
                                Continue to PayFast
                            </button>
                        </form>
                    <?php else: ?>
                        <div class="alert alert-warning">
                            Online account-credit payments are temporarily unavailable. Please contact support.
                        </div>
                    <?php endif; ?>
                </section>

                <section class="service-panel" style="margin-top:20px;">
                    <div class="service-panel-head inline">
                        <div>
                            <span class="service-eyebrow">History</span>
                            <h2>Recent Credit Deposits</h2>
                        </div>
                    </div>

                    <div style="overflow-x:auto;">
                        <table class="client-clean-table">
                            <thead>
                                <tr>
                                    <th>Date</th>
                                    <th>Credit Amount</th>
                                    <th>PayFast Charge</th>
                                    <th>Status</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $deposits; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $deposit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php
                                        $status = strtolower((string) $deposit->status);
                                        $statusLabel = [
                                            'whmcs_sync_failed' => 'Payment Processing',
                                            'manual_review' => 'Under Review',
                                            'verified' => 'Payment Received',
                                        ][$status] ?? ucwords(str_replace('_', ' ', $status));
                                    ?>
                                    <tr>
                                        <td><?php echo e($deposit->created_at?->format('M j, Y g:i A')); ?></td>
                                        <td><strong><?php echo e($money($deposit->amount, $deposit->currency)); ?></strong></td>
                                        <td><?php echo e($money($deposit->payable_amount, $deposit->payable_currency)); ?></td>
                                        <td>
                                            <span class="status-pill <?php echo e($status); ?>"><?php echo e($statusLabel); ?></span>
                                            <?php if(in_array($status, ['failed', 'rejected', 'manual_review', 'whmcs_sync_failed'], true)): ?>
                                                <br><small>This payment needs attention. Please retry or contact support.</small>
                                            <?php endif; ?>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr><td colspan="4">No credit deposits yet.</td></tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </section>
            </main>

            <aside class="service-dashboard-side">
                <section class="service-panel service-summary-panel">
                    <span class="service-eyebrow">Currency Rules</span>
                    <h2><?php echo e($currency); ?> Account</h2>
                    <p class="service-muted">
                        The credit amount is added in <?php echo e($currency); ?>, which is your account billing currency.
                        Browser location, VPN, and guest-store currency do not change account credit.
                    </p>
                </section>

                <section class="service-panel service-summary-panel" style="margin-top:18px;">
                    <span class="service-eyebrow">Payment Safety</span>
                    <h2>Server Verified</h2>
                    <p class="service-muted">
                        Account credit is added only after the payment is confirmed securely.
                    </p>
                </section>
            </aside>
        </div>
    </div>
 <?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/add-funds.blade.php ENDPATH**/ ?>