<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
use Twig\TemplateWrapper;
/* infoauto/index.html.twig */
class __TwigTemplate_06d4db2ad70c109ada4148da0df63aa4 extends Template
{
private Source $source;
/**
* @var array<string, Template>
*/
private array $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->blocks = [
'title' => [$this, 'block_title'],
'body' => [$this, 'block_body'],
'javascripts' => [$this, 'block_javascripts'],
];
}
protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
{
// line 1
return "base.html.twig";
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "infoauto/index.html.twig"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "infoauto/index.html.twig"));
$this->parent = $this->load("base.html.twig", 1);
yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
}
// line 3
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_title(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "title"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "title"));
yield "Infoauto - Precios";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
yield from [];
}
// line 5
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_body(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "body"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "body"));
// line 6
yield " <h1>Infoauto - Precios</h1>
<div class=\"row mt-3 border border-1 container-options\">
<div class=\"col-12 col-lg-2 border-end container-brands\">
<h4 class=\"text-center\">Marca</h4>
<div class=\"list-group\">
";
// line 13
$context['_parent'] = $context;
$context['_seq'] = CoreExtension::ensureTraversable((isset($context["brands"]) || array_key_exists("brands", $context) ? $context["brands"] : (function () { throw new RuntimeError('Variable "brands" does not exist.', 13, $this->source); })()));
foreach ($context['_seq'] as $context["key"] => $context["item"]) {
// line 14
yield " <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-brand\" data-key=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["key"], "html", null, true);
yield "\" data-id=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["item"], "brandId", [], "any", false, false, false, 14), "html", null, true);
yield "\" data-name=\"";
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["item"], "brandName", [], "any", false, false, false, 14), "html", null, true);
yield "\">
";
// line 15
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, $context["item"], "brandName", [], "any", false, false, false, 15), "html", null, true);
yield "
</button>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['key'], $context['item'], $context['_parent']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 18
yield " </div>
</div>
<div class=\"col-12 col-lg-2 border-end container-models\">
<h4 class=\"text-center\">Modelo</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-2 border-end container-years\">
<h4 class=\"text-center\">Fabricación</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-4 border-end container-versions\">
<h4 class=\"text-center\">Versión</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-2 container-prices\">
<h4 class=\"text-center\">Precio</h4>
<div class=\"list-group\"></div>
</div>
</div>
<style>
.container-options {
height: calc(100vh - 230px);
}
.container-brands, .container-models, .container-years, .container-versions, .container-prices {
overflow-y: auto;
height: 100%;
}
</style>
";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
yield from [];
}
// line 54
/**
* @return iterable<null|scalar|\Stringable>
*/
public function block_javascripts(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$__internal_5a27a8ba21ca79b61932376b2fa922d2 = $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
$__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block", "javascripts"));
// line 55
yield " ";
yield from $this->yieldParentBlock("javascripts", $context, $blocks);
yield "
<script src=\"";
// line 57
yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("js/jquery.tmpl.min.js"), "html", null, true);
yield "\"></script>
<script type=\"text/javascript\">
var brands = ";
// line 60
yield json_encode((isset($context["brands"]) || array_key_exists("brands", $context) ? $context["brands"] : (function () { throw new RuntimeError('Variable "brands" does not exist.', 60, $this->source); })()));
yield ";
var brandSelected = 0;
var modelSelected = 0;
var yearSelected = 0;
var versionSelected = 0;
console.log(brands);
\$('.btn-brand').click(function() {
\$('.container-brands .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-models .list-group button').remove();
brands[\$(this).data('key')].brandGroups.sort((a, b) => a.name.localeCompare(b.name));
brandSelected = \$(this).data('id');
\$.each(brands[\$(this).data('key')].brandGroups, function(index, item) {
\$('.container-models .list-group').append( \$('#button-model-template').tmpl({ type: 'model', key: index, id: item.id, name: item.name, list_price: item.list_price, groups: JSON.stringify(item) }) );
});
});
\$(document).off('click', '.btn-model').on('click', '.btn-model', function() {
\$('.container-models .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-years .list-group button').remove();
\$('.container-versions .list-group button').remove();
\$('.container-prices .list-group button').remove();
modelSelected = \$(this).data('id');
if (\$(this).data('list-price')) {
\$('.container-years .list-group').append(\$('#button-year-template').tmpl({type: 'year', year: '0km'}));
}
let groups = JSON.parse( \$(this).attr('data-groups') );
for (var i = groups.prices_to; i >= groups.prices_from; i--) {
\$('.container-years .list-group').append( \$('#button-year-template').tmpl({ type: 'year', year: i }) );
}
});
\$(document).off('click', '.btn-year').on('click', '.btn-year', function() {
\$('.container-years .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-versions .list-group button').remove();
\$('.container-prices .list-group button').remove();
yearSelected = \$(this).data('year');
\$('.spinner-' + yearSelected + ' div').removeClass('spinner-hide');
\$.get('";
// line 109
yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("infoauto_get_versions");
yield "', {brandId:brandSelected, modelId:modelSelected, modelYear:yearSelected }, function(data) {
\$.each(data, function(index, item) {
\$('.container-versions .list-group').append( \$('#button-version-template').tmpl({ type: 'version', name: item.name, price: item.price, codia: item.codia }) );
});
\$('.spinner-' + yearSelected + ' > div').addClass('spinner-hide');
});
});
\$(document).off('click', '.btn-version').on('click', '.btn-version', function() {
\$('.container-versions .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-prices .list-group button').remove();
\$('.container-prices .list-group').append( \$('#button-price-template').tmpl({ type: 'price', price: \$(this).data('price'), codia: \$(this).data('codia') }) );
});
function formatNumber(num) {
return new Intl.NumberFormat('es-ES', { minimumFractionDigits: 0 }).format(num);
}
</script>
<script id=\"button-model-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-key=\"\${key}\" data-id=\"\${id}\" data-name=\"\${name}\" data-list-price=\"\${list_price}\" data-groups='\${groups}'>
\${name}
</button>
</script>
<script id=\"button-year-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type} spinner-\${year}\" data-year=\"\${year}\">
\${year}
<div class=\"spinner-border text-white float-end spinner-hide\" role=\"status\">
<span class=\"visually-hidden\"></span>
</div>
</button>
</script>
<script id=\"button-version-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
\${name}
</button>
</script>
<script id=\"button-price-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
\$ \${price}.000
</button>
</script>
";
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
yield from [];
}
/**
* @codeCoverageIgnore
*/
public function getTemplateName(): string
{
return "infoauto/index.html.twig";
}
/**
* @codeCoverageIgnore
*/
public function isTraitable(): bool
{
return false;
}
/**
* @codeCoverageIgnore
*/
public function getDebugInfo(): array
{
return array ( 254 => 109, 202 => 60, 196 => 57, 190 => 55, 177 => 54, 132 => 18, 123 => 15, 114 => 14, 110 => 13, 101 => 6, 88 => 5, 65 => 3, 42 => 1,);
}
public function getSourceContext(): Source
{
return new Source("{% extends 'base.html.twig' %}
{% block title %}Infoauto - Precios{% endblock %}
{% block body %}
<h1>Infoauto - Precios</h1>
<div class=\"row mt-3 border border-1 container-options\">
<div class=\"col-12 col-lg-2 border-end container-brands\">
<h4 class=\"text-center\">Marca</h4>
<div class=\"list-group\">
{% for key, item in brands %}
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-brand\" data-key=\"{{ key }}\" data-id=\"{{ item.brandId }}\" data-name=\"{{ item.brandName }}\">
{{ item.brandName }}
</button>
{% endfor %}
</div>
</div>
<div class=\"col-12 col-lg-2 border-end container-models\">
<h4 class=\"text-center\">Modelo</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-2 border-end container-years\">
<h4 class=\"text-center\">Fabricación</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-4 border-end container-versions\">
<h4 class=\"text-center\">Versión</h4>
<div class=\"list-group\"></div>
</div>
<div class=\"col-12 col-lg-2 container-prices\">
<h4 class=\"text-center\">Precio</h4>
<div class=\"list-group\"></div>
</div>
</div>
<style>
.container-options {
height: calc(100vh - 230px);
}
.container-brands, .container-models, .container-years, .container-versions, .container-prices {
overflow-y: auto;
height: 100%;
}
</style>
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script src=\"{{ asset('js/jquery.tmpl.min.js') }}\"></script>
<script type=\"text/javascript\">
var brands = {{ brands|json_encode|raw }};
var brandSelected = 0;
var modelSelected = 0;
var yearSelected = 0;
var versionSelected = 0;
console.log(brands);
\$('.btn-brand').click(function() {
\$('.container-brands .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-models .list-group button').remove();
brands[\$(this).data('key')].brandGroups.sort((a, b) => a.name.localeCompare(b.name));
brandSelected = \$(this).data('id');
\$.each(brands[\$(this).data('key')].brandGroups, function(index, item) {
\$('.container-models .list-group').append( \$('#button-model-template').tmpl({ type: 'model', key: index, id: item.id, name: item.name, list_price: item.list_price, groups: JSON.stringify(item) }) );
});
});
\$(document).off('click', '.btn-model').on('click', '.btn-model', function() {
\$('.container-models .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-years .list-group button').remove();
\$('.container-versions .list-group button').remove();
\$('.container-prices .list-group button').remove();
modelSelected = \$(this).data('id');
if (\$(this).data('list-price')) {
\$('.container-years .list-group').append(\$('#button-year-template').tmpl({type: 'year', year: '0km'}));
}
let groups = JSON.parse( \$(this).attr('data-groups') );
for (var i = groups.prices_to; i >= groups.prices_from; i--) {
\$('.container-years .list-group').append( \$('#button-year-template').tmpl({ type: 'year', year: i }) );
}
});
\$(document).off('click', '.btn-year').on('click', '.btn-year', function() {
\$('.container-years .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-versions .list-group button').remove();
\$('.container-prices .list-group button').remove();
yearSelected = \$(this).data('year');
\$('.spinner-' + yearSelected + ' div').removeClass('spinner-hide');
\$.get('{{ path('infoauto_get_versions') }}', {brandId:brandSelected, modelId:modelSelected, modelYear:yearSelected }, function(data) {
\$.each(data, function(index, item) {
\$('.container-versions .list-group').append( \$('#button-version-template').tmpl({ type: 'version', name: item.name, price: item.price, codia: item.codia }) );
});
\$('.spinner-' + yearSelected + ' > div').addClass('spinner-hide');
});
});
\$(document).off('click', '.btn-version').on('click', '.btn-version', function() {
\$('.container-versions .list-group button').removeClass('active');
\$(this).addClass('active');
\$('.container-prices .list-group button').remove();
\$('.container-prices .list-group').append( \$('#button-price-template').tmpl({ type: 'price', price: \$(this).data('price'), codia: \$(this).data('codia') }) );
});
function formatNumber(num) {
return new Intl.NumberFormat('es-ES', { minimumFractionDigits: 0 }).format(num);
}
</script>
<script id=\"button-model-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-key=\"\${key}\" data-id=\"\${id}\" data-name=\"\${name}\" data-list-price=\"\${list_price}\" data-groups='\${groups}'>
\${name}
</button>
</script>
<script id=\"button-year-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type} spinner-\${year}\" data-year=\"\${year}\">
\${year}
<div class=\"spinner-border text-white float-end spinner-hide\" role=\"status\">
<span class=\"visually-hidden\"></span>
</div>
</button>
</script>
<script id=\"button-version-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
\${name}
</button>
</script>
<script id=\"button-price-template\" type=\"text/x-jquery-tmpl\">
<button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
\$ \${price}.000
</button>
</script>
{% endblock %}", "infoauto/index.html.twig", "/home/dgsystem/htdocs/sistema.dgautomotores.com.ar/public/templates/infoauto/index.html.twig");
}
}