<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

use Carbon_Fields\Field\Field;
use Gigneo\Theme_Option;

//Tab Main Heading
$gigneo_template_main_heading = Theme_Option::render_heading_markup(
	esc_html__( 'Template', 'gigneo' ),
	esc_html__( 'Manage and configure platform templates.', 'gigneo' )
);

$gigneo_template_fields[] =
	Field::make( 'html', 'gigneo_ts_main_heading_template' )
		->set_html( $gigneo_template_main_heading )
		->set_classes( 'gn-ts-main-heading' );

//General
$gigneo_template_general_heading = Theme_Option::render_heading_markup(
	esc_html__( 'General', 'gigneo' ),
	esc_html__( 'Set general dashboard, privacy and terms templates here.', 'gigneo' )
);

$gigneo_general_template_fields[] =
	Field::make( 'html', 'gigneo_ts_heading_general_templates' )
		->set_html( $gigneo_template_general_heading )
		->set_classes( 'gn-ts-field-heading' );

$gigneo_general_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_dashboard', esc_html__( 'Dashboard', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_general_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_hire', esc_html__( 'Hire', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_general_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_privacy_policy', esc_html__( 'Privacy policy', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_general_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_terms_and_condition', esc_html__( 'Terms and condition', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_general_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_contact', esc_html__( 'Contact', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_general_template_fields = apply_filters( 'gigneo_ts_tab_template_section_general_fields', $gigneo_general_template_fields );
$gigneo_template_fields         = array_merge( $gigneo_template_fields, $gigneo_general_template_fields );

//Auth
$gigneo_auth_template_fields[] =
	Field::make( 'html', 'gigneo_ts_separator_auth_templates' )
		->set_html( '<hr>' )
		->set_classes( 'gn-separator' );

$gigneo_other_template_heading = Theme_Option::render_heading_markup(
	esc_html__( 'Auth', 'gigneo' ),
	esc_html__( 'Set login, register and forget password templates.', 'gigneo' )
);

$gigneo_auth_template_fields[] =
	Field::make( 'html', 'gigneo_ts_heading_auth_template' )
		->set_html( $gigneo_other_template_heading )
		->set_classes( 'gn-ts-field-heading' );

$gigneo_auth_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_login', esc_html__( 'Login', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_auth_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_register', esc_html__( 'Register', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_auth_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_forgot_password', esc_html__( 'Forgot password', 'gigneo' ) )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

$gigneo_auth_template_fields = apply_filters( 'gigneo_ts_tab_template_section_auth_fields', $gigneo_auth_template_fields );
$gigneo_template_fields      = array_merge( $gigneo_template_fields, $gigneo_auth_template_fields );

//Archives
$gigneo_archive_template_fields[] =
	Field::make( 'html', 'gigneo_ts_separator_archive_template' )
		->set_html( '<hr>' )
		->set_classes( 'gn-separator' );

$gigneo_template_archive_heading = Theme_Option::render_heading_markup(
	esc_html__( 'Archive', 'gigneo' ),
	esc_html__( 'Set posts archive templates here.', 'gigneo' )
);

$gigneo_archive_template_fields[] =
	Field::make( 'html', 'gigneo_ts_heading_archive_template' )
		->set_html( $gigneo_template_archive_heading )
		->set_classes( 'gn-ts-field-heading' );

$gigneo_archive_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_freelancers', gigneo_freelancer_plural() )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

if ( 'jobs' !== gigneo_platform_type() ) {
	$gigneo_archive_template_fields[] =
		Field::make( 'select', 'gigneo_ts_template_services', esc_html__( 'Services', 'gigneo' ) )
			->set_options( gigneo_get_pages() )
			->set_classes( 'gn-select2' )
			->set_default_value( '' );
}


$gigneo_archive_template_fields[] =
	Field::make( 'select', 'gigneo_ts_template_employers', gigneo_employer_plural() )
		->set_options( gigneo_get_pages() )
		->set_classes( 'gn-select2' )
		->set_default_value( '' );

if ( 'services' !== gigneo_platform_type() ) {
	$gigneo_archive_template_fields[] =
		Field::make( 'select', 'gigneo_ts_template_jobs', esc_html__( 'Jobs', 'gigneo' ) )
			->set_options( gigneo_get_pages() )
			->set_classes( 'gn-select2' )
			->set_default_value( '' );
}

$gigneo_archive_template_fields = apply_filters( 'gigneo_ts_tab_template_section_archive_fields', $gigneo_archive_template_fields );
$gigneo_template_fields         = array_merge( $gigneo_template_fields, $gigneo_archive_template_fields );
