<?php
// note: used in Inventory Detail Shortcode with Razor display.

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

use CarDealerPress\includes\functions\Fn_Inventory;
use CarDealerPress\includes\helpers\helpers as helpers;

//$content = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
//$content .= '<html xmlns="https://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US" prefix="og: http://ogp.me/ns#">';
//$content .= '<head>';
//$content .= '<title>Vehicle Form Entry</title>';
//$content .= '<script type="text/javascript" src="' . esc_url(includes_url( 'js/jquery/jquery.js' )) . '"></script>';
//$content .= '</head>';
//$content .= '<body>';
//echo $content;

// @codingStandardsIgnoreStart
$safe = helpers::sanitize_get( $_GET );
// @codingStandardsIgnoreEnd

if ( isset( $safe['vin'] ) ) {
	$vin                         = $safe['vin'];
	$db_vehicle_result           = $this->db_requests->cdp_db_init( 'inventory', array( 'vin' => $vin ) );
	$db_vehicle                  = $db_vehicle_result ? $db_vehicle_result[0] : array();
	$price                       = ( new Fn_Inventory() )->get_price_display(
		array(
			'company' => $this->company,
			'vehicle' => $db_vehicle,
			'theme'   => 'from-popup',
		)
	);
	$db_vehicle['primary_price'] = $price['primary_price'];

	( new Fn_Inventory() )->apply_gravity_form_hooks( $db_vehicle );
	gravity_form( $safe['form_id'], $display_title = true, $display_description = false, $display_inactive = false, $field_values = false, $ajax = false, $tabindex = 0, $echo = true );
}
//echo '</body></html>';
