<?php

$this->start_controls_section(
    'content_section',
    [
        'label' => __('History Content', 'ostech-addon'),
        'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
        'condition' => [
            'layout_type' => 'layout_one'
        ]
    ]
);

$this->add_control(
    'sec_icon',
    [
        'label' => __('Section Icon', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::ICONS,
        'default' => [
            'value' => 'fa fa-star',
            'library' => 'font-awesome',
        ],
    ]
);

$this->add_control(
    'sec_title',
    [
        'label' => __('Section Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Add title', 'ostech-addon'),
        'default' => __('Default Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($this, 'Section Title', 'h2', 'layout_one');

$this->add_control(
    'sec_sub_title',
    [
        'label' => __('Section Sub Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Add sub title', 'ostech-addon'),
        'default' => __('Default Sub Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($this, 'Section Sub Title', 'span', 'layout_one');


$history_one = new \Elementor\Repeater();

$history_one->add_control(
    'title',
    [
        'label' => __('Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Default Title', 'ostech-addon'),
        'default' => __('Default Title', 'ostech-addon'),
    ]
);

ostech_elementor_heading_option($history_one, 'History Title', 'h4', 'layout_one');

$history_one->add_control(
    'summary',
    [
        'label' => __('Summary', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Default Summary', 'ostech-addon'),
        'default' => __('Default Summary', 'ostech-addon'),
    ]
);

$history_one->add_control(
    'check_list',
    [
        'label' => __('Check List', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::CODE,
        'label_block' => true,
        'default' => wp_kses('<li> <div class="icon"> <i class="fa fa-check"></i> </div> <div class="text"> <p>Pellentes gravida lectus.</p> </div> </li> <li> <div class="icon"> <i class="fa fa-check"></i> </div> <div class="text"> <p>Finibus aliquet ultrices.</p> </div> </li>', 'ostech_allowed_tags')
    ]
);

$history_one->add_control(
    'date',
    [
        'label' => __('Date', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '1',
        'placeholder' => __('Date', 'ostech-addon'),
        'default' => __('28 January 2023', 'ostech-addon'),
    ]
);

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

$history_one->add_control(
    'url',
    [
        'label' => __('Url', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::URL,
        'placeholder' => __('#', 'ostech-addon'),
        'show_external' => false,
        'default' => [
            'url' => '#',
            'is_external' => false,
            'nofollow' => false,
        ],
        'show_label' => true,
    ]
);

$this->add_control(
    'history_one_list',
    [
        'label' => __('History List', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $history_one->get_controls(),
        'prevent_empty' => false,
        'title_field' => '{{{ title }}}',
    ]
);

$this->add_control(
    'shape_one',
    [
        'label' => __('Shape', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::MEDIA,

    ]
);

$this->end_controls_section();
