<?php $__env->startSection('breadcrumb'); ?>
    <b class="breadcrumb-item"><?php echo e(config('app.name')); ?></b>
    <li class="breadcrumb-item active" aria-current="page">Payment Plans</li>
<?php $__env->stopSection(); ?>

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

<style>
/* GLOBAL UI POLISH */
.card {
    border-radius: 18px !important;
}
.card-header {
    border-top-left-radius: 18px !important;
    border-top-right-radius: 18px !important;
}
.badge {
    border-radius: 10px;
}
.btn {
    border-radius: 10px;
}

/* MOBILE RESPONSIVE TABLE */
@media (max-width: 768px) {
    table thead { display: none; }

    table tbody tr {
        display: block;
        margin-bottom: 14px;
        padding: 14px;
        border: 1px solid #e6e6e6;
        border-radius: 14px;
        background: #fff;
    }

    table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 6px 8px;
        align-items: center;
        text-align: right;
    }

    table tbody td:before {
        content: attr(data-label);
        width: 50%;
        font-weight: 600;
        text-align: left;
        color: #666;
    }

    .btn-group {
        width: 100%;
        justify-content: flex-end;
    }
}

.masked {
    font-family: monospace;
    color: #888;
}
</style>

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="h3 fw-bold text-gray-800 mb-1">Payment Plans</h1>
        <p class="text-muted small mb-0">Manage payment gateway configuration</p>
    </div>

    <a href="<?php echo e(route('paymentplan.create')); ?>" class="btn btn-success btn-lg shadow-sm px-4">
        <i class="fas fa-plus me-2"></i>Add Gateway
    </a>
</div>

<div class="card shadow border-0">
    <div class="card-header py-3 d-flex justify-content-between align-items-center"
         style="background: linear-gradient(90deg, #4e73df, #224abe);">
        <h6 class="fw-bold text-white mb-0">Configured Payment Gateways</h6>
        <span class="badge bg-light text-dark fs-6">
            <?php echo e(count($plans)); ?> gateways
        </span>
    </div>

    <div class="card-body p-0">
        <div class="table-responsive">
            <table class="table table-hover align-middle mb-0">
                <thead class="table-light">
                <tr>
                    <th class="ps-3">#</th>
                    <th>Gateway</th>
                    <th>API Key</th>
                    <th>Secret Key</th>
                    <th>Webhook Secret</th>
                    <th>Mode</th>
                    <th class="text-center">Enabled</th>
                    <th class="text-center">Actions</th>
                </tr>
                </thead>

                <tbody>
                <?php $__empty_1 = true; $__currentLoopData = $plans; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $plan): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>

                        
                        <td class="ps-3 fw-bold"><?php echo e($loop->iteration); ?></td>

                        
                        <td data-label="Gateway">
                            <span class="badge bg-dark px-3 py-2">
                                <?php echo e(ucfirst($plan->plan_provider)); ?>

                            </span>
                        </td>

                        
                        <td data-label="API Key">
                            <?php
                                $apiKey = $plan->razorpay_key
                                    ?? $plan->stripe_publishable_key
                                    ?? $plan->paypal_client_id
                                    ?? null;
                            ?>

                            <?php if($apiKey): ?>
                                <span class="masked bg-light px-2 py-1 rounded">
                                    <?php echo e(substr($apiKey, 0, 6)); ?>•••••
                                </span>
                            <?php else: ?>
                                <span class="badge bg-danger">Not Set</span>
                            <?php endif; ?>
                        </td>

                        
                        <td data-label="Secret Key">
                            <?php
                                $secret = $plan->razorpay_secret
                                    ?? $plan->stripe_secret_key
                                    ?? $plan->paypal_secret_key
                                    ?? null;
                            ?>

                            <?php if($secret): ?>
                                <span class="masked bg-light px-2 py-1 rounded">
                                    <?php echo e(substr($secret, 0, 4)); ?>••••••
                                </span>
                            <?php else: ?>
                                <span class="badge bg-danger">Not Set</span>
                            <?php endif; ?>
                        </td>

                        
                        <td data-label="Webhook">
                            <?php if($plan->webhook_secret): ?>
                                <span class="masked bg-light px-2 py-1 rounded">
                                    <?php echo e(substr($plan->webhook_secret, 0, 4)); ?>••••
                                </span>
                            <?php else: ?>
                                <span class="text-muted">—</span>
                            <?php endif; ?>
                        </td>

                        
                        <td data-label="Mode">
                            <span class="badge bg-secondary px-3 py-2">
                                <?php echo e(strtoupper($plan->paypal_mode ?? 'live')); ?>

                            </span>
                        </td>

                        
                        <td data-label="Enabled" class="text-center">
                            <?php if($plan->enabled): ?>
                                <span class="badge bg-success px-3 py-2">Enabled</span>
                            <?php else: ?>
                                <span class="badge bg-danger px-3 py-2">Disabled</span>
                            <?php endif; ?>
                        </td>

                        
                        <td class="text-center">
                            <div class="btn-group shadow-sm">
                                <a href="<?php echo e(route('paymentplan.edit', $plan->plan_id)); ?>"
                                   class="btn btn-info btn-sm">
                                    Edit
                                </a>

                                <form action="<?php echo e(route('paymentplan.destroy', $plan->plan_id)); ?>"
                                      method="POST" class="d-inline">
                                    <?php echo method_field('DELETE'); ?>
                                    <?php echo csrf_field(); ?>
                                    <button class="btn btn-danger btn-sm"
                                            onclick="return confirm('Delete this payment gateway?')">
                                        Delete
                                    </button>
                                </form>
                            </div>
                        </td>
                    </tr>

                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr>
                        <td colspan="8" class="text-center text-muted py-5">
                            <i class="fas fa-credit-card fa-4x opacity-25 mb-3"></i>
                            <div class="h5">No gateways configured yet</div>
                            <small>Add your first payment gateway to get started!</small>
                        </td>
                    </tr>
                <?php endif; ?>
                </tbody>

            </table>
        </div>
    </div>
</div>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('manage.admin.controlpanel', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\xampp8.2\htdocs\MCCMS\resources\views/manage/admin/paymentplan/paymentplan.blade.php ENDPATH**/ ?>