

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

<?php $__env->startSection('content'); ?>
<div class="content-wrapper">
    <div class="row">
        <div class="col-sm-12">
            <h4 class="mb-4">Credit Summary</h4>
        </div>
    </div>

    <!-- Stats Cards -->
    <div class="row">
        <div class="col-md-3 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <p class="text-muted mb-2">Current Balance</p>
                            <h3 class="mb-0 text-success"><?php echo e(App\CPU\Helpers::formatCurrency($stats['current_balance'])); ?></h3>
                        </div>
                        <div class="text-success">
                            <i class="mdi mdi-wallet mdi-36px"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-3 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <p class="text-muted mb-2">Total Commission Earned</p>
                            <h3 class="mb-0 text-primary"><?php echo e(App\CPU\Helpers::formatCurrency($stats['total_earned'])); ?></h3>
                        </div>
                        <div class="text-primary">
                            <i class="mdi mdi-cash-multiple mdi-36px"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-3 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <p class="text-muted mb-2">Total Credits Added</p>
                            <h3 class="mb-0 text-info"><?php echo e(App\CPU\Helpers::formatCurrency($stats['total_credits'])); ?></h3>
                        </div>
                        <div class="text-info">
                            <i class="mdi mdi-plus-circle mdi-36px"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-3 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center">
                        <div>
                            <p class="text-muted mb-2">Total Debits</p>
                            <h3 class="mb-0 text-danger"><?php echo e(App\CPU\Helpers::formatCurrency($stats['total_debits'])); ?></h3>
                        </div>
                        <div class="text-danger">
                            <i class="mdi mdi-minus-circle mdi-36px"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Actions -->
    <div class="row">
        <div class="col-md-6 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">Add Balance</h4>
                    <form action="<?php echo e(route('reseller.addBalance')); ?>" method="POST" enctype="multipart/form-data">
                        <?php echo csrf_field(); ?>
                        <div class="form-group">
                            <label for="amount">Amount (<?php echo e(App\CPU\Helpers::getCurrencySymbol()); ?>)</label>
                            <input type="number" class="form-control" id="amount" name="amount" 
                                   step="0.01" min="1" required placeholder="Enter amount">
                        </div>
                        <div class="form-group">
                            <label for="payment_method">Payment Method</label>
                            <select class="form-control" id="payment_method" name="payment_method">
                                <option value="manual">Manual Payment</option>
                                <option value="bank_transfer">Bank Transfer</option>
                                <option value="paypal">PayPal</option>
                                <option value="crypto">Cryptocurrency</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="proof_of_payment">Proof of Payment (Screenshot/Receipt)</label>
                            <input type="file" class="form-control" id="proof_of_payment" name="proof_of_payment" accept="image/*,.pdf">
                            <small class="text-muted">Upload a screenshot or photo of your payment receipt (optional but recommended)</small>
                        </div>
                        <button type="submit" class="btn btn-primary">Add Balance</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="col-md-6 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">Request Withdrawal</h4>
                    <form action="<?php echo e(route('reseller.credit.withdrawal')); ?>" method="POST">
                        <?php echo csrf_field(); ?>
                        <div class="form-group">
                            <label for="withdraw_amount">Amount (<?php echo e(App\CPU\Helpers::getCurrencySymbol()); ?>)</label>
                            <input type="number" class="form-control" id="withdraw_amount" name="amount" 
                                   step="0.01" min="1" required placeholder="Enter amount">
                        </div>
                        <div class="form-group">
                            <label for="payment_details">Payment Details</label>
                            <textarea class="form-control" id="payment_details" name="payment_details" 
                                      rows="3" required placeholder="Enter your payment details (bank account, PayPal email, etc.)"></textarea>
                        </div>
                        <button type="submit" class="btn btn-warning">Request Withdrawal</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <!-- Recent Transactions -->
    <div class="row">
        <div class="col-12 grid-margin stretch-card">
            <div class="card">
                <div class="card-body">
                    <div class="d-flex justify-content-between align-items-center mb-3">
                        <h4 class="card-title">Recent Transactions</h4>
                        <a href="<?php echo e(route('reseller.credit.transactions')); ?>" class="btn btn-sm btn-primary">View All</a>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>Date</th>
                                    <th>Type</th>
                                    <th>Amount</th>
                                    <th>Balance</th>
                                    <th>Description</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__empty_1 = true; $__currentLoopData = $recentTransactions; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $transaction): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td><?php echo e($transaction->created_at->format('Y-m-d H:i')); ?></td>
                                    <td>
                                        <?php switch($transaction->type):
                                            case ('credit'): ?>
                                                <span class="badge badge-success">Credit</span>
                                                <?php break; ?>
                                            <?php case ('debit'): ?>
                                                <span class="badge badge-danger">Debit</span>
                                                <?php break; ?>
                                            <?php case ('commission'): ?>
                                                <span class="badge badge-primary">Commission</span>
                                                <?php break; ?>
                                            <?php case ('refund'): ?>
                                                <span class="badge badge-info">Refund</span>
                                                <?php break; ?>
                                            <?php case ('adjustment'): ?>
                                                <span class="badge badge-warning">Adjustment</span>
                                                <?php break; ?>
                                        <?php endswitch; ?>
                                    </td>
                                    <td class="<?php echo e($transaction->amount >= 0 ? 'text-success' : 'text-danger'); ?>">
                                        <?php echo e($transaction->amount >= 0 ? '+' : ''); ?><?php echo e(App\CPU\Helpers::formatCurrency(abs($transaction->amount))); ?>

                                    </td>
                                    <td><?php echo e(App\CPU\Helpers::formatCurrency($transaction->balance_after)); ?></td>
                                    <td><?php echo e($transaction->description ?? '-'); ?></td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td colspan="5" class="text-center">No transactions yet</td>
                                </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.reseller', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\pixy\resources\views/reseller/credit/summary.blade.php ENDPATH**/ ?>