Gasthaus zur Krone

Welcome to Gasthaus zur Krone, where cozy charm meets modern comfort. Located in the heart of Wertingen, our family-run hotel offers a warm and inviting atmosphere for every guest.

Discover More

Featured Photos

Discover the charm of Gasthaus zur Krone in Wertingen

// Rolls Quantity and Protein Selection Management document.addEventListener('DOMContentLoaded', function() { // Function to set up interactive features for a menu item function setupMenuItem(menuItem) { const proteinSelect = menuItem.querySelector('.protein-select'); const quantityInput = menuItem.querySelector('.quantity-input'); const plusButton = menuItem.querySelector('.quantity-btn.plus'); const minusButton = menuItem.querySelector('.quantity-btn.minus'); const totalPriceElement = menuItem.querySelector('.total-price'); const itemTotalPriceElement = menuItem.querySelector('.item-total-price'); const priceElement = menuItem.querySelector('.font-semibold'); function extractBasePrice() { // Extract base price more robustly const priceText = priceElement ? priceElement.textContent : ( menuItem.querySelector('.text-lg.font-semibold') || menuItem.querySelector('.text-sm.font-medium') )?.textContent || '0€'; const price = parseFloat(priceText.replace('€', '').trim()); return isNaN(price) ? 0 : price; } function updateTotalPrice() { const quantity = parseInt(quantityInput.value); const basePrice = extractBasePrice(); const totalPrice = (quantity * basePrice).toFixed(2); // Update total price display with animation if (totalPriceElement) { totalPriceElement.textContent = `${basePrice}€ pro Stück`; totalPriceElement.classList.add('animate-pulse'); setTimeout(() => { totalPriceElement.classList.remove('animate-pulse'); }, 500); } // Update item total price element if (itemTotalPriceElement) { itemTotalPriceElement.textContent = `${totalPrice}€`; itemTotalPriceElement.classList.add('animate-pulse'); setTimeout(() => { itemTotalPriceElement.classList.remove('animate-pulse'); }, 500); } } // Plus button functionality plusButton.addEventListener('click', function() { // If protein selection is required, ensure it's selected if (proteinSelect && proteinSelect.value === '') { proteinSelect.classList.add('border-red-500', 'animate-shake'); setTimeout(() => { proteinSelect.classList.remove('border-red-500', 'animate-shake'); }, 500); alert('Please select a protein option first.'); return; } const currentValue = parseInt(quantityInput.value); const newValue = Math.min(currentValue + 1, 10); // Limit quantity to 10 quantityInput.value = newValue; // Visual and haptic feedback quantityInput.classList.add('bg-green-100', 'transition-colors', 'animate-bounce'); plusButton.classList.add('scale-110'); setTimeout(() => { quantityInput.classList.remove('bg-green-100', 'animate-bounce'); plusButton.classList.remove('scale-110'); }, 300); // Disable plus button if max quantity reached if (newValue === 10) { plusButton.disabled = true; plusButton.classList.add('opacity-50', 'cursor-not-allowed'); } // Enable minus button minusButton.disabled = false; minusButton.classList.remove('opacity-50', 'cursor-not-allowed'); updateTotalPrice(); }); // Minus button functionality minusButton.addEventListener('click', function() { const currentValue = parseInt(quantityInput.value); const newValue = Math.max(currentValue - 1, 0); // Ensure non-negative quantityInput.value = newValue; // Visual and haptic feedback quantityInput.classList.add('bg-red-100', 'transition-colors', 'animate-bounce'); minusButton.classList.add('scale-110'); setTimeout(() => { quantityInput.classList.remove('bg-red-100', 'animate-bounce'); minusButton.classList.remove('scale-110'); }, 300); // Disable minus button if zero if (newValue === 0) { minusButton.disabled = true; minusButton.classList.add('opacity-50', 'cursor-not-allowed'); } // Enable plus button plusButton.disabled = false; plusButton.classList.remove('opacity-50', 'cursor-not-allowed'); updateTotalPrice(); }); // Protein selection change handler if (proteinSelect) { proteinSelect.addEventListener('change', function() { const selectedOption = proteinSelect.options[proteinSelect.selectedIndex]; const priceMatch = selectedOption.textContent.match(/\((\d+(?:\.\d{1,2})?)\€\)/); if (priceMatch) { const selectedPrice = parseFloat(priceMatch[1]); const totalPriceElement = menuItem.querySelector('.total-price'); if (totalPriceElement) { totalPriceElement.textContent = priceMatch[0]; } } quantityInput.value = 0; // Reset quantity when protein changes updateTotalPrice(); // Reset button states plusButton.disabled = false; minusButton.disabled = true; plusButton.classList.remove('opacity-50', 'cursor-not-allowed'); minusButton.classList.add('opacity-50', 'cursor-not-allowed'); }); } // Add keyboard support for quantity input quantityInput.addEventListener('keydown', function(event) { if (event.key === 'ArrowUp') { plusButton.click(); } else if (event.key === 'ArrowDown') { minusButton.click(); } }); // Initialize state minusButton.disabled = true; minusButton.classList.add('opacity-50', 'cursor-not-allowed'); updateTotalPrice(); } // Setup for all menu items with quantity controls const menuItems = document.querySelectorAll('li[class*="group/menu-item"], li .protein-select').closest('li'); menuItems.forEach(setupMenuItem); }); // Discount Code Handling document.addEventListener('DOMContentLoaded', function() { const discountCodeInput = document.getElementById('discount-code'); const applyDiscountButton = document.getElementById('apply-discount'); const discountMessage = document.getElementById('discount-message'); const validDiscountCodes = ['SUVI10', 'WELCOME10', 'FLAVOR10']; // Mock order total (in a real scenario, this would be calculated dynamically) let orderTotal = 50.00; applyDiscountButton.addEventListener('click', function() { const enteredCode = discountCodeInput.value.trim().toUpperCase(); if (validDiscountCodes.includes(enteredCode)) { // Calculate 10% discount const discountAmount = orderTotal * 0.10; const discountedTotal = orderTotal - discountAmount; // Successful discount application discountMessage.innerHTML = ` 🎉 Discount applied!
Original Total: €${orderTotal.toFixed(2)}
Discount (10%): -€${discountAmount.toFixed(2)}
New Total: €${discountedTotal.toFixed(2)} `; discountMessage.classList.remove('text-red-500'); discountMessage.classList.add('text-green-500'); // Optional: Add a temporary visual effect discountCodeInput.classList.add('border-green-500'); // Redirect to menu/checkout page after a short delay setTimeout(() => { window.location.href = '/menu?discount=' + enteredCode; }, 1500); } else { // Invalid discount code discountMessage.textContent = '❌ Invalid discount code. Please try again.'; discountMessage.classList.remove('text-green-500'); discountMessage.classList.add('text-red-500'); // Add a temporary shake animation for invalid code discountCodeInput.classList.add('animate-shake'); setTimeout(() => { discountCodeInput.classList.remove('animate-shake'); }, 500); } }); // Add keyboard support (Enter key) discountCodeInput.addEventListener('keypress', function(event) { if (event.key === 'Enter') { applyDiscountButton.click(); } }); }); // Image upload handling document.getElementById('imageUpload').addEventListener('change', function(event) { const file = event.target.files[0]; if (file) { const reader = new FileReader(); reader.onload = function(e) { const img = document.querySelector('.clicked-element').previousElementSibling; img.src = e.target.result; img.alt = "Custom Uploaded Image"; }; reader.readAsDataURL(file); } }); // Enhanced Pricing and Quantity Management document.addEventListener('DOMContentLoaded', function() { // Function to extract price for a specific menu item function extractPrice(menuItem) { // First, try to find the base price in the item-base-price span const basePriceSpan = menuItem.querySelector('.item-base-price'); if (basePriceSpan) { const basePrice = parseFloat(basePriceSpan.textContent.replace('€', '').replace(',', '.').trim()); if (!isNaN(basePrice)) return basePrice; } // If not found, try extracting from other elements const priceElements = [ menuItem.querySelector('.font-semibold'), menuItem.querySelector('.text-lg.font-semibold'), menuItem.querySelector('.text-sm.font-medium') ]; for (const priceElement of priceElements) { if (priceElement) { const priceText = priceElement.textContent.replace('€', '').replace(',', '.').trim(); const price = parseFloat(priceText); if (!isNaN(price)) return price; } } return 0; } // Function to update total price for a menu item function updateMenuItemPrice(menuItem) { const quantityInput = menuItem.querySelector('.quantity-input'); const totalPriceElement = menuItem.querySelector('.total-price'); const itemTotalPriceElement = menuItem.querySelector('.item-total-price'); const basePrice = extractPrice(menuItem); const quantity = parseInt(quantityInput.value || 0); const totalPrice = (basePrice * quantity); // Update total price display if (totalPriceElement) { totalPriceElement.textContent = `${basePrice.toFixed(2)}€ pro Stück`; } // Update item total price element if (itemTotalPriceElement) { itemTotalPriceElement.textContent = `${totalPrice.toFixed(2)}€`; // Visual indication of price change itemTotalPriceElement.classList.add('animate-pulse'); setTimeout(() => { itemTotalPriceElement.classList.remove('animate-pulse'); }, 300); } // Update quantity input styles quantityInput.classList.add('bg-blue-100', 'transition-colors'); setTimeout(() => { quantityInput.classList.remove('bg-blue-100'); }, 300); } // Setup price management for all menu items const menuItems = document.querySelectorAll('li'); menuItems.forEach(menuItem => { const quantityInput = menuItem.querySelector('.quantity-input'); const plusButton = menuItem.querySelector('.quantity-btn.plus'); const minusButton = menuItem.querySelector('.quantity-btn.minus'); // Update price on quantity change if (quantityInput) { quantityInput.addEventListener('change', () => updateMenuItemPrice(menuItem)); } // Quantity buttons management if (plusButton) { plusButton.addEventListener('click', () => { if (quantityInput) { const currentValue = parseInt(quantityInput.value || 0); quantityInput.value = Math.min(currentValue + 1, 10); updateMenuItemPrice(menuItem); // Add visual feedback for plus button plusButton.classList.add('bg-green-200', 'scale-110'); setTimeout(() => { plusButton.classList.remove('bg-green-200', 'scale-110'); }, 200); } }); } if (minusButton) { minusButton.addEventListener('click', () => { if (quantityInput) { const currentValue = parseInt(quantityInput.value || 0); quantityInput.value = Math.max(currentValue - 1, 0); updateMenuItemPrice(menuItem); // Add visual feedback for minus button minusButton.classList.add('bg-red-200', 'scale-110'); setTimeout(() => { minusButton.classList.remove('bg-red-200', 'scale-110'); }, 200); } }); } // Initial price update updateMenuItemPrice(menuItem); }); }); // Gallery Image Zoom Functionality document.addEventListener('DOMContentLoaded', function() { const galleryContainer = document.getElementById('gallery-container'); const galleryImages = galleryContainer.querySelectorAll('.gallery-image'); // Create zoom modal const zoomModal = document.createElement('div'); zoomModal.id = 'gallery-zoom-modal'; zoomModal.style.cssText = ` display: none; position: fixed; z-index: 1000; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); display: flex; justify-content: center; align-items: center; `; const zoomImage = document.createElement('img'); zoomImage.style.cssText = ` max-width: 90%; max-height: 90%; object-fit: contain; cursor: pointer; `; zoomModal.appendChild(zoomImage); document.body.appendChild(zoomModal); // Add click event to each gallery image galleryImages.forEach(image => { image.addEventListener('click', function() { zoomImage.src = this.src; zoomModal.style.display = 'flex'; }); }); // Close zoom modal when clicking outside the image zoomModal.addEventListener('click', function(event) { if (event.target === zoomModal) { zoomModal.style.display = 'none'; } }); // Close zoom modal with ESC key document.addEventListener('keydown', function(event) { if (event.key === 'Escape' && zoomModal.style.display === 'flex') { zoomModal.style.display = 'none'; } }); });