Update app.py
Browse files116 unmodified lines117118119120121122123124125126127128226 unmodified lines35535635735835936036136236336412 unmodified lines3773783793803813823833843853862 unmodified lines38939039139239339439527 unmodified lines423424425426427428429131 unmodified lines56156256356456556656756856957015 unmodified lines58658758858959059159259359414 unmodified lines60961061161261361432 unmodified lines647648649650651652653222 unmodified lines876877878879880881882116 unmodified linesmax-width: 1200px;margin: 0 auto;}h1 {text-align: center;color: #2c3e50;margin-bottom: 40px;font-size: 2.5em;font-weight: 700;}.products-grid {display: grid;226 unmodified linesmax-width: 120px;max-height: 120px;}h1 {font-size: 1.8em;margin-bottom: 20px;}.product h2 {font-size: 0.9em;}12 unmodified lines</head><body><div class="container"><h1>Каталог товаров</h1><div class="products-grid">{% for product in products %}<div class="product">{% if product.get('photos') and product['photos']|length > 0 %}<div class="product-image"><img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"2 unmodified lines</div>{% endif %}<h2>{{ product['name'] }}</h2><div class="product-price">{{ product['price'] }} ₽</div><p class="product-description">{{ product['description'][:100] }}{% if product['description']|length > 100 %}...{% endif %}</p><button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button><button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>27 unmodified lines<h2>Корзина</h2><div id="cartContent"></div><div style="margin-top: 20px; text-align: right;"><strong>Итого: <span id="cartTotal">0</span> ₽</strong><button class="product-button clear-cart" onclick="clearCart()">Очистить корзину</button><button class="product-button order-button" onclick="orderViaWhatsApp()">Заказать</button></div>131 unmodified lines` : ''}<div><strong>${item.name}</strong><p>${item.price} ₽ × ${item.quantity}</p></div></div><span>${itemTotal} ₽</span></div>`;}).join('');15 unmodified linescart.forEach((item, index) => {const itemTotal = item.price * item.quantity;total += itemTotal;orderText += `${index + 1}. ${item.name} - ${item.price} ₽ × ${item.quantity}%0A`;});orderText += `Итого: ${total} ₽`;const whatsappUrl = `https://api.whatsapp.com/send?phone=996500398754&text=${orderText}`;window.open(whatsappUrl, '_blank');14 unmodified lines}}console.log("Инициализация страницы, товары:", products);updateCartButton();</script>32 unmodified lines<div class="swiper-button-next"></div><div class="swiper-button-prev"></div></div><p><strong>Цена:</strong> {{ product['price'] }} ₽</p><p><strong>Описание:</strong> {{ product['description'] }}</p></div>'''222 unmodified lines{% for product in products %}<div class="product-item"><h3>{{ product['name'] }}</h3><p><strong>Цена:</strong> {{ product['price'] }} руб.</p><p><strong>Описание:</strong> {{ product['description'] }}</p>{% if product.get('photos') and product['photos']|length > 0 %}<div style="background-color: #fff; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;">116 unmodified lines117118119120121122123124125126127128129130131132133134135136137138226 unmodified lines36536636736836937037137237337437537612 unmodified lines3893903913923933943953963973983994002 unmodified lines40340440540640740840927 unmodified lines437438439440441442443131 unmodified lines57557657757857958058158258358415 unmodified lines60060160260360460560660760814 unmodified lines62362462562662762862963063163263363463563663763863964064164264364464532 unmodified lines678679680681682683684222 unmodified lines907908909910911912913116 unmodified linesmax-width: 1200px;margin: 0 auto;}.search-container {text-align: center;margin-bottom: 40px;}#search-input {width: 80%;max-width: 500px;padding: 10px;font-size: 1em;border: 1px solid #ddd;border-radius: 5px;outline: none;}#search-input:focus {border-color: #3498db;box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);}.products-grid {display: grid;226 unmodified linesmax-width: 120px;max-height: 120px;}.search-container {margin-bottom: 20px;}#search-input {width: 90%;}.product h2 {font-size: 0.9em;}12 unmodified lines</head><body><div class="container"><div class="search-container"><input type="text" id="search-input" placeholder="Поиск по названию или описанию..."></div><div class="products-grid" id="products-grid">{% for product in products %}<div class="product" data-name="{{ product['name']|lower }}" data-description="{{ product['description']|lower }}">{% if product.get('photos') and product['photos']|length > 0 %}<div class="product-image"><img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"2 unmodified lines</div>{% endif %}<h2>{{ product['name'] }}</h2><div class="product-price">{{ product['price'] }}</div><p class="product-description">{{ product['description'][:100] }}{% if product['description']|length > 100 %}...{% endif %}</p><button class="product-button" onclick="openModal({{ loop.index0 }})">Подробнее</button><button class="product-button add-to-cart" onclick="openQuantityModal({{ loop.index0 }})">В корзину</button>27 unmodified lines<h2>Корзина</h2><div id="cartContent"></div><div style="margin-top: 20px; text-align: right;"><strong>Итого: <span id="cartTotal">0</span></strong><button class="product-button clear-cart" onclick="clearCart()">Очистить корзину</button><button class="product-button order-button" onclick="orderViaWhatsApp()">Заказать</button></div>131 unmodified lines` : ''}<div><strong>${item.name}</strong><p>${item.price} × ${item.quantity}</p></div></div><span>${itemTotal}</span></div>`;}).join('');15 unmodified linescart.forEach((item, index) => {const itemTotal = item.price * item.quantity;total += itemTotal;orderText += `${index + 1}. ${item.name} - ${item.price} × ${item.quantity}%0A`;});orderText += `Итого: ${total}`;const whatsappUrl = `https://api.whatsapp.com/send?phone=996500398754&text=${orderText}`;window.open(whatsappUrl, '_blank');14 unmodified lines}}// Поисковая строкаdocument.getElementById('search-input').addEventListener('input', function(e) {const searchTerm = e.target.value.toLowerCase();const productElements = document.querySelectorAll('.product');productElements.forEach(product => {const name = product.getAttribute('data-name');const description = product.getAttribute('data-description');if (name.includes(searchTerm) || description.includes(searchTerm)) {product.style.display = 'flex';} else {product.style.display = 'none';}});});console.log("Инициализация страницы, товары:", products);updateCartButton();</script>32 unmodified lines<div class="swiper-button-next"></div><div class="swiper-button-prev"></div></div><p><strong>Цена:</strong> {{ product['price'] }}</p><p><strong>Описание:</strong> {{ product['description'] }}</p></div>'''222 unmodified lines{% for product in products %}<div class="product-item"><h3>{{ product['name'] }}</h3><p><strong>Цена:</strong> {{ product['price'] }}</p><p><strong>Описание:</strong> {{ product['description'] }}</p>{% if product.get('photos') and product['photos']|length > 0 %}<div style="background-color: #fff; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;">
app.py+48-17