<?php
/**
 * Template: single-dealer
 *
 * Single dealer page. Two-column layout: dealer-card on the left
 * (logo / contact / hours / map / description) and that dealer's
 * inventory on the right.
 *
 * @package ThemeREX\AutoDealer
 * @version 1.0.0
 */

declare(strict_types=1);

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

use ThemeREX\AutoDealer\Frontend\TemplateLoader;

TemplateLoader::renderHeader();

$dealer_id = (int) get_the_ID();
?>

<main id="primary" class="site-main trx-ad-dealer">
	<div class="trx-ad-dealer__container">

		<header class="trx-ad-dealer__header">
			<h1 class="trx-ad-dealer__title"><?php the_title(); ?></h1>
		</header>

		<div class="trx-ad-dealer__layout">
			<aside class="trx-ad-dealer__sidebar">
				<?php TemplateLoader::getTemplatePart( 'dealer-card', array( 'dealer_id' => $dealer_id ) ); ?>
			</aside>

			<section class="trx-ad-dealer__listings">
				<h2 class="trx-ad-dealer__listings-heading">
					<?php esc_html_e( 'Vehicles from this dealer', 'trx-auto-dealer' ); ?>
				</h2>
				<?php TemplateLoader::getTemplatePart( 'dealer-listings', array( 'dealer_id' => $dealer_id ) ); ?>
			</section>
		</div>

	</div>
</main>

<?php
TemplateLoader::renderFooter();
