<?php
 
add_action( 'pxl_post_metabox_register', 'solarva_page_options_register' );
function solarva_page_options_register( $metabox ) {
 
	$panels = [
		'post' => [
			'opt_name'            => 'post_option',
			'display_name'        => esc_html__( 'Post Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'post_settings' => [
					'title'  => esc_html__( 'Post Options', 'solarva' ),
					'icon'   => 'el el-cog',
					'fields' => array_merge(
						solarva_sidebar_pos_opts(['prefix' => 'post_', 'default' => true, 'default_value' => '-1']),
						array(
							array(
					            'id'=> 'post_video_link',
					            'type' => 'text',
					            'title' => esc_html__('Video Link', 'solarva'),
					            'validate' => 'url',
					            'default' => '',
					        ),
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'solarva' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
					    )
					)
				]
			]
		],
		'page' => [
			'opt_name'            => 'pxl_page_options',
			'display_name'        => esc_html__( 'Page Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'Header', 'solarva' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
				        solarva_header_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						solarva_header_mobile_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
				                'id'       => 'header_display',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Header Display', 'solarva'),
				                'options'  => array(
				                    'show' => esc_html__('Show', 'solarva'),
				                    'hide'  => esc_html__('Hide', 'solarva'),
				                ),
				                'default'  => 'show',
				            ),
				            array(
				                'id'       => 'page_mobile_style',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Mobile Style', 'solarva'),
				                'options'  => array(
				                    'inherit'  => esc_html__('Inherit', 'solarva'),
				                    'light'  => esc_html__('Light', 'solarva'),
				                    'dark'  => esc_html__('Dark', 'solarva'),
				                ),
				                'default'  => 'inherit',
				            ),
				            array(
				           		'id'       => 'logo_m',
					            'type'     => 'media',
					            'title'    => esc_html__('Mobile Logo Dark', 'solarva'),
					            'default'  => '',
					            'url'      => false,
					        ),
					        array(
				           		'id'       => 'logo_light_m',
					            'type'     => 'media',
					            'title'    => esc_html__('Mobile Logo Light', 'solarva'),
					            'default'  => '',
					            'url'      => false,
					        ),
					        array(
				                'id'       => 'p_menu',
				                'type'     => 'select',
				                'title'    => esc_html__( 'Menu', 'solarva' ),
				                'options'  => solarva_get_nav_menu_slug(),
				                'default' => '',
				                'description' => 'When you select Custom Menu. The custom menu will apply to the entire layout when you use Case Nav Menu widget in Elementor and Menu on header layout in Mobile.'
				            ),
					    ),
					    array(
				            array(
				                'id'       => 'sticky_scroll',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Sticky Scroll', 'solarva'),
				                'options'  => array(
				                    '-1' => esc_html__('Inherit', 'solarva'),
				                    'pxl-sticky-stt' => esc_html__('Scroll To Top', 'solarva'),
				                    'pxl-sticky-stb'  => esc_html__('Scroll To Bottom', 'solarva'),
				                ),
				                'default'  => '-1',
				            ),
				            array(
				                'id'       => 'header_margin',
				                'type'     => 'spacing',
				                'mode'     => 'margin',
				                'title'    => esc_html__('Margin', 'solarva'),
				                'width'    => false,
				                'unit'     => 'px',
				                'output'    => array('#pxl-header-elementor .pxl-header-elementor-main'),
				            ),
				        )
				    )
					 
				],
				'page_title' => [
					'title'  => esc_html__( 'Page Title', 'solarva' ),
					'icon'   => 'el el-indent-left',
					'fields' => array_merge(
				        solarva_page_title_opts([
							'default'         => true,
							'default_value'   => '-1'
						])
				    )
				],
				'content' => [
					'title'  => esc_html__( 'Content', 'solarva' ),
					'icon'   => 'el-icon-pencil',
					'fields' => array_merge(
						solarva_sidebar_pos_opts(['prefix' => 'page_', 'default' => false, 'default_value' => '0']),
						array(
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Spacing Top/Bottom', 'solarva' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							), 
					    )
					)
				],
				'footer' => [
					'title'  => esc_html__( 'Footer', 'solarva' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        solarva_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
						array(
							array(
				                'id'       => 'footer_display',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Footer Display', 'solarva'),
				                'options'  => array(
				                    'show' => esc_html__('Show', 'solarva'),
				                    'hide'  => esc_html__('Hide', 'solarva'),
				                ),
				                'default'  => 'show',
				            ),
							array(
				                'id'       => 'p_footer_fixed',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Footer Fixed', 'solarva'),
				                'options'  => array(
				                    'inherit' => esc_html__('Inherit', 'solarva'),
				                    'on' => esc_html__('On', 'solarva'),
				                    'off' => esc_html__('Off', 'solarva'),
				                ),
				                'default'  => 'inherit',
				            ),
				            array(
				                'id'       => 'back_top_top_style',
				                'type'     => 'button_set',
				                'title'    => esc_html__('Back to Top Style', 'solarva'),
				                'options'  => array(
				                    'style-default' => esc_html__('Default', 'solarva'),
				                    'style-round' => esc_html__('Round', 'solarva'),
				                ),
				                'default'  => 'style-default',
				            ),
						)
				    )
				],
				'colors' => [
					'title'  => esc_html__( 'Colors', 'solarva' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        array(
				        	array(
							    'id'        => 'page_body_color',
							    'type'      => 'color',
							    'title'     => esc_html__('Body Background Color', 'solarva'),
							    'default'   => '',
							    'transparent' => false,
							    'output'    => array(
							        'background-color' => 'body',
							    )
							),
				        	array(
					            'id'          => 'primary_color',
					            'type'        => 'color',
					            'title'       => esc_html__('Primary Color', 'solarva'),
					            'transparent' => false,
					            'default'     => ''
					        ),
					        array(
					            'id'          => 'gradient_color',
					            'type'        => 'color_gradient',
					            'title'       => esc_html__('Gradient Color', 'solarva'),
					            'transparent' => false,
					            'default'  => array(
					                'from' => '',
					                'to'   => '', 
					            ),
					        ),
					    )
				    )
				],
				'extra' => [
					'title'  => esc_html__( 'Extra', 'solarva' ),
					'icon'   => 'el el-website',
					'fields' => array_merge(
				        array(
				        	array(
					            'id' => 'body_custom_class',
					            'type' => 'text',
					            'title' => esc_html__('Body Custom Class', 'solarva'),
					        ),
					    )
				    )
				]
			]
		],
		'portfolio' => [
			'opt_name'            => 'pxl_portfolio_options',
			'display_name'        => esc_html__( 'Portfolio Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'solarva' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'solarva' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						)
				    )
				],
				'infos' => [
					'title'  => esc_html__( 'Info', 'solarva' ),
					'icon'   => 'eicon-info-circle-o',
					'fields' => array( 
						array(
							'id'=> 'portfolio_info1',
							'type' => 'text',
							'title' => esc_html__('Info 1', 'solarva'),
							'default' => '',
						),
						array(
							'id'=> 'portfolio_info2',
							'type' => 'text',
							'title' => esc_html__('Info 2', 'solarva'),
							'default' => '',
						),
						array(
							'id'=> 'portfolio_info3',
							'type' => 'text',
							'title' => esc_html__('Info 3', 'solarva'),
							'default' => '',
						),
					),
				],
			]
		],
		'service' => [
			'opt_name'            => 'pxl_service_options',
			'display_name'        => esc_html__( 'Service Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'solarva' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(					
							array(
					            'id'=> 'service_external_link',
					            'type' => 'text',
					            'title' => esc_html__('External Link', 'solarva'),
					            'validate' => 'url',
					            'default' => '',
					        ),
					        array(
					            'id'       => 'service_icon_type',
					            'type'     => 'button_set',
					            'title'    => esc_html__('Icon Type', 'solarva'),
					            'options'  => array(
					                'icon'  => esc_html__('Icon', 'solarva'),
					                'image'  => esc_html__('Image', 'solarva'),
					            ),
					            'default'  => 'icon'
					        ),
					        array(
					            'id'       => 'service_icon_font',
					            'type'     => 'pxl_iconpicker',
					            'title'    => esc_html__('Icon', 'solarva'),
					            'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'icon' ),
            					'force_output' => true
					        ),
					        array(
					            'id'       => 'service_icon_img',
					            'type'     => 'media',
					            'title'    => esc_html__('Icon Image', 'solarva'),
					            'default' => '',
					            'required' => array( 0 => 'service_icon_type', 1 => 'equals', 2 => 'image' ),
				            	'force_output' => true
					        ),
							array(
					            'id'=> 'service_feature_list',
					            'type' => 'textarea',
					            'title' => esc_html__('Feature List', 'solarva'),
					            'validate' => 'html_custom',
					            'default' => '',
								'description' => esc_html__('Enter the list items into the cell text area, separating each item with "|"', 'solarva'),
					        ),
							// 
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'solarva' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						),
						solarva_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
				    ),
				],
			]
		],

		'team' => [
			'opt_name'            => 'pxl_team_options',
			'display_name'        => esc_html__( 'Team Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'solarva' ),
					'icon'   => 'el-icon-website',
					'fields' => array_merge(
						array(					
							array(
					            'id'=> 'team_position',
					            'type' => 'text',
					            'title' => esc_html__('Position', 'solarva'),
								'placeholder' => esc_html__('Head Of Operation', 'solarva'),
					        ),
							array(
					            'id'=> 'team_email',
					            'type' => 'text',
					            'title' => esc_html__('Email', 'solarva'),
								'placeholder' => esc_html__('user@gmail.com', 'solarva'),
					        ),
							array(
					            'id'=> 'team_phone_number',
					            'type' => 'text',
					            'title' => esc_html__('Phone Number', 'solarva'),
								'placeholder' => esc_html__('+84126 032 001', 'solarva'),
					        ),
							array(
					            'id'=> 'team_address',
					            'type' => 'text',
					            'title' => esc_html__('Address', 'solarva'),
								'placeholder' => esc_html__('231, Utah Downtown Mall, USA', 'solarva'),
					        ),
							// 
					        array(
								'id'             => 'content_spacing',
								'type'           => 'spacing',
								'output'         => array( '#pxl-wapper #pxl-main' ),
								'right'          => false,
								'left'           => false,
								'mode'           => 'padding',
								'units'          => array( 'px' ),
								'units_extended' => 'false',
								'title'          => esc_html__( 'Content Spacing Top/Bottom', 'solarva' ),
								'default'        => array(
									'padding-top'    => '',
									'padding-bottom' => '',
									'units'          => 'px',
								)
							),
						),



						solarva_footer_opts([
							'default'         => true,
							'default_value'   => '-1'
						]),
				    ),
				],
				'socials' => [
					'title'  => esc_html__( 'Socials', 'solarva' ),
					'icon'   => ' eicon-social-icons',
					'fields' => array( 
						array(
							'id'       => 'team_social_share',
							'title'    => esc_html__('Social', 'solarva'),
							'subtitle' => esc_html__('Display the Social Share for blog team.', 'solarva'),
							'type'     => 'switch',
							'default'  => true,
						),
						array(
							'id'       => 'social_pinterest',
							'title'    => esc_html__('Pinterest', 'solarva'),
							'type'     => 'switch',
							'default'  => false,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
							'divider'  => false,
						),
						array(
							'id'       => 'link_social_pinterest',
							'title'    => esc_html__('Link Pinterest', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_pinterest', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'social_youtube',
							'title'    => esc_html__('Youtube', 'solarva'),
							'type'     => 'switch',
							'default'  => false,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'link_social_youtube',
							'title'    => esc_html__('Link Youtube', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_youtube', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'social_linkedin',
							'title'    => esc_html__('LinkedIn', 'solarva'),
							'type'     => 'switch',
							'default'  => true,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'link_social_linkedin',
							'title'    => esc_html__('Link Linked', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_linkedin', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'social_instagram',
							'title'    => esc_html__('Instagram', 'solarva'),
							'type'     => 'switch',
							'default'  => true,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'link_social_instagram',
							'title'    => esc_html__('Link Instagram', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_instagram', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'social_twitter',
							'title'    => esc_html__('Twitter', 'solarva'),
							'type'     => 'switch',
							'default'  => true,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'link_social_twitter',
							'title'    => esc_html__('Link Twitter', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_twitter', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'social_facebook',
							'title'    => esc_html__('Facebook', 'solarva'),
							'type'     => 'switch',
							'default'  => true,
							'required' => array( 0 => 'team_social_share', 1 => 'equals', 2 => '1' ),
						),
						array(
							'id'       => 'link_social_facebook',
							'title'    => esc_html__('Link Facebook', 'solarva'),
							'type'     => 'text',
							'default'  => '#',
							'required' => array( 0 => 'social_facebook', 1 => 'equals', 2 => '1' ),
						),
					),
				]
				
			]
		],


		'pxl-template' => [ //post_type
			'opt_name'            => 'pxl_hidden_template_options',
			'display_name'        => esc_html__( 'Template Options', 'solarva' ),
			'show_options_object' => false,
			'context'  => 'advanced',
			'priority' => 'default',
			'sections'  => [
				'header' => [
					'title'  => esc_html__( 'General', 'solarva' ),
					'icon'   => 'el-icon-website',
					'fields' => array(
						array(
							'id'    => 'template_type',
							'type'  => 'select',
							'title' => esc_html__('Type', 'solarva'),
				            'options' => [
				            	'df'       	   => esc_html__('Select Type', 'solarva'), 
								'header'       => esc_html__('Header Desktop', 'solarva'),
								'header-mobile'       => esc_html__('Header Mobile', 'solarva'),
								'footer'       => esc_html__('Footer', 'solarva'), 
								'mega-menu'    => esc_html__('Mega Menu', 'solarva'), 
								'page-title'   => esc_html__('Page Title', 'solarva'), 
								'tab' => esc_html__('Tab', 'solarva'),
								'hidden-panel' => esc_html__('Hidden Panel', 'solarva'),
								'popup' => esc_html__('Popup', 'solarva'),
								'page' => esc_html__('Page', 'solarva'),
								'slider' => esc_html__('Slider', 'solarva'),
				            ],
				            'default' => 'df',
				        ),
				        array(
							'id'    => 'header_type',
							'type'  => 'select',
							'title' => esc_html__('Header Type', 'solarva'),
				            'options' => [
				            	'px-header--default'       	   => esc_html__('Default', 'solarva'), 
								'px-header--transparent'       => esc_html__('Transparent', 'solarva'),
				            ],
				            'default' => 'px-header--default',
				            'indent' => true,
                			'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header' ),
				        ),

				        array(
							'id'    => 'header_mobile_type',
							'type'  => 'select',
							'title' => esc_html__('Header Type', 'solarva'),
				            'options' => [
				            	'px-header--default'       	   => esc_html__('Default', 'solarva'), 
								'px-header--transparent'       => esc_html__('Transparent', 'solarva'),
				            ],
				            'default' => 'px-header--default',
				            'indent' => true,
                			'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'header-mobile' ),
				        ),

				        array(
							'id'    => 'hidden_panel_position',
							'type'  => 'select',
							'title' => esc_html__('Hidden Panel Position', 'solarva'),
				            'options' => [
				            	'top'       	   => esc_html__('Top', 'solarva'),
				            	'right'       	   => esc_html__('Right', 'solarva'),
				            ],
				            'default' => 'right',
				            'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
				        ),
				        array(
				            'id'          => 'hidden_panel_height',
				            'type'        => 'text',
				            'title'       => esc_html__('Hidden Panel Height', 'solarva'),
				            'subtitle'       => esc_html__('Enter number. Default is auto.', 'solarva'),
				            'transparent' => false,
				            'default'     => '',
				            'force_output' => true,
				            'required' => array( 0 => 'hidden_panel_position', 1 => 'equals', 2 => 'top' ),
				        ),
				        array(
				            'id'          => 'hidden_panel_boxcolor',
				            'type'        => 'color',
				            'title'       => esc_html__('Box Color', 'solarva'),
				            'transparent' => false,
				            'default'     => '',
				            'required' => array( 0 => 'template_type', 1 => 'equals', 2 => 'hidden-panel' ),
				        ),
					),
				    
				],
			]
		],
	];
 
	$metabox->add_meta_data( $panels );
}
 