

<?php $__env->startSection('content'); ?>
<main class="container">
    <div class="row justify-content-center">
        <div class="col-lg-6">
            <div class="card shadow">
                <div class="card-body">
                    <h2 class="card-title text-center mb-4">Payment Form</h2>
                    <form action="<?php echo e(route('payment.process')); ?>" method="POST" id="paymentForm">
                        <?php echo csrf_field(); ?>
                        <!-- Hidden input fields for sponsor and student IDs -->
                        <!-- <input type="hidden" id="sponsorId" name="sponsor_id">
                        <input type="hidden" id="studentId" name="student_id"> -->
                        
                        <!-- Sponsor Details Section -->
                        <fieldset>
                            <legend class="fw-bold">Sponsor Details</legend>
                            <div class="mb-3">
                                <label for="sponsor" class="form-label">Select Sponsor:</label>
                                <select class="form-select" name="sponsor" id="sponsor">
                                    <option value="" selected disabled>Select Sponsor</option>
                                    <?php $__currentLoopData = $sponsors; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sponsor): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($sponsor->id); ?>" data-email="<?php echo e($sponsor->email); ?>" data-phone="<?php echo e($sponsor->phone); ?>" data-pan="<?php echo e($sponsor->pan); ?>"><?php echo e($sponsor->fullName); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="email" class="form-label">Email:</label>
                                <input type="text" class="form-control" id="email" name="email" readonly>
                            </div>
                            <div class="mb-3">
                                <label for="phone" class="form-label">Phone:</label>
                                <input type="text" class="form-control" id="phone" name="phone" readonly>
                            </div>
                            <div class="mb-3">
                                <label for="pan" class="form-label">PAN:</label>
                                <input type="text" class="form-control" id="pan" name="pan" readonly>
                            </div>
                        </fieldset>

                        <!-- Student Details Section -->
                        <fieldset>
                            <legend class="fw-bold">Student Details</legend>
                            <div class="mb-3">
                                <label for="student" class="form-label">Select Student:</label>
                                <select class="form-select" name="student" id="student">
                                    <option value="" selected disabled>Select Student</option>
                                    <?php $__currentLoopData = $students; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $student): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($student->id); ?>" data-age="<?php echo e($student->student_age); ?>" data-dob="<?php echo e($student->date_of_birth); ?>" data-gender="<?php echo e($student->gender); ?>"><?php echo e($student->student_name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="age" class="form-label">Age:</label>
                                <input type="text" class="form-control" id="age" name="age" readonly>
                            </div>
                            <div class="mb-3">
                                <label for="dob" class="form-label">Date of Birth:</label>
                                <input type="text" class="form-control" id="dob" name="dob" readonly>
                            </div>
                            <div class="mb-3">
                                <label for="gender" class="form-label">Gender:</label>
                                <input type="text" class="form-control" id="gender" name="gender" readonly>
                            </div>
                        </fieldset>

                        <!-- Payment Method Section -->
                        <fieldset>
                            <legend class="fw-bold">Payment Method</legend>
                            <div class="mb-3">
                                <label for="method" class="form-label">Payment Method:</label>
                                <select class="form-select" name="method" id="method">
                                    <option value="credit_card">Credit Card</option>
                                    <option value="paypal">PayPal</option>
                                    <!-- Add more payment methods if needed -->
                                </select>
                            </div>
                            <div class="mb-3">
                                <label for="amount" class="form-label">Amount:</label>
                                <input type="text" class="form-control" id="amount" name="amount" required>
                            </div>
                        </fieldset>

                        <div class="text-center">
                            <button type="submit" class="btn btn-primary btn-lg">Pay Now</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <?php $__env->startPush('scripts'); ?>
     <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>

    <!-- Custom JavaScript -->
    <script>
    document.addEventListener("DOMContentLoaded", function() {
        // Get references to form elements
        const sponsorSelect = document.getElementById("sponsor");
        const emailInput = document.getElementById("email");
        const phoneInput = document.getElementById("phone");
        const panInput = document.getElementById("pan");
        const sponsorIdInput = document.getElementById("sponsorId");

        const studentSelect = document.getElementById("student");
        const ageInput = document.getElementById("age");
        const dobInput = document.getElementById("dob");
        const genderInput = document.getElementById("gender");
        const studentIdInput = document.getElementById("studentId");

        // Update sponsor details on sponsor selection change
        sponsorSelect.addEventListener("change", function() {
            const selectedSponsor = sponsorSelect.options[sponsorSelect.selectedIndex];
            emailInput.value = selectedSponsor.getAttribute("data-email");
            phoneInput.value = selectedSponsor.getAttribute("data-phone");
            panInput.value = selectedSponsor.getAttribute("data-pan");
            sponsorIdInput.value = selectedSponsor.value; // Update hidden input with sponsor ID
        });

        // Update student details on student selection change
        studentSelect.addEventListener("change", function() {
            const selectedStudent = studentSelect.options[studentSelect.selectedIndex];
            ageInput.value = selectedStudent.getAttribute("data-age");
            dobInput.value = selectedStudent.getAttribute("data-dob");
            genderInput.value = selectedStudent.getAttribute("data-gender");
            studentIdInput.value = selectedStudent.value; // Update hidden input with student ID
        });
    });
</script>
    <?php $__env->stopPush(); ?>
</main>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.header', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\91638\VB150\VB150\resources\views/payment.blade.php ENDPATH**/ ?>