<link rel="stylesheet" href="<?php echo e(asset('public/assets/css/apply.css')); ?>">

<?php $__env->startSection('content'); ?>
<section class="login">
    <div class="login_box" style="width: 600px;">

        <div class="left" style="width: 600px;">
            <div class="contact">
                <div class="">
                    <h1 style="text-align: center; text-decoration: underline;">Apply Now</h1>

                    <div class="">
                        <label for="order_document" style="font-size: 20px;">Order Document</label>
                        <p>Order for Academic Document and have it delivered to you at your convient place of choice.
                        </p>
                        <center><a class="btn btn-success text-white" style="background-color: #1cc88a;" href="<?php echo route('verification-page'); ?>">Order now</a></center> 
                    </div>

                    <div class="form-group " style="margin-top: 40px;">
                        <label for="order_document" style="font-size: 20px;">Check Document Status</label>
                        <p>Check the status of your academic document.</p>
                        
                        <center>
                        <a class="btn btn-success text-white" style="background-color: #064bba;" href="<?php echo route('track-document'); ?>">Check now</a>
                        </center>
                    </div>
                    <center>
                    <a class="submit" class="text-white;" style="text-align: center; color: #fff; background-color: #6c757d; border-color: #6c757d;"
                        href="<?php echo route('payment-options'); ?>">Make Payment For Document</a>
                    </center>
                    
                </div>
            </div>
        </div>


        <div class="modal fade" id="verify_transaction_id_modal" tabindex="-1" role="dialog"
            aria-labelledby="addDesignationModalLabel" aria-hidden="true" style="z-index: 1000">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="addDesignationModalLabel">Enter Info</h5>

                        <button type="button" class="btn btn-sm bg-danger text-white" class="close" data-dismiss="modal"
                            aria-label="Close">
                            <span aria-hidden="true" style="color: white;">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">

                        <div class="col-12">
                            <div class="form-group">
                                <label for="transaction_id">Transaction Id</label>
                                <input type="text" class="form-control" id="transaction_id" name="transaction_id" />
                            </div>
                        </div>

                        <div style="flex: 1;"></div>
                        <div class="d-flex align-items-center justify-content-end" style="">
                            <button class="btn bg-primary text-white" onclick="verifyApplicant()"><i
                                    class="fas fa-save mr-1"></i>Verify</button>
                        </div>
                    </div>

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

        <div class="modal fade" id="verify_index_number_modal" tabindex="-1" role="dialog"
            aria-labelledby="verifyIndexNumberModalLabel" aria-hidden="true" style="z-index: 1000">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="verifyIndexNumberModalLabel">Enter Info</h5>

                        <button type="button" class="btn btn-sm bg-danger text-white" class="close" data-dismiss="modal"
                            aria-label="Close">
                            <span aria-hidden="true" style="color: white;">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">

                        <div class="col-12">
                            <div class="form-group">
                                <label for="index_number">Index Number</label>
                                <input type="text" class="form-control" id="index_number" name="index_number" />
                            </div>
                        </div>

                        <div style="flex: 1;"></div>
                        <div class="d-flex align-items-center justify-content-end" style="">
                            <button class="btn bg-primary text-white" onclick="verifyIndexNumber()"><i
                                    class="fas fa-save mr-1"></i>Verify</button>
                        </div>
                    </div>

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

        <div class="modal fade" id="verified_student_info_modal" tabindex="-1" role="dialog"
            aria-labelledby="verifiedStudentInfoModal" aria-hidden="true" style="z-index: 1000">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="verifiedStudentInfoModal">Student Information</h5>

                        <button type="button" class="btn btn-sm bg-danger text-white" class="close" data-dismiss="modal"
                            aria-label="Close">
                            <span aria-hidden="true" style="color: white;">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">

                       
                        <div style="flex: 1;"></div>
                        <div class="d-flex align-items-center justify-content-end" style="">
                            <button class="btn bg-primary text-white" onclick="verifyIndexNumber()"><i
                                    class="fas fa-save mr-1"></i>Verify</button>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>

<script>
function showVerifyPage() {
    $('#verify_transaction_id_modal').modal('show');
}

function verifyApplicant() {
    let transaction_id = document.getElementById('transaction_id').value;
    const csrfToken = document.head.querySelector("[name~=csrf-token][content]").content;
    let postData = {
        transaction_id: transaction_id,
        _token: csrfToken
    }

    Swal.fire({
        title: 'Info',
        text: 'Do you want to verify',
        icon: 'question',
        confirmButtonText: 'Yes',
        showCancelButton: true,
        cancelButtonText: 'No',
        confirmButtonColor: '#1cc88a',
        cancelButtonColor: '#d33',

    }).then((result) => {
        /* Read more about isConfirmed, isDenied below */
        if (result.isConfirmed) {
            $.ajax({
                url: `<?php echo e(url('/verify-transaction-id')); ?>`,
                method: 'POST',
                data: postData,
                success: function(result_) {
                    document.getElementById('transaction_id').value = "";
                    if (result_['code']) {
                        if (result_['code'] == 'R0122') {
                            Swal.fire({
                                title: 'Info',
                                text: result_['msg'],
                                icon: result_,
                                confirmButtonText: 'Okay',
                                confirmButtonColor: '#1cc88a'

                            })
                        }
                    } else {
                        $('#verify_index_number_modal').modal('show');
                    }
                }
            });

        } else if (result.isDenied) {
            Swal.fire('Changes are not saved', '', 'info')
        }

    })
}

function verifyIndexNumber() {
    let index_number = document.getElementById('index_number').value;
    const csrfToken = document.head.querySelector("[name~=csrf-token][content]").content;
    let postData = {
        index_number: index_number,
        _token: csrfToken
    }
    console.log(postData);

    $.ajax({
        url: `<?php echo e(url('/verify-index-number')); ?>`,
        method: 'POST',
        data: postData,
        success: function(result_) {
            console.log(result_);
            document.getElementById('index_number').value = "";
            if (result_['code']) {
                if (result_['code'] == 'R0122') {
                    Swal.fire({
                        title: 'Info',
                        text: result_['msg'],
                        icon: result_,
                        confirmButtonText: 'Okay',
                        confirmButtonColor: '#1cc88a'

                    })
                }
            } else {
                if (result_['success'] == 'true') {

                }
            }
        }
    });
}
</script>
<?php echo $__env->make('master_content', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>