templates/Components/Destination/Detail/Tabs/priceTable.html.twig line 1
{% if(showStyle is defined) %}<style>.table {width: 100%;border-collapse: collapse;font-size: 0.7rem; /* Zmenšení velikosti textu */}.table-smaller td,.table-smaller th {padding: 4px; /* Menší padding uvnitř buněk */text-align: center;vertical-align: middle;border: 1px solid #ccc;}thead tr {background-color: #f2f2f2;}thead td {font-weight: bold;padding: 6px; /* Menší padding v záhlaví */text-align: center;border: 1px solid #ddd;}.field-title {font-weight: bold;text-align: left;padding-left: 6px; /* Menší zarovnání */white-space: nowrap; /* Zabránění zalomení textu */}.bg-reserved {background-color: #eccb0b;color: white;font-weight: bold;text-align: center;}.bg-full {background-color: #d2494c;color: white;font-weight: bold;text-align: center;}.bg-only-bus {background-color: #4fbe1b;color: white;font-weight: bold;text-align: center;}.bg-only-car {background-color: #6FA5D2;color: white;font-weight: bold;text-align: center;}tbody tr:nth-child(even) {background-color: #f9f9f9;}tbody tr:hover {background-color: #f1f1f1;}td {padding: 4px; /* Menší padding */border: 1px solid #ddd;font-size: 0.7rem; /* Zmenšení textu pro obsah buněk */}td.bg-reserved {background-color: #eccb0b;color: #fff;font-weight: bold;}td.bg-full {background-color: #d2494c;color: #fff;font-weight: bold;}td.bg-only-bus {background-color: #4fbe1b;color: #fff;font-weight: bold;}td.bg-only-car {background-color: #6FA5D2;color: #fff;font-weight: bold;}.bg-price-text {background-color: #9b59b6;color: #fff;font-weight: bold;text-align: center;}td.bg-price-text {background-color: #9b59b6;color: #fff;font-weight: bold;}td.pdf-bg-only-bus {background-color: #4fbe1b;color: #fff;font-weight: bold;}td.pdf-bg-only-car {background-color: #6FA5D2;color: #fff;font-weight: bold;}/* Přidání automatického zmenšení tabulky */.table {table-layout: fixed; /* Nastavení pevného layoutu tabulky */}td {word-wrap: break-word; /* Rozdělení dlouhých slov */}</style>{% endif %}{% if(destination.generatePriceTable) %}<table class="table table-smaller"><thead><tr><td></td><td><strong>Termín</strong></td><td><strong>Počet dní pob./záj.</strong></td><td><strong>Den odjezdu</strong></td>{% for accommodation in destination.accommodations %}<td><strong>{{ accommodation.name }}</strong></td>{% endfor %}</tr></thead><tbody>{% for term in destination.activeTerms %}<tr class="{% if(term.onlyBus) %}bus pdf-bg-only-bus{% endif %}{% if(term.onlyCar) %}car pdf-bg-only-car{% endif %}"><td class="field-title{% if(term.onlyBus) %} pdf-bg-only-bus{% endif %}{% if(term.onlyCar) %} pdf-bg-only-car{% endif %}">{{ term.number }}</td><td>{{ term.start|date('d.m.') }} - {{ term.end|date('d.m.') }}</td><td>{{ term.numberOfDays }}</td><td>{{ term.departureDay }}</td>{% for accommodation in destination.accommodations %}{% set termPrice = term.getAccommodationTermPrice(accommodation) %}{% set price = termPrice ? termPrice.price : null %}{% set bgClass = term.getAccommodationBgClass(accommodation) %}<td class="{{ bgClass }}">{% if termPrice and termPrice.priceText is not empty %}{{ termPrice.priceText }}{% elseif(price) %}{{ price|format_currency('CZK') }}{% if bgClass in ['bg-full', 'bg-reserved'] and termPrice %}<br><button class="btn btn-sm btn-warning watchdog-btn"data-term-price-id="{{ termPrice.id }}"data-destination="{{ destination.name }}"data-term="{{ term.start|date('d.m.') }} - {{ term.end|date('d.m.') }}"data-accommodation="{{ accommodation.name }}"data-price="{{ price }}"style="font-size: 0.65rem; padding: 2px 6px; margin-top: 2px;">🔔 Hlídat</button>{% endif %}{% else %}-{% endif %}</td>{% endfor %}</tr>{% endfor %}</tbody></table><span class="bg-reserved">Rezervováno</span><span class="bg-full">Prodáno</span><span class="bg-only-car">Pouze vlastní doprava</span><span class="bg-only-bus">Pouze autobusová doprava</span><span class="bg-price-text">Text místo ceny</span><!-- Modal pro watchdog --><div class="modal fade" id="watchdogModal" tabindex="-1" role="dialog" aria-labelledby="watchdogModalLabel"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title" id="watchdogModalLabel">🔔 Hlídat dostupnost</h4></div><div class="modal-body"><div id="watchdog-info" style="margin-bottom: 15px; padding: 10px; background-color: #f5f5f5; border-radius: 4px;"><strong>Destinace:</strong> <span id="modal-destination"></span><br><strong>Termín:</strong> <span id="modal-term"></span><br><strong>Ubytování:</strong> <span id="modal-accommodation"></span><br><strong>Cena:</strong> <span id="modal-price"></span></div><div class="form-group"><label for="watchdog-email">Váš e-mail:</label><input type="email" class="form-control" id="watchdog-email" placeholder="vas@email.cz" required><small class="form-text text-muted">Pošleme vám e-mail, jakmile bude termín dostupný k objednání.</small></div><div class="form-group"><div class="checkbox"><label><input type="checkbox" id="watchdog-gdpr-consent" required>Souhlasím se zpracováním mého e-mailu za účelem zasílání upozornění na dostupnost vybraného termínu.</label></div><small class="form-text text-muted" style="margin-top: 5px;"><a href="#gdpr-details" data-toggle="collapse" aria-expanded="false" aria-controls="gdpr-details" style="color: #337ab7;">Informace o zpracování osobních údajů</a></small><div class="collapse" id="gdpr-details" style="margin-top: 10px;"><div class="well well-sm" style="margin-bottom: 0; font-size: 12px;"><strong>Informace o zpracování osobních údajů:</strong><br>Správcem vašich osobních údajů je Iveria Travel. Váš e-mail bude použit výhradně pro zaslání upozorněnína dostupnost vybraného termínu. Po odeslání upozornění nebo na základě vašeho odvolání souhlasubudou údaje vymazány. Máte právo na přístup k údajům, jejich opravu, výmaz a přenositelnost.<br><br>Svůj souhlas mohu kdykoli odvolat kliknutím na odkaz v zaslaném e-mailu.</div></div></div><div id="watchdog-message" style="display: none; margin-top: 10px;"></div></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">Zrušit</button><button type="button" class="btn btn-primary" id="watchdog-submit">Hlídat dostupnost</button></div></div></div></div><script>(function() {let currentTermPriceId = null;// Otevření modalu při kliknutí na tlačítkodocument.addEventListener('click', function(e) {if (e.target && e.target.classList.contains('watchdog-btn')) {currentTermPriceId = e.target.getAttribute('data-term-price-id');document.getElementById('modal-destination').textContent = e.target.getAttribute('data-destination');document.getElementById('modal-term').textContent = e.target.getAttribute('data-term');document.getElementById('modal-accommodation').textContent = e.target.getAttribute('data-accommodation');// Formátování cenyconst price = e.target.getAttribute('data-price');if (price) {const formattedPrice = new Intl.NumberFormat('cs-CZ', {style: 'currency',currency: 'CZK'}).format(price);document.getElementById('modal-price').textContent = formattedPrice;} else {document.getElementById('modal-price').textContent = '-';}document.getElementById('watchdog-email').value = '';document.getElementById('watchdog-gdpr-consent').checked = false;document.getElementById('watchdog-message').style.display = 'none';// Zavřít GDPR details collapseif (typeof jQuery !== 'undefined') {jQuery('#gdpr-details').collapse('hide');}// Otevřít modal (Bootstrap 3)if (typeof jQuery !== 'undefined') {jQuery('#watchdogModal').modal('show');}}});// Odeslání formuláředocument.getElementById('watchdog-submit').addEventListener('click', function() {const email = document.getElementById('watchdog-email').value.trim();const gdprConsent = document.getElementById('watchdog-gdpr-consent').checked;const messageDiv = document.getElementById('watchdog-message');if (!email) {showMessage('Prosím, vyplňte e-mailovou adresu.', 'danger');return;}if (!validateEmail(email)) {showMessage('Prosím, zadejte platnou e-mailovou adresu.', 'danger');return;}if (!gdprConsent) {showMessage('Prosím, potvrďte souhlas se zpracováním osobních údajů.', 'danger');return;}// Disable tlačítko během odesíláníconst submitBtn = document.getElementById('watchdog-submit');submitBtn.disabled = true;submitBtn.textContent = 'Odesílám...';// AJAX požadavekfetch('/term-price-watchdog', {method: 'POST',headers: {'Content-Type': 'application/json',},body: JSON.stringify({termPriceId: currentTermPriceId,email: email,gdprConsent: gdprConsent})}).then(response => response.json()).then(data => {if (data.ok) {showMessage(data.message || 'Hlídání bylo úspěšně nastaveno!', 'success');setTimeout(function() {if (typeof jQuery !== 'undefined') {jQuery('#watchdogModal').modal('hide');}}, 2000);} else {showMessage(data.message || 'Došlo k chybě. Zkuste to prosím znovu.', 'danger');}}).catch(error => {console.error('Error:', error);showMessage('Došlo k chybě při komunikaci se serverem.', 'danger');}).finally(() => {submitBtn.disabled = false;submitBtn.textContent = 'Hlídat dostupnost';});});function showMessage(message, type) {const messageDiv = document.getElementById('watchdog-message');messageDiv.className = 'alert alert-' + type;messageDiv.textContent = message;messageDiv.style.display = 'block';}function validateEmail(email) {const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;return re.test(email);}})();</script>{% endif %}{{ destination.priceTable | raw }}