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

<?php $__env->startSection('content'); ?>
<div class="container-fluid py-4">
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="mb-0">Available Credit Packages</h5>
                </div>
                <div class="card-body">
                    <?php if(session('success')): ?>
                        <div class="alert alert-success"><?php echo e(session('success')); ?></div>
                    <?php endif; ?>
                    
                    <?php if($packages->isEmpty()): ?>
                        <div class="text-center py-5">
                            <p class="text-muted">No credit packages available at the moment.</p>
                        </div>
                    <?php else: ?>
                        <div class="row g-4">
                            <?php $__currentLoopData = $packages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $package): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="col-md-4">
                                    <div class="card h-100 border-primary">
                                        <div class="card-header bg-primary text-white">
                                            <h5 class="mb-0"><?php echo e($package->name); ?></h5>
                                        </div>
                                        <div class="card-body text-center">
                                            <h2 class="text-primary mb-3"><?php echo e(number_format($package->credits, 2)); ?></h2>
                                            <p class="text-muted">Credits</p>
                                            <hr>
                                            <h3 class="mb-3"><?php echo e(App\CPU\Helpers::formatCurrency($package->price)); ?></h3>
                                            <?php if($package->description): ?>
                                                <p class="text-muted small"><?php echo e($package->description); ?></p>
                                            <?php endif; ?>
                                            <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#requestModal<?php echo e($package->id); ?>">
                                                <i class="mdi mdi-cart-plus"></i> Request Package
                                            </button>
                                        </div>
                                    </div>
                                </div>

                                <!-- Request Modal -->
                                <div class="modal fade" id="requestModal<?php echo e($package->id); ?>" tabindex="-1">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <form action="<?php echo e(route('reseller.credit.packages.request', $package->id)); ?>" method="POST" enctype="multipart/form-data">
                                                <?php echo csrf_field(); ?>
                                                <div class="modal-header">
                                                    <h5 class="modal-title">Request: <?php echo e($package->name); ?></h5>
                                                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="alert alert-info">
                                                        <strong>Package:</strong> <?php echo e($package->name); ?><br>
                                                        <strong>Credits:</strong> <?php echo e(number_format($package->credits, 2)); ?><br>
                                                        <strong>Price:</strong> <?php echo e(App\CPU\Helpers::formatCurrency($package->price)); ?>

                                                    </div>
                                                    <div class="mb-3">
                                                        <label class="form-label">Payment Method</label>
                                                        <select name="payment_method" class="form-select" required>
                                                            <option value="">Select Payment Method</option>
                                                            <option value="gcash">GCash</option>
                                                            <option value="paymaya">PayMaya</option>
                                                            <option value="bank_transfer">Bank Transfer</option>
                                                            <option value="crypto">Cryptocurrency</option>
                                                            <option value="other">Other</option>
                                                        </select>
                                                    </div>
                                                    <div class="mb-3">
                                                        <label class="form-label">Payment Reference / Transaction ID</label>
                                                        <input type="text" name="payment_reference" class="form-control" placeholder="Enter your payment reference or transaction ID" required>
                                                    </div>
                                                    <div class="mb-3">
                                                        <label class="form-label">Proof of Payment (Screenshot/Receipt)</label>
                                                        <input type="file" name="proof_of_payment" class="form-control" accept="image/*,.pdf">
                                                        <small class="text-muted">Upload a screenshot or photo of your payment receipt (optional but recommended)</small>
                                                    </div>
                                                    <p class="text-muted small">After submitting, wait for admin approval. Your credits will be added once approved.</p>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="submit" class="btn btn-primary">Submit Request</button>
                                                </div>
                                            </form>
                                        </div>
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\pixy\resources\views/reseller/credit/packages.blade.php ENDPATH**/ ?>