Update app.py
Browse files
app.py
CHANGED
|
@@ -220,132 +220,111 @@ CATALOG_TEMPLATE = '''
|
|
| 220 |
<head>
|
| 221 |
<meta charset="UTF-8">
|
| 222 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 223 |
-
<title>
|
| 224 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 225 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 226 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
|
| 227 |
<style>
|
| 228 |
:root {
|
| 229 |
-
--primary-color: #
|
| 230 |
-
--primary-dark: #
|
| 231 |
-
--surface-color: #
|
| 232 |
-
--surface-dark: #
|
| 233 |
-
--background-color: #
|
| 234 |
-
--background-dark: #
|
| 235 |
-
--text-color: #
|
| 236 |
-
--text-color-dark: #
|
| 237 |
-
--border-color: #
|
| 238 |
--border-color-dark: #3A3A3A;
|
| 239 |
}
|
| 240 |
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 241 |
-
body {
|
| 242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
-
/* General Layout */
|
| 245 |
.container { max-width: 100%; margin: 0 auto; padding: 0; }
|
| 246 |
.content-area { padding: 15px; }
|
| 247 |
|
| 248 |
-
|
| 249 |
-
.header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background: var(--surface-color); border-bottom: 1px solid var(--border-color); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
|
| 250 |
-
body.dark-mode .header { background: var(--surface-dark); border-bottom-color: var(--border-color-dark); }
|
| 251 |
.header h1 { font-size: 1.4rem; font-weight: 500; color: var(--primary-color); }
|
| 252 |
-
.logo-title-container img { height: 35px; width: 35px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 5px rgba(0, 122, 255, 0.5); }
|
| 253 |
-
.theme-toggle { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--primary-color); padding: 5px; }
|
| 254 |
-
.theme-toggle:hover { opacity: 0.8; }
|
| 255 |
|
| 256 |
-
.store-address { padding: 12px 15px; text-align: center; background-color: var(--surface-
|
| 257 |
-
body.dark-mode .store-address { background-color: var(--surface-dark); color: var(--text-color-dark); box-shadow: 0 1px 3px rgba(255,255,255,0.1); }
|
| 258 |
|
| 259 |
-
/* Filters and Search */
|
| 260 |
.search-container { padding: 0 15px 15px; }
|
| 261 |
-
#search-input { width: 100%; padding: 10px 15px; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 20px; outline: none; transition: all 0.3s; background-color: var(--surface-
|
| 262 |
-
|
| 263 |
-
#search-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2); }
|
| 264 |
|
| 265 |
.filters-container { margin: 0 15px 15px; display: flex; overflow-x: auto; gap: 8px; padding-bottom: 5px; scrollbar-width: none; }
|
| 266 |
.filters-container::-webkit-scrollbar { display: none; }
|
| 267 |
-
.category-filter { padding: 8px 14px; border: 1px solid var(--border-color); border-radius: 20px; background-color: var(--surface-
|
| 268 |
-
|
| 269 |
-
.category-filter.active, .category-filter:hover { background-color: var(--primary-color); color: white; border-color: var(--primary-color); box-shadow: 0 2px 5px rgba(0, 122, 255, 0.3); }
|
| 270 |
|
| 271 |
-
/* Product Grid */
|
| 272 |
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 10px 15px 70px; }
|
| 273 |
@media (min-width: 600px) { .products-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; } }
|
| 274 |
|
| 275 |
-
.product { background: var(--surface-
|
| 276 |
-
body.dark-mode .product { background: var(--surface-dark); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); }
|
| 277 |
.product:active { transform: scale(0.98); }
|
| 278 |
|
| 279 |
-
.product-image { width: 100%; aspect-ratio: 1 / 1; background-color: var(--surface-
|
| 280 |
.product-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
|
| 281 |
.product-info { padding: 10px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
|
| 282 |
-
.product h2 { font-size: 0.95rem; font-weight: 500; margin: 0 0 5px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-color); }
|
| 283 |
-
body.dark-mode .product h2 { color: var(--text-color-dark); }
|
| 284 |
.product-price { font-size: 1.1rem; color: var(--primary-color); font-weight: 700; text-align: center; margin: 5px 0; }
|
| 285 |
-
.product-description { display: none; }
|
| 286 |
.product-actions { padding: 0 10px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
|
| 287 |
|
| 288 |
-
.product-button { display: block; width: 100%; padding: 8px; border: none; border-radius: 8px; background-color: var(--primary-color); color:
|
| 289 |
.product-button:hover { background-color: var(--primary-dark); }
|
| 290 |
.product-button i { margin-right: 5px; }
|
| 291 |
|
| 292 |
-
|
| 293 |
-
#cart-button { position: fixed; bottom: 15px; right: 15px; background-color: var(--primary-color); color: white; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.3rem; cursor: pointer; display: none; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0, 122, 255, 0.4); z-index: 1000; }
|
| 294 |
#cart-button span { position: absolute; top: -5px; right: -5px; background-color: #FF3B30; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; min-width: 20px; text-align: center; }
|
| 295 |
|
| 296 |
-
|
| 297 |
-
.modal {
|
| 298 |
-
.modal-content { background: var(--surface-color); margin: 5% auto; padding: 20px; border-radius: 12px; width: 95%; max-width: 600px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: slideIn 0.3s ease-out; position: relative; }
|
| 299 |
-
body.dark-mode .modal-content { background: var(--surface-dark); color: var(--text-color-dark); }
|
| 300 |
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
| 301 |
|
| 302 |
.close { position: absolute; top: 10px; right: 15px; font-size: 1.8rem; color: #aaa; cursor: pointer; transition: color 0.3s; line-height: 1; }
|
| 303 |
.close:hover { color: var(--primary-color); }
|
| 304 |
-
body.dark-mode .close { color: var(--text-color-dark); }
|
| 305 |
-
body.dark-mode .close:hover { color: var(--primary-color); }
|
| 306 |
|
| 307 |
.modal-content h2 { margin-top: 0; margin-bottom: 20px; color: var(--primary-color); font-size: 1.5rem; display: flex; align-items: center; gap: 10px;}
|
| 308 |
|
| 309 |
-
.cart-item { display: grid; grid-template-columns: 60px 1fr auto 20px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-color); }
|
| 310 |
-
body.dark-mode .cart-item { border-bottom-color: var(--border-color-dark); }
|
| 311 |
.cart-item:last-child { border-bottom: none; }
|
| 312 |
-
.cart-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 6px; background-color: var(--surface-
|
| 313 |
.cart-item-details { grid-column: 2; }
|
| 314 |
.cart-item-details strong { display: block; margin-bottom: 3px; font-size: 1rem; }
|
| 315 |
-
.cart-item-price { font-size: 0.85rem; color: #
|
| 316 |
-
body.dark-mode .cart-item-price { color: #aaa; }
|
| 317 |
.cart-item-total { font-weight: bold; text-align: right; grid-column: 3; font-size: 0.95rem;}
|
| 318 |
.cart-item-remove { background:none; border:none; color:#FF3B30; cursor:pointer; font-size: 1.2em; padding: 5px; line-height: 1; }
|
| 319 |
|
| 320 |
-
.quantity-input, .color-select, .model-select { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; margin-top: 5px; margin-bottom: 15px; box-sizing: border-box; background-color: var(--
|
| 321 |
-
body.dark-mode .quantity-input, body.dark-mode .color-select, body.dark-mode .model-select { background-color: var(--background-dark); border-color: var(--border-color-dark); color: var(--text-color-dark); }
|
| 322 |
|
| 323 |
-
.cart-summary { margin-top: 20px; text-align: right; border-top: 1px solid var(--border-color); padding-top: 15px; }
|
| 324 |
-
body.dark-mode .cart-summary { border-top-color: var(--border-color-dark); }
|
| 325 |
.cart-summary strong { font-size: 1.2rem; color: var(--primary-color); }
|
| 326 |
.cart-actions { margin-top: 20px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
|
| 327 |
.cart-actions .product-button { flex-grow: 1; padding: 10px; }
|
| 328 |
-
.clear-cart { background-color: #
|
| 329 |
-
.clear-cart:hover { background-color: #
|
| 330 |
.formulate-order-button { background-color: var(--primary-color); }
|
| 331 |
.formulate-order-button:hover { background-color: var(--primary-dark); }
|
| 332 |
|
| 333 |
-
.notification { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background-color: var(--primary-color); color:
|
| 334 |
.notification.show { opacity: 1;}
|
| 335 |
.no-results-message { grid-column: 1 / -1; text-align: center; padding: 40px; font-size: 1.1rem; color: #aaa; }
|
| 336 |
-
.top-product-indicator { position: absolute; top: 5px; right: 5px; background-color: rgba(255,
|
| 337 |
</style>
|
| 338 |
</head>
|
| 339 |
<body>
|
| 340 |
<div class="container">
|
| 341 |
<div class="header">
|
| 342 |
<div class="logo-title-container" style="display: flex; align-items: center; gap: 10px;">
|
| 343 |
-
<
|
| 344 |
-
<h1>Мобильный мир</h1>
|
| 345 |
</div>
|
| 346 |
-
<button class="theme-toggle" onclick="toggleTheme()" aria-label="Переключить тему">
|
| 347 |
-
<i class="fas fa-moon"></i>
|
| 348 |
-
</button>
|
| 349 |
</div>
|
| 350 |
|
| 351 |
<div class="store-address">Наш адрес: {{ store_address }}</div>
|
|
@@ -455,29 +434,6 @@ CATALOG_TEMPLATE = '''
|
|
| 455 |
let selectedProductIndex = null;
|
| 456 |
let cart = JSON.parse(localStorage.getItem('soolaCart') || '[]');
|
| 457 |
|
| 458 |
-
function toggleTheme() {
|
| 459 |
-
document.body.classList.toggle('dark-mode');
|
| 460 |
-
const icon = document.querySelector('.theme-toggle i');
|
| 461 |
-
const isDarkMode = document.body.classList.contains('dark-mode');
|
| 462 |
-
icon.classList.toggle('fa-moon', !isDarkMode);
|
| 463 |
-
icon.classList.toggle('fa-sun', isDarkMode);
|
| 464 |
-
localStorage.setItem('soolaTheme', isDarkMode ? 'dark' : 'light');
|
| 465 |
-
}
|
| 466 |
-
|
| 467 |
-
function applyInitialTheme() {
|
| 468 |
-
const savedTheme = localStorage.getItem('soolaTheme');
|
| 469 |
-
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
| 470 |
-
|
| 471 |
-
if (savedTheme === 'dark' || (!savedTheme && prefersDark)) {
|
| 472 |
-
document.body.classList.add('dark-mode');
|
| 473 |
-
const icon = document.querySelector('.theme-toggle i');
|
| 474 |
-
if (icon) icon.classList.replace('fa-moon', 'fa-sun');
|
| 475 |
-
} else {
|
| 476 |
-
const icon = document.querySelector('.theme-toggle i');
|
| 477 |
-
if (icon) icon.classList.replace('fa-sun', 'fa-moon');
|
| 478 |
-
}
|
| 479 |
-
}
|
| 480 |
-
|
| 481 |
function openModal(index) {
|
| 482 |
loadProductDetails(index);
|
| 483 |
const modal = document.getElementById('productModal');
|
|
@@ -566,7 +522,7 @@ CATALOG_TEMPLATE = '''
|
|
| 566 |
}
|
| 567 |
|
| 568 |
setupVariantSelect('colorSelect', 'colorLabel', product.colors);
|
| 569 |
-
setupVariantSelect('modelSelect', 'modelLabel', product.models);
|
| 570 |
|
| 571 |
document.getElementById('quantityInput').value = 1;
|
| 572 |
const modal = document.getElementById('quantityModal');
|
|
@@ -585,7 +541,7 @@ CATALOG_TEMPLATE = '''
|
|
| 585 |
const modelSelect = document.getElementById('modelSelect');
|
| 586 |
|
| 587 |
const color = colorSelect.style.display !== 'none' && colorSelect.value ? colorSelect.value : 'N/A';
|
| 588 |
-
const model = modelSelect.style.display !== 'none' && modelSelect.value ? modelSelect.value : 'N/A';
|
| 589 |
|
| 590 |
if (isNaN(quantity) || quantity <= 0) {
|
| 591 |
alert("Пожалуйста, укажите корректное количество (больше 0).");
|
|
@@ -599,7 +555,7 @@ CATALOG_TEMPLATE = '''
|
|
| 599 |
return;
|
| 600 |
}
|
| 601 |
|
| 602 |
-
const cartItemId = `${product.name}-${color}-${model}`;
|
| 603 |
const existingItemIndex = cart.findIndex(item => item.id === cartItemId);
|
| 604 |
|
| 605 |
if (existingItemIndex > -1) {
|
|
@@ -612,7 +568,7 @@ CATALOG_TEMPLATE = '''
|
|
| 612 |
photo: product.photos && product.photos.length > 0 ? product.photos[0] : null,
|
| 613 |
quantity: quantity,
|
| 614 |
color: color,
|
| 615 |
-
model: model
|
| 616 |
});
|
| 617 |
}
|
| 618 |
|
|
@@ -659,7 +615,7 @@ CATALOG_TEMPLATE = '''
|
|
| 659 |
|
| 660 |
let variantText = [];
|
| 661 |
if (item.color !== 'N/A') variantText.push(`Цвет: ${item.color}`);
|
| 662 |
-
if (item.model !== 'N/A') variantText.push(`Модель: ${item.model}`);
|
| 663 |
|
| 664 |
const variantDisplay = variantText.length > 0 ? ` (${variantText.join(', ')})` : '';
|
| 665 |
|
|
@@ -756,7 +712,7 @@ CATALOG_TEMPLATE = '''
|
|
| 756 |
if (existingNoResults) existingNoResults.remove();
|
| 757 |
|
| 758 |
const allProductElements = document.querySelectorAll('.products-grid .product');
|
| 759 |
-
if (allProductElements.length === 0 && products.length > 0) return;
|
| 760 |
|
| 761 |
document.querySelectorAll('.products-grid .product').forEach(productElement => {
|
| 762 |
const name = productElement.getAttribute('data-name');
|
|
@@ -836,7 +792,6 @@ CATALOG_TEMPLATE = '''
|
|
| 836 |
}
|
| 837 |
|
| 838 |
document.addEventListener('DOMContentLoaded', () => {
|
| 839 |
-
applyInitialTheme();
|
| 840 |
updateCartButton();
|
| 841 |
setupFilters();
|
| 842 |
|
|
@@ -863,7 +818,7 @@ CATALOG_TEMPLATE = '''
|
|
| 863 |
PRODUCT_DETAIL_TEMPLATE = '''
|
| 864 |
<div style="padding: 10px;">
|
| 865 |
<h2 style="font-size: 1.6rem; font-weight: 600; margin-bottom: 15px; text-align: center; color: var(--primary-color);">{{ product['name'] }}</h2>
|
| 866 |
-
<div class="swiper-container" style="max-width: 450px; margin: 0 auto 20px; border-radius: 10px; overflow: hidden; background-color: var(--surface-
|
| 867 |
<div class="swiper-wrapper">
|
| 868 |
{% if product.get('photos') and product['photos']|length > 0 %}
|
| 869 |
{% for photo in product['photos'] %}
|
|
@@ -908,9 +863,8 @@ PRODUCT_DETAIL_TEMPLATE = '''
|
|
| 908 |
</div>
|
| 909 |
</div>
|
| 910 |
<script>
|
| 911 |
-
|
| 912 |
-
document.documentElement.style.setProperty('--
|
| 913 |
-
document.documentElement.style.setProperty('--surface-color', document.body.classList.contains('dark-mode') ? '#21252B' : '#FFFFFF');
|
| 914 |
</script>
|
| 915 |
'''
|
| 916 |
|
|
@@ -920,16 +874,17 @@ ORDER_TEMPLATE = '''
|
|
| 920 |
<head>
|
| 921 |
<meta charset="UTF-8">
|
| 922 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 923 |
-
<title>Заказ №{{ order.id }} -
|
| 924 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 925 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 926 |
<style>
|
| 927 |
:root {
|
| 928 |
-
--primary-color: #
|
| 929 |
-
--
|
| 930 |
-
--
|
| 931 |
-
--
|
| 932 |
-
--
|
|
|
|
| 933 |
}
|
| 934 |
body { font-family: 'Roboto', sans-serif; background: var(--background-color); color: var(--text-color); line-height: 1.5; padding: 15px; }
|
| 935 |
.container { max-width: 800px; margin: 15px auto; padding: 25px; background: var(--surface-color); border-radius: 12px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid var(--border-color); }
|
|
@@ -938,18 +893,18 @@ ORDER_TEMPLATE = '''
|
|
| 938 |
.order-meta { font-size: 0.85rem; color: #888; margin-bottom: 15px; text-align: center; }
|
| 939 |
.order-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 15px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
|
| 940 |
.order-item:last-child { border-bottom: none; }
|
| 941 |
-
.order-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 6px; background-color: #
|
| 942 |
.item-details strong { display: block; margin-bottom: 3px; font-size: 1rem; color: var(--text-color);}
|
| 943 |
-
.item-details span { font-size: 0.85rem; color: #
|
| 944 |
.item-total { font-weight: bold; text-align: right; font-size: 1rem; color: var(--primary-color);}
|
| 945 |
.order-summary { margin-top: 25px; padding-top: 15px; border-top: 2px solid var(--primary-color); text-align: right; }
|
| 946 |
.order-summary p { margin-bottom: 8px; font-size: 1rem; }
|
| 947 |
.order-summary strong { font-size: 1.2rem; color: var(--primary-color); }
|
| 948 |
-
.customer-info { margin-top: 25px; background-color: #
|
| 949 |
.customer-info p { margin-bottom: 6px; font-size: 0.95rem; }
|
| 950 |
.customer-info strong { color: var(--primary-color); }
|
| 951 |
.actions { margin-top: 25px; text-align: center; }
|
| 952 |
-
.button { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--primary-color); color:
|
| 953 |
.button:hover { background-color: var(--primary-dark); }
|
| 954 |
.not-found { text-align: center; color: #c53030; font-size: 1.2rem; padding: 40px 0;}
|
| 955 |
</style>
|
|
@@ -1010,10 +965,9 @@ ORDER_TEMPLATE = '''
|
|
| 1010 |
function sendOrderViaWhatsApp() {
|
| 1011 |
const orderId = '{{ order.id }}';
|
| 1012 |
const orderUrl = `{{ request.url }}`;
|
| 1013 |
-
|
| 1014 |
-
const whatsappNumber = "77074354171";
|
| 1015 |
|
| 1016 |
-
let message = `Здравствуйте! Хочу подтвердить свой заказ
|
| 1017 |
message += `*Номер заказа:* ${orderId}%0A`;
|
| 1018 |
message += `*Ссылка на заказ:* ${encodeURIComponent(orderUrl)}%0A%0A`;
|
| 1019 |
message += `Пожалуйста, свяжитесь со мной для уточнения деталей оплаты и доставки.`;
|
|
@@ -1039,138 +993,110 @@ ADMIN_TEMPLATE = '''
|
|
| 1039 |
<head>
|
| 1040 |
<meta charset="UTF-8">
|
| 1041 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 1042 |
-
<title>Админ-панель -
|
| 1043 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 1044 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 1045 |
<style>
|
| 1046 |
-
/* TWA Inspired Theme */
|
| 1047 |
:root {
|
| 1048 |
-
--primary-color: #
|
| 1049 |
-
--primary-dark: #
|
| 1050 |
-
--surface-color: #
|
| 1051 |
-
--surface-dark: #
|
| 1052 |
-
--background-color: #
|
| 1053 |
-
--background-dark: #
|
| 1054 |
-
--text-color: #
|
| 1055 |
-
--text-color-dark: #
|
| 1056 |
-
--border-color: #
|
| 1057 |
--border-color-dark: #3A3A3A;
|
| 1058 |
-
--success-bg: #
|
| 1059 |
-
--success-text: #
|
| 1060 |
-
--error-bg: #
|
| 1061 |
-
--error-text: #
|
| 1062 |
-
--warning-bg: #
|
| 1063 |
-
--warning-text: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1064 |
}
|
| 1065 |
-
|
| 1066 |
-
.
|
| 1067 |
-
.header { padding-bottom: 15px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;}
|
| 1068 |
h1, h2, h3 { font-weight: 500; color: var(--primary-color); margin-bottom: 15px; }
|
| 1069 |
h1 { font-size: 1.6rem; }
|
| 1070 |
-
h2 { font-size: 1.4rem; margin-top: 30px; display: flex; align-items: center; gap: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border-color);}
|
| 1071 |
-
h3 { font-size: 1.1rem; color: var(--text-color); margin-top: 20px; font-weight: 600; }
|
| 1072 |
-
.section { margin-bottom: 30px; padding: 20px; background-color:
|
| 1073 |
|
| 1074 |
-
|
| 1075 |
-
|
| 1076 |
-
|
| 1077 |
-
body.dark-mode .header { border-bottom-color: var(--border-color-dark); }
|
| 1078 |
-
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 { color: var(--primary-color); }
|
| 1079 |
-
body.dark-mode .section { background-color: var(--background-dark); border-color: var(--border-color-dark); }
|
| 1080 |
-
|
| 1081 |
-
/* Forms */
|
| 1082 |
-
label { font-weight: 500; margin-top: 10px; display: block; color: var(--text-color); font-size: 0.9rem;}
|
| 1083 |
-
input[type="text"], input[type="number"], input[type="password"], input[type="tel"], textarea, select { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; transition: border-color 0.3s ease; background-color: var(--surface-color); color: var(--text-color); }
|
| 1084 |
-
body.dark-mode input[type="text"], body.dark-mode input[type="number"], body.dark-mode textarea, body.dark-mode select { background-color: var(--surface-dark); border-color: var(--border-color-dark); color: var(--text-color-dark); }
|
| 1085 |
-
|
| 1086 |
-
input:focus, textarea:focus, select:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2); }
|
| 1087 |
textarea { min-height: 80px; resize: vertical; }
|
| 1088 |
-
input[type="file"] { padding: 8px; background-color: #
|
| 1089 |
input[type="checkbox"] { transform: scale(1.1); margin-right: 5px; vertical-align: middle; }
|
| 1090 |
|
| 1091 |
-
|
| 1092 |
-
button, .button { padding: 8px 15px; border: none; border-radius: 6px; background-color: var(--primary-color); color: white; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease, transform 0.1s ease; margin-top: 10px; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; line-height: 1.2;}
|
| 1093 |
button:hover, .button:hover { background-color: var(--primary-dark); }
|
| 1094 |
-
.delete-button { background-color: #FF3B30; }
|
| 1095 |
.delete-button:hover { background-color: #d11a2a; }
|
| 1096 |
.add-button { background-color: var(--primary-color); }
|
| 1097 |
.add-button:hover { background-color: var(--primary-dark); }
|
| 1098 |
|
| 1099 |
-
/* Product List */
|
| 1100 |
.item-list { display: grid; gap: 15px; }
|
| 1101 |
-
.item { background: var(--surface-
|
| 1102 |
-
|
| 1103 |
-
.item
|
| 1104 |
-
body.dark-mode .item p { color: #aaa; }
|
| 1105 |
-
.item strong { color: var(--text-color); }
|
| 1106 |
-
body.dark-mode .item strong { color: var(--text-color-dark); }
|
| 1107 |
.item .description { font-size: 0.8rem; color: #888; max-height: 40px; overflow: hidden; }
|
| 1108 |
.item-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
|
| 1109 |
-
.photo-preview img { max-width: 60px; max-height: 60px; border-radius: 4px; margin: 3px 3px 0 0; border: 1px solid var(--border-color); object-fit: cover;}
|
| 1110 |
|
| 1111 |
-
/* Variants Input */
|
| 1112 |
.variant-input-group { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
| 1113 |
.variant-input-group input { flex-grow: 1; margin: 0; }
|
| 1114 |
-
.remove-variant-btn { background-color: #FF3B30; padding: 6px 10px; font-size: 0.8rem; margin-top: 0; line-height: 1; }
|
| 1115 |
-
.add-variant-btn { background-color: #
|
| 1116 |
-
.add-variant-btn:hover { background-color: #
|
| 1117 |
|
| 1118 |
-
/* Messages and Statuses */
|
| 1119 |
.message { padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; font-size: 0.9rem;}
|
| 1120 |
-
.message.success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid #
|
| 1121 |
-
.message.error { background-color: var(--error-bg); color: var(--error-text); border: 1px solid #
|
| 1122 |
-
.message.warning { background-color: var(--warning-bg); color: var(--warning-text); border: 1px solid #
|
| 1123 |
.status-indicator { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 0.75rem; font-weight: 500; margin-left: 5px; vertical-align: middle; }
|
| 1124 |
.status-indicator.in-stock { background-color: #c6f6d5; color: #2f855a; }
|
| 1125 |
.status-indicator.out-of-stock { background-color: #fed7d7; color: #c53030; }
|
| 1126 |
.status-indicator.top-product { background-color: #fff3c4; color: #9c4221; margin-left: 5px;}
|
| 1127 |
|
| 1128 |
-
|
| 1129 |
-
.status-indicator.
|
| 1130 |
-
.status-indicator.
|
| 1131 |
-
.status-indicator.
|
| 1132 |
-
.status-indicator.shipped { background-color: #a7f3d0; color: #065f46; } /* Teal */
|
| 1133 |
|
| 1134 |
-
|
| 1135 |
-
details {
|
| 1136 |
-
|
| 1137 |
-
details > summary { cursor: pointer; font-weight: 500; color: var(--text-color); display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; list-style: none; position: relative; }
|
| 1138 |
-
details[open] > summary { border-bottom: 1px solid var(--border-color); }
|
| 1139 |
.order-details-content { padding: 10px 15px; }
|
| 1140 |
-
.order-item-detail { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed #
|
| 1141 |
.order-item-detail:first-child { border-top: none; }
|
| 1142 |
.order-item-detail img { width: 30px; height: 30px; object-fit: contain; border-radius: 3px; }
|
| 1143 |
.order-item-name { flex-grow: 1; }
|
| 1144 |
.order-item-qty-price { width: 130px; text-align: right; flex-shrink: 0; }
|
| 1145 |
-
.order-total-summary { font-size: 1rem; font-weight: 600; margin-top: 15px; padding-top: 10px; border-top: 1px solid var(--border-color); text-align: right; color: var(--primary-color); }
|
| 1146 |
-
.order-status-form { display: flex; gap: 10px; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--border-color); flex-wrap: wrap; }
|
| 1147 |
.order-status-form select { max-width: 180px; margin-top: 0; flex-grow: 1; }
|
| 1148 |
|
| 1149 |
.flex-container { display: flex; flex-wrap: wrap; gap: 20px; }
|
| 1150 |
.flex-item { flex: 1; min-width: 300px; }
|
| 1151 |
</style>
|
| 1152 |
-
<script>
|
| 1153 |
-
function toggleTheme() {
|
| 1154 |
-
document.body.classList.toggle('dark-mode');
|
| 1155 |
-
localStorage.setItem('adminTheme', document.body.classList.contains('dark-mode') ? 'dark' : 'light');
|
| 1156 |
-
}
|
| 1157 |
-
document.addEventListener('DOMContentLoaded', () => {
|
| 1158 |
-
if (localStorage.getItem('adminTheme') === 'dark') {
|
| 1159 |
-
document.body.classList.add('dark-mode');
|
| 1160 |
-
}
|
| 1161 |
-
});
|
| 1162 |
-
</script>
|
| 1163 |
</head>
|
| 1164 |
<body>
|
| 1165 |
<div class="container">
|
| 1166 |
<div class="header">
|
| 1167 |
<div class="logo-title-container" style="display: flex; align-items: center; gap: 10px;">
|
| 1168 |
-
<img src="https://huggingface.co/spaces/Kgshop/mobilnymir/resolve/main/IMG_20251019_120056_121.jpg" alt="Мобильный мир Logo" style="height: 40px; width: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 5px rgba(0, 122, 255, 0.7);">
|
| 1169 |
<h1><i class="fas fa-tools"></i> Админ-панель</h1>
|
| 1170 |
</div>
|
| 1171 |
<div>
|
| 1172 |
<a href="{{ url_for('catalog') }}" class="button" style="margin-right: 10px;"><i class="fas fa-store"></i> Каталог</a>
|
| 1173 |
-
<button class="button" onclick="toggleTheme()"><i class="fas fa-adjust"></i> Тема</button>
|
| 1174 |
</div>
|
| 1175 |
</div>
|
| 1176 |
|
|
@@ -1197,7 +1123,7 @@ ADMIN_TEMPLATE = '''
|
|
| 1197 |
Заказ №{{ order.id }}
|
| 1198 |
<span class="status-indicator {{ current_status }}">{{ status_map_ru.get(current_status, current_status) }}</span>
|
| 1199 |
</span>
|
| 1200 |
-
<span style="font-size: 0.85rem; color: #
|
| 1201 |
Дата: {{ order.created_at }} | Итого: {{ "%.2f"|format(order.total_price) }} {{ currency_code }}
|
| 1202 |
</span>
|
| 1203 |
</summary>
|
|
@@ -1242,7 +1168,7 @@ ADMIN_TEMPLATE = '''
|
|
| 1242 |
{% endfor %}
|
| 1243 |
</select>
|
| 1244 |
<button type="submit" class="button" style="flex-grow: 0;"><i class="fas fa-check"></i> Сохранить</button>
|
| 1245 |
-
<a href="{{ url_for('view_order', order_id=order.id) }}" target="_blank" class="button" style="background-color: #555; flex-grow: 0;"><i class="fas fa-eye"></i> Просмотр</a>
|
| 1246 |
</form>
|
| 1247 |
</div>
|
| 1248 |
</div>
|
|
@@ -1511,10 +1437,9 @@ ADMIN_TEMPLATE = '''
|
|
| 1511 |
function addVariantInput(containerId, fieldName, placeholder) {
|
| 1512 |
const container = document.getElementById(containerId);
|
| 1513 |
if (container) {
|
| 1514 |
-
// Check if there's only one empty placeholder left, and remove it before adding a new one
|
| 1515 |
const existingInputs = container.querySelectorAll('input[name="' + fieldName + '"]');
|
| 1516 |
if (existingInputs.length === 1 && existingInputs[0].value.trim() === '') {
|
| 1517 |
-
existingInputs[0].value = '';
|
| 1518 |
}
|
| 1519 |
|
| 1520 |
const newInputGroup = document.createElement('div');
|
|
@@ -1540,7 +1465,6 @@ ADMIN_TEMPLATE = '''
|
|
| 1540 |
|
| 1541 |
group.remove();
|
| 1542 |
|
| 1543 |
-
// If all inputs for this field are removed, add an empty placeholder back
|
| 1544 |
if (container && container.children.length === 0) {
|
| 1545 |
const placeholderGroup = document.createElement('div');
|
| 1546 |
placeholderGroup.className = 'variant-input-group';
|
|
@@ -1590,7 +1514,6 @@ def product_detail(index):
|
|
| 1590 |
logging.warning(f"Attempted access to non-existent or out-of-stock product with index {index}")
|
| 1591 |
return "Товар не найден или отсутствует в наличии.", 404
|
| 1592 |
|
| 1593 |
-
# Pass the sorted index back so the JS function can correctly call openQuantityModal
|
| 1594 |
products_index = index
|
| 1595 |
|
| 1596 |
return render_template_string(
|
|
@@ -1632,7 +1555,7 @@ def create_order():
|
|
| 1632 |
"price": price,
|
| 1633 |
"quantity": quantity,
|
| 1634 |
"color": item.get('color', 'N/A'),
|
| 1635 |
-
"model": item.get('model', 'N/A'),
|
| 1636 |
"photo": photo_name,
|
| 1637 |
"photo_url": photo_url
|
| 1638 |
})
|
|
@@ -1771,7 +1694,7 @@ def admin():
|
|
| 1771 |
category = request.form.get('category')
|
| 1772 |
photos_files = request.files.getlist('photos')
|
| 1773 |
colors = [c.strip() for c in request.form.getlist('colors') if c.strip()]
|
| 1774 |
-
models = [m.strip() for m in request.form.getlist('models') if m.strip()]
|
| 1775 |
in_stock = 'in_stock' in request.form
|
| 1776 |
is_top = 'is_top' in request.form
|
| 1777 |
|
|
@@ -1844,7 +1767,7 @@ def admin():
|
|
| 1844 |
'id': str(uuid.uuid4()),
|
| 1845 |
'name': name, 'price': price, 'description': description,
|
| 1846 |
'category': category if category in categories else 'Без категории',
|
| 1847 |
-
'photos': photos_list, 'colors': colors, 'models': models,
|
| 1848 |
'in_stock': in_stock, 'is_top': is_top
|
| 1849 |
}
|
| 1850 |
products.append(new_product)
|
|
@@ -1879,7 +1802,7 @@ def admin():
|
|
| 1879 |
category = request.form.get('category')
|
| 1880 |
product_to_edit['category'] = category if category in categories else 'Без категории'
|
| 1881 |
product_to_edit['colors'] = [c.strip() for c in request.form.getlist('colors') if c.strip()]
|
| 1882 |
-
product_to_edit['models'] = [m.strip() for m in request.form.getlist('models') if m.strip()]
|
| 1883 |
product_to_edit['in_stock'] = 'in_stock' in request.form
|
| 1884 |
product_to_edit['is_top'] = 'is_top' in request.form
|
| 1885 |
|
|
|
|
| 220 |
<head>
|
| 221 |
<meta charset="UTF-8">
|
| 222 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 223 |
+
<title>АДК - Каталог</title>
|
| 224 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 225 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 226 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
|
| 227 |
<style>
|
| 228 |
:root {
|
| 229 |
+
--primary-color: #FFD700;
|
| 230 |
+
--primary-dark: #cca300;
|
| 231 |
+
--surface-color: #121212;
|
| 232 |
+
--surface-dark: #1A1A1A;
|
| 233 |
+
--background-color: #000000;
|
| 234 |
+
--background-dark: #000000;
|
| 235 |
+
--text-color: #E0E0E0;
|
| 236 |
+
--text-color-dark: #F5F5F5;
|
| 237 |
+
--border-color: #2A2A2A;
|
| 238 |
--border-color-dark: #3A3A3A;
|
| 239 |
}
|
| 240 |
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 241 |
+
body {
|
| 242 |
+
font-family: 'Roboto', sans-serif;
|
| 243 |
+
background: var(--background-dark);
|
| 244 |
+
color: var(--text-color-dark);
|
| 245 |
+
line-height: 1.5;
|
| 246 |
+
transition: all 0.3s;
|
| 247 |
+
}
|
| 248 |
|
|
|
|
| 249 |
.container { max-width: 100%; margin: 0 auto; padding: 0; }
|
| 250 |
.content-area { padding: 15px; }
|
| 251 |
|
| 252 |
+
.header { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background: var(--surface-dark); border-bottom: 1px solid var(--border-color-dark); box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
|
|
|
|
|
|
|
| 253 |
.header h1 { font-size: 1.4rem; font-weight: 500; color: var(--primary-color); }
|
|
|
|
|
|
|
|
|
|
| 254 |
|
| 255 |
+
.store-address { padding: 12px 15px; text-align: center; background-color: var(--surface-dark); border-radius: 8px; box-shadow: 0 1px 3px rgba(255,255,255,0.1); font-size: 0.9rem; color: var(--text-color-dark); margin: 15px; }
|
|
|
|
| 256 |
|
|
|
|
| 257 |
.search-container { padding: 0 15px 15px; }
|
| 258 |
+
#search-input { width: 100%; padding: 10px 15px; font-size: 1rem; border: 1px solid var(--border-color-dark); border-radius: 20px; outline: none; transition: all 0.3s; background-color: var(--surface-dark); color: var(--text-color-dark); }
|
| 259 |
+
#search-input:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2); }
|
|
|
|
| 260 |
|
| 261 |
.filters-container { margin: 0 15px 15px; display: flex; overflow-x: auto; gap: 8px; padding-bottom: 5px; scrollbar-width: none; }
|
| 262 |
.filters-container::-webkit-scrollbar { display: none; }
|
| 263 |
+
.category-filter { padding: 8px 14px; border: 1px solid var(--border-color-dark); border-radius: 20px; background-color: var(--surface-dark); cursor: pointer; transition: all 0.2s ease; font-size: 0.85rem; font-weight: 400; color: var(--text-color-dark); white-space: nowrap; }
|
| 264 |
+
.category-filter.active, .category-filter:hover { background-color: var(--primary-color); color: #000; border-color: var(--primary-color); box-shadow: 0 2px 5px rgba(255, 215, 0, 0.3); }
|
|
|
|
| 265 |
|
|
|
|
| 266 |
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 10px 15px 70px; }
|
| 267 |
@media (min-width: 600px) { .products-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; } }
|
| 268 |
|
| 269 |
+
.product { background: var(--surface-dark); border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease, box-shadow 0.2s ease; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; height: 100%; position: relative; }
|
|
|
|
| 270 |
.product:active { transform: scale(0.98); }
|
| 271 |
|
| 272 |
+
.product-image { width: 100%; aspect-ratio: 1 / 1; background-color: var(--surface-dark); display: flex; justify-content: center; align-items: center; padding: 10px; }
|
| 273 |
.product-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
|
| 274 |
.product-info { padding: 10px; flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
|
| 275 |
+
.product h2 { font-size: 0.95rem; font-weight: 500; margin: 0 0 5px 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-color-dark); }
|
|
|
|
| 276 |
.product-price { font-size: 1.1rem; color: var(--primary-color); font-weight: 700; text-align: center; margin: 5px 0; }
|
| 277 |
+
.product-description { display: none; }
|
| 278 |
.product-actions { padding: 0 10px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
|
| 279 |
|
| 280 |
+
.product-button { display: block; width: 100%; padding: 8px; border: none; border-radius: 8px; background-color: var(--primary-color); color: #000; font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: all 0.2s ease; text-align: center; text-decoration: none; }
|
| 281 |
.product-button:hover { background-color: var(--primary-dark); }
|
| 282 |
.product-button i { margin-right: 5px; }
|
| 283 |
|
| 284 |
+
#cart-button { position: fixed; bottom: 15px; right: 15px; background-color: var(--primary-color); color: #000; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.3rem; cursor: pointer; display: none; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(255, 215, 0, 0.4); z-index: 1000; }
|
|
|
|
| 285 |
#cart-button span { position: absolute; top: -5px; right: -5px; background-color: #FF3B30; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; min-width: 20px; text-align: center; }
|
| 286 |
|
| 287 |
+
.modal { display: none; position: fixed; z-index: 1001; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.8); backdrop-filter: blur(5px); overflow-y: auto; }
|
| 288 |
+
.modal-content { background: var(--surface-dark); margin: 5% auto; padding: 20px; border-radius: 12px; width: 95%; max-width: 600px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); animation: slideIn 0.3s ease-out; position: relative; color: var(--text-color-dark); }
|
|
|
|
|
|
|
| 289 |
@keyframes slideIn { from { transform: translateY(-30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
| 290 |
|
| 291 |
.close { position: absolute; top: 10px; right: 15px; font-size: 1.8rem; color: #aaa; cursor: pointer; transition: color 0.3s; line-height: 1; }
|
| 292 |
.close:hover { color: var(--primary-color); }
|
|
|
|
|
|
|
| 293 |
|
| 294 |
.modal-content h2 { margin-top: 0; margin-bottom: 20px; color: var(--primary-color); font-size: 1.5rem; display: flex; align-items: center; gap: 10px;}
|
| 295 |
|
| 296 |
+
.cart-item { display: grid; grid-template-columns: 60px 1fr auto 20px; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-color-dark); }
|
|
|
|
| 297 |
.cart-item:last-child { border-bottom: none; }
|
| 298 |
+
.cart-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 6px; background-color: var(--surface-dark); padding: 5px; }
|
| 299 |
.cart-item-details { grid-column: 2; }
|
| 300 |
.cart-item-details strong { display: block; margin-bottom: 3px; font-size: 1rem; }
|
| 301 |
+
.cart-item-price { font-size: 0.85rem; color: #aaa; }
|
|
|
|
| 302 |
.cart-item-total { font-weight: bold; text-align: right; grid-column: 3; font-size: 0.95rem;}
|
| 303 |
.cart-item-remove { background:none; border:none; color:#FF3B30; cursor:pointer; font-size: 1.2em; padding: 5px; line-height: 1; }
|
| 304 |
|
| 305 |
+
.quantity-input, .color-select, .model-select { width: 100%; padding: 10px; border: 1px solid var(--border-color-dark); border-radius: 8px; font-size: 1rem; margin-top: 5px; margin-bottom: 15px; box-sizing: border-box; background-color: var(--background-dark); color: var(--text-color-dark); }
|
|
|
|
| 306 |
|
| 307 |
+
.cart-summary { margin-top: 20px; text-align: right; border-top: 1px solid var(--border-color-dark); padding-top: 15px; }
|
|
|
|
| 308 |
.cart-summary strong { font-size: 1.2rem; color: var(--primary-color); }
|
| 309 |
.cart-actions { margin-top: 20px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
|
| 310 |
.cart-actions .product-button { flex-grow: 1; padding: 10px; }
|
| 311 |
+
.clear-cart { background-color: #555; color: #fff; }
|
| 312 |
+
.clear-cart:hover { background-color: #777; }
|
| 313 |
.formulate-order-button { background-color: var(--primary-color); }
|
| 314 |
.formulate-order-button:hover { background-color: var(--primary-dark); }
|
| 315 |
|
| 316 |
+
.notification { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background-color: var(--primary-color); color: #000; padding: 10px 20px; border-radius: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.2); z-index: 1002; opacity: 0; transition: opacity 0.5s ease; font-size: 0.9rem;}
|
| 317 |
.notification.show { opacity: 1;}
|
| 318 |
.no-results-message { grid-column: 1 / -1; text-align: center; padding: 40px; font-size: 1.1rem; color: #aaa; }
|
| 319 |
+
.top-product-indicator { position: absolute; top: 5px; right: 5px; background-color: rgba(255, 215, 0, 0.9); color: #000; padding: 2px 6px; font-size: 0.7rem; border-radius: 4px; font-weight: bold; z-index: 10; }
|
| 320 |
</style>
|
| 321 |
</head>
|
| 322 |
<body>
|
| 323 |
<div class="container">
|
| 324 |
<div class="header">
|
| 325 |
<div class="logo-title-container" style="display: flex; align-items: center; gap: 10px;">
|
| 326 |
+
<h1>АДК</h1>
|
|
|
|
| 327 |
</div>
|
|
|
|
|
|
|
|
|
|
| 328 |
</div>
|
| 329 |
|
| 330 |
<div class="store-address">Наш адрес: {{ store_address }}</div>
|
|
|
|
| 434 |
let selectedProductIndex = null;
|
| 435 |
let cart = JSON.parse(localStorage.getItem('soolaCart') || '[]');
|
| 436 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 437 |
function openModal(index) {
|
| 438 |
loadProductDetails(index);
|
| 439 |
const modal = document.getElementById('productModal');
|
|
|
|
| 522 |
}
|
| 523 |
|
| 524 |
setupVariantSelect('colorSelect', 'colorLabel', product.colors);
|
| 525 |
+
setupVariantSelect('modelSelect', 'modelLabel', product.models);
|
| 526 |
|
| 527 |
document.getElementById('quantityInput').value = 1;
|
| 528 |
const modal = document.getElementById('quantityModal');
|
|
|
|
| 541 |
const modelSelect = document.getElementById('modelSelect');
|
| 542 |
|
| 543 |
const color = colorSelect.style.display !== 'none' && colorSelect.value ? colorSelect.value : 'N/A';
|
| 544 |
+
const model = modelSelect.style.display !== 'none' && modelSelect.value ? modelSelect.value : 'N/A';
|
| 545 |
|
| 546 |
if (isNaN(quantity) || quantity <= 0) {
|
| 547 |
alert("Пожалуйста, укажите корректное количество (больше 0).");
|
|
|
|
| 555 |
return;
|
| 556 |
}
|
| 557 |
|
| 558 |
+
const cartItemId = `${product.name}-${color}-${model}`;
|
| 559 |
const existingItemIndex = cart.findIndex(item => item.id === cartItemId);
|
| 560 |
|
| 561 |
if (existingItemIndex > -1) {
|
|
|
|
| 568 |
photo: product.photos && product.photos.length > 0 ? product.photos[0] : null,
|
| 569 |
quantity: quantity,
|
| 570 |
color: color,
|
| 571 |
+
model: model
|
| 572 |
});
|
| 573 |
}
|
| 574 |
|
|
|
|
| 615 |
|
| 616 |
let variantText = [];
|
| 617 |
if (item.color !== 'N/A') variantText.push(`Цвет: ${item.color}`);
|
| 618 |
+
if (item.model !== 'N/A') variantText.push(`Модель: ${item.model}`);
|
| 619 |
|
| 620 |
const variantDisplay = variantText.length > 0 ? ` (${variantText.join(', ')})` : '';
|
| 621 |
|
|
|
|
| 712 |
if (existingNoResults) existingNoResults.remove();
|
| 713 |
|
| 714 |
const allProductElements = document.querySelectorAll('.products-grid .product');
|
| 715 |
+
if (allProductElements.length === 0 && products.length > 0) return;
|
| 716 |
|
| 717 |
document.querySelectorAll('.products-grid .product').forEach(productElement => {
|
| 718 |
const name = productElement.getAttribute('data-name');
|
|
|
|
| 792 |
}
|
| 793 |
|
| 794 |
document.addEventListener('DOMContentLoaded', () => {
|
|
|
|
| 795 |
updateCartButton();
|
| 796 |
setupFilters();
|
| 797 |
|
|
|
|
| 818 |
PRODUCT_DETAIL_TEMPLATE = '''
|
| 819 |
<div style="padding: 10px;">
|
| 820 |
<h2 style="font-size: 1.6rem; font-weight: 600; margin-bottom: 15px; text-align: center; color: var(--primary-color);">{{ product['name'] }}</h2>
|
| 821 |
+
<div class="swiper-container" style="max-width: 450px; margin: 0 auto 20px; border-radius: 10px; overflow: hidden; background-color: var(--surface-dark);">
|
| 822 |
<div class="swiper-wrapper">
|
| 823 |
{% if product.get('photos') and product['photos']|length > 0 %}
|
| 824 |
{% for photo in product['photos'] %}
|
|
|
|
| 863 |
</div>
|
| 864 |
</div>
|
| 865 |
<script>
|
| 866 |
+
document.documentElement.style.setProperty('--primary-color', '#FFD700');
|
| 867 |
+
document.documentElement.style.setProperty('--surface-dark', '#1A1A1A');
|
|
|
|
| 868 |
</script>
|
| 869 |
'''
|
| 870 |
|
|
|
|
| 874 |
<head>
|
| 875 |
<meta charset="UTF-8">
|
| 876 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 877 |
+
<title>Заказ №{{ order.id }} - АДК</title>
|
| 878 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 879 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 880 |
<style>
|
| 881 |
:root {
|
| 882 |
+
--primary-color: #FFD700;
|
| 883 |
+
--primary-dark: #cca300;
|
| 884 |
+
--surface-color: #121212;
|
| 885 |
+
--background-color: #000000;
|
| 886 |
+
--text-color: #E0E0E0;
|
| 887 |
+
--border-color: #2A2A2A;
|
| 888 |
}
|
| 889 |
body { font-family: 'Roboto', sans-serif; background: var(--background-color); color: var(--text-color); line-height: 1.5; padding: 15px; }
|
| 890 |
.container { max-width: 800px; margin: 15px auto; padding: 25px; background: var(--surface-color); border-radius: 12px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid var(--border-color); }
|
|
|
|
| 893 |
.order-meta { font-size: 0.85rem; color: #888; margin-bottom: 15px; text-align: center; }
|
| 894 |
.order-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 15px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-color); }
|
| 895 |
.order-item:last-child { border-bottom: none; }
|
| 896 |
+
.order-item img { width: 60px; height: 60px; object-fit: contain; border-radius: 6px; background-color: #222; padding: 5px; border: 1px solid #444;}
|
| 897 |
.item-details strong { display: block; margin-bottom: 3px; font-size: 1rem; color: var(--text-color);}
|
| 898 |
+
.item-details span { font-size: 0.85rem; color: #aaa; display: block;}
|
| 899 |
.item-total { font-weight: bold; text-align: right; font-size: 1rem; color: var(--primary-color);}
|
| 900 |
.order-summary { margin-top: 25px; padding-top: 15px; border-top: 2px solid var(--primary-color); text-align: right; }
|
| 901 |
.order-summary p { margin-bottom: 8px; font-size: 1rem; }
|
| 902 |
.order-summary strong { font-size: 1.2rem; color: var(--primary-color); }
|
| 903 |
+
.customer-info { margin-top: 25px; background-color: #2c2a00; padding: 15px; border-radius: 8px; border: 1px solid #575300;}
|
| 904 |
.customer-info p { margin-bottom: 6px; font-size: 0.95rem; }
|
| 905 |
.customer-info strong { color: var(--primary-color); }
|
| 906 |
.actions { margin-top: 25px; text-align: center; }
|
| 907 |
+
.button { padding: 10px 20px; border: none; border-radius: 8px; background-color: var(--primary-color); color: #000; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease; font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
|
| 908 |
.button:hover { background-color: var(--primary-dark); }
|
| 909 |
.not-found { text-align: center; color: #c53030; font-size: 1.2rem; padding: 40px 0;}
|
| 910 |
</style>
|
|
|
|
| 965 |
function sendOrderViaWhatsApp() {
|
| 966 |
const orderId = '{{ order.id }}';
|
| 967 |
const orderUrl = `{{ request.url }}`;
|
| 968 |
+
const whatsappNumber = "77079049379";
|
|
|
|
| 969 |
|
| 970 |
+
let message = `Здравствуйте! Хочу подтвердить свой заказ в АДК:%0A%0A`;
|
| 971 |
message += `*Номер заказа:* ${orderId}%0A`;
|
| 972 |
message += `*Ссылка на заказ:* ${encodeURIComponent(orderUrl)}%0A%0A`;
|
| 973 |
message += `Пожалуйста, свяжитесь со мной для уточнения деталей оплаты и доставки.`;
|
|
|
|
| 993 |
<head>
|
| 994 |
<meta charset="UTF-8">
|
| 995 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 996 |
+
<title>Админ-панель - АДК</title>
|
| 997 |
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 998 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 999 |
<style>
|
|
|
|
| 1000 |
:root {
|
| 1001 |
+
--primary-color: #FFD700;
|
| 1002 |
+
--primary-dark: #cca300;
|
| 1003 |
+
--surface-color: #121212;
|
| 1004 |
+
--surface-dark: #1A1A1A;
|
| 1005 |
+
--background-color: #000000;
|
| 1006 |
+
--background-dark: #000000;
|
| 1007 |
+
--text-color: #E0E0E0;
|
| 1008 |
+
--text-color-dark: #F5F5F5;
|
| 1009 |
+
--border-color: #2A2A2A;
|
| 1010 |
--border-color-dark: #3A3A3A;
|
| 1011 |
+
--success-bg: #103a23;
|
| 1012 |
+
--success-text: #6ee39f;
|
| 1013 |
+
--error-bg: #4d0000;
|
| 1014 |
+
--error-text: #ffb3b3;
|
| 1015 |
+
--warning-bg: #4d4400;
|
| 1016 |
+
--warning-text: #ffeeba;
|
| 1017 |
+
}
|
| 1018 |
+
body {
|
| 1019 |
+
font-family: 'Roboto', sans-serif;
|
| 1020 |
+
background-color: var(--background-dark);
|
| 1021 |
+
color: var(--text-color-dark);
|
| 1022 |
+
padding: 15px;
|
| 1023 |
+
line-height: 1.5;
|
| 1024 |
}
|
| 1025 |
+
.container { max-width: 1200px; margin: 0 auto; background-color: var(--surface-dark); padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(255,255,255,0.1); }
|
| 1026 |
+
.header { padding-bottom: 15px; margin-bottom: 20px; border-bottom: 1px solid var(--border-color-dark); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;}
|
|
|
|
| 1027 |
h1, h2, h3 { font-weight: 500; color: var(--primary-color); margin-bottom: 15px; }
|
| 1028 |
h1 { font-size: 1.6rem; }
|
| 1029 |
+
h2 { font-size: 1.4rem; margin-top: 30px; display: flex; align-items: center; gap: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border-color-dark);}
|
| 1030 |
+
h3 { font-size: 1.1rem; color: var(--text-color-dark); margin-top: 20px; font-weight: 600; }
|
| 1031 |
+
.section { margin-bottom: 30px; padding: 20px; background-color: var(--background-dark); border: 1px solid var(--border-color-dark); border-radius: 8px; }
|
| 1032 |
|
| 1033 |
+
label { font-weight: 500; margin-top: 10px; display: block; color: var(--text-color-dark); font-size: 0.9rem;}
|
| 1034 |
+
input[type="text"], input[type="number"], input[type="password"], input[type="tel"], textarea, select { width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--border-color-dark); border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; transition: border-color 0.3s ease; background-color: var(--surface-dark); color: var(--text-color-dark); }
|
| 1035 |
+
input:focus, textarea:focus, select:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1036 |
textarea { min-height: 80px; resize: vertical; }
|
| 1037 |
+
input[type="file"] { padding: 8px; background-color: #222; cursor: pointer; border: 1px solid var(--border-color-dark); border-radius: 6px; }
|
| 1038 |
input[type="checkbox"] { transform: scale(1.1); margin-right: 5px; vertical-align: middle; }
|
| 1039 |
|
| 1040 |
+
button, .button { padding: 8px 15px; border: none; border-radius: 6px; background-color: var(--primary-color); color: #000; font-weight: 500; cursor: pointer; transition: background-color 0.2s ease, transform 0.1s ease; margin-top: 10px; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 5px; text-decoration: none; line-height: 1.2;}
|
|
|
|
| 1041 |
button:hover, .button:hover { background-color: var(--primary-dark); }
|
| 1042 |
+
.delete-button { background-color: #FF3B30; color: #fff;}
|
| 1043 |
.delete-button:hover { background-color: #d11a2a; }
|
| 1044 |
.add-button { background-color: var(--primary-color); }
|
| 1045 |
.add-button:hover { background-color: var(--primary-dark); }
|
| 1046 |
|
|
|
|
| 1047 |
.item-list { display: grid; gap: 15px; }
|
| 1048 |
+
.item { background: var(--surface-dark); padding: 15px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.05); border: 1px solid var(--border-color-dark); }
|
| 1049 |
+
.item p { margin: 3px 0; font-size: 0.85rem; color: #aaa; }
|
| 1050 |
+
.item strong { color: var(--text-color-dark); }
|
|
|
|
|
|
|
|
|
|
| 1051 |
.item .description { font-size: 0.8rem; color: #888; max-height: 40px; overflow: hidden; }
|
| 1052 |
.item-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
|
| 1053 |
+
.photo-preview img { max-width: 60px; max-height: 60px; border-radius: 4px; margin: 3px 3px 0 0; border: 1px solid var(--border-color-dark); object-fit: cover;}
|
| 1054 |
|
|
|
|
| 1055 |
.variant-input-group { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
|
| 1056 |
.variant-input-group input { flex-grow: 1; margin: 0; }
|
| 1057 |
+
.remove-variant-btn { background-color: #FF3B30; color: #fff; padding: 6px 10px; font-size: 0.8rem; margin-top: 0; line-height: 1; }
|
| 1058 |
+
.add-variant-btn { background-color: #444; color: var(--primary-color); margin-top: 5px;}
|
| 1059 |
+
.add-variant-btn:hover { background-color: #555; }
|
| 1060 |
|
|
|
|
| 1061 |
.message { padding: 10px 15px; border-radius: 6px; margin-bottom: 15px; font-size: 0.9rem;}
|
| 1062 |
+
.message.success { background-color: var(--success-bg); color: var(--success-text); border: 1px solid #2a6f47;}
|
| 1063 |
+
.message.error { background-color: var(--error-bg); color: var(--error-text); border: 1px solid #a00000;}
|
| 1064 |
+
.message.warning { background-color: var(--warning-bg); color: var(--warning-text); border: 1px solid #7f6e1f; }
|
| 1065 |
.status-indicator { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 0.75rem; font-weight: 500; margin-left: 5px; vertical-align: middle; }
|
| 1066 |
.status-indicator.in-stock { background-color: #c6f6d5; color: #2f855a; }
|
| 1067 |
.status-indicator.out-of-stock { background-color: #fed7d7; color: #c53030; }
|
| 1068 |
.status-indicator.top-product { background-color: #fff3c4; color: #9c4221; margin-left: 5px;}
|
| 1069 |
|
| 1070 |
+
.status-indicator.new { background-color: #ffe0b2; color: #e65100; }
|
| 1071 |
+
.status-indicator.accepted { background-color: #b3e5fc; color: #0277bd; }
|
| 1072 |
+
.status-indicator.prepared { background-color: #c6f6d5; color: #2f855a; }
|
| 1073 |
+
.status-indicator.shipped { background-color: #a7f3d0; color: #065f46; }
|
|
|
|
| 1074 |
|
| 1075 |
+
details { background-color: var(--surface-dark); border: 1px solid var(--border-color-dark); border-radius: 8px; margin-bottom: 10px; }
|
| 1076 |
+
details > summary { cursor: pointer; font-weight: 500; color: var(--text-color-dark); display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; list-style: none; position: relative; }
|
| 1077 |
+
details[open] > summary { border-bottom: 1px solid var(--border-color-dark); }
|
|
|
|
|
|
|
| 1078 |
.order-details-content { padding: 10px 15px; }
|
| 1079 |
+
.order-item-detail { display: flex; gap: 10px; padding: 8px 0; border-top: 1px dashed #333; font-size: 0.9rem; align-items: center; }
|
| 1080 |
.order-item-detail:first-child { border-top: none; }
|
| 1081 |
.order-item-detail img { width: 30px; height: 30px; object-fit: contain; border-radius: 3px; }
|
| 1082 |
.order-item-name { flex-grow: 1; }
|
| 1083 |
.order-item-qty-price { width: 130px; text-align: right; flex-shrink: 0; }
|
| 1084 |
+
.order-total-summary { font-size: 1rem; font-weight: 600; margin-top: 15px; padding-top: 10px; border-top: 1px solid var(--border-color-dark); text-align: right; color: var(--primary-color); }
|
| 1085 |
+
.order-status-form { display: flex; gap: 10px; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px dashed var(--border-color-dark); flex-wrap: wrap; }
|
| 1086 |
.order-status-form select { max-width: 180px; margin-top: 0; flex-grow: 1; }
|
| 1087 |
|
| 1088 |
.flex-container { display: flex; flex-wrap: wrap; gap: 20px; }
|
| 1089 |
.flex-item { flex: 1; min-width: 300px; }
|
| 1090 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1091 |
</head>
|
| 1092 |
<body>
|
| 1093 |
<div class="container">
|
| 1094 |
<div class="header">
|
| 1095 |
<div class="logo-title-container" style="display: flex; align-items: center; gap: 10px;">
|
|
|
|
| 1096 |
<h1><i class="fas fa-tools"></i> Админ-панель</h1>
|
| 1097 |
</div>
|
| 1098 |
<div>
|
| 1099 |
<a href="{{ url_for('catalog') }}" class="button" style="margin-right: 10px;"><i class="fas fa-store"></i> Каталог</a>
|
|
|
|
| 1100 |
</div>
|
| 1101 |
</div>
|
| 1102 |
|
|
|
|
| 1123 |
Заказ №{{ order.id }}
|
| 1124 |
<span class="status-indicator {{ current_status }}">{{ status_map_ru.get(current_status, current_status) }}</span>
|
| 1125 |
</span>
|
| 1126 |
+
<span style="font-size: 0.85rem; color: #aaa; flex-shrink: 0; margin-left: 10px;">
|
| 1127 |
Дата: {{ order.created_at }} | Итого: {{ "%.2f"|format(order.total_price) }} {{ currency_code }}
|
| 1128 |
</span>
|
| 1129 |
</summary>
|
|
|
|
| 1168 |
{% endfor %}
|
| 1169 |
</select>
|
| 1170 |
<button type="submit" class="button" style="flex-grow: 0;"><i class="fas fa-check"></i> Сохранить</button>
|
| 1171 |
+
<a href="{{ url_for('view_order', order_id=order.id) }}" target="_blank" class="button" style="background-color: #555; color: #fff; flex-grow: 0;"><i class="fas fa-eye"></i> Просмотр</a>
|
| 1172 |
</form>
|
| 1173 |
</div>
|
| 1174 |
</div>
|
|
|
|
| 1437 |
function addVariantInput(containerId, fieldName, placeholder) {
|
| 1438 |
const container = document.getElementById(containerId);
|
| 1439 |
if (container) {
|
|
|
|
| 1440 |
const existingInputs = container.querySelectorAll('input[name="' + fieldName + '"]');
|
| 1441 |
if (existingInputs.length === 1 && existingInputs[0].value.trim() === '') {
|
| 1442 |
+
existingInputs[0].value = '';
|
| 1443 |
}
|
| 1444 |
|
| 1445 |
const newInputGroup = document.createElement('div');
|
|
|
|
| 1465 |
|
| 1466 |
group.remove();
|
| 1467 |
|
|
|
|
| 1468 |
if (container && container.children.length === 0) {
|
| 1469 |
const placeholderGroup = document.createElement('div');
|
| 1470 |
placeholderGroup.className = 'variant-input-group';
|
|
|
|
| 1514 |
logging.warning(f"Attempted access to non-existent or out-of-stock product with index {index}")
|
| 1515 |
return "Товар не найден или отсутствует в наличии.", 404
|
| 1516 |
|
|
|
|
| 1517 |
products_index = index
|
| 1518 |
|
| 1519 |
return render_template_string(
|
|
|
|
| 1555 |
"price": price,
|
| 1556 |
"quantity": quantity,
|
| 1557 |
"color": item.get('color', 'N/A'),
|
| 1558 |
+
"model": item.get('model', 'N/A'),
|
| 1559 |
"photo": photo_name,
|
| 1560 |
"photo_url": photo_url
|
| 1561 |
})
|
|
|
|
| 1694 |
category = request.form.get('category')
|
| 1695 |
photos_files = request.files.getlist('photos')
|
| 1696 |
colors = [c.strip() for c in request.form.getlist('colors') if c.strip()]
|
| 1697 |
+
models = [m.strip() for m in request.form.getlist('models') if m.strip()]
|
| 1698 |
in_stock = 'in_stock' in request.form
|
| 1699 |
is_top = 'is_top' in request.form
|
| 1700 |
|
|
|
|
| 1767 |
'id': str(uuid.uuid4()),
|
| 1768 |
'name': name, 'price': price, 'description': description,
|
| 1769 |
'category': category if category in categories else 'Без категории',
|
| 1770 |
+
'photos': photos_list, 'colors': colors, 'models': models,
|
| 1771 |
'in_stock': in_stock, 'is_top': is_top
|
| 1772 |
}
|
| 1773 |
products.append(new_product)
|
|
|
|
| 1802 |
category = request.form.get('category')
|
| 1803 |
product_to_edit['category'] = category if category in categories else 'Без категории'
|
| 1804 |
product_to_edit['colors'] = [c.strip() for c in request.form.getlist('colors') if c.strip()]
|
| 1805 |
+
product_to_edit['models'] = [m.strip() for m in request.form.getlist('models') if m.strip()]
|
| 1806 |
product_to_edit['in_stock'] = 'in_stock' in request.form
|
| 1807 |
product_to_edit['is_top'] = 'is_top' in request.form
|
| 1808 |
|