<?php
/**
 * Template part for displaying slider section
 *
 * @package Restaurant Eatery
 * @subpackage restaurant_eatery
 */

?>
<?php $restaurant_eatery_static_image = get_stylesheet_directory_uri() . '/assets/images/slider-img.png'; ?>
<?php if (get_theme_mod('restaurant_eatery_slider_arrows', false) != '') : ?>

<section id="slider">
    <div class="container">
        <div class="row">
            <div class="col-lg-6 col-md-12 align-self-center">
                <div class="banner-content">
                    <?php if (get_theme_mod('restaurant_eatery_slider_short_text') != '') { ?>
                        <span class="sub-title mb-2"><?php echo esc_html(get_theme_mod('restaurant_eatery_slider_short_text')); ?></span>
                    <?php } ?>
                    <?php if (get_theme_mod('restaurant_eatery_slider_top_heading') != '') { ?>
                        <h2><?php echo esc_html(get_theme_mod('restaurant_eatery_slider_top_heading')); ?></h2>
                    <?php } ?>
                    <?php if (get_theme_mod('restaurant_eatery_slider_top_para') != '') { ?>
                        <p class="content"><?php echo esc_html(get_theme_mod('restaurant_eatery_slider_top_para')); ?></p>
                    <?php } ?>
                    <div class="more-btn mt-4">
                        <?php 
                            // Get the button text and link from the theme settings.
                            $restaurant_eatery_btn_text1 = get_theme_mod('restaurant_eatery_btn_text1', __('More Services', 'restaurant-eatery'));
                            $restaurant_eatery_btn_link1 = get_theme_mod('restaurant_eatery_btn_link1', '');

                            // Fallback to the permalink if no link is provided.
                            $restaurant_eatery_button_link = !empty($restaurant_eatery_btn_link1) ? $restaurant_eatery_btn_link1 : get_permalink();

                            if (!empty($restaurant_eatery_btn_text1)) { ?>
                                <a href="<?php echo esc_url($restaurant_eatery_button_link); ?>" target="_blank" class="text-capitalize me-2 mb-3 slider-btn1"><?php echo esc_html($restaurant_eatery_btn_text1); ?><i class="fas fa-arrow-right ms-3"></i><span class="screen-reader-text"><?php echo esc_html($restaurant_eatery_btn_text1); ?></span></a>
                        <?php } ?>
                    </div>
                </div>
            </div>
            <div class="col-lg-6 col-md-12 align-self-center">
                <div class="restaurant-box">
                    <div class="server-col">
                        <div class="row">
                            <div class="col-xl-3 col-lg-4 col-md-4 align-self-center">
                                <?php if (get_theme_mod('restaurant_eatery_slider_server_head') != '') { ?>
                                    <h4 class="mb-0"><?php echo esc_html(get_theme_mod('restaurant_eatery_slider_server_head')); ?></h4>
                                <?php } ?>
                            </div>
                            <div class="col-xl-9 col-lg-8 col-md-8 align-self-center">
                                <div class="gallery-users my-2">
                                    <?php
                                    $default_image = get_template_directory_uri() . '/assets/images/user-img.png';

                                    for ( $restaurant_eatery_i = 1; $restaurant_eatery_i <= 5; $restaurant_eatery_i++ ) :

                                        $restaurant_eatery_image = get_theme_mod( 'restaurant_eatery_gallery_image_' . $restaurant_eatery_i );
                                        $restaurant_eatery_image_src = ! empty( $restaurant_eatery_image ) ? $restaurant_eatery_image : $default_image;
                                        ?>
                                            <img src="<?php echo esc_url( $restaurant_eatery_image_src ); ?>" alt="Server Image">
                                        <?php
                                    endfor;
                                    ?>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="rest-title">
                        <div class="row">
                            <div class="col-lg-6 col-md-6">
                                <?php
                                  $restaurant_eatery_slider_restaurant_img = get_theme_mod('restaurant_eatery_slider_restaurant_img');
                                  $restaurant_eatery_slider_default_img2 = get_template_directory_uri() . '/assets/images/slider-top-img.png'; 
                                ?>
                                <div class="slider-map2 <?php echo empty($restaurant_eatery_slider_restaurant_img) ? 'no-image1' : ''; ?>">
                                  <?php if (!empty($restaurant_eatery_slider_restaurant_img)) : ?>
                                    <img src="<?php echo esc_url($restaurant_eatery_slider_restaurant_img); ?>" alt="<?php esc_attr_e('Restaurant Image', 'restaurant-eatery'); ?>" />
                                  <?php endif; ?>
                                </div>
                                <?php if (get_theme_mod('restaurant_eatery_slider_restaurant_title') != '') { ?>
                                    <h3><?php echo esc_html(get_theme_mod('restaurant_eatery_slider_restaurant_title')); ?></h3>
                                <?php } ?>
                            </div>
                            <div class="col-lg-6 col-md-6">
                                <div class="slider-img">
                                    <div id="owl-carousel" class="owl-carousel">
                                        <?php
                                        $restaurant_eatery_default_slider_image = get_template_directory_uri() . '/assets/images/slider-img.png';

                                        for ( $restaurant_eatery_i = 1; $restaurant_eatery_i <= 3; $restaurant_eatery_i++ ) :

                                            $restaurant_eatery_image = get_theme_mod( 'restaurant_eatery_slider_dishes_image_' . $restaurant_eatery_i );
                                            $restaurant_eatery_image_src = ! empty( $restaurant_eatery_image ) ? $restaurant_eatery_image : $restaurant_eatery_default_slider_image;
                                            ?>
                                            <div class="item">
                                                <img src="<?php echo esc_url( $restaurant_eatery_image_src ); ?>" alt="Slider Image">
                                            </div>
                                            <?php
                                        endfor;
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="black-img">
                    <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/assets/images/black-img.png" alt="Black Icon Image">
                </div>
            </div>
        </div>
    </div>
</section>
<div class="slider-svg">
    <svg viewBox="0 0 1200 114" fill="none" xmlns="http://www.w3.org/2000/svg">
        <path d="M986.93 73.4059C1063.47 34.1657 1180.63 70.9065 1200 88.402V0H0V59.6595C49.9321 -32.8164 192.762 17.3788 253.996 53.4111C309.607 89.0268 408.956 139.951 516.428 97.4621C587.659 58.0782 680.135 61.534 761.364 86.215C814.475 101.211 895.079 126.205 986.93 73.4059Z" fill="var(--color-primary1)"/>
    </svg>
</div>
<?php endif; ?>
