<?php

/**
 * Elementor daltech Case Studies Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.0
 */
class Daltech_Case_Studies extends \Elementor\Widget_Base
{

    /**
     * Get widget name.
     *
     * Retrieve Case Studies widget name.
     *
     * @since 1.0.0
     * @access public
     *
     * @return string Widget name.
     */
    public function get_name()
    {
        return 'daltech_case_studies';
    }

    /**
     * Get widget title.
     *
     * Retrieve Case Studies Nav Tab widget title.
     *
     * @since 1.0.0
     * @access public
     *
     * @return string Widget title.
     */
    public function get_title()
    {
        return esc_html__('Case Studies', 'daltech-core');
    }

    /**
     * Get widget icon.
     *
     * Retrieve Case Studies Nav Tab widget icon.
     *
     * @since 1.0.0
     * @access public
     *
     * @return string Widget icon.
     */
    public function get_icon()
    {
        return 'eicon-code';
    }

    /**
     * Get widget categories.
     *
     * Retrieve the list of categories the Case Studies Nav Tab widget belongs to.
     *
     * @since 1.0.0
     * @access public
     *
     * @return array Widget categories.
     */
    public function get_categories()
    {
        return ['daltech'];
    }

    // Add The Input For User
    protected function register_controls()
    {

        $this->start_controls_section(
            'daltech_Case Studies_style',
            [
                'label'        => esc_html__('Case Studies Style', 'daltech-core'),
                'tab'        => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'style',
            [
                'label'     => esc_html__('Case Studies Style', 'daltech-core'),
                'type'         => \Elementor\Controls_Manager::SELECT,
                'default'     => '1',
                'options'     => [
                    '1'      => esc_html__('Style One', 'daltech-core'),
                    '2'      => esc_html__('Style Two', 'daltech-core'),
                    '3'      => esc_html__('Style Three', 'daltech-core'),
                    '4'      => esc_html__('Style Four', 'daltech-core'),
                ],
            ]
        );


        $this->add_control(
            'section_title',
            [
                'label'         => esc_html__('Section Title', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('section title', 'daltech-core'),
                'default'         => esc_html__('Default Section Title', 'daltech-core'),
                'condition' => [
                    'style' => ['1', '2', '3']
                ]
            ]

        );

        $this->add_control(
            'section_subtitle',
            [
                'label'         => esc_html__('Section Subtitle', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('section subtitle', 'daltech-core'),
                'default'         => esc_html__('Default Section SubTitle', 'daltech-core'),
                'condition' => [
                    'style' => ['1', '2', '3']
                ]

            ]
        );

        $this->add_control(
            'section_summary',
            [
                'label'     => __('Section Summary', 'daltech-core'),
                'type'         => \Elementor\Controls_Manager::TEXTAREA,
                'rows'         => 2,
                'default'      => __('Default Section Summary', 'daltech-core'),
                'condition' => [
                    'style' => ['1']
                ]
            ]
        );

        $layout_one_case_studies_list = new \Elementor\Repeater();

        $layout_one_case_studies_list->add_control(
            'title_one',
            [
                'label'         => esc_html__('Title One', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('title one', 'daltech-core'),
                'default'         => esc_html__('Default Title One', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_one_case_studies_list->add_control(
            'subtitle_one',
            [
                'label'         => esc_html__('Sub-Title One', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('sub-title one', 'daltech-core'),
                'default'         => esc_html__('Default Sub-Title One', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_one_case_studies_list->add_control(
            'url_one',
            [
                'label'         => esc_html__('URL One', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::URL,
                'placeholder'     => esc_html__('https://your-link.com', 'daltech-core'),
                'show_external' => true,
                'default'         => [
                    'url'             => '#',
                    'is_external'     => true,
                    'nofollow'         => true,
                ],
            ]
        );

        $layout_one_case_studies_list->add_control(
            'image_one',
            [
                'label' => esc_html__('Image One', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $layout_one_case_studies_list->add_control(
            'title_two',
            [
                'label'         => esc_html__('Title TWo', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('title two', 'daltech-core'),
                'default'         => esc_html__('Default Title Two', 'daltech-core'),
                'label_block'     => true,
            ]
        );


        $layout_one_case_studies_list->add_control(
            'subtitle_two',
            [
                'label'         => esc_html__('Sub-Title Two', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('sub-title two', 'daltech-core'),
                'default'         => esc_html__('Default Sub-Title Two', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_one_case_studies_list->add_control(
            'url_two',
            [
                'label'         => esc_html__('URL Two', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::URL,
                'placeholder'     => esc_html__('https://your-link.com', 'daltech-core'),
                'show_external' => true,
                'default'         => [
                    'url'             => '#',
                    'is_external'     => true,
                    'nofollow'         => true,
                ],
            ]
        );

        $layout_one_case_studies_list->add_control(
            'image_two',
            [
                'label' => esc_html__('Image Two', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $this->add_control(
            'layout_one_case_studies_list',
            [
                'label'     => esc_html__('Case Studies', 'daltech-core'),
                'type'         => \Elementor\Controls_Manager::REPEATER,
                'fields'     => $layout_one_case_studies_list->get_controls(),
                'default'     => [
                    [
                        'list_title' => esc_html__('Add Case Studies', 'daltech-core'),
                    ],
                ],
                'title_field' => '{{{ title_one }}}',
                'prevent_empty' => false,
                'condition' => [
                    'style' => '1'
                ]
            ]
        );

        $layout_two_case_studies_list = new \Elementor\Repeater();

        $layout_two_case_studies_list->add_control(
            'title',
            [
                'label'         => esc_html__('Title', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('title', 'daltech-core'),
                'default'         => esc_html__('Default Title', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_two_case_studies_list->add_control(
            'subtitle',
            [
                'label'         => esc_html__('Sub-Title', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('sub-title', 'daltech-core'),
                'default'         => esc_html__('Default Sub-Title', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_two_case_studies_list->add_control(
            'url',
            [
                'label'         => esc_html__('URL', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::URL,
                'placeholder'     => esc_html__('https://your-link.com', 'daltech-core'),
                'show_external' => true,
                'default'         => [
                    'url'             => '#',
                    'is_external'     => true,
                    'nofollow'         => true,
                ],
            ]
        );

        $layout_two_case_studies_list->add_control(
            'image',
            [
                'label' => esc_html__('Image', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $this->add_control(
            'layout_two_case_studies_list',
            [
                'label'     => esc_html__('Case Studies', 'daltech-core'),
                'type'         => \Elementor\Controls_Manager::REPEATER,
                'fields'     => $layout_two_case_studies_list->get_controls(),
                'default'     => [
                    [
                        'list_title' => esc_html__('Add Case Studies', 'daltech-core'),
                    ],
                ],
                'title_field' => '{{{ title }}}',
                'prevent_empty' => false,
                'condition' => [
                    'style' => ['2', '3']
                ]
            ]
        );

        $layout_four_case_studies_list = new \Elementor\Repeater();

        $layout_four_case_studies_list->add_control(
            'title',
            [
                'label'         => esc_html__('Title', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('title', 'daltech-core'),
                'default'         => esc_html__('Default Title', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_four_case_studies_list->add_control(
            'subtitle',
            [
                'label'         => esc_html__('Sub-Title', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::TEXTAREA,
                'placeholder'     => esc_html__('sub-title', 'daltech-core'),
                'default'         => esc_html__('Default Sub-Title', 'daltech-core'),
                'label_block'     => true,
            ]
        );

        $layout_four_case_studies_list->add_control(
            'url',
            [
                'label'         => esc_html__('URL', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::URL,
                'placeholder'     => esc_html__('https://your-link.com', 'daltech-core'),
                'show_external' => true,
                'default'         => [
                    'url'             => '#',
                    'is_external'     => true,
                    'nofollow'         => true,
                ],
            ]
        );

        $layout_four_case_studies_list->add_control(
            'image',
            [
                'label' => esc_html__('Image', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $layout_four_case_studies_list->add_control(
            'shape',
            [
                'label' => esc_html__('Shape', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $layout_four_case_studies_list->add_control(
            'icon_image',
            [
                'label' => esc_html__('Icon Image', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ]
            ]
        );

        $this->add_control(
            'layout_four_case_studies_list',
            [
                'label'     => esc_html__('Case Studies', 'daltech-core'),
                'type'         => \Elementor\Controls_Manager::REPEATER,
                'fields'     => $layout_four_case_studies_list->get_controls(),
                'default'     => [
                    [
                        'list_title' => esc_html__('Add Case Studies', 'daltech-core'),
                    ],
                ],
                'title_field' => '{{{ title }}}',
                'prevent_empty' => false,
                'condition' => [
                    'style' => ['4']
                ]
            ]
        );

        $this->add_control(
            'bg_image',
            [
                'label' => esc_html__('Background Image', 'agrofa-addon'),
                'type' => \Elementor\Controls_Manager::MEDIA,
                'default' => [
                    'url' => \Elementor\Utils::get_placeholder_image_src(),
                ],
                'condition' => [
                    'style' => ['1']
                ]
            ]
        );

        $this->add_control(
            'layout_one_url',
            [
                'label'         => esc_html__('URL', 'daltech-core'),
                'type'             => \Elementor\Controls_Manager::URL,
                'placeholder'     => esc_html__('https://your-link.com', 'daltech-core'),
                'show_external' => true,
                'default'         => [
                    'url'             => '#',
                    'is_external'     => true,
                    'nofollow'         => true,
                ],
                'condition' => [
                    'style' => ['1']
                ]
            ]
        );

        $this->end_controls_section();

        // Slider Option
        $this->start_controls_section(
            'slider_settings',
            [
                'label' => __('Carousel Settings', 'modina-core'),
                'tab'   => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'slidestoshow',
            [
                'label' => __('Slides To Show', 'modina-core'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block' => true,
                'default' => '1',
                'options' => [
                    '1'  => __('1', 'modina-core'),
                    '2'  => __('2', 'modina-core'),
                    '3'  => __('3', 'modina-core'),
                    '4'  => __('4', 'modina-core'),
                ],
            ]
        );

        $this->add_control(
            'slidestoscroll',
            [
                'label' => __('Slides To Scroll', 'modina-core'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block' => true,
                'default' => '1',
                'options' => [
                    '1'  => __('1', 'modina-core'),
                    '2'  => __('2', 'modina-core'),
                    '3'  => __('3', 'modina-core'),
                    '4'  => __('4', 'modina-core'),
                ],
            ]
        );

        $this->add_control(
            'autoplay',
            [
                'label' => __('Auto Play?', 'modina-core'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Show', 'modina-core'),
                'label_off' => __('Hide', 'modina-core'),
                'return_value' => 'yes',
                'default' => 'yes',
            ]
        );

        $this->add_control(
            'infinite',
            [
                'label' => __('Infinite Loop', 'modina-core'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => __('Show', 'modina-core'),
                'label_off' => __('Hide', 'modina-core'),
                'return_value' => 'yes',
                'default' => 'yes',
            ]
        );

        $this->add_control(
            'autoplaytimeout',
            [
                'label' => __('Autoplay Timeout', 'modina-core'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block' => true,
                'default' => '1000',
                'options' => [
                    '1000'  => __('1 Second', 'modina-core'),
                    '2000'  => __('2 Second', 'modina-core'),
                    '3000'  => __('3 Second', 'modina-core'),
                    '4000'  => __('4 Second', 'modina-core'),
                    '5000'  => __('5 Second', 'modina-core'),
                    '6000'  => __('6 Second', 'modina-core'),
                    '7000'  => __('7 Second', 'modina-core'),
                    '8000'  => __('8 Second', 'modina-core'),
                    '9000'  => __('9 Second', 'modina-core'),
                    '10000' => __('10 Second', 'modina-core'),
                    '11000' => __('11 Second', 'modina-core'),
                    '12000' => __('12 Second', 'modina-core'),
                    '13000' => __('13 Second', 'modina-core'),
                    '14000' => __('14 Second', 'modina-core'),
                    '15000' => __('15 Second', 'modina-core'),
                ],
            ]
        );

        $this->end_controls_section();

        include DALTECH_PLUGIN_WIDGET_STYLE_PATH . 'case-studies-style.php';
    }

    // Output For User
    protected function render()
    {
        $settings = $this->get_settings_for_display();

        $slidestoshow = !empty($settings['slidestoshow']) ? $settings['slidestoshow'] : '2';
        $slidestoscroll = !empty($settings['slidestoscroll']) ? $settings['slidestoscroll'] : '2';
        $infinite = $settings['infinite'] == 'yes' ? 'true' : 'false';
        $autoplay = $settings['autoplay'] == 'yes' ? 'true' : 'false';
        $autoplaytimeout =  !empty($settings['autoplaytimeout']) ? $settings['autoplaytimeout'] : '800';

        if ($settings['style'] == '1') :
?>
            <!--<< Case Studies Section Start >>-->
            <section class="case-studies-1 section-padding fix pt-0">
                <div class="container">
                    <div class="case-studies-wrapper">
                        <div class="row g-0">
                            <div class="col-xl-7">
                                <div class="case-studies-content-area">
                                    <div class="section-title">
                                        <span class="wow fadeInUp">
                                            <?php echo wp_kses_post($settings['section_subtitle'], 'daltech_kses_allowed_html'); ?></span>
                                        <h2 class="wow fadeInUp" data-wow-delay=".3s">
                                            <?php echo wp_kses_post($settings['section_title'], 'daltech_kses_allowed_html'); ?>
                                        </h2>
                                    </div>
                                    <p class="mt-4 mt-md-0 wow fadeInUp" data-wow-delay=".5s">
                                        <?php echo wp_kses_post($settings['section_summary'], 'daltech_kses_allowed_html'); ?>
                                    </p>
                                    <div class="case-studies-items">
                                        <?php
                                        foreach ($settings['layout_one_case_studies_list'] as $item) :
                                        ?>
                                            <div class="case-studies-content">
                                                <div class="content wow fadeInUp" data-wow-delay=".3s">
                                                    <h5 class="mb-2 wow fadeInUp" data-wow-delay=".3s">
                                                        <?php echo wp_kses_post($item['subtitle_one'], 'daltech_kses_allowed_html'); ?>
                                                    </h5>
                                                    <h3>
                                                        <a href="<?php echo esc_url($item['url_one']['url']); ?>" class="changeImage2 wow fadeInUp pt-0 clicked" data-image="<?php echo esc_url($item['image_one']['url']); ?>">
                                                            <?php echo wp_kses_post($item['title_one'], 'daltech_kses_allowed_html'); ?>
                                                        </a>
                                                    </h3>
                                                </div>
                                                <div class="content wow fadeInUp" data-wow-delay=".5s">
                                                    <h5 class="mb-2">
                                                        <?php echo wp_kses_post($item['subtitle_two'], 'daltech_kses_allowed_html'); ?>
                                                    </h5>
                                                    <h3>
                                                        <a href="<?php echo esc_url($item['url_two']['url']); ?>" class="changeImage2 wow fadeInUp pt-0 clicked" data-image="<?php echo esc_url($item['image_two']['url']); ?>">
                                                            <?php echo wp_kses_post($item['title_two'], 'daltech_kses_allowed_html'); ?>
                                                        </a>
                                                    </h3>
                                                </div>
                                            </div>
                                        <?php
                                        endforeach;
                                        ?>
                                    </div>
                                </div>
                            </div>
                            <div class="col-xl-5 mt-5 mt-xl-0">
                                <div class="image case-studies-image">
                                    <img id="myImage2" src="<?php echo esc_url($settings['bg_image']['url']); ?>" alt="<?php echo esc_url(bloginfo('name')); ?>">
                                    <a href="<?php echo esc_url($settings['layout_one_url']['url']); ?>" class="icon">
                                        <i class="flaticon-up-arrow"></i>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>
            <!-- End Case Studiess style one -->

        <?php elseif ($settings['style'] == '2') : ?>

            <!-- Start Case Studiess style Two -->
            <section class="case-studies fix section-padding fix">
                <div class="container">
                    <div class="section-title text-center">
                        <span class="wow fadeInUp">
                            <?php echo wp_kses_post($settings['section_subtitle'], 'daltech_kses_allowed_html'); ?></span>
                        <h2 class="wow fadeInUp" data-wow-delay=".3s">
                            <?php echo wp_kses_post($settings['section_title'], 'daltech_kses_allowed_html'); ?>
                        </h2>
                    </div>
                </div>
                <div class="case-studies-wrapper-2">
                    <div class="case-studies-carousel-active">
                        <?php
                        foreach ($settings['layout_two_case_studies_list'] as $item) :
                        ?>
                            <div class="case-studies-items">
                                <div class="case-studies-image">
                                    <?php
                                    if (!empty($item['image']['url'])) :
                                        echo daltech_img_tag(array(
                                            'url'   => esc_url($item['image']['url'])
                                        ));
                                    endif;
                                    ?>
                                    <a href="<?php echo esc_url($item['url']['url']); ?>" class="icon">
                                        <i class="flaticon-next-1"></i>
                                    </a>
                                    <div class="case-studies-content">
                                        <P><?php echo wp_kses_post($item['subtitle'], 'daltech_kses_allowed_html'); ?></P>
                                        <h4>
                                            <a href="<?php echo esc_url($item['url']['url']); ?>">
                                                <?php echo wp_kses_post($item['title'], 'daltech_kses_allowed_html'); ?>
                                            </a>
                                        </h4>
                                    </div>
                                </div>
                            </div>
                        <?php
                        endforeach;
                        ?>
                    </div>
                </div>
            </section>
            <!-- End Case Studiess style Two -->

            <script>
                (function($) {
                    "use strict";
                    $(document).ready(function() {
                        if ($('.case-studies-carousel-active').length > 0) {
                            $('.case-studies-carousel-active').slick({
                                autoplay: <?php echo $autoplay; ?>,
                                autoplaySpeed: <?php echo $infinite; ?>,
                                speed: 800,
                                arrows: false,
                                slidesToShow: <?php echo $slidestoshow; ?>,
                                slidesToScroll: <?php echo $slidestoscroll; ?>,
                                dots: false,
                                dotsClass: 'slide-dots',
                                responsive: [{
                                        breakpoint: 1699,
                                        settings: {
                                            slidesToShow: 4,
                                        }
                                    },
                                    {
                                        breakpoint: 1499,
                                        settings: {
                                            slidesToShow: 3,
                                        }
                                    },
                                    {
                                        breakpoint: 1191,
                                        settings: {
                                            slidesToShow: 2,
                                        }
                                    },
                                    {
                                        breakpoint: 768,
                                        settings: {
                                            slidesToShow: 2,
                                            center: true,
                                        }
                                    },
                                    {
                                        breakpoint: 700,
                                        settings: {
                                            slidesToShow: 1
                                        }
                                    }
                                ],

                            });
                        }

                    });
                }(jQuery));
            </script>


        <?php elseif ($settings['style'] == '3') : ?>

            <!-- Start Case Studiess style Three  -->
            <section class="case-study section-padding pt-0">
                <div class="container">
                    <div class="section-title style-2 text-center">
                        <span class="wow fadeInUp">
                            <?php echo wp_kses_post($settings['section_subtitle'], 'daltech_kses_allowed_html'); ?>
                        </span>
                        <h2 class="wow fadeInUp" data-wow-delay=".3s">
                            <?php echo wp_kses_post($settings['section_title'], 'daltech_kses_allowed_html'); ?>
                        </h2>
                    </div>
                </div>
                <div class="case-study-wrapper">
                    <div class="case-studies-carousel-active-2">
                        <?php
                        foreach ($settings['layout_two_case_studies_list'] as $item) :
                        ?>
                            <div class="case-study-items">
                                <div class="case-study-image">
                                    <?php
                                    if (!empty($item['image']['url'])) :
                                        echo daltech_img_tag(array(
                                            'url'   => esc_url($item['image']['url'])
                                        ));
                                    endif;
                                    ?>
                                </div>
                                <div class="case-study-content">
                                    <h3>
                                        <a href="<?php echo esc_url($item['url']['url']); ?>">
                                            <?php echo wp_kses_post($item['title'], 'daltech_kses_allowed_html'); ?>
                                        </a>
                                    </h3>
                                    <p> <?php echo wp_kses_post($item['subtitle'], 'daltech_kses_allowed_html'); ?></p>
                                    <a href="<?php echo esc_url($item['url']['url']); ?>" class="icon">
                                        <i class="fal fa-arrow-right"></i>
                                    </a>
                                </div>
                            </div>
                        <?php
                        endforeach;
                        ?>
                    </div>
                </div>
            </section>
            <!-- End Case Studiess style Three  -->

            <script>
                (function($) {
                    "use strict";
                    $(document).ready(function() {
                        if ($('.case-studies-carousel-active-2').length > 0) {
                            $('.case-studies-carousel-active-2').slick({
                                autoplay: <?php echo $autoplay; ?>,
                                autoplaySpeed: <?php echo $autoplaytimeout; ?>,
                                speed: 1000,
                                arrows: false,
                                slidesToShow: <?php echo $slidestoshow; ?>,
                                slidesToScroll: <?php echo $slidestoscroll; ?>,
                                dots: false,
                                dotsClass: 'slide-dots',
                                responsive: [{
                                        breakpoint: 1499,
                                        settings: {
                                            slidesToShow: 3,
                                        }
                                    },
                                    {
                                        breakpoint: 1399,
                                        settings: {
                                            slidesToShow: 2,
                                        }
                                    },
                                    {
                                        breakpoint: 768,
                                        settings: {
                                            slidesToShow: 2,
                                            center: true,
                                        }
                                    },
                                    {
                                        breakpoint: 700,
                                        settings: {
                                            slidesToShow: 1
                                        }
                                    }
                                ],

                            });
                        }

                    });
                }(jQuery));
            </script>

        <?php elseif ($settings['style'] == '4') : ?>

            <!-- Strat Case Studiess style Four  -->
            <section class="it-case-study section-padding">
                <div class="single-case-study-wrapper">
                    <div class="it-case-study-carousel-active">
                        <?php
                        foreach ($settings['layout_four_case_studies_list'] as $item) :
                        ?>
                            <div class="single-it-case-study">
                                <div class="case-study-image">
                                    <?php
                                    if (!empty($item['image']['url'])) :
                                        echo daltech_img_tag(array(
                                            'url'   => esc_url($item['image']['url'])
                                        ));
                                    endif;
                                    ?>
                                    <div class="case-study-content">
                                        <div class="arrow-shape">
                                            <?php
                                            if (!empty($item['shape']['url'])) :
                                                echo daltech_img_tag(array(
                                                    'url'   => esc_url($item['shape']['url'])
                                                ));
                                            endif;
                                            ?>
                                        </div>
                                        <div class="icon">
                                            <?php
                                            if (!empty($item['icon_image']['url'])) :
                                                echo daltech_img_tag(array(
                                                    'url'   => esc_url($item['icon_image']['url'])
                                                ));
                                            endif;
                                            ?>
                                        </div>
                                        <p><?php echo wp_kses_post($item['subtitle'], 'daltech_kses_allowed_html'); ?></p>
                                        <h4>
                                            <a href="<?php echo esc_url($item['url']['url']); ?>">
                                                <?php echo wp_kses_post($item['title'], 'daltech_kses_allowed_html'); ?>
                                            </a>
                                        </h4>
                                    </div>
                                </div>
                            </div>
                        <?php
                        endforeach;
                        ?>
                    </div>
                </div>
            </section>
            <!-- End Case Studiess style Four  -->

            <script>
                (function($) {
                    "use strict";
                    $(document).ready(function() {
                        if ($('.it-case-study-carousel-active').length > 0) {
                            $('.it-case-study-carousel-active').slick({
                                autoplay: <?php echo $autoplay; ?>,
                                autoplaySpeed: 2000,
                                speed: <?php echo $autoplaytimeout; ?>,
                                arrows: false,
                                slidesToShow: <?php echo $slidestoshow; ?>,
                                slidesToScroll: <?php echo $slidestoscroll; ?>,
                                dots: true,
                                dotsClass: 'slide-dots',
                                responsive: [{
                                        breakpoint: 1399,
                                        settings: {
                                            slidesToShow: 3,
                                        }
                                    },
                                    {
                                        breakpoint: 1191,
                                        settings: {
                                            slidesToShow: 2,
                                        }
                                    },
                                    {
                                        breakpoint: 768,
                                        settings: {
                                            slidesToShow: 1,
                                            center: true,
                                        }
                                    },
                                    {
                                        breakpoint: 480,
                                        settings: {
                                            slidesToShow: 1
                                        }
                                    }
                                ],

                            });
                        }

                    });
                }(jQuery));
            </script>
<?php
        endif;
    }
}
