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


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

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

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

$opening = new \Elementor\Repeater();

$opening->add_control(
    'date',
    [
        'label' => __('Title', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add Date', 'ostech-addon'),
        'default' => __('Add Date', 'ostech-addon'),
    ]
);

$opening->add_control(
    'time',
    [
        'label' => __('Time', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'placeholder' => __('Add Time', 'ostech-addon'),
        'default' => __('Add Time', 'ostech-addon'),
    ]
);

$this->add_control(
    'opening_time_list',
    [
        'label' => __('Opening Time List', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::REPEATER,
        'fields' => $opening->get_controls(),
        'prevent_empty' => false,
        'default' => [
            [
                'title' => __('Awesome Title', 'ostech-addon'),
            ],
        ],
        'title_field' => '{{{ date }}}',
    ]
);

$this->end_controls_section();
