<?php $__env->startSection('content'); ?>
    <section class="jobs-det section bg-babyBlue">
        <div class="container">
            <div class="row mt-5">
                <div class="col-lg-7">
                    <div class="text-content wow left_to_right_apperance">
                        <h1 class="title fw-bold color-dark mb-3"><?php echo e($careerDetails->name); ?></h1>
                        <h5 class="categ color-primary mb-3"><?php echo e($specializationName); ?></h5>
                        <p class="date mb-4"><i class="fa-regular fa-calendar me-2 color-dark opacity-50"></i><?php echo e(date('d M Y', strtotime($career->created_at))); ?></p>
                        <p class="det"><?php echo e($careerDetails->description); ?></p>
                    </div>
                    <div class="box wow left_to_right_apperance">
                        <form class="add_form" action="<?php echo e($action); ?>" method="post" enctype="multipart/form-data">
                            <?php echo csrf_field(); ?>
                            <div class="row">
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.name')); ?></label>
                                        <input name="name" class="form-control" placeholder="e.g. John" type="text"/>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.phone')); ?></label>
                                        <input name="phone" class="form-control" placeholder="e.g. +966- - 854 000 0000" type="text"/>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.country_id')); ?></label>
                                        <select name="country_id" class="form-control form-select">
                                            <?php if(count($countries)): ?>
                                                <?php $__currentLoopData = $countries; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $country): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($country->id); ?>"><?php echo e($country->name); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.address')); ?></label>
                                        <input name="address" class="form-control" placeholder="st name , city" type="text"/>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.birth_date')); ?></label>
                                        <input name="birth_date" class="form-control" placeholder="e.g. 24 Apr 2020" type="date"/>
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.education_id')); ?></label>
                                        <select name="education_id" class="form-control form-select">
                                            <?php if(count($educations)): ?>
                                                <?php $__currentLoopData = $educations; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $education): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <option value="<?php echo e($education->id); ?>"><?php echo e($education->name); ?></option>
                                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            <?php endif; ?>
                                        </select>
                                    </div>
                                </div>












                                <div class="col-lg-12">
                                    <div class="form-group">
                                        <label class="label"><?php echo e(__('careerApplications.cv')); ?></label>
                                        <div class="uploading_box">
                                            <div class="input-group">
                                                    <span class="input-group-btn">
                                                      <div class="btn btn-default browse-button">
                                                          <span class="browse-button-text">
                                                          <i class="fa fa-folder-open"></i> <?php echo e(__('careerApplications.browse')); ?></span>
                                                          <input type="file" accept=".pdf" name="cv"/>
                                                      </div>
                                                      <button type="button" class="btn btn-default clear-button" style="display:none;">
                                                        <span class="fa fa-times"></span> <?php echo e(__('careerApplications.clear')); ?>

                                                      </button>
                                                    </span>
                                                <input type="text" class="form-control filename" disabled="disabled" placeholder="<?php echo e(__('careerApplications.upload_cv_placeholder')); ?>">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-lg-3 mt-5 m-auto">
                                    <button class="butn primary_butn w-100 add_button">
                                        <b><?php echo e(__('careerApplications.apply')); ?></b>
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="col-lg-5">
                    <div class="img-box">
                        <img src="<?php echo e(asset($career->image)); ?>" alt="" class="sec-img zi-5 wow left_to_right_apperance"/>
                    </div>
                </div>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>

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

        $('.add_button').click(async function (e) {
            e.preventDefault();

            $(this).prop('disabled', true);

            let form = $('.add_form'),
                data = new FormData(form[0]),
                url = form.attr('action'),
                method = form.attr('method');

            const response=await ajax({
                url,
                data,
                dataType: 'json',
                method
            });

            if (response.errors){
                $(this).prop('disabled', false);
                toasterError(response.errors);
            }

            if (response.message){
                toasterSuccess(response.message);
                setTimeout(function () {
                    window.location.reload();
                }, 200);
            }

        });


    </script>

    <script>
        // Show filename, show clear button and change browse
        //button text when a valid extension file is selected

        let change = "<?php echo e(__('careerApplications.change')); ?>";

        $(".browse-button input:file").change(function (){
            $("input[name='cv']").each(function() {
                var fileName = $(this).val().split('/').pop().split('\\').pop();
                $(".filename").val(fileName);
                $(".browse-button-text").html(`<i class="fa fa-refresh"></i> ${change}`);
                $(".clear-button").show();
            });
        });

        //actions happening when the button is clicked
        $('.clear-button').click(function(){
            $('.filename').val("");
            $('.clear-button').hide();
            $('.browse-button input:file').val("");
            $(".browse-button-text").html('<i class="fa fa-folder-open"></i> Browse');
        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('web.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\wamp64\www\procare\resources\views/web/careers/career_form.blade.php ENDPATH**/ ?>