<?php

namespace ThemeAtelier\EventfulForElementor\Admin\Widgets\Options;

class EventfulForElementorLayout
{
    /**
     * Content Layout Options.
     */
    public static function ppfe_content_layout_options($widget)
    {
        $widget->start_controls_section(
            'section_layout',
            [
                'label' => esc_html__('Filter Events', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'widget_name',
            [
                'label' => esc_html__('Widget Name', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::HIDDEN,
                'default' => $widget->get_name(),
            ]
        );

        $widget->add_control(
            'post_list_orientation',
            [
                'label' => esc_html__('Content Orientation', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => [
                    'left-thumb' => esc_html__('Left Image', 'eventful-for-elementor'),
                    'right-thumb' => esc_html__('Right Image', 'eventful-for-elementor'),
                ],
                'default' => 'left-thumb',
                'condition' => [
                    'widget_name' => 'eventful-post-list-widget'
                ]
            ]
        );

        $widget->add_control(
            'include_or_exclude',
            [
                'label' => esc_html__('Include Or Exclude', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'label_block'   => true,
                'options'    => array(
                    'include' => esc_html__('Include Only', 'eventful-for-elementor'),
                    'exclude'        => esc_html__('Exclude', 'eventful-for-elementor'),
                ),
                'default' => 'include',
            ]
        );

        $widget->add_control(
            'efpe_include_only_posts',
            [
                'label'         => esc_html__('Include Only', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'label_block'   => true,
                'multiple'      => true,
                'options'       => EventfulForElementorUtlitiesFunctions::include_only_post(),
                'condition' => [
                    'include_or_exclude' => ['include'],
                ],
            ]
        );

        $widget->add_control(
            'efpe_exclude_post_set',
            [
                'label'         => esc_html__('Exclude', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'label_block'   => true,
                'multiple'      => true,
                'options'       => EventfulForElementorUtlitiesFunctions::include_only_post(),
                'condition' => [
                    'include_or_exclude' => ['exclude'],
                ],
            ]
        );

        $widget->add_control(
            'efpe_exclude_too',
            [
                'label'         => esc_html__('Exclude event type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'label_block'   => true,
                'multiple'      => true,
                'separator' => 'after',
                'options'       => array(
                    'current'               => esc_html__('Current Event', 'eventful-for-elementor'),
                    'password_protected'    => esc_html__('Password Protected Events', 'eventful-for-elementor'),
                ),
            ]
        );

        $widget->add_control(
            'efpe_event_type',
            [
                'label'         => esc_html__('Type of Event', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => array(
                    'future'    => esc_html__('Upcoming Events', 'eventful-for-elementor'),
                    'past'      => esc_html__('Past Events', 'eventful-for-elementor'),
                    'all'       => esc_html__('All (Upcoming + Past)', 'eventful-for-elementor'),
                ),
                'default' => 'all',
            ]
        );

        $widget->add_control(
            'hide_free_events',
            [
                'label' => esc_html__('Hide Free Events', 'eventful-pro-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Show', 'eventful-pro-for-elementor'),
                'label_off' => esc_html__('Hide', 'eventful-pro-for-elementor'),
                'separator' => 'before',
            ]
        );
        $widget->add_control(
            'hide_event_without_thumbnail',
            [
                'label' => esc_html__('Hide Events Without Featured Images', 'eventful-pro-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Show', 'eventful-pro-for-elementor'),
                'label_off' => esc_html__('Hide', 'eventful-pro-for-elementor'),
                'separator' => 'before',
            ]
        );

        $widget->add_control(
            'efpe_post_limit',
            [
                'label'         => esc_html__('Limit', 'eventful-for-elementor'),
                'description'   => esc_html__('Number of total items to display.', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::NUMBER,
                'default'       => 20,
            ]
        );
        $widget->add_control(
            'efpe_post_offset',
            [
                'label'         => esc_html__('Offset', 'eventful-for-elementor'),
                'description'   => esc_html__('Number of total items to display.', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::NUMBER,
                'default'       => 0,
            ]
        );

        $widget->add_control(
            'advanced_filtering',
            [
                'label' => esc_html__('Advanced Filtering', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::HEADING,
                'separator' => 'before',
            ]
        );
        $widget->add_control(
            'efpe_advanced_filter',
            [
                'label' => esc_html__('Filter by', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT2,
                'description' => esc_html__('Pick options to filter.', 'eventful-for-elementor'),
                'label_block' => true,
                'multiple' => true,
                'options' => [
                    'taxonomy' => esc_html__('Taxonomy', 'eventful-for-elementor'),
                    'author' => esc_html__('Author', 'eventful-for-elementor'),
                    'sortby' => esc_html__('Sort By', 'eventful-for-elementor'),
                    'status' => esc_html__('Status', 'eventful-for-elementor'),
                    'date' => esc_html__('Date', 'eventful-for-elementor'),
                    'keyword' => esc_html__('Keyword', 'eventful-for-elementor'),
                ],
            ]
        );

        $widget->add_control(
            'taxonomy_query_toggle',
            [
                'label' => esc_html__('Taxonomy', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'condition' => [
                    'efpe_advanced_filter' => 'taxonomy',
                ],
            ]
        );

        $widget->start_popover();

        $widget->add_control(
            'taxonomy_options',
            [
                'label' => esc_html__('Taxonomy Options', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::REPEATER,
                'prevent_empty' => false,
                'fields' => [
                    [
                        'name' => 'select_taxonomy',
                        'label' => esc_html__('Select Taxonomy', 'eventful-for-elementor'),
                        'type' => \Elementor\Controls_Manager::SELECT,
                        'options' => array_merge(['' => esc_html__('Select Taxonomy', 'eventful-for-elementor')], EventfulForElementorUtlitiesFunctions::get_post_type_taxonomies('tribe_events')),
                        'label_block' => true,
                        'default' => 'category'
                    ],

                    [
                        'name' => 'hide_taxonomy_name',
                        'label' => esc_html__('Hide Taxonomy Name', 'eventful-for-elementor'),
                        'type' => \Elementor\Controls_Manager::SWITCHER,
                        'label_on' => esc_html__('Show', 'eventful-for-elementor'),
                        'label_off' => esc_html__('Hide', 'eventful-for-elementor'),
                        'default' => 'yes',
                    ],
                    [
                        'name' => 'taxonomy_term_operator',
                        'label' => esc_html__('Operator', 'eventful-for-elementor'),
                        'type' => \Elementor\Controls_Manager::SELECT,
                        'options' => [
                            'IN' => esc_html__('IN', 'eventful-for-elementor'),
                            'AND' => esc_html__('AND', 'eventful-for-elementor'),
                            'NOT IN' => esc_html__('NOT IN', 'eventful-for-elementor'),
                        ],
                        'default' => 'IN',
                    ],
                    [
                        'name' => 'add_filter_post',
                        'label' => esc_html__('Add to Ajax Live Filters', 'eventful-for-elementor'),
                        'type' => \Elementor\Controls_Manager::SWITCHER,
                        'label_on' => esc_html__('Show', 'eventful-for-elementor'),
                        'label_off' => esc_html__('Hide', 'eventful-for-elementor'),
                    ],
                    [
                        'name' => 'ajax_filter_style',
                        'label' => esc_html__('Filter Type', 'eventful-for-elementor'),
                        'type' => \Elementor\Controls_Manager::SELECT,
                        'options' => [
                            'fl_dropdown' => esc_html__('Dropdown', 'eventful-for-elementor'),
                            'fl_radio' => esc_html__('Radio', 'eventful-for-elementor'),
                            'fl_checkbox' => esc_html__('Checkbox', 'eventful-for-elementor'),
                            'fl_btn' => esc_html__('Button', 'eventful-for-elementor'),
                        ],
                        'default' => 'fl_btn',
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                    [
                        'name'          => 'ajax_filter_label',
                        'label'         => esc_html__('Live Filter Label', 'eventful-for-elementor'),
                        'type'          => \Elementor\Controls_Manager::TEXT,
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                    [
                        'name'          => 'ajax_rename_all_text',
                        'label'         => esc_html__('Rename "All" Text', 'eventful-for-elementor'),
                        'type'          => \Elementor\Controls_Manager::TEXT,
                        'default'       => esc_html__('All', 'eventful-for-elementor'),
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                    [
                        'name'          => 'ajax_hide_empty',
                        'label'         => esc_html__('Hide Empty Term(s)', 'eventful-for-elementor'),
                        'type'          => \Elementor\Controls_Manager::SWITCHER,
                        'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                        'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                    [
                        'name'          => 'ajax_show_count',
                        'label'         => esc_html__('Show Event Count', 'eventful-for-elementor'),
                        'type'          => \Elementor\Controls_Manager::SWITCHER,
                        'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                        'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                    [
                        'name'          => 'efpe_live_filter_align',
                        'label'         => esc_html__('Alignment', 'eventful-for-elementor'),
                        'type'          => \Elementor\Controls_Manager::CHOOSE,
                        'options'       => [
                            'left' => [
                                'title' => esc_html__('Left', 'eventful-for-elementor'),
                                'icon'  => 'eicon-text-align-left',
                            ],
                            'center' => [
                                'title' => esc_html__('Center', 'eventful-for-elementor'),
                                'icon'  => 'eicon-text-align-center',
                            ],
                            'right' => [
                                'title' => esc_html__('Right', 'eventful-for-elementor'),
                                'icon'  => 'eicon-text-align-right',
                            ],
                        ],
                        'default'       => 'center',
                        'condition'     => [
                            'add_filter_post' => 'yes',
                        ],
                    ],
                ],
            ],

        );

        $widget->add_control(
            'taxonomy_relation',
            [
                'label'         => esc_html__('Relation', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => [
                    'AND'       => esc_html__('AND', 'eventful-for-elementor'),
                    'OR'        => esc_html__('OR', 'eventful-for-elementor'),
                ],
                'default'       => 'AND',
            ]
        );

        $widget->end_popover();

        $widget->add_control(
            'author_query_toggle',
            [
                'label'         => esc_html__('Author', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label_off'     => esc_html__('Default', 'eventful-for-elementor'),
                'label_on'      => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value'  => 'yes',
                'default'       => 'yes',
                'condition'     => [
                    'efpe_advanced_filter' => 'author',
                ],
            ]
        );

        $widget->start_popover();


        $widget->add_control(
            'select_author',
            [
                'label'         => esc_html__('Event by Author', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'multiple'      => true,
                'label_block'   => true,
                'options'       => EventfulForElementorUtlitiesFunctions::get_post_type_author(),
            ]
        );
        $widget->add_control(
            'author_live_filters',
            [
                'label'         => esc_html__('Add to Ajax Live Filters', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SWITCHER,
                'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
            ]
        );
        $widget->add_control(
            'author_filter_style',
            [
                'label'         => esc_html__('Filter Type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => [
                    'fl_dropdown' => esc_html__('Dropdown', 'eventful-for-elementor'),
                    'fl_radio'  => esc_html__('Radio', 'eventful-for-elementor'),
                    'fl_checkbox' => esc_html__('Checkbox', 'eventful-for-elementor'),
                    'fl_btn'    => esc_html__('Button', 'eventful-for-elementor'),
                ],
                'default'       => 'fl_btn',
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'author_filter_label',
            [
                'label' => esc_html__('Live Filter Label', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'author_rename_all_text',
            [
                'label'         => esc_html__('Rename "All" Text', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::TEXT,
                'default'       => esc_html__('All', 'eventful-for-elementor'),
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'author_hide_empty',
            [
                'label'         => esc_html__('Hide Empty Term(s)', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SWITCHER,
                'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'author_show_count',
            [
                'label'         => esc_html__('Show Event Count', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SWITCHER,
                'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'author_live_filter_align',
            [
                'label'         => esc_html__('Alignment', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::CHOOSE,
                'options'       => [
                    'left'      => [
                        'title' => esc_html__('Left', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-left',
                    ],
                    'center'    => [
                        'title' => esc_html__('Center', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__('Right', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-right',
                    ],
                ],
                'default'       => 'center',
                'condition'     => [
                    'author_live_filters' => 'yes',
                ],
            ]
        );
        $widget->add_control(
            'select_not_author',
            [
                'label'         => esc_html__('Event Not by Author', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'multiple'      => true,
                'label_block'   => true,
                'options'       => EventfulForElementorUtlitiesFunctions::get_post_type_author(),
            ]
        );
        $widget->end_popover();

        $widget->add_control(
            'sortby_query_toggle',
            [
                'label'         => esc_html__('Order By', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label_off'     => esc_html__('Default', 'eventful-for-elementor'),
                'label_on'      => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value'  => 'yes',
                'default'       => 'yes',
                'condition'     => [
                    'efpe_advanced_filter' => 'sortby',
                ],
            ]
        );

        $widget->start_popover();

        $widget->add_control(
            'select_sortby',
            [
                'label' => esc_html__('Sort By', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'multiple' => true,
                'label_block' => true,
                'options' => array(
                    'ID'           => esc_html__('ID', 'eventful-for-elementor'),
                    'title'        => esc_html__('Title', 'eventful-for-elementor'),
                    '_EventStartDate'         => esc_html__('Event Start Date', 'eventful-for-elementor'),
                    'date'         => esc_html__('Date', 'eventful-for-elementor'),
                    'modified'     => esc_html__('Modified date', 'eventful-for-elementor'),
                    'post__in'     => esc_html__('Event in (Drag & Drop)', 'eventful-for-elementor'),
                    'post_slug'    => esc_html__('Event slug', 'eventful-for-elementor'),
                    'post_type'    => esc_html__('Event type', 'eventful-for-elementor'),
                    'rand'         => esc_html__('Random', 'eventful-for-elementor'),
                    'comment_count' => esc_html__('Comment count', 'eventful-for-elementor'),
                    'menu_order'   => esc_html__('Menu order', 'eventful-for-elementor'),
                    'author'       => esc_html__('Author', 'eventful-for-elementor'),
                    'most_liked'   => esc_html__('Most Liked', 'eventful-for-elementor'),
                    'most_viewed'  => esc_html__('Most Viewed', 'eventful-for-elementor'),
                ),
                'default' => '_EventStartDate',
            ]
        );
        $widget->add_control(
            'sortby_live_filters',
            [
                'label'     => esc_html__('Add to Ajax Live Filters', 'eventful-for-elementor'),
                'type'      => \Elementor\Controls_Manager::SWITCHER,
                'label_on'  => esc_html__('Show', 'eventful-for-elementor'),
                'label_off' => esc_html__('Hide', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'sortby_filter_style',
            [
                'label'         => esc_html__('Filter Type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => [
                    'fl_dropdown'   => esc_html__('Dropdown', 'eventful-for-elementor'),
                    'fl_radio'      => esc_html__('Radio', 'eventful-for-elementor'),
                    'fl_checkbox'   => esc_html__('Checkbox', 'eventful-for-elementor'),
                    'fl_btn'        => esc_html__('Button', 'eventful-for-elementor'),
                ],
                'default'       => 'fl_btn',
                'condition'     => [
                    'sortby_live_filters' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'efpe_add_filter_orderby',
            [
                'label'         => esc_html__('Filter Type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT2,
                'multiple'      => true,
                'label_block'   => true,
                'options'       => array(
                    'ID'            => esc_html__('ID', 'eventful-for-elementor'),
                    'title'         => esc_html__('Title', 'eventful-for-elementor'),
                    '_EventStartDate'          => esc_html__('Event Start Date', 'eventful-for-elementor'),
                    'date'          => esc_html__('Date', 'eventful-for-elementor'),
                    'modified'      => esc_html__('Modified date', 'eventful-for-elementor'),
                    'post_type'     => esc_html__('Event type', 'eventful-for-elementor'),
                    'rand'          => esc_html__('Random', 'eventful-for-elementor'),
                    'comment_count' => esc_html__('Comment count', 'eventful-for-elementor'),
                    'menu_order'    => esc_html__('Menu order', 'eventful-for-elementor'),
                    'author'        => esc_html__('Author', 'eventful-for-elementor'),
                    'most_liked'    => esc_html__('Most Liked', 'eventful-for-elementor'),
                    'most_viewed'   => esc_html__('Most Viewed', 'eventful-for-elementor'),
                ),
                'condition'         => [
                    'sortby_live_filters' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'sortby_filter_label',
            [
                'label'         => esc_html__('Label', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::TEXT,
                'condition'     => [
                    'sortby_live_filters' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'sortby_rename_all_text',
            [
                'label'         => esc_html__('Rename "All" Text', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::TEXT,
                'default'       => esc_html__('All', 'eventful-for-elementor'),
                'condition'     => [
                    'sortby_live_filters' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'sortby_live_filter_align',
            [
                'label'         => esc_html__('Alignment', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::CHOOSE,
                'options'       => [
                    'left'      => [
                        'title' => esc_html__('Left', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-left',
                    ],
                    'center'    => [
                        'title' => esc_html__('Center', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-center',
                    ],
                    'right'     => [
                        'title' => esc_html__('Right', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-right',
                    ],
                ],
                'default'       => 'center',
                'condition'     => [
                    'sortby_live_filters' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'select_filter_order',
            [
                'label'         => esc_html__('Filter Type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => array(
                    'ASC'       => esc_html__('Ascending', 'eventful-for-elementor'),
                    'DESC'      => esc_html__('Descending', 'eventful-for-elementor'),
                ),
                'default'       => 'ASC',
            ]
        );

        $widget->add_control(
            'add_order_filter_post',
            [
                'label'         => esc_html__('Add to Ajax Live Filters', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SWITCHER,
                'label_on'      => esc_html__('Show', 'eventful-for-elementor'),
                'label_off'     => esc_html__('Hide', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'order_filter_options',
            [
                'label'         => esc_html__('Filter Type', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::SELECT,
                'options'       => array(
                    'fl_dropdown' => esc_html__('Dropdown', 'eventful-for-elementor'),
                    'fl_radio'    => esc_html__('Radio', 'eventful-for-elementor'),
                    'fl_btn'      => esc_html__('Button', 'eventful-for-elementor'),
                ),
                'default' => 'fl_dropdown',
                'condition'     => [
                    'add_order_filter_post' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'order_filter_label',
            [
                'label'         => esc_html__('Label', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::TEXT,
                'default'       => esc_html('Order', 'eventful-for-elementor'),
                'condition'     => [
                    'add_order_filter_post' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'efpe_live_filter_align',
            [
                'label'         => esc_html__('Alignment', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::CHOOSE,
                'options'       => [
                    'left'      => [
                        'title' => esc_html__('Left', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__('Center', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__('Right', 'eventful-for-elementor'),
                        'icon'  => 'eicon-text-align-right',
                    ],
                ],
                'default'       => 'center',
                'condition'     => [
                    'add_order_filter_post' => 'yes',
                ],
            ]
        );

        $widget->end_popover();

        $widget->add_control(
            'status_query_toggle',
            [
                'label'         => esc_html__('Event Status', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label_off'     => esc_html__('Default', 'eventful-for-elementor'),
                'label_on'      => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value'  => 'yes',
                'default'       => 'yes',
                'condition'     => [
                    'efpe_advanced_filter' => 'status',
                ],
            ]
        );

        $widget->start_popover();

        $widget->add_control(
            'select_status',
            [
                'label' => esc_html__('Event Status', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT2,
                'multiple' => true,
                'label_block' => true,
                'options' => EventfulForElementorUtlitiesFunctions::get_post_statuses(),
            ]
        );
        $widget->end_popover();
        $widget->add_control(
            'date_query_toggle',
            [
                'label' => esc_html__('Date', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label_off' => esc_html__('Default', 'eventful-for-elementor'),
                'label_on' => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value' => 'yes',
                'default' => 'yes',
                'condition'     => [
                    'efpe_advanced_filter' => 'date',
                ],
            ]
        );

        $widget->start_popover();

        $widget->add_control(
            'select_date',
            [
                'label' => esc_html__('Published Date', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options' => array(
                    'yesterday'  => esc_html__('Yesterday', 'eventful-for-elementor'),
                    'today_only' => esc_html__('Today Only', 'eventful-for-elementor'),
                    'today_onwards' => esc_html__('Today and Onwards', 'eventful-for-elementor'),
                    'this_week'  => esc_html__('This Week', 'eventful-for-elementor'),
                    'this_month' => esc_html__('This Month', 'eventful-for-elementor'),
                    'this_year'  => esc_html__('This Year', 'eventful-for-elementor'),
                    'week_ago'   => esc_html__('1 Week ago to today', 'eventful-for-elementor'),
                    'month_ago'  => esc_html__('1 month ago to today', 'eventful-for-elementor'),
                    'year_ago'   => esc_html__('1 year ago to today', 'eventful-for-elementor'),
                    'specific_date' => esc_html__('Specific Date', 'eventful-for-elementor'),
                    'specific_month' => esc_html__('Specific Month', 'eventful-for-elementor'),
                    'specific_year' => esc_html__('Specific Year', 'eventful-for-elementor'),
                    'specific_period' => esc_html__('Specific Period ( From & To )', 'eventful-for-elementor'),
                ),
            ]
        );
        $widget->add_control(
            'select_post_specific_date',
            [
                'label' => esc_html__('Select Date', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::DATE_TIME,
                'label_block'   => false,
                'condition'     => [
                    'select_date' => 'specific_date',
                ],
                'default'   => 'yy-mm-dd',
            ]
        );
        $widget->add_control(
            'select_post_date_from',
            [
                'label' => esc_html__('From', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::DATE_TIME,
                'label_block'   => false,
                'condition'     => [
                    'select_date' => 'specific_period',
                ],
                'default'   => 'yy-mm-dd',
            ]
        );
        $widget->add_control(
            'select_post_date_to',
            [
                'label' => esc_html__('To', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::DATE_TIME,
                'label_block'   => false,
                'condition'     => [
                    'select_date' => 'specific_period',
                ],
                'default'   => 'yy-mm-dd',
            ]
        );
        $widget->add_control(
            'select_specific_month',
            [
                'label' => esc_html__('Published Date', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SELECT,
                'options'    => array(
                    '1'  => esc_html__('January', 'eventful-for-elementor'),
                    '2'  => esc_html__('February', 'eventful-for-elementor'),
                    '3'  => esc_html__('March', 'eventful-for-elementor'),
                    '4'  => esc_html__('April', 'eventful-for-elementor'),
                    '5'  => esc_html__('May', 'eventful-for-elementor'),
                    '6'  => esc_html__('June', 'eventful-for-elementor'),
                    '7'  => esc_html__('July', 'eventful-for-elementor'),
                    '8'  => esc_html__('August', 'eventful-for-elementor'),
                    '9'  => esc_html__('September', 'eventful-for-elementor'),
                    '10' => esc_html__('October', 'eventful-for-elementor'),
                    '11' => esc_html__('November', 'eventful-for-elementor'),
                    '12' => esc_html__('December', 'eventful-for-elementor'),
                ),
                'condition'     => [
                    'select_date' => 'specific_month',
                ],
            ]
        );

        $widget->add_control(
            'select_post_specific_year',
            [
                'label' => esc_html__('Set Year', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::NUMBER,
                'default' => 2024,
                'condition'     => [
                    'select_date' => 'specific_year',
                ],
            ]
        );
        $widget->end_popover();
        $widget->add_control(
            'keyword_query_toggle',
            [
                'label' => esc_html__('Type Keyword', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
                'label_off' => esc_html__('Default', 'eventful-for-elementor'),
                'label_on' => esc_html__('Custom', 'eventful-for-elementor'),
                'return_value' => 'yes',
                'default' => 'yes',
                'condition'     => [
                    'efpe_advanced_filter' => 'keyword',
                ],
            ]
        );

        $widget->start_popover();

        $widget->add_control(
            'efpe_set_post_keyword',
            [
                'label' => esc_html__('Type Keyword', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'placeholder' => esc_html__('Enter keyword(s).', 'eventful-for-elementor'),
            ]
        );

        $widget->add_control(
            'add_search_filter_post',
            [
                'label' => esc_html__('Add to Ajax Live Filters', 'eventful-for-elementor'),
                'type' => \Elementor\Controls_Manager::SWITCHER,
                'label_on' => esc_html__('Show', 'eventful-for-elementor'),
                'label_off' => esc_html__('Hide', 'eventful-for-elementor'),
                'return_value' => 'yes',
            ]
        );

        $widget->add_control(
            'keyword_filter_label',
            [
                'label'         => esc_html__('Label', 'eventful-for-elementor'),
                'type'          => \Elementor\Controls_Manager::TEXT,
                'placeholder'   => esc_html__('Type live filter label.', 'eventful-for-elementor'),
                'condition'     => [
                    'add_search_filter_post' => 'yes',
                ],
            ]
        );

        $widget->add_control(
            'keyword_live_filter_align',
            [
                'label'     => esc_html__('Alignment', 'eventful-for-elementor'),
                'type'      => \Elementor\Controls_Manager::CHOOSE,
                'options'   => [
                    'left'  => [
                        'title' => esc_html__('Left', 'eventful-for-elementor'),
                        'icon' => 'eicon-text-align-left',
                    ],
                    'center' => [
                        'title' => esc_html__('Center', 'eventful-for-elementor'),
                        'icon' => 'eicon-text-align-center',
                    ],
                    'right' => [
                        'title' => esc_html__('Right', 'eventful-for-elementor'),
                        'icon' => 'eicon-text-align-right',
                    ],
                ],
                'default'   => 'center',
                'condition'     => [
                    'add_search_filter_post' => 'yes',
                ],
            ]
        );

        $widget->end_popover();

        $widget->end_controls_section();
    }
}
