

<?php $__env->startSection('css'); ?>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.13.2/themes/base/jquery-ui.min.css"
          integrity="sha512-ELV+xyi8IhEApPS/pSj66+Jiw+sOT1Mqkzlh8ExXihe4zfqbWkxPRi8wptXIO9g73FSlhmquFlUOuMSoXz5IRw=="
          crossorigin="anonymous" referrerpolicy="no-referrer" />
    <link rel="stylesheet" href="<?php echo e(asset('assets/web/css/book_now.css')); ?>">
    <!-- ----- new style ----- -->
    <!--    <style>-->

    <!--    </style>-->
<?php $__env->stopSection(); ?>


<?php $__env->startSection('content'); ?>
    <section class="hotel_request section-padding bg-light">
        <div class="container">
            <div class="hotel_request_form">
                <div class="form_title">
                    <h3> <?php echo e(__('bookings.other_info')); ?> </h3>
                    <div class="steps">
                        <span class="active"></span>
                        <span class="active"></span>
                        <span class="active"></span>
                        <span class="active"></span>
                    </div>
                </div>
                <form action="<?php echo e(route('checkStep_4')); ?>" method="post" class="add_form">
                    <?php echo csrf_field(); ?>
                    <div class="form_body">
                        <div class="row">
                            <div class="col-lg-6">
                                <?php if(count($quoteCategoriesWithSubCats)): ?>
                                    <?php $__currentLoopData = $quoteCategoriesWithSubCats; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $quoteCatName => $quoteCategoriesWithSubCat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <div class="form-group mt-4">
                                        <h5> <?php echo e($quoteCatName); ?> : </h5>
                                        <?php $__currentLoopData = $quoteCategoriesWithSubCat; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $quoteSubCat): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <div class="checks mt-3">
                                            <div class="custom-control custom-checkbox custom-control-inline">
                                                <input type="checkbox" class="custom-control-input" id="other<?php echo e($quoteSubCat->quote_sub_cat_id); ?>" name="quote_sub_categories[]" value="<?php echo e($quoteSubCat->quote_sub_cat_id); ?>" data-cat="<?php echo e($quoteSubCat->quote_cat_id); ?>">
                                                <label class="custom-control-label" for="other<?php echo e($quoteSubCat->quote_sub_cat_id); ?>"><?php echo e($quoteSubCat->quoteSubCatName); ?></label>
                                            </div>
                                        </div>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>






                            </div>
                            <div class="col-12">
                                <div class="form-group">
                                    <label for=""> <?php echo e(__('bookings.notes')); ?> : </label>
                                    <textarea name="notes" class="form-control" placeholder="..." rows="6"></textarea>
                                </div>
                                <div class="form-group mt-3">
                                    <div class="col-sm-offset-3 col-sm-9">
                                        <div class="g-recaptcha" data-sitekey="<?php echo e(env('GOOGLE_RECAPTCHA_KEY')); ?>"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- ----- -->
                        <div class="text-center">
                            <button class="butn color my-4 rounded-lg py-3 px-5 w-25 add_button">
                                <span> <i class="fas fa-paper-plane mr-2"></i> <?php echo e(__('main.send')); ?> </span>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('inner_js'); ?>
    <script src="https://www.google.com/recaptcha/api.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>

    <script>

        let services = [];


        $('.add_button').click(async function (e) {
            e.preventDefault();
            $(this).prop('disabled', true);

            let quoteCat = [],
                quoteCatWithSub = [];


            $('input[type="checkbox"]:checked').each(function () {
                quoteCat.push($(this).data('cat'));
                quoteCatWithSub.push([$(this).data('cat'), parseInt($(this).val())]);
            });


            // let quoteCatIds = quoteCat.filter(function (value, index) {
            //     return quoteCat.indexOf(value) === index;
            // });


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

            data.append('quote_categories', quoteCat);
            data.append('cats_with_sub', JSON.stringify(quoteCatWithSub));


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


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

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

            }

        });

    </script>

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

<?php echo $__env->make('web.layouts.container', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nesmaalyomhost/public_html/mawada/resources/views/web/bookings/step_4.blade.php ENDPATH**/ ?>