<?php
/**
 * The template for displaying related room in single room page.
 *
 * This template can be overridden by copying it to yourtheme/wp-hotel-booking/single-room/related-room.php.
 *
 * @author  ThimPress, leehld
 * @package WP-Hotel-Booking/Templates
 * @version 1.6
 */

/**
 * Prevent loading this file directly
 */
defined('ABSPATH') || exit();

$room    = WPHB_Room::instance(get_the_ID());
$related = $room->get_related_rooms();

global $hb_settings;

/**
 * @var $related WP_Query
 */
?>

<?php if ($related->posts ) { ?>
    <div class="hb_related_other_room has_slider">
        <div class="container">
            <h3 class="title"><?php _e('Other Rooms', 'hotel-26'); ?></h3>    

    <?php hotel_booking_room_loop_start(); ?>

    <?php
    while ( $related->have_posts() ) :
        $related->the_post();
        ?>
        <?php hb_get_template_part('content', 'room'); ?>
    <?php endwhile; ?>

    <?php hotel_booking_room_loop_end(); ?>
        </div>
    </div>

    <script type="text/javascript">
        (function ($) {
            "use strict";
            $(document).ready(function () {
                var thimpress_hotel_booking_carousel_related = $('.hb_related_other_room .rooms');
                thimpress_hotel_booking_carousel_related.owlCarousel({
                    nav: true,
                    dots: false,
                    rewind: true,
                    items: 1,
                    navSpeed: 600,
                    autoplaySpeed: 1000,
                    autoplay: true,
                    autoplayHoverPause: true,
                    margin: 30,
                    responsive: {
                    576: {
                        items: 2
                        },
                    992: {
                        items: 3
                        },
                    1200: {
                        items: 4
                        }
                    }
                });
            });
        })(jQuery);
    </script>
<?php } ?>