var/cache/dev/twig/93/93a5c637d0d441f6feca9fa381883349.php line 45

Open in your IDE?
  1. <?php
  2. use Twig\Environment;
  3. use Twig\Error\LoaderError;
  4. use Twig\Error\RuntimeError;
  5. use Twig\Extension\CoreExtension;
  6. use Twig\Extension\SandboxExtension;
  7. use Twig\Markup;
  8. use Twig\Sandbox\SecurityError;
  9. use Twig\Sandbox\SecurityNotAllowedTagError;
  10. use Twig\Sandbox\SecurityNotAllowedFilterError;
  11. use Twig\Sandbox\SecurityNotAllowedFunctionError;
  12. use Twig\Source;
  13. use Twig\Template;
  14. use Twig\TemplateWrapper;
  15. /* infoauto/index.html.twig */
  16. class __TwigTemplate_06d4db2ad70c109ada4148da0df63aa4 extends Template
  17. {
  18.     private Source $source;
  19.     /**
  20.      * @var array<string, Template>
  21.      */
  22.     private array $macros = [];
  23.     public function __construct(Environment $env)
  24.     {
  25.         parent::__construct($env);
  26.         $this->source $this->getSourceContext();
  27.         $this->blocks = [
  28.             'title' => [$this'block_title'],
  29.             'body' => [$this'block_body'],
  30.             'javascripts' => [$this'block_javascripts'],
  31.         ];
  32.     }
  33.     protected function doGetParent(array $context): bool|string|Template|TemplateWrapper
  34.     {
  35.         // line 1
  36.         return "base.html.twig";
  37.     }
  38.     protected function doDisplay(array $context, array $blocks = []): iterable
  39.     {
  40.         $macros $this->macros;
  41.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  42.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""infoauto/index.html.twig"));
  43.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  44.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""infoauto/index.html.twig"));
  45.         $this->parent $this->load("base.html.twig"1);
  46.         yield from $this->parent->unwrap()->yield($contextarray_merge($this->blocks$blocks));
  47.         
  48.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  49.         
  50.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  51.     }
  52.     // line 3
  53.     /**
  54.      * @return iterable<null|scalar|\Stringable>
  55.      */
  56.     public function block_title(array $context, array $blocks = []): iterable
  57.     {
  58.         $macros $this->macros;
  59.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  60.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""title"));
  61.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  62.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""title"));
  63.         yield "Infoauto - Precios";
  64.         
  65.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  66.         
  67.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  68.         yield from [];
  69.     }
  70.     // line 5
  71.     /**
  72.      * @return iterable<null|scalar|\Stringable>
  73.      */
  74.     public function block_body(array $context, array $blocks = []): iterable
  75.     {
  76.         $macros $this->macros;
  77.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  78.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""body"));
  79.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  80.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""body"));
  81.         // line 6
  82.         yield "    <h1>Infoauto - Precios</h1>
  83.     <div class=\"row mt-3 border border-1 container-options\">
  84.         <div class=\"col-12 col-lg-2 border-end container-brands\">
  85.             <h4 class=\"text-center\">Marca</h4>
  86.             <div class=\"list-group\">
  87.                 ";
  88.         // line 13
  89.         $context['_parent'] = $context;
  90.         $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); })()));
  91.         foreach ($context['_seq'] as $context["key"] => $context["item"]) {
  92.             // line 14
  93.             yield "                    <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-brand\" data-key=\"";
  94.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($context["key"], "html"nulltrue);
  95.             yield "\" data-id=\"";
  96.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "brandId", [], "any"falsefalsefalse14), "html"nulltrue);
  97.             yield "\" data-name=\"";
  98.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "brandName", [], "any"falsefalsefalse14), "html"nulltrue);
  99.             yield "\">
  100.                         ";
  101.             // line 15
  102.             yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env$this->source$context["item"], "brandName", [], "any"falsefalsefalse15), "html"nulltrue);
  103.             yield "
  104.                     </button>
  105.                 ";
  106.         }
  107.         $_parent $context['_parent'];
  108.         unset($context['_seq'], $context['key'], $context['item'], $context['_parent']);
  109.         $context array_intersect_key($context$_parent) + $_parent;
  110.         // line 18
  111.         yield "            </div>
  112.         </div>
  113.         <div class=\"col-12 col-lg-2 border-end container-models\">
  114.             <h4 class=\"text-center\">Modelo</h4>
  115.             <div class=\"list-group\"></div>
  116.         </div>
  117.         <div class=\"col-12 col-lg-2 border-end container-years\">
  118.             <h4 class=\"text-center\">Fabricación</h4>
  119.             <div class=\"list-group\"></div>
  120.         </div>
  121.         <div class=\"col-12 col-lg-4 border-end container-versions\">
  122.             <h4 class=\"text-center\">Versión</h4>
  123.             <div class=\"list-group\"></div>
  124.         </div>
  125.         <div class=\"col-12 col-lg-2 container-prices\">
  126.             <h4 class=\"text-center\">Precio</h4>
  127.             <div class=\"list-group\"></div>
  128.         </div>
  129.     </div>
  130.     <style>
  131.         .container-options {
  132.             height: calc(100vh - 230px);
  133.         }
  134.         .container-brands, .container-models, .container-years, .container-versions, .container-prices {
  135.             overflow-y: auto;
  136.             height: 100%;
  137.         }
  138.     </style>
  139. ";
  140.         
  141.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  142.         
  143.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  144.         yield from [];
  145.     }
  146.     // line 54
  147.     /**
  148.      * @return iterable<null|scalar|\Stringable>
  149.      */
  150.     public function block_javascripts(array $context, array $blocks = []): iterable
  151.     {
  152.         $macros $this->macros;
  153.         $__internal_5a27a8ba21ca79b61932376b2fa922d2 $this->extensions["Symfony\\Bundle\\WebProfilerBundle\\Twig\\WebProfilerExtension"];
  154.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->enter($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  155.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  156.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""javascripts"));
  157.         // line 55
  158.         yield "    ";
  159.         yield from $this->yieldParentBlock("javascripts"$context$blocks);
  160.         yield "
  161.     <script src=\"";
  162.         // line 57
  163.         yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\AssetExtension']->getAssetUrl("js/jquery.tmpl.min.js"), "html"nulltrue);
  164.         yield "\"></script>
  165.     <script type=\"text/javascript\">
  166.         var brands = ";
  167.         // line 60
  168.         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); })()));
  169.         yield ";
  170.         var brandSelected = 0;
  171.         var modelSelected = 0;
  172.         var yearSelected = 0;
  173.         var versionSelected = 0;
  174.         console.log(brands);
  175.         \$('.btn-brand').click(function() {
  176.             \$('.container-brands .list-group button').removeClass('active');
  177.             \$(this).addClass('active');
  178.             \$('.container-models .list-group button').remove();
  179.             brands[\$(this).data('key')].brandGroups.sort((a, b) => a.name.localeCompare(b.name));
  180.             brandSelected = \$(this).data('id');
  181.             \$.each(brands[\$(this).data('key')].brandGroups, function(index, item) {
  182.                 \$('.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) }) );
  183.             });
  184.         });
  185.         \$(document).off('click', '.btn-model').on('click', '.btn-model',  function() {
  186.             \$('.container-models .list-group button').removeClass('active');
  187.             \$(this).addClass('active');
  188.             \$('.container-years .list-group button').remove();
  189.             \$('.container-versions .list-group button').remove();
  190.             \$('.container-prices .list-group button').remove();
  191.             modelSelected = \$(this).data('id');
  192.             if (\$(this).data('list-price')) {
  193.                 \$('.container-years .list-group').append(\$('#button-year-template').tmpl({type: 'year', year: '0km'}));
  194.             }
  195.             let groups = JSON.parse( \$(this).attr('data-groups') );
  196.             for (var i = groups.prices_to; i >= groups.prices_from; i--) {
  197.                 \$('.container-years .list-group').append( \$('#button-year-template').tmpl({ type: 'year', year: i }) );
  198.             }
  199.         });
  200.         \$(document).off('click', '.btn-year').on('click', '.btn-year',  function() {
  201.             \$('.container-years .list-group button').removeClass('active');
  202.             \$(this).addClass('active');
  203.             \$('.container-versions .list-group button').remove();
  204.             \$('.container-prices .list-group button').remove();
  205.             yearSelected = \$(this).data('year');
  206.             \$('.spinner-' + yearSelected + ' div').removeClass('spinner-hide');
  207.             \$.get('";
  208.         // line 109
  209.         yield $this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("infoauto_get_versions");
  210.         yield "', {brandId:brandSelected, modelId:modelSelected, modelYear:yearSelected }, function(data) {
  211.                 \$.each(data, function(index, item) {
  212.                     \$('.container-versions .list-group').append( \$('#button-version-template').tmpl({ type: 'version', name: item.name, price: item.price, codia: item.codia }) );
  213.                 });
  214.                 \$('.spinner-' + yearSelected + ' > div').addClass('spinner-hide');
  215.             });
  216.         });
  217.         \$(document).off('click', '.btn-version').on('click', '.btn-version',  function() {
  218.             \$('.container-versions .list-group button').removeClass('active');
  219.             \$(this).addClass('active');
  220.             \$('.container-prices .list-group button').remove();
  221.             \$('.container-prices .list-group').append( \$('#button-price-template').tmpl({ type: 'price', price: \$(this).data('price'), codia: \$(this).data('codia') }) );
  222.         });
  223.         function formatNumber(num) {
  224.             return new Intl.NumberFormat('es-ES', { minimumFractionDigits: 0 }).format(num);
  225.         }
  226.     </script>
  227.     <script id=\"button-model-template\" type=\"text/x-jquery-tmpl\">
  228.         <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}'>
  229.             \${name}
  230.         </button>
  231.     </script>
  232.     <script id=\"button-year-template\" type=\"text/x-jquery-tmpl\">
  233.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type} spinner-\${year}\" data-year=\"\${year}\">
  234.             \${year}
  235.             <div class=\"spinner-border text-white float-end spinner-hide\" role=\"status\">
  236.                 <span class=\"visually-hidden\"></span>
  237.             </div>
  238.         </button>
  239.     </script>
  240.     <script id=\"button-version-template\" type=\"text/x-jquery-tmpl\">
  241.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
  242.             \${name}
  243.         </button>
  244.     </script>
  245.     <script id=\"button-price-template\" type=\"text/x-jquery-tmpl\">
  246.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
  247.             \$  \${price}.000
  248.         </button>
  249.     </script>
  250. ";
  251.         
  252.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  253.         
  254.         $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  255.         yield from [];
  256.     }
  257.     /**
  258.      * @codeCoverageIgnore
  259.      */
  260.     public function getTemplateName(): string
  261.     {
  262.         return "infoauto/index.html.twig";
  263.     }
  264.     /**
  265.      * @codeCoverageIgnore
  266.      */
  267.     public function isTraitable(): bool
  268.     {
  269.         return false;
  270.     }
  271.     /**
  272.      * @codeCoverageIgnore
  273.      */
  274.     public function getDebugInfo(): array
  275.     {
  276.         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,);
  277.     }
  278.     public function getSourceContext(): Source
  279.     {
  280.         return new Source("{% extends 'base.html.twig' %}
  281. {% block title %}Infoauto - Precios{% endblock %}
  282. {% block body %}
  283.     <h1>Infoauto - Precios</h1>
  284.     <div class=\"row mt-3 border border-1 container-options\">
  285.         <div class=\"col-12 col-lg-2 border-end container-brands\">
  286.             <h4 class=\"text-center\">Marca</h4>
  287.             <div class=\"list-group\">
  288.                 {% for key, item in brands %}
  289.                     <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 }}\">
  290.                         {{ item.brandName }}
  291.                     </button>
  292.                 {% endfor %}
  293.             </div>
  294.         </div>
  295.         <div class=\"col-12 col-lg-2 border-end container-models\">
  296.             <h4 class=\"text-center\">Modelo</h4>
  297.             <div class=\"list-group\"></div>
  298.         </div>
  299.         <div class=\"col-12 col-lg-2 border-end container-years\">
  300.             <h4 class=\"text-center\">Fabricación</h4>
  301.             <div class=\"list-group\"></div>
  302.         </div>
  303.         <div class=\"col-12 col-lg-4 border-end container-versions\">
  304.             <h4 class=\"text-center\">Versión</h4>
  305.             <div class=\"list-group\"></div>
  306.         </div>
  307.         <div class=\"col-12 col-lg-2 container-prices\">
  308.             <h4 class=\"text-center\">Precio</h4>
  309.             <div class=\"list-group\"></div>
  310.         </div>
  311.     </div>
  312.     <style>
  313.         .container-options {
  314.             height: calc(100vh - 230px);
  315.         }
  316.         .container-brands, .container-models, .container-years, .container-versions, .container-prices {
  317.             overflow-y: auto;
  318.             height: 100%;
  319.         }
  320.     </style>
  321. {% endblock %}
  322. {% block javascripts %}
  323.     {{ parent() }}
  324.     <script src=\"{{ asset('js/jquery.tmpl.min.js') }}\"></script>
  325.     <script type=\"text/javascript\">
  326.         var brands = {{ brands|json_encode|raw }};
  327.         var brandSelected = 0;
  328.         var modelSelected = 0;
  329.         var yearSelected = 0;
  330.         var versionSelected = 0;
  331.         console.log(brands);
  332.         \$('.btn-brand').click(function() {
  333.             \$('.container-brands .list-group button').removeClass('active');
  334.             \$(this).addClass('active');
  335.             \$('.container-models .list-group button').remove();
  336.             brands[\$(this).data('key')].brandGroups.sort((a, b) => a.name.localeCompare(b.name));
  337.             brandSelected = \$(this).data('id');
  338.             \$.each(brands[\$(this).data('key')].brandGroups, function(index, item) {
  339.                 \$('.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) }) );
  340.             });
  341.         });
  342.         \$(document).off('click', '.btn-model').on('click', '.btn-model',  function() {
  343.             \$('.container-models .list-group button').removeClass('active');
  344.             \$(this).addClass('active');
  345.             \$('.container-years .list-group button').remove();
  346.             \$('.container-versions .list-group button').remove();
  347.             \$('.container-prices .list-group button').remove();
  348.             modelSelected = \$(this).data('id');
  349.             if (\$(this).data('list-price')) {
  350.                 \$('.container-years .list-group').append(\$('#button-year-template').tmpl({type: 'year', year: '0km'}));
  351.             }
  352.             let groups = JSON.parse( \$(this).attr('data-groups') );
  353.             for (var i = groups.prices_to; i >= groups.prices_from; i--) {
  354.                 \$('.container-years .list-group').append( \$('#button-year-template').tmpl({ type: 'year', year: i }) );
  355.             }
  356.         });
  357.         \$(document).off('click', '.btn-year').on('click', '.btn-year',  function() {
  358.             \$('.container-years .list-group button').removeClass('active');
  359.             \$(this).addClass('active');
  360.             \$('.container-versions .list-group button').remove();
  361.             \$('.container-prices .list-group button').remove();
  362.             yearSelected = \$(this).data('year');
  363.             \$('.spinner-' + yearSelected + ' div').removeClass('spinner-hide');
  364.             \$.get('{{ path('infoauto_get_versions') }}', {brandId:brandSelected, modelId:modelSelected, modelYear:yearSelected }, function(data) {
  365.                 \$.each(data, function(index, item) {
  366.                     \$('.container-versions .list-group').append( \$('#button-version-template').tmpl({ type: 'version', name: item.name, price: item.price, codia: item.codia }) );
  367.                 });
  368.                 \$('.spinner-' + yearSelected + ' > div').addClass('spinner-hide');
  369.             });
  370.         });
  371.         \$(document).off('click', '.btn-version').on('click', '.btn-version',  function() {
  372.             \$('.container-versions .list-group button').removeClass('active');
  373.             \$(this).addClass('active');
  374.             \$('.container-prices .list-group button').remove();
  375.             \$('.container-prices .list-group').append( \$('#button-price-template').tmpl({ type: 'price', price: \$(this).data('price'), codia: \$(this).data('codia') }) );
  376.         });
  377.         function formatNumber(num) {
  378.             return new Intl.NumberFormat('es-ES', { minimumFractionDigits: 0 }).format(num);
  379.         }
  380.     </script>
  381.     <script id=\"button-model-template\" type=\"text/x-jquery-tmpl\">
  382.         <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}'>
  383.             \${name}
  384.         </button>
  385.     </script>
  386.     <script id=\"button-year-template\" type=\"text/x-jquery-tmpl\">
  387.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type} spinner-\${year}\" data-year=\"\${year}\">
  388.             \${year}
  389.             <div class=\"spinner-border text-white float-end spinner-hide\" role=\"status\">
  390.                 <span class=\"visually-hidden\"></span>
  391.             </div>
  392.         </button>
  393.     </script>
  394.     <script id=\"button-version-template\" type=\"text/x-jquery-tmpl\">
  395.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
  396.             \${name}
  397.         </button>
  398.     </script>
  399.     <script id=\"button-price-template\" type=\"text/x-jquery-tmpl\">
  400.         <button type=\"button\" class=\"list-group-item list-group-item-action border-0 btn-\${type}\" data-price=\"\${price}\" data-codia=\"\${codia}\">
  401.             \$  \${price}.000
  402.         </button>
  403.     </script>
  404. {% endblock %}""infoauto/index.html.twig""/home/dgsystem/htdocs/sistema.dgautomotores.com.ar/public/templates/infoauto/index.html.twig");
  405.     }
  406. }