<?php if (isset($component)) { $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54 = $component; } ?>
<?php $component = App\View\Components\AppLayout::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?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 && $constructor = (new ReflectionClass(App\View\Components\AppLayout::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
    <div class="py-6">
        <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
            <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
                <div class="p-6 text-gray-900">
                    <?php if(session('error')): ?>
                        <div class="alert alert-danger text-red-600">
                            <?php echo e(session('error')); ?>

                        </div>
                    <?php endif; ?>
                    <div class="border-b-2 border-slate-100 pb-4">
                        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
                            <?php echo e(__('Dashboard')); ?>

                        </h2>
                    </div>
                    <div class="grid grid-cols-2 gap-4 mt-6">
                        <div class="border-l-2 bg-blue-50 border-blue-500 p-4">
                            <h2 class="text-l font-bold"><?php echo e(__('Current Package')); ?></h2>
                            <p class="text-xl mt-2 font-bold"><?php echo e($user->detail->package_name); ?></p>
                        </div>
                        <div class="border-l-2 bg-blue-50 border-blue-500 p-4">
                            <h2 class="text-l font-bold"><?php echo e(__('Package Start')); ?></h2>
                            <p class="text-xl mt-2 font-bold"><?php echo e($user->detail->package_start); ?></p>
                        </div>
                        <div class="border-l-2 bg-blue-50 border-blue-500 p-4">
                            <h2 class="text-l font-bold"><?php echo e(__('Current Due')); ?></h2>
                            <p class="text-xl mt-2 font-bold"><?php echo e($user->due_amount($user->id)); ?></p>
                        </div>
                    </div>
                    <div class="mt-6">
                        <?php if($user->due_amount($user->id) > 0): ?>
                            <form action="<?php echo e(route('payment.process')); ?>" method="POST" id="payment-form">
                                <?php echo csrf_field(); ?>
                                <input type="hidden" name="amount" value="200">
                                <input type="hidden" name="payment_method" id="payment_method" value="">
                                <div id="card-element"></div>
                                <div id="card-errors" role="alert"></div>
                                <button type="submit" class="btn btn-primary">Confirm Payment</button>
                            </form>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <?php $__env->startPush('scripts'); ?>
    <script src="https://js.stripe.com/v3/"></script>
    <script>
        const stripe = Stripe('<?php echo e(config('services.stripe.key')); ?>');
        const elements = stripe.elements();
        const cardElement = elements.create('card');
        cardElement.mount('#card-element');

        cardElement.on('change', function(event) {
            const displayError = document.getElementById('card-errors');
            if (event.error) {
                displayError.textContent = event.error.message;
            } else {
                displayError.textContent = '';
            }
        });

        const paymentForm = document.getElementById('payment-form');
        paymentForm.addEventListener('submit', function(event) {
            event.preventDefault();
            stripe.createPaymentMethod('card', cardElement)
                .then(function(result) {
                    if (result.error) {
                        const errorElement = document.getElementById('card-errors');
                        errorElement.textContent = result.error.message;
                    } else {
                        const paymentMethodInput = document.getElementById('payment_method');
                        paymentMethodInput.value = result.paymentMethod.id;
                        paymentForm.submit();
                    }
                });
        });
    </script>
    <?php $__env->stopPush(); ?>

 <?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54)): ?>
<?php $component = $__componentOriginal9ac128a9029c0e4701924bd2d73d7f54; ?>
<?php unset($__componentOriginal9ac128a9029c0e4701924bd2d73d7f54); ?>
<?php endif; ?>
<?php /**PATH C:\wamp64\www\betternet 4\resources\views/dashboard2.blade.php ENDPATH**/ ?>