<?php $__env->startSection('content'); ?>
    <?php
        $userDate = session()->get('users_date');
    ?>
    <section class="section">
        <div class="container">
            <div class="row g-4 justify-content-center">
                <div class="col-lg-8">
                    <div class="room-details-head">
                        <div>
                            <h2 class="title"><?php echo e(__($roomType->name)); ?></h2>
                            <div class="d-flex justify-content-center flex-wrap gap-3">
                                <span>
                                    <?php echo app('translator')->get('Adult'); ?> &nbsp; <?php echo e($roomType->total_adult); ?>

                                </span>

                                <span>
                                    <?php echo app('translator')->get('Child'); ?> &nbsp; <?php echo e($roomType->total_child); ?>

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

                        <div>
                            <h2 class="text--base fare"><?php echo e(showAmount($roomType->fare)); ?></h2>
                            <span class="text--small">+<?php echo e(gs()->tax); ?>% <?php echo e(__(gs()->tax_name)); ?></span>
                            <span class="text--base text-sm"> / <?php echo app('translator')->get('Night'); ?></span>
                        </div>
                    </div>

                    <div class="room-details-thumb-slider">
                        <?php $__currentLoopData = $roomType->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $roomTypeImage): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div class="single-slide">
                                <div class="room-details-thumb">
                                    <img alt="image" src="<?php echo e(getImage(getFilePath('roomTypeImage') . '/' . $roomTypeImage->image, getFileSize('roomTypeImage'))); ?>">
                                </div>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    </div>

                    <?php if($roomType->images->count() > 1): ?>
                        <div class="room-details-nav-slider mt-4">
                            <?php $__currentLoopData = $roomType->images; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $roomTypeImage): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <div class="single-slide">
                                    <div class="room-details-nav-thumb">
                                        <img alt="image" src="<?php echo e(getImage(getFilePath('roomTypeImage') . '/' . $roomTypeImage->image, getFileSize('roomTypeImage'))); ?>">
                                    </div>
                                </div>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </div>
                    <?php endif; ?>

                    <div class="room-details-card mt-4">
                        <h5 class="title"><?php echo app('translator')->get('Description'); ?></h5>
                        <div class="body"> <?php echo $roomType->description;?> </div>
                    </div>

                    <div class="room-details-card mt-4">
                        <h5 class="title"><?php echo app('translator')->get('Check-In Time & Checkout Time'); ?></h5>

                        <div class="body">
                            <div class="d-inline-flex flex-md-row flex-column gap-md-5 flex-wrap gap-3">
                                <span class="me-2">
                                    <i class="las la-door-closed"></i> <?php echo app('translator')->get('Check-In'); ?>:
                                    <?php echo e(showDateTime(gs()->checkin_time, 'H:i A')); ?>

                                </span>
                                <span class="me-2">
                                    <i class="las la-door-open"></i> <?php echo app('translator')->get('Checkout'); ?>:
                                    <?php echo e(showDateTime(gs()->checkout_time, 'H:i A')); ?>

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

                    <div class="room-details-card mt-4">
                        <h5 class="title"><?php echo app('translator')->get('Cancellation Policy'); ?></h5>

                        <div class="body">
                            <?php if($roomType->cancellation_fee == 0): ?>
                                <span> <i class="las la-check-double"></i> <?php echo app('translator')->get('Free Cancellation'); ?></span>
                            <?php else: ?>
                                <h5 class="text-center"><?php echo app('translator')->get('Cancellation Fee'); ?> <?php echo e(showAmount($roomType->cancellation_fee)); ?> / <?php echo app('translator')->get('Night'); ?></h5>
                            <?php endif; ?>

                            <div class="mt-2"><?php echo $roomType->cancellation_policy; ?></div>
                        </div>
                    </div>

                    <?php if($roomType->amenities->count()): ?>
                        <div class="room-details-card mt-4">
                            <h5 class="title"><?php echo app('translator')->get('Amenities'); ?></h5>

                            <div class="body">
                                <div class="d-inline-flex flex-md-row flex-column gap-md-5 flex-wrap gap-3">
                                    <?php $__currentLoopData = $roomType->amenities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $amenity): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <span class="me-2">
                                            <?php echo $amenity->icon ?>
                                            <?php echo e(__($amenity->title)); ?>

                                        </span>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if($roomType->facilities->count()): ?>
                        <div class="room-details-card mt-4">
                            <h5 class="title"><?php echo app('translator')->get('Facilities'); ?></h5>
                            <div class="body">
                                <div class="d-inline-flex flex-md-row flex-column gap-md-5 flex-wrap gap-3">
                                    <?php $__currentLoopData = $roomType->facilities; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $facility): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <span class="me-2">
                                            <?php echo $facility->icon ?>
                                            <?php echo e(__($facility->title)); ?>

                                        </span>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <?php if($roomType->beds): ?>
                        <div class="room-details-card mt-4">
                            <h5 class="title"><?php echo app('translator')->get('Beds'); ?></h5>
                            <div class="body">
                                <div class="d-inline-flex flex-md-row flex-column gap-md-5 flex-wrap gap-3">
                                    <?php $__currentLoopData = $roomType->beds; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $bed): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <span class="me-2"><i class="las la-check-double"></i> <?php echo e(__($bed)); ?></span>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>
                </div>

                <div class="col-lg-4">
                    <input form="confirmation-form" hidden name="room_type_id" type="text" value="<?php echo e($roomType->id); ?>">
                    <div class="room-booking-sidebar">
                        <div class="room-booking-widget">
                            <div class="room-booking-widget__body mt-0">
                                <div class="mb-3">
                                    <label class="fw-bold"><?php echo app('translator')->get('Check-In'); ?></label>
                                    <div class="custom-icon-field">
                                        <input autocomplete="off" class="check-in-date form--control" data-date-format="mm/dd/yyyy" data-language="en" data-multiple-dates-separator=" - " data-position='top left' data-range="false" form="confirmation-form" name="check_in" placeholder="<?php echo app('translator')->get('Month/Date/Year'); ?>" type="text">
                                        <i class="fas fa-calendar-alt"></i>
                                    </div>
                                </div>

                                <div class="mb-3">
                                    <label class="fw-bold"><?php echo app('translator')->get('Check-Out'); ?></label>
                                    <div class="custom-icon-field">
                                        <input autocomplete="off" class="check-out-date form--control" data-date-format="mm/dd/yyyy" data-language="en" data-multiple-dates-separator=" - " data-position='top left' data-range="false" form="confirmation-form" name="check_out" placeholder="<?php echo app('translator')->get('Month/Date/Year'); ?>" type="text">
                                        <i class="fas fa-calendar-alt"></i>
                                    </div>
                                    <div class="bookingLimitationMsg text--warning"></div>
                                </div>

                                <div class="mb-3">
                                    <label class="fw-bold"><?php echo app('translator')->get('Rooms'); ?></label>
                                    <input class="form--control" form="confirmation-form" name="number_of_rooms" placeholder="<?php echo app('translator')->get('Number of Rooms'); ?>" required type="number">
                                </div>

                                <div class="room-booking-widget__body">
                                    <ul class="room-booking-widget-list"></ul>
                                    <button class="btn btn--base w-100 confirmationBtn booking" data-action="<?php echo e(route('request.booking')); ?>" data-question="<?php echo app('translator')->get('Are your sure, you want to book this room?'); ?>" type="button"><?php echo app('translator')->get('SEND BOOKING REQUEST'); ?></button>
                                </div>

                            </div><!-- room-booking-widget end -->
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- room details section end -->
    <?php if (isset($component)) { $__componentOriginalbd5922df145d522b37bf664b524be380 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginalbd5922df145d522b37bf664b524be380 = $attributes; } ?>
<?php $component = App\View\Components\ConfirmationModal::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? $attributes->all() : [])); ?>
<?php $component->withName('confirmation-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag): ?>
<?php $attributes = $attributes->except(\App\View\Components\ConfirmationModal::ignoredParameterNames()); ?>
<?php endif; ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $attributes = $__attributesOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__attributesOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalbd5922df145d522b37bf664b524be380)): ?>
<?php $component = $__componentOriginalbd5922df145d522b37bf664b524be380; ?>
<?php unset($__componentOriginalbd5922df145d522b37bf664b524be380); ?>
<?php endif; ?>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('style'); ?>
    <style>
        #confirmationModal button {
            padding: 0.375rem 0.625rem;
            font-size: 0.875rem;
        }
    </style>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script-lib'); ?>
    <script src="<?php echo e(asset($activeTemplateTrue . 'js/datepicker.min.js')); ?>"></script>
    <script src="<?php echo e(asset($activeTemplateTrue . 'js/datepicker.en.js')); ?>"></script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('script'); ?>
    <script>
        (function($) {
            "use strict";
            let maxRoomBookingLimit = 0;
            let btnRequest = $('.confirmationBtn');
            btnRequest.attr('disabled', true);

            $('.booking').on('click', function() {
                let minCheckIn = $('[name=check_in]').val();
                let maxCheckOut = $('[name=check_out]').val();
                console.log(minCheckIn >= maxCheckOut);
                if (minCheckIn >= maxCheckOut) {
                    notify('error', 'Check in date must be grater than check out date!')
                    $(this).removeClass('confirmationBtn');
                } else {
                    $(this).addClass('confirmationBtn');
                }
            })


            var datepicker1 = $('.check-in-date').datepicker({
                autoClose: true
            });
            var datepicker2 = $('.check-out-date').datepicker({
                autoClose: true
            });

            <?php if(isset($userDate)): ?>
                var checkIn = <?php echo json_encode($userDate['checkin'], 15, 512) ?>;
                var checkout = <?php echo json_encode($userDate['check_out'], 15, 512) ?>;
                datepicker1.data('datepicker').selectDate(new Date(checkIn));
                datepicker2.data('datepicker').selectDate(new Date(checkout));
                getAvaliableRooms();
            <?php endif; ?>

            $('.check-in-date, .check-out-date').on('focusout', function(e) {
                e.preventDefault();
                getAvaliableRooms();
            });

            function getAvaliableRooms() {
                let data = {};

                data.check_in = $('input[name=check_in]').val();
                data.check_out = $('input[name=check_out]').val();
                data.room_type_id = $('input[name=room_type_id]').val();

                $('[name=number_of_rooms]').val('');

                if (!data.check_in || !data.check_out) {
                    return;
                }

                $.ajax({
                    type: "get",
                    url: "<?php echo e(route('room.available.search')); ?>",
                    data: data,
                    success: function(response) {
                        let messageBox = $('.bookingLimitationMsg');
                        if (response.success) {
                            maxRoomBookingLimit = response.success;
                            messageBox.text(`<?php echo app('translator')->get('You can book maximum ${response.success} rooms'); ?>`);
                            btnRequest.removeAttr('disabled');
                        } else {
                            notify('error', response.error);
                            messageBox.empty();
                            btnRequest.attr('disabled', true);
                        }
                    }
                });
            }

            $('[name=number_of_rooms]').on('input', function() {
                $('.confirmationBtn').attr('disabled', false);
                if ($(this).val() > maxRoomBookingLimit) {
                    btnRequest.attr('disabled', true);
                    notify('error', "Number of rooms can't be greater than maximum allowed room");
                }
            });

            $('.form--control').on('keypress', function(e) {
                if (e.keyCode == 13) {
                    e.preventDefault();
                    btnRequest.click();
                }
            })
        })(jQuery);
    </script>
<?php $__env->stopPush(); ?>

<?php $__env->startPush('style'); ?>
    <style>
        .main-wrapper {
            background-color: #fafafa
        }
    </style>
<?php $__env->stopPush(); ?>

<?php echo $__env->make($activeTemplate . 'layouts.frontend', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/ryanupiz/pan.ryangroups.com/hotel/viserhotel/Files/core/resources/views/templates/basic/room/details.blade.php ENDPATH**/ ?>