<?php

namespace CarDealerPress\Templates\Admin\Theme\Navigation;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

use CarDealerPress\includes\helpers\helpers as helpers;
use CarDealerPress\Templates\Admin as templates;
use CarDealerPress\templates\partials\admin\Display;


function detail_nav() {
	// @codingStandardsIgnoreStart
	$safe = helpers::sanitize_get( $_GET );
	// @codingStandardsIgnoreEnd
	$section1 = $safe['section1'] ?? 'general';

	$content = '<div id="cdp-detail-wrapper" class="settings-wrapper display">';
	$content .= '<div class="wrap">';
	$content .= '<nav class="nav-tab-wrapper">';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=general" class="nav-tab ' . ( 'general' === $section1 ? 'nav-tab-active' : '' ) . '">General</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=similar_vehicles" class="nav-tab ' . ( 'similar_vehicles' === $section1 ? 'nav-tab-active' : '' ) . '">Similar Vehicles</a>';
	if ( function_exists( 'gravity_form' ) ) {
		$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=forms" class="nav-tab ' . ( 'forms' === $section1 ? 'nav-tab-active' : '' ) . '">Forms</a>';
	}
	if ( Display::theme_check() ) {
		$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=extra_boxes" class="nav-tab ' . ( 'extra_boxes' === $section1 ? 'nav-tab-active' : '' ) . '">Extra Boxes</a>';
		$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=maps" class="nav-tab ' . ( 'maps' === $section1 ? 'nav-tab-active' : '' ) . '">Maps</a>';
		$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=vehicle_attributes" class="nav-tab ' . ( 'vehicle_attributes' === $section1 ? 'nav-tab-active' : '' ) . '">Vehicle Attributes</a>';
	}
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=scripts" class="nav-tab ' . ( 'scripts' === $section1 ? 'nav-tab-active' : '' ) . '">Script</a>';
	$content .= '<a href="?page=cardealerpress_theme&tab=inventory_display&section=detail&section1=styles" class="nav-tab ' . ( 'styles' === $section1 ? 'nav-tab-active' : '' ) . '">Styles</a>';
	$content .= '</nav>';
	$content .= '<div class="tab-content">';
	switch ( $section1 ) :
		case 'general':
			$content .= templates\Theme\Inventory_Display\Detail\detail_general();
			break;
		case 'similar_vehicles':
			$content .= templates\Theme\Inventory_Display\Detail\similar_vehicles();
			break;
		case 'extra_boxes':
			$content .= templates\Theme\Inventory_Display\extra_boxes( array( 'location' => 'detail' ) );
			break;
		case 'forms':
			$content .= templates\Theme\Inventory_Display\Detail\forms();
			break;
		case 'maps':
			$content .= templates\Theme\Inventory_Display\Detail\maps();
			break;
		case 'vehicle_attributes':
			$content .= templates\Theme\Inventory_Display\vehicle_attributes( array( 'page' => 'detail' ) );
			break;
		case 'scripts':
			$content .= templates\Theme\injector_scripts_detail();
			break;
		case 'styles':
			$content .= templates\Theme\injector_style( array( 'location' => 'detail' ) );
			break;
	endswitch;
	$content .= '</div>';

	return $content;
}
