<?php

namespace WPTE_PRODUCT_LAYOUT\Layouts\Table\Backend;

use WPTE_PRODUCT_LAYOUT\Includes\Controls;
use WPTE_PRODUCT_LAYOUT\Layouts\Table\Layout;

/**
 * Layout1
 */
class Layout1 extends Layout {
	/**
	 * Method register_controls
	 *
	 * @return void
	 */
	public function register_layout() {

		// Start Genetal Tabs.
		$this->start_section_tabs(
			'wpte-table-section-layout1-tabs',
			[
				'condition' => [
					'general',
				],
			]
		);

		$this->start_controls_section(
			'wpte_product_layout_settings',
			[
				'label'   => 'Layouts',
				'showing' => true,
			]
		);

		$this->add_extra_control(
			'wpte_product_layout_header',
			$this->style,
			[
				'label' => 'Hide & Show',
				'type'  => Controls::HEADING,
				'css'   => 'padding-top:10px; padding-bottom:10px',
			]
		);

		$this->add_control(
			'wpte_table_products_show_image',
			$this->style,
			[
				'label'        => __( 'Show Image', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'return_value' => 'yes',
			]
		);

		$this->add_control(
			'wpte_table_products_show_title',
			$this->style,
			[
				'label'        => __( 'Show Name', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'return_value' => 'yes',
			]
		);

		$this->add_control(
			'wpte_table_products_show_description',
			$this->style,
			[
				'label'        => __( 'Show Description', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'return_value' => 'yes',
			]
		);

		$this->add_control(
			'wpte_table_products_show_price',
			$this->style,
			[
				'label'        => __( 'Show Price', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'return_value' => 'yes',
			]
		);

		$this->add_control(
			'wpte_table_products_show_qty',
			$this->style,
			[
				'label'        => __( 'Show Quantity', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'return_value' => 'yes',
			]
		);

		$this->add_control(
			'wpte_table_products_show_icons',
			$this->style,
			[
				'label'        => __( 'Show Button', 'product-layouts' ),
				'type'         => Controls::SWITCHER,
				'default'      => 'no',
				'label_on'     => __( 'Yes', 'product-layouts' ),
				'label_off'    => __( 'No', 'product-layouts' ),
				'css'          => 'padding-bottom:10px',
				'return_value' => 'yes',
			]
		);

		$this->end_controls_section();

		// Initial Controls from Layout.php
		// ================================================.
		$this->wpte_intial_controls();
		// ================================================

		// =============CART SETTINGS=====================
		$this->start_controls_section(
			'wpte-product-table-style-1-icons',
			[
				'label'     => 'Button Setting',
				'showing'   => true,
				'condition' => [
					'wpte_table_products_show_icons' => 'yes',
				],
			]
		);

		$this->add_group_control(
			'wpte-product-table-style-1-cart-icon',
			$this->style,
			[
				'type'        => Controls::CART,
				'default'     => __( 'Cart Icons', 'product-layouts' ),
				'operator'    => 'icontext', // icon, text, icontext.
				'condition'   => [
					'wpte_table_products_show_icons' => 'yes',
				],
				'description' => '',
			]
		);

		$this->end_controls_section();

		// =============END CART SETTINGS=====================

		$this->end_section_tabs();

		/**
		 * =========================================================================
		 * =================================STAET STYLE TAB=========================
		 * =========================================================================
		 */
		$this->start_section_tabs(
			'wpte-table-section-layout1-style-tabs',
			[
				'condition' => [
					'style',
				],
			]
		);

		$this->wpte_product_table_setting_style();
		$this->wpte_product_table_image_style();
		$this->wpte_product_table_title_style();
		$this->wpte_product_table_description_style();
		$this->wpte_price_style();
		$this->wpte_product_table_quantity_style();
		$this->wpte_product_table_button_style();

		$this->end_section_tabs();
	}
}
