<?php

namespace CarDealerPress\Templates\Admin\Theme;

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

use CarDealerPress\Includes\Helpers\Option;
use CarDealerPress\templates\partials\admin\Table_Rows;

function general() {
	$content = '<table>';
	$content .= '<tbody>';
	$content .= '<tr><th><h2>General Settings</h2></th></tr>';
	$content .= theme_options();
	$content .= '</tbody>';
	$content .= '</table>';

	return $content;
}

function theme_options() {
	$themes  = \CarDealerPress\Admin\Functions\main::get_theme_names( 'inventory' );
	$value   = Option::check_for_option( 'cdp_theme_options', array( 'theme', 'general', 'name' ) );
	$content = table_rows::tr_select_dropown(
		array(
			'label' => 'Theme Name',
			'id'    => 'theme-name',
			'name'  => 'cdp_theme_options[theme][general][name]',
			'value' => $value,
			'list'  => $themes,
		)
	);

	// Armadillo VDP | Format
	if ( 'armadillo' === Option::check_for_option( 'cdp_theme_options', array( 'theme', 'general', 'name' ) ) ) {
		$content .= '<tr><th><h2>VDP Layout Option</h2></th></tr>';
		$value   = Option::check_for_option( 'cdp_theme_options', array( 'theme', 'general', 'detail_format' ) );
		$content .= table_rows::tr_select_dropown(
			array(
				'label' => 'Detail Format',
				'id'    => 'theme-detail-format]',
				'name'  => 'cdp_theme_options[theme][general][detail_format]',
				'value' => $value,
				'list'  => array( 'Default', 'Style 2' ),
			)
		);
	}

	return $content;
}
