templates/default/cotizaciones.html.twig line 1
- {# {% extends 'default/contenido.html.twig' %} #}
- {% extends 'base.html.twig' %}
- {% block title %}{{ contenido.metaTitle|default(contenido.titulo)| replace({'| Eurochange.es':''}) }}{% endblock %}
- {% block metadescription %}{{ contenido.metaDescription|default(contenido.intro) }}{% endblock %}
- {% block metakeywords %}{{ contenido.metaKeywords }}{% endblock %}
- {% block metarobots %}{{ contenido.metaRobots|default(parent()) }}{% endblock %}
- {% block canonical %}{% if contenido.canonical %}<link rel="canonical" href="{{contenido.canonical}}" />{% endif %}{% endblock %}
- {% block bodyId %}cotizacion{% endblock %}
- {% block body %}
- <div class="title container">
- <h1>{{ 'Cotizaciones y tipo de cambio de divisas' | trans}}</h1>
- </div>
- <div id="cotizaciones" class="container">
- <p id="pri" class="d-none d-md-block">{{ 'Si vas a viajar al extranjero, en Eurochange.es podrás cambiar tus Euros a la divisa que necesites. A tu vuelta también podrás cambiar los billetes extranjeros que te sobren a Euros en cualquiera de nuestras oficinas de cambio de divisas.' | trans}}</p>
- <p class="d-none d-md-block">{{ 'Consulta el tipo de cambio de las principales divisas a continuación. Busca tu oficina de cambio más cercana y comprueba los servicios disponibles, o haz tu reserva online y recóge tu dinero en cualquiera de nuestras casas de cambio, de una manera comoda en cualquier punto de España. ¡Así de sencillo!' | trans}}</p>
- {#<select id="select-ofi" class="form-select" aria-label="Default select example">
- <option value="todos" selected>Para comenzar, selecciona tu oficina más cercana</option>
- {% for oficina in oficinas %}
- <option value="{{ oficina.nombre }}">{{ oficina.nombre }}</option>
- {% endfor %}
- </select>#}
- {{ render(controller('App\\Controller\\DefaultController::oficinaAction', { select_id: 'select_ofi2' } )) }}
- {% if of != "" %}<p class="info-select">{{ 'Precios para' | trans}} {{ of.nombre }} {{ diaMax }}</p>{% endif %}
- {% if ofi_var == 0 %}
- <span id="no-cot">{{ 'Porfavor selecciona una oficina para que le podamos dar las tarifas correctas' | trans}}</span>
- {% endif %}
- <table id="tabla-cot">
- <tr>
- <th>{{ 'Divisa' | trans}}</th>
- <th>{{ 'Compramos' | trans}}<span class="info-valor1">i<p style="display:none;">{{ 'Utiliza la flecha para ver el tipo de cambio directo o indirecto.' | trans}}</p></span></th>
- <th>{{ 'Vendemos' | trans}}<span class="info-valor2">i<p style="display:none;">{{ 'Utiliza la flecha para ver el tipo de cambio directo o indirecto.' | trans}}</p></span></th>
- </tr>
- {% for cotizacion in cotizaciones %}
- <tr data-oficina="{{ cotizacion.oficina }}">
- <td>
- <a href="{{ path('divisas', {'nombre': cotizacion.shortName.slug}) }}"><span class="banderas">
- {% if cotizacion.shortName.imagen %}
- {{ sonata_thumbnail(cotizacion.shortName.imagen, 'flag', {'title': cotizacion.shortName.nombre}) }}
- {% endif %}
- </span>{{ cotizacion.shortName.shortName }} - {{ cotizacion.shortName.nombre }}</a>
- </td>
- <td>
- {% if cotizacion.oficina.id == 66 %}
- -
- {% elseif cotizacion.oficina.franjas is empty %}
- -
- {% else %}
- <span class="antes">1</span>
- <label class="switch">
- <input type="checkbox" class="toggleSwitch" autocomplete="off">
- <span class="slider"></span>
- <span class="label-on">{{ cotizacion.shortName }}</span>
- <span class="label-off">EUR</span>
- </label>
- <span class="despues">{{ cotizacion.precioCompra|number_format(cotizacion.shortName.numDecimales) }}</span>
- {% endif %}
- </td>
- <td>
- {% if cotizacion.oficina.franjas is empty %}
- -
- {% elseif cotizacion.oficina.permiteCompra == 1 %}
- <span class="antes">1</span>
- <label class="switch">
- <input type="checkbox" class="toggleSwitch" autocomplete="off">
- <span class="slider"></span>
- <span class="label-on">{{ cotizacion.shortName }}</span>
- <span class="label-off">EUR</span>
- </label>
- <span class="despues">{{ cotizacion.precioVenta|number_format(cotizacion.shortName.numDecimales) }}</span>
- {% else %}
- -
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </table>
- <div id="tabla-cot-res">
- <ul class="nav nav-tabs" id="tabla-res" role="tablist">
- <span id="divRes">{{ 'Divisa' | trans}}</span>
- <span class="info-valor1">i<p style="display:none;">{{ 'Utiliza la flecha para ver el tipo de cambio directo o indirecto.' | trans}}</p></span>
- <li class="nav-item" role="presentation">
- <button class="nav-link active" id="comp" data-bs-toggle="tab" data-bs-target="#compramos" type="button" role="tab" aria-controls="home" aria-selected="true">{{ 'Compramos' | trans}}</button>
- </li>
- <li class="nav-item" role="presentation">
- <button class="nav-link" id="vend" data-bs-toggle="tab" data-bs-target="#vendemos" type="button" role="tab" aria-controls="profile" aria-selected="false">{{ 'Vendemos' | trans}}</button>
- </li>
- </ul>
- <div class="tab-content" id="tabla-res-content">
- <div class="tab-pane fade show active" id="compramos" role="tabpanel" aria-labelledby="home-tab">
- {% for cotizacion in cotizaciones %}
- <div class="row">
- <div class="col-6 voltN">
- <a href="{{ path('divisas', {'nombre': cotizacion.shortName}) }}"><span class="banderas">
- {% if cotizacion.shortName.imagen %}
- {{ sonata_thumbnail(cotizacion.shortName.imagen, 'flag', {'title': cotizacion.shortName.nombre}) }}
- {% endif %}
- </span>{{ cotizacion.shortName }}</a>
- </div>
- <div class="col-6 volt">
- {% if cotizacion.oficina.id == 66 %}
- -
- {% elseif cotizacion.oficina.franjas is empty %}
- -
- {% else %}
- <span class="antes">1</span>
- <label class="switch">
- <input type="checkbox" class="toggleSwitch" autocomplete="off">
- <span class="slider"></span>
- <span class="label-on">{{ cotizacion.shortName }}</span>
- <span class="label-off">EUR</span>
- </label>
- <span class="despues">{{ cotizacion.precioCompra|number_format(cotizacion.shortName.numDecimales) }}</span>
- {% endif %}
- </div>
- </div>
- {% endfor %}
- </div>
- <div class="tab-pane fade" id="vendemos" role="tabpanel" aria-labelledby="profile-tab">
- {% for cotizacion in cotizaciones %}
- <div class="row">
- <div class="col-6 voltN">
- <a href="{{ path('divisas', {'nombre': cotizacion.shortName}) }}"><span class="banderas">
- {% if cotizacion.shortName.imagen %}
- {{ sonata_thumbnail(cotizacion.shortName.imagen, 'flag', {'title': cotizacion.shortName.nombre}) }}
- {% endif %}
- </span>{{ cotizacion.shortName }}</a>
- </div>
- <div class="col-6 volt">
- {% if cotizacion.oficina.franjas is empty %}
- -
- {% elseif cotizacion.oficina.permiteCompra == 1 %}
- <span class="antes">1</span>
- <label class="switch">
- <input type="checkbox" class="toggleSwitch" autocomplete="off">
- <span class="slider"></span>
- <span class="label-on">{{ cotizacion.shortName }}</span>
- <span class="label-off">EUR</span>
- </label>
- <span class="despues">{{ cotizacion.precioVenta|number_format(cotizacion.shortName.numDecimales) }}</span>
- {% else %}
- -
- {% endif %}
- </div>
- </div>
- {% endfor %}
- </div>
- </div>
- </div>
- <button id="ver-mas">{{ 'Ver +' | trans}}</button>
- </div>
- {% block empresas %}
- {{ render(controller('App\\Controller\\DefaultController::empresas' )) }}
- {% endblock %}
- {% endblock %}
- {% block funciones_eventos %}
- {{ parent() }}
- <script>
- // Hacer el cambio de Compramos/Vendemos
- const toggleSwitches = document.querySelectorAll('.toggleSwitch');
- const spanAntes = document.querySelectorAll('.antes');
- const spanDespues = document.querySelectorAll('.despues');
- toggleSwitches.forEach((toggleSwitch, index) => {
- toggleSwitch.addEventListener('change', function() {
- const numero1 = parseFloat(spanAntes[index].innerText);
- const numero2 = parseFloat(spanDespues[index].innerText);
- if (toggleSwitch.checked) {
- spanAntes[index].innerText = (numero1 / numero2).toFixed(3);
- spanDespues[index].innerText = '1';
- } else {
- spanAntes[index].innerText = '1';
- spanDespues[index].innerText = (numero2 / numero1).toFixed(3);
- }
- });
- });
- // Funcionalidad del botón "Ver +"
- var tablaCuerpo = document.getElementById('tabla-cot');
- var verMas = document.getElementById('ver-mas');
- var filasVisibles = 16;
- var aumento = 10;
- function actualizarFilasVisibles() {
- var filas = tablaCuerpo.getElementsByTagName('tr');
- var filasOcultas = filas.length - filasVisibles;
- for (var i = 0; i < filas.length; i++) {
- if (i < filasVisibles) {
- filas[i].style.display = 'table-row';
- } else {
- filas[i].style.display = 'none';
- }
- }
- if (filasOcultas > 0) {
- verMas.style.display = 'block';
- } else {
- verMas.style.display = 'none';
- }
- }
- actualizarFilasVisibles();
- verMas.addEventListener('click', function() {
- filasVisibles += aumento;
- actualizarFilasVisibles();
- });
- </script>
- {% endblock %}