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

<div class="mkt-header">
    <div><h2 class="mkt-title">Withdrawals</h2><p class="mkt-sub">Request and track your earnings withdrawals</p></div>
</div>

<div class="form-grid" style="align-items:start;">
    <div class="card">
        <div class="withdraw-balance-box">
            <span class="withdraw-balance-label">Available Balance</span>
            <span class="withdraw-balance-amount"><?php echo e(optional($settings)->website_currency ?? ''); ?><?php echo e(number_format($user->seller_balance, 2)); ?></span>
        </div>
        <?php if(optional($settings)->seller_withdrawal_fee > 0): ?>
        <p style="font-size:13px;color:var(--text-secondary);margin-bottom:16px;">Withdrawal fee: <strong><?php echo e($settings->seller_withdrawal_fee); ?>%</strong></p>
        <?php endif; ?>
        <h3 class="title">Request Withdrawal</h3>
        <form method="POST" action="<?php echo e(route('user.marketplace.seller.withdrawals.store')); ?>">
            <?php echo csrf_field(); ?>
            <div class="form-group" style="margin-bottom:16px;">
                <label class="form-label">Amount <span class="required">*</span></label>
                <input type="number" step="0.01" min="1" max="<?php echo e($user->seller_balance); ?>" name="amount" class="form-control" required>
            </div>
            <div class="form-group" style="margin-bottom:16px;">
                <label class="form-label">Account Details <span class="required">*</span></label>
                <textarea name="account_details" class="form-control" rows="3" style="height:auto;padding:12px 16px;" placeholder="Bank name, account number, account name..." required></textarea>
            </div>
            <button type="submit" class="btn btn-primary"><i class="ti ti-send"></i> Request Withdrawal</button>
        </form>
    </div>

    <div class="card">
        <h3 class="title">Withdrawal History</h3>
        <?php if($withdrawals->isEmpty()): ?>
            <div class="mkt-empty" style="padding:30px 0;"><i class="ti ti-cash-off"></i><p>No withdrawals yet.</p></div>
        <?php else: ?>
        <div class="table-responsive">
            <table class="table">
                <thead><tr><th>Amount</th><th>Fee</th><th>Net</th><th>Status</th><th>Date</th></tr></thead>
                <tbody>
                    <?php $__currentLoopData = $withdrawals; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $w): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e(optional($settings)->website_currency ?? ''); ?><?php echo e(number_format($w->amount, 2)); ?></td>
                        <td><?php echo e(optional($settings)->website_currency ?? ''); ?><?php echo e(number_format($w->fee, 2)); ?></td>
                        <td><strong><?php echo e(optional($settings)->website_currency ?? ''); ?><?php echo e(number_format($w->net_amount, 2)); ?></strong></td>
                        <td><span class="status <?php echo e($w->status === 'approved' ? 'success' : ($w->status === 'rejected' ? 'failed' : 'pending')); ?>"><?php echo e(ucfirst($w->status)); ?></span></td>
                        <td><?php echo e($w->created_at->format('M d, Y')); ?></td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
        <div class="pagination-wrapper">
            <div class="pagination-links"><?php echo e($withdrawals->links()); ?></div>
        </div>
        <?php endif; ?>
    </div>
</div>

<?php $__env->stopSection(); ?>
<?php $__env->startPush('style'); ?>
<style>
.mkt-header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;margin-bottom:24px;}
.mkt-title{font-size:22px;font-weight:700;color:var(--text-primary);margin:0 0 4px;}
.mkt-sub{font-size:14px;color:var(--text-secondary);margin:0;}
.withdraw-balance-box{background:linear-gradient(135deg,#6366f1,#4f46e5);border-radius:12px;padding:20px;margin-bottom:20px;display:flex;align-items:center;justify-content:space-between;}
.withdraw-balance-label{font-size:13px;color:rgba(255,255,255,.8);}
.withdraw-balance-amount{font-size:24px;font-weight:800;color:#fff;}
.mkt-empty{text-align:center;padding:30px 20px;color:var(--text-secondary);}
.mkt-empty i{font-size:36px;display:block;margin-bottom:8px;opacity:.5;}
</style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('frontend.layout.dash', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp\htdocs\jjd\socialnum\sstack\mine\core\resources\views/frontend/marketplace/seller/withdrawals.blade.php ENDPATH**/ ?>