<?php

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

$package_list = new \Elementor\Repeater();

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

ostech_elementor_heading_option($package_list, 'Package Title', 'h3', 'layout_one');

$package_list->add_control(
    'subtitle',
    [
        'label' => __('Subtitle', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Add subtitle', 'ostech-addon'),
        'default' => __('Subtitle', 'ostech-addon'),
    ]
);

$package_list->add_control(
    'price',
    [
        'label' => __('Price', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '1',
        'placeholder' => __('Add price', 'ostech-addon'),
        'default' => __('$60', 'ostech-addon'),
    ]
);

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

$package_list->add_control(
    'shape',
    [
        'label' => __('Shape', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::MEDIA,
    ]
);

$package_list->add_control(
    'title_shape',
    [
        'label' => __('Title Shape', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::MEDIA,
    ]
);

$package_list->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,
    ]
);

$package_list->add_control(
    'button_label',
    [
        'label' => __('Button Label', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::TEXTAREA,
        'rows' => '2',
        'placeholder' => __('Add button label', 'ostech-addon'),
        'default' => __('Button Label', 'ostech-addon'),
    ]
);

$package_list->add_control(
    'button_icon',
    [
        'label' => __('Button Icon', 'ostech-addon'),
        'type' => \Elementor\Controls_Manager::ICONS,
        'default' => [
            'value' => 'icon-right-arrow',
            'library' => 'custom-icon',
        ],
    ]
);

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

$this->end_controls_section();
