<?php

namespace Layerdrops\Ostech\Widgets;


class Register extends \Elementor\Widget_Base
{
    public function get_name()
    {
        return 'ostech-register';
    }

    public function get_title()
    {
        return __('Register', 'ostech-addon');
    }

    public function get_icon()
    {
        return 'eicon-cogs';
    }

    public function get_categories()
    {
        return ['ostech-category'];
    }

    protected function register_controls()
    {
        $this->start_controls_section(
            'layout_section',
            [
                'label' => __('Layout', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
            ]
        );

        $this->add_control(
            'layout_type',
            [
                'label' => __('Select Layout', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::SELECT2,
                'default' => 'layout_one',
                'options' => [
                    'layout_one' => __('Layout One', 'ostech-addon'),
                ]
            ]
        );

        $this->end_controls_section();


        $this->start_controls_section(
            'content_section',
            [
                'label' => __('Content', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
                'condition' => [
                    'layout_type' => 'layout_one'
                ]
            ]
        );
        $this->add_control(
            'title',
            [
                'label' => __('Title', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Register ', 'ostech-addon'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'email_placeholder',
            [
                'label' => __('Email Placeholder', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Email Address', 'ostech-addon'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'password_placeholder',
            [
                'label' => __('Placeholder for Password', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Password* ', 'ostech-addon'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'privacy_text',
            [
                'label' => __('Privacy Text', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::TEXTAREA,
                'default' => __('I accept company <a href="#">privacy policy</a>.', 'ostech-addon'),
                'label_block' => true,
            ]
        );

        $this->add_control(
            'register_btn_text',
            [
                'label' => __('Register Button Text', 'ostech-addon'),
                'type' => \Elementor\Controls_Manager::TEXT,
                'default' => __('Register', 'ostech-addon'),
                'label_block' => true,
            ]
        );

        $this->end_controls_section();


        //style
        $this->start_controls_section(
            'style_options',
            [
                'label' => esc_html__('Style Options', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );
        ostech_elementor_general_style_options($this, 'Title', '{{WRAPPER}} .login-page__wrap__title', ['layout_one']);
        ostech_elementor_general_style_options($this, 'Privacy', '{{WRAPPER}} .login-page__form .checked-box label,{{WRAPPER}} .login-page__form .checked-box label a', ['layout_one']);
        $this->end_controls_section();

        //button style
        $this->start_controls_section(
            'button_style',
            [
                'label' => esc_html__('Button Style', 'ostech-addon'),
                'tab' => \Elementor\Controls_Manager::TAB_STYLE,
            ]
        );

        ostech_elementor_button_style_options($this, 'Button', '{{WRAPPER}} .ostech-btn', '{{WRAPPER}} .ostech-btn:hover', ['layout_one']);

        $this->end_controls_section();
    }

    protected function render()
    {
        $settings = $this->get_settings_for_display();
        include ostech_get_template('register-one.php');
    }
}
