<?php

/**
 * Views class for Shortcode generator options.
 *
 * @link       https://themeatelier.net
 * @since      1.0.0
 *
 * @package greet-bubble
 * @subpackage greet-bubble/Admin/Views/GreetBubbleGeneral
 * @author     ThemeAtelier<themeatelierbd@gmail.com>
 */

namespace ThemeAtelier\GreetBubble\Admin\Views;

use ThemeAtelier\GreetBubble\Admin\Framework\Classes\GREET_BUBBLE;

class GreetBubbleGeneral
{

    /**
     * Create Option fields for the setting options.
     *
     * @param string $prefix Option setting key prefix.
     * @return void
     */
    public static function options($prefix)
    {
        //
        // Create a section
        //
        GREET_BUBBLE::createSection($prefix, array(
            'title'  => __('GENERAL', 'greet-bubble'),
            'icon'   => 'icofont-gear',
            'fields' => array(

                array(
                    'id'    => 'poster',
                    'type'  => 'media',
                    'title' => __('Default Video Thumbnail', 'greet-bubble'),
                    'title_help' => '<div class="greet-bubble-info-label">' . __('Upload an image to show while the video loads or until the user clicks Play. If you leave this blank, the first frame of the video will be used automatically.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DEMO_URL.'" target="_blank">' . __('Live Demo', 'greet-bubble') . '</a><a class="tooltip_btn_secondary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                ),

                array(
                    'id'      => 'video',
                    'type'    => 'media',
                    'title'   => esc_html__('Upload Video (MP4)*', 'greet-bubble'),
                    'desc'  =>  __('You must upload an MP4 file for Greet Bubble to function properly on your website.', 'greet-bubble'),
                    'title_help' =>
                    '<div class="greet-bubble-info-label">'
                        . sprintf(
                            /* translators: %s = URL to video converter website */
                            __('If you don’t have an MP4 video, you can use %s to convert your file.', 'greet-bubble'),
                            '<a href="https://www.freeconvert.com" target="_blank">this tool</a>'
                        )
                        . '</div>'
                        . '<a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DEMO_URL.'" target="_blank">'
                        . __('Live Demo', 'greet-bubble')
                        . '</a>'
                        . '<a class="tooltip_btn_secondary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">'
                        . __('Open Docs', 'greet-bubble')
                        . '</a>',
                    'library' => 'video',
                ),

                array(
                    'id'     => 'bubble_buttons',
                    'type'   => 'group',
                    'max'    => 3,
                    'accordion_title_number' => true,
                    'title'  => esc_html__('Include Buttons', 'greet-bubble'),
                    'title_help' => '<div class="greet-bubble-info-label">' . __('Add custom buttons and choose what happens when users click them.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DEMO_URL.'" target="_blank">' . __('Live Demo', 'greet-bubble') . '</a><a class="tooltip_btn_secondary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                    'fields' => array(
                        array(
                            'id'    => 'button_text',
                            'title' => esc_html__('Button Label', 'greet-bubble'),
                            'title_help' => '<div class="greet-bubble-info-label">' . __('Enter the text that will appear on this button.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                            'type'  => 'text',
                            'default' => esc_html__('Make a Booking', 'greet-bubble'),
                        ),
                        array(
                            'id'    => 'button_icon',
                            'title' => esc_html__('Button Icon', 'greet-bubble'),
                            'title_help' => '<div class="greet-bubble-info-label">' . __('Choose an icon to display inside the button.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                            'type'  => 'icon',
                        ),
                        array(
                            'id'        => 'button_behavior',
                            'type'      => 'button_set',
                            'inline'    => 'true',
                            'title'     => esc_html__('Button Action', 'greet-bubble'),
                            'title_help' => '<div class="greet-bubble-info-label">' . __('Select what the button should do when clicked.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                            'options'    => array(
                                'another_video' => array('text' => __('Another Video', 'greet-bubble')),
                                'external_link' => array('text' => __('External Link', 'greet-bubble')),
                                'contact_form' => array(
                                    'text' => __('Contact Form', 'greet-bubble'),
                                    'pro_only'  => true,
                                ),
                            ),
                            'default' => 'another_video',
                        ),
                        array(
                            'id'      => 'video_link',
                            'type'    => 'media',
                            'title'   => esc_html__('Upload Video (MP4)*', 'greet-bubble'),
                            'desc'   => __('Upload an MP4 file to play when this button is clicked.', 'greet-bubble'),
                            'title_help' =>
                    '<div class="greet-bubble-info-label">'
                        . sprintf(
                            /* translators: %s = URL to video converter website */
                            __('If you don’t have an MP4 video, you can use %s to convert your file.', 'greet-bubble'),
                            '<a href="https://www.freeconvert.com" target="_blank">this tool</a>'
                        )
                        . '</div>'
                        . '<a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DEMO_URL.'" target="_blank">'
                        . __('Live Demo', 'greet-bubble')
                        . '</a>'
                        . '<a class="tooltip_btn_secondary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">'
                        . __('Open Docs', 'greet-bubble')
                        . '</a>',
                            'library' => 'video',
                            'dependency' => array('button_behavior', '==', 'another_video'),
                        ),
                        array(
                            'id'    => 'button_link',
                            'title' => esc_html__('Add Button Link', 'greet-bubble'),
                            'title_help' => '<div class="greet-bubble-info-label">' . __('Add the URL that should open when the button is clicked. Remove the URL if you want to load a second video instead.', 'greet-bubble') . '</div><a class="tooltip_btn_primary" href="'.GREET_BUBBLE_DOCS_URL.'greet-bubble-settings/general/?ref=1" target="_blank">' . __('Open Docs', 'greet-bubble') . '</a>',
                            'type'  => 'link',
                            'dependency' => array('button_behavior', '==', 'external_link'),
                        ),
                    ),
                ),
            )
        ));
    }
}
