<?php $__env->startSection('breadcrumb'); ?>
    <b class="breadcrumb-item"><?php echo e(config('app.name')); ?></b>
    <li class="breadcrumb-item">
        <a href="<?php echo e(route('paymentoption.index')); ?>">Payment Plans</a>
    </li>
    <li class="breadcrumb-item active">Edit</li>
<?php $__env->stopSection(); ?>

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

<style>
.card {
    border-radius: 18px !important;
}
.card-header {
    border-top-left-radius: 18px !important;
    border-top-right-radius: 18px !important;
}
.form-control, .form-select {
    border-radius: 10px;
}
.btn {
    border-radius: 10px;
}
</style>

<div class="d-flex justify-content-between align-items-center mb-4">
    <div>
        <h1 class="h3 fw-bold mb-1 text-gray-800">Edit Payment Gateway</h1>
        <p class="text-muted small mb-0">
            Update API keys for <strong><?php echo e(ucfirst($option->option_provider)); ?></strong>
        </p>
    </div>
    <a href="<?php echo e(route('paymentoption.index')); ?>" class="btn btn-light btn-lg shadow-sm px-4">
        ← Back
    </a>
</div>

<div class="row justify-content-center">
    <div class="col-xl-7 col-lg-9">

        <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">
                    Editing: <?php echo e(ucfirst($option->option_provider)); ?>

                </h6>
                <span class="badge bg-light text-dark px-3">
                    ID: <?php echo e($option->option_id); ?>

                </span>
            </div>

            <div class="card-body p-5">

                <form action="<?php echo e(route('paymentoption.update', $option->option_id)); ?>" method="POST">
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('PUT'); ?>

                    <div class="row g-4">

                        
                        <div class="col-12">
                            <label class="form-label fw-bold">Payment Gateway</label>
                            <select name="option_provider" id="gateway" class="form-select form-select-lg" required>
                                <option value="razorpay" <?php echo e($option->option_provider=='razorpay' ? 'selected':''); ?>>Razorpay</option>
                                <option value="stripe" <?php echo e($option->option_provider=='stripe' ? 'selected':''); ?>>Stripe</option>
                                <option value="paypal" <?php echo e($option->option_provider=='paypal' ? 'selected':''); ?>>PayPal</option>
                            </select>
                        </div>

                        
                        <div id="razorpay_fields" class="<?php echo e($option->option_provider=='razorpay' ? '' : 'd-none'); ?>">
                            <div class="border rounded-4 p-4 mt-3">
                                <h5 class="fw-bold mb-3 text-primary">Razorpay Credentials</h5>

                                <label class="form-label">Razorpay Key</label>
                                <input type="text" name="razorpay_key" class="form-control form-control-lg"
                                       value="<?php echo e(old('razorpay_key', $option->razorpay_key)); ?>">

                                <label class="form-label mt-3">Razorpay Secret</label>
                                <input type="text" name="razorpay_secret" class="form-control form-control-lg"
                                       value="<?php echo e(old('razorpay_secret', $option->razorpay_secret)); ?>">
                            </div>
                        </div>

                        
                        <div id="stripe_fields" class="<?php echo e($option->option_provider=='stripe' ? '' : 'd-none'); ?>">
                            <div class="border rounded-4 p-4 mt-3">
                                <h5 class="fw-bold mb-3 text-info">Stripe Credentials</h5>

                                <label class="form-label">Publishable Key</label>
                                <input type="text" name="stripe_publishable_key" class="form-control form-control-lg"
                                       value="<?php echo e(old('stripe_publishable_key', $option->stripe_publishable_key)); ?>">

                                <label class="form-label mt-3">Secret Key</label>
                                <input type="text" name="stripe_secret_key" class="form-control form-control-lg"
                                       value="<?php echo e(old('stripe_secret_key', $option->stripe_secret_key)); ?>">
                            </div>
                        </div>

                        
                        <div id="paypal_fields" class="<?php echo e($option->option_provider=='paypal' ? '' : 'd-none'); ?>">
                            <div class="border rounded-4 p-4 mt-3">
                                <h5 class="fw-bold mb-3 text-warning">PayPal Credentials</h5>

                                <label class="form-label">Client ID</label>
                                <input type="text" name="paypal_client_id" class="form-control form-control-lg"
                                       value="<?php echo e(old('paypal_client_id', $option->paypal_client_id)); ?>">

                                <label class="form-label mt-3">Secret Key</label>
                                <input type="text" name="paypal_secret_key" class="form-control form-control-lg"
                                       value="<?php echo e(old('paypal_secret_key', $option->paypal_secret_key)); ?>">

                                <label class="form-label mt-3">Mode</label>
                                <select name="paypal_mode" class="form-select form-select-lg">
                                    <option value="sandbox" <?php echo e($option->paypal_mode=='sandbox'?'selected':''); ?>>Sandbox</option>
                                    <option value="live" <?php echo e($option->paypal_mode=='live'?'selected':''); ?>>Live</option>
                                </select>
                            </div>
                        </div>

                        
                        <div class="col-12 mt-4">
                            <label class="form-label fw-bold">Webhook Secret</label>
                            <input type="text" name="webhook_secret" class="form-control form-control-lg"
                                   value="<?php echo e(old('webhook_secret', $option->webhook_secret)); ?>">
                        </div>

                        
                        <div class="col-12">
                            <label class="form-label fw-bold">Callback URL</label>
                            <input type="text" name="callback_url" class="form-control form-control-lg"
                                   value="<?php echo e(old('callback_url', $option->callback_url)); ?>">
                        </div>

                        
                        <div class="col-12">
                            <label class="form-label fw-bold">Enabled</label>
                            <select name="enabled" class="form-select form-select-lg">
                                <option value="1" <?php echo e($option->enabled ? 'selected':''); ?>>Enabled</option>
                                <option value="0" <?php echo e(!$option->enabled ? 'selected':''); ?>>Disabled</option>
                            </select>
                        </div>

                    </div>

                    <hr class="my-5">

                    <div class="d-flex justify-content-between">
                        <a href="<?php echo e(route('paymentoption.index')); ?>" class="btn btn-light btn-lg px-5">
                            Cancel
                        </a>
                        <button type="submit" class="btn btn-primary btn-lg px-5">
                            Save Changes
                        </button>
                    </div>

                </form>

            </div>
        </div>

    </div>
</div>


<script>
document.getElementById("gateway").addEventListener("change", function () {
    let value = this.value;

    document.getElementById("razorpay_fields").classList.add("d-none");
    document.getElementById("stripe_fields").classList.add("d-none");
    document.getElementById("paypal_fields").classList.add("d-none");

    if (value === "razorpay") document.getElementById("razorpay_fields").classList.remove("d-none");
    if (value === "stripe") document.getElementById("stripe_fields").classList.remove("d-none");
    if (value === "paypal") document.getElementById("paypal_fields").classList.remove("d-none");
});
</script>

<?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/paymentoption/editpaymentoption.blade.php ENDPATH**/ ?>