Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -108,14 +108,33 @@ def catalog():
|
|
| 108 |
}
|
| 109 |
body {
|
| 110 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 111 |
-
background
|
| 112 |
-
color: #
|
| 113 |
line-height: 1.6;
|
| 114 |
padding: 20px;
|
| 115 |
}
|
| 116 |
.container {
|
| 117 |
max-width: 1200px;
|
| 118 |
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
}
|
| 120 |
.search-container {
|
| 121 |
text-align: center;
|
|
@@ -124,15 +143,22 @@ def catalog():
|
|
| 124 |
#search-input {
|
| 125 |
width: 80%;
|
| 126 |
max-width: 500px;
|
| 127 |
-
padding:
|
| 128 |
font-size: 1em;
|
| 129 |
-
border:
|
| 130 |
-
border-radius:
|
| 131 |
outline: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
}
|
| 133 |
#search-input:focus {
|
| 134 |
-
border-color: #
|
| 135 |
-
box-shadow: 0 0
|
| 136 |
}
|
| 137 |
.products-grid {
|
| 138 |
display: grid;
|
|
@@ -141,22 +167,23 @@ def catalog():
|
|
| 141 |
padding: 0 15px;
|
| 142 |
}
|
| 143 |
.product {
|
| 144 |
-
background:
|
| 145 |
border-radius: 12px;
|
| 146 |
padding: 20px;
|
| 147 |
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 148 |
display: flex;
|
| 149 |
flex-direction: column;
|
| 150 |
-
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.
|
|
|
|
| 151 |
}
|
| 152 |
.product:hover {
|
| 153 |
transform: translateY(-5px);
|
| 154 |
-
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.
|
| 155 |
}
|
| 156 |
.product-image {
|
| 157 |
width: 200px;
|
| 158 |
height: 200px;
|
| 159 |
-
background-color: #
|
| 160 |
border-radius: 8px;
|
| 161 |
margin: 0 auto 15px;
|
| 162 |
overflow: hidden;
|
|
@@ -178,31 +205,31 @@ def catalog():
|
|
| 178 |
}
|
| 179 |
.product h2 {
|
| 180 |
font-size: 1.2em;
|
| 181 |
-
color: #
|
| 182 |
margin-bottom: 10px;
|
| 183 |
font-weight: 600;
|
| 184 |
text-align: center;
|
| 185 |
}
|
| 186 |
.product-price {
|
| 187 |
font-size: 1.3em;
|
| 188 |
-
color: #
|
| 189 |
font-weight: 700;
|
| 190 |
margin: 10px 0;
|
| 191 |
text-align: center;
|
| 192 |
}
|
| 193 |
.product-description {
|
| 194 |
-
color: #
|
| 195 |
font-size: 0.9em;
|
| 196 |
flex-grow: 1;
|
| 197 |
margin-bottom: 15px;
|
| 198 |
text-align: center;
|
| 199 |
}
|
| 200 |
.product-button {
|
| 201 |
-
background-color: #
|
| 202 |
-
color:
|
| 203 |
padding: 10px 20px;
|
| 204 |
border: none;
|
| 205 |
-
border-radius:
|
| 206 |
cursor: pointer;
|
| 207 |
transition: background-color 0.3s ease;
|
| 208 |
text-align: center;
|
|
@@ -210,22 +237,24 @@ def catalog():
|
|
| 210 |
display: block;
|
| 211 |
margin: 5px auto;
|
| 212 |
font-weight: 500;
|
|
|
|
| 213 |
}
|
| 214 |
.product-button:hover {
|
| 215 |
-
background-color: #
|
|
|
|
| 216 |
}
|
| 217 |
.add-to-cart {
|
| 218 |
-
background-color: #
|
| 219 |
}
|
| 220 |
.add-to-cart:hover {
|
| 221 |
-
background-color: #
|
| 222 |
}
|
| 223 |
#cart-button {
|
| 224 |
position: fixed;
|
| 225 |
bottom: 20px;
|
| 226 |
right: 20px;
|
| 227 |
-
background-color: #
|
| 228 |
-
color:
|
| 229 |
border: none;
|
| 230 |
border-radius: 50%;
|
| 231 |
width: 60px;
|
|
@@ -233,11 +262,11 @@ def catalog():
|
|
| 233 |
font-size: 20px;
|
| 234 |
cursor: pointer;
|
| 235 |
display: none;
|
| 236 |
-
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
|
| 237 |
z-index: 1000;
|
| 238 |
}
|
| 239 |
#cart-button:hover {
|
| 240 |
-
background-color: #
|
| 241 |
}
|
| 242 |
.modal {
|
| 243 |
display: none;
|
|
@@ -248,66 +277,78 @@ def catalog():
|
|
| 248 |
width: 100%;
|
| 249 |
height: 100%;
|
| 250 |
overflow: auto;
|
| 251 |
-
background-color: rgba(0,0,0,0.4);
|
| 252 |
}
|
| 253 |
.modal-content {
|
| 254 |
position: relative;
|
| 255 |
-
background
|
| 256 |
margin: 10% auto;
|
| 257 |
padding: 20px;
|
| 258 |
-
border: 1px solid
|
| 259 |
width: 80%;
|
| 260 |
max-width: 600px;
|
| 261 |
-
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 262 |
-
|
|
|
|
|
|
|
| 263 |
}
|
| 264 |
@keyframes animatetop {
|
| 265 |
from {top: -300px; opacity: 0}
|
| 266 |
to {top: 10%; opacity: 1}
|
| 267 |
}
|
| 268 |
.close {
|
| 269 |
-
color: #
|
| 270 |
float: right;
|
| 271 |
font-size: 28px;
|
| 272 |
font-weight: bold;
|
| 273 |
cursor: pointer;
|
| 274 |
}
|
| 275 |
.close:hover {
|
| 276 |
-
color:
|
| 277 |
}
|
| 278 |
.cart-item {
|
| 279 |
display: flex;
|
| 280 |
justify-content: space-between;
|
| 281 |
align-items: center;
|
| 282 |
padding: 10px 0;
|
| 283 |
-
border-bottom: 1px solid
|
| 284 |
}
|
| 285 |
.cart-item img {
|
| 286 |
width: 50px;
|
| 287 |
height: 50px;
|
| 288 |
object-fit: contain;
|
| 289 |
-
background-color: #
|
| 290 |
margin-right: 10px;
|
| 291 |
}
|
| 292 |
.quantity-input {
|
| 293 |
width: 60px;
|
| 294 |
padding: 5px;
|
| 295 |
margin: 10px 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
}
|
| 297 |
.clear-cart {
|
| 298 |
background-color: #e74c3c;
|
| 299 |
margin-top: 10px;
|
| 300 |
margin-right: 10px;
|
|
|
|
|
|
|
| 301 |
}
|
| 302 |
.clear-cart:hover {
|
| 303 |
background-color: #c0392b;
|
|
|
|
| 304 |
}
|
| 305 |
.order-button {
|
| 306 |
background-color: #25D366;
|
| 307 |
margin-top: 10px;
|
|
|
|
|
|
|
| 308 |
}
|
| 309 |
.order-button:hover {
|
| 310 |
background-color: #20B956;
|
|
|
|
| 311 |
}
|
| 312 |
@media (max-width: 768px) {
|
| 313 |
body {
|
|
@@ -348,6 +389,12 @@ def catalog():
|
|
| 348 |
bottom: 15px;
|
| 349 |
right: 15px;
|
| 350 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 351 |
}
|
| 352 |
@media (max-width: 480px) {
|
| 353 |
.products-grid {
|
|
@@ -366,10 +413,11 @@ def catalog():
|
|
| 366 |
max-height: 120px;
|
| 367 |
}
|
| 368 |
.search-container {
|
| 369 |
-
margin-bottom:
|
| 370 |
}
|
| 371 |
#search-input {
|
| 372 |
width: 90%;
|
|
|
|
| 373 |
}
|
| 374 |
.product h2 {
|
| 375 |
font-size: 0.9em;
|
|
@@ -389,6 +437,10 @@ def catalog():
|
|
| 389 |
</head>
|
| 390 |
<body>
|
| 391 |
<div class="container">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 392 |
<div class="search-container">
|
| 393 |
<input type="text" id="search-input" placeholder="Поиск по названию или описанию...">
|
| 394 |
</div>
|
|
@@ -561,7 +613,7 @@ def catalog():
|
|
| 561 |
let total = 0;
|
| 562 |
|
| 563 |
if (cart.length === 0) {
|
| 564 |
-
cartContent.innerHTML = '<p>Корзина пуста</p>';
|
| 565 |
} else {
|
| 566 |
cartContent.innerHTML = cart.map(item => {
|
| 567 |
const itemTotal = item.price * item.quantity;
|
|
@@ -574,11 +626,11 @@ def catalog():
|
|
| 574 |
alt="${item.name}">
|
| 575 |
` : ''}
|
| 576 |
<div>
|
| 577 |
-
<strong>${item.name}</strong>
|
| 578 |
-
<p>${item.price} × ${item.quantity}</p>
|
| 579 |
</div>
|
| 580 |
</div>
|
| 581 |
-
<span>${itemTotal}</span>
|
| 582 |
</div>
|
| 583 |
`;
|
| 584 |
}).join('');
|
|
@@ -657,7 +709,7 @@ def product_detail(index):
|
|
| 657 |
return "Продукт не найден", 404
|
| 658 |
detail_html = '''
|
| 659 |
<div class="container">
|
| 660 |
-
<h2>{{ product['name'] }}</h2>
|
| 661 |
<div class="swiper-container">
|
| 662 |
<div class="swiper-wrapper">
|
| 663 |
{% if product.get('photos') %}
|
|
@@ -678,8 +730,8 @@ def product_detail(index):
|
|
| 678 |
<div class="swiper-button-next"></div>
|
| 679 |
<div class="swiper-button-prev"></div>
|
| 680 |
</div>
|
| 681 |
-
<p><strong>Цена:</strong> {{ product['price'] }}</p>
|
| 682 |
-
<p><strong>Описание:</strong> {{ product['description'] }}</p>
|
| 683 |
</div>
|
| 684 |
'''
|
| 685 |
return render_template_string(detail_html, product=product, repo_id=REPO_ID)
|
|
@@ -820,125 +872,159 @@ def admin():
|
|
| 820 |
<title>Админ-панель</title>
|
| 821 |
<style>
|
| 822 |
body {
|
| 823 |
-
font-family:
|
|
|
|
|
|
|
| 824 |
margin: 20px;
|
| 825 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 826 |
}
|
| 827 |
h1 {
|
| 828 |
-
color: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 829 |
}
|
| 830 |
form {
|
| 831 |
-
background
|
| 832 |
padding: 20px;
|
| 833 |
-
border: 1px solid
|
| 834 |
-
border-radius:
|
| 835 |
-
max-width: 100%;
|
| 836 |
margin-bottom: 20px;
|
| 837 |
}
|
| 838 |
label {
|
| 839 |
display: block;
|
| 840 |
margin-top: 10px;
|
| 841 |
-
color: #
|
| 842 |
}
|
| 843 |
input, textarea {
|
| 844 |
width: 100%;
|
| 845 |
padding: 8px;
|
| 846 |
margin-top: 5px;
|
| 847 |
-
border: 1px solid
|
| 848 |
-
border-radius:
|
| 849 |
box-sizing: border-box;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 850 |
}
|
| 851 |
button {
|
| 852 |
margin-top: 15px;
|
| 853 |
-
padding: 10px
|
| 854 |
-
background-color: #
|
| 855 |
-
color:
|
| 856 |
border: none;
|
| 857 |
-
border-radius:
|
| 858 |
cursor: pointer;
|
|
|
|
|
|
|
| 859 |
}
|
| 860 |
button:hover {
|
| 861 |
-
background-color: #
|
|
|
|
| 862 |
}
|
| 863 |
.product-list {
|
| 864 |
margin-top: 20px;
|
| 865 |
}
|
| 866 |
.product-item {
|
| 867 |
-
background
|
| 868 |
-
border: 1px solid
|
| 869 |
padding: 15px;
|
| 870 |
margin-bottom: 10px;
|
| 871 |
-
border-radius:
|
|
|
|
| 872 |
}
|
| 873 |
.edit-form {
|
| 874 |
margin-top: 10px;
|
| 875 |
padding: 10px;
|
| 876 |
-
border: 1px solid
|
| 877 |
-
border-radius:
|
| 878 |
-
background
|
|
|
|
|
|
|
|
|
|
| 879 |
}
|
| 880 |
</style>
|
| 881 |
</head>
|
| 882 |
<body>
|
| 883 |
-
<
|
| 884 |
-
|
| 885 |
-
<
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
| 899 |
-
<
|
| 900 |
-
|
| 901 |
-
|
| 902 |
-
<
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
| 909 |
-
<
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
<
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
<
|
| 921 |
-
|
| 922 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 923 |
<input type="hidden" name="index" value="{{ loop.index0 }}">
|
| 924 |
-
<
|
| 925 |
-
<input type="text" id="name" name="name" value="{{ product['name'] }}" required>
|
| 926 |
-
<label for="price">Цена:</label>
|
| 927 |
-
<input type="number" id="price" name="price" step="0.01" value="{{ product['price'] }}" required>
|
| 928 |
-
<label for="description">Описание:</label>
|
| 929 |
-
<textarea id="description" name="description" rows="4" required>{{ product['description'] }}</textarea>
|
| 930 |
-
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 931 |
-
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 932 |
-
<button type="submit">Сохранить изменения</button>
|
| 933 |
</form>
|
| 934 |
-
</
|
| 935 |
-
|
| 936 |
-
<input type="hidden" name="action" value="delete">
|
| 937 |
-
<input type="hidden" name="index" value="{{ loop.index0 }}">
|
| 938 |
-
<button type="submit">Удалить</button>
|
| 939 |
-
</form>
|
| 940 |
</div>
|
| 941 |
-
{% endfor %}
|
| 942 |
</div>
|
| 943 |
</body>
|
| 944 |
</html>
|
|
|
|
| 108 |
}
|
| 109 |
body {
|
| 110 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 111 |
+
background: linear-gradient(135deg, #1a3b3b, #2a5a5a);
|
| 112 |
+
color: #ffffff;
|
| 113 |
line-height: 1.6;
|
| 114 |
padding: 20px;
|
| 115 |
}
|
| 116 |
.container {
|
| 117 |
max-width: 1200px;
|
| 118 |
margin: 0 auto;
|
| 119 |
+
background: rgba(0, 0, 0, 0.1);
|
| 120 |
+
border-radius: 10px;
|
| 121 |
+
padding: 20px;
|
| 122 |
+
}
|
| 123 |
+
.logo {
|
| 124 |
+
display: flex;
|
| 125 |
+
align-items: center;
|
| 126 |
+
justify-content: center;
|
| 127 |
+
margin-bottom: 20px;
|
| 128 |
+
}
|
| 129 |
+
.logo img {
|
| 130 |
+
width: 50px;
|
| 131 |
+
height: 50px;
|
| 132 |
+
margin-right: 10px;
|
| 133 |
+
}
|
| 134 |
+
.logo h1 {
|
| 135 |
+
font-size: 2em;
|
| 136 |
+
color: #ffffff;
|
| 137 |
+
font-weight: 700;
|
| 138 |
}
|
| 139 |
.search-container {
|
| 140 |
text-align: center;
|
|
|
|
| 143 |
#search-input {
|
| 144 |
width: 80%;
|
| 145 |
max-width: 500px;
|
| 146 |
+
padding: 12px;
|
| 147 |
font-size: 1em;
|
| 148 |
+
border: none;
|
| 149 |
+
border-radius: 25px;
|
| 150 |
outline: none;
|
| 151 |
+
background-color: #ffffff;
|
| 152 |
+
color: #2a5a5a;
|
| 153 |
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
| 154 |
+
}
|
| 155 |
+
#search-input::placeholder {
|
| 156 |
+
color: #2a5a5a;
|
| 157 |
+
opacity: 0.7;
|
| 158 |
}
|
| 159 |
#search-input:focus {
|
| 160 |
+
border-color: #25D366;
|
| 161 |
+
box-shadow: 0 0 8px rgba(37, 211, 102, 0.5);
|
| 162 |
}
|
| 163 |
.products-grid {
|
| 164 |
display: grid;
|
|
|
|
| 167 |
padding: 0 15px;
|
| 168 |
}
|
| 169 |
.product {
|
| 170 |
+
background: rgba(255, 255, 255, 0.1);
|
| 171 |
border-radius: 12px;
|
| 172 |
padding: 20px;
|
| 173 |
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 174 |
display: flex;
|
| 175 |
flex-direction: column;
|
| 176 |
+
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
|
| 177 |
+
backdrop-filter: blur(5px);
|
| 178 |
}
|
| 179 |
.product:hover {
|
| 180 |
transform: translateY(-5px);
|
| 181 |
+
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
|
| 182 |
}
|
| 183 |
.product-image {
|
| 184 |
width: 200px;
|
| 185 |
height: 200px;
|
| 186 |
+
background-color: #ffffff;
|
| 187 |
border-radius: 8px;
|
| 188 |
margin: 0 auto 15px;
|
| 189 |
overflow: hidden;
|
|
|
|
| 205 |
}
|
| 206 |
.product h2 {
|
| 207 |
font-size: 1.2em;
|
| 208 |
+
color: #ffffff;
|
| 209 |
margin-bottom: 10px;
|
| 210 |
font-weight: 600;
|
| 211 |
text-align: center;
|
| 212 |
}
|
| 213 |
.product-price {
|
| 214 |
font-size: 1.3em;
|
| 215 |
+
color: #25D366;
|
| 216 |
font-weight: 700;
|
| 217 |
margin: 10px 0;
|
| 218 |
text-align: center;
|
| 219 |
}
|
| 220 |
.product-description {
|
| 221 |
+
color: #e0e0e0;
|
| 222 |
font-size: 0.9em;
|
| 223 |
flex-grow: 1;
|
| 224 |
margin-bottom: 15px;
|
| 225 |
text-align: center;
|
| 226 |
}
|
| 227 |
.product-button {
|
| 228 |
+
background-color: #25D366;
|
| 229 |
+
color: #ffffff;
|
| 230 |
padding: 10px 20px;
|
| 231 |
border: none;
|
| 232 |
+
border-radius: 25px;
|
| 233 |
cursor: pointer;
|
| 234 |
transition: background-color 0.3s ease;
|
| 235 |
text-align: center;
|
|
|
|
| 237 |
display: block;
|
| 238 |
margin: 5px auto;
|
| 239 |
font-weight: 500;
|
| 240 |
+
border: 2px solid #25D366;
|
| 241 |
}
|
| 242 |
.product-button:hover {
|
| 243 |
+
background-color: #20B956;
|
| 244 |
+
border-color: #20B956;
|
| 245 |
}
|
| 246 |
.add-to-cart {
|
| 247 |
+
background-color: #25D366;
|
| 248 |
}
|
| 249 |
.add-to-cart:hover {
|
| 250 |
+
background-color: #20B956;
|
| 251 |
}
|
| 252 |
#cart-button {
|
| 253 |
position: fixed;
|
| 254 |
bottom: 20px;
|
| 255 |
right: 20px;
|
| 256 |
+
background-color: #25D366;
|
| 257 |
+
color: #ffffff;
|
| 258 |
border: none;
|
| 259 |
border-radius: 50%;
|
| 260 |
width: 60px;
|
|
|
|
| 262 |
font-size: 20px;
|
| 263 |
cursor: pointer;
|
| 264 |
display: none;
|
| 265 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
| 266 |
z-index: 1000;
|
| 267 |
}
|
| 268 |
#cart-button:hover {
|
| 269 |
+
background-color: #20B956;
|
| 270 |
}
|
| 271 |
.modal {
|
| 272 |
display: none;
|
|
|
|
| 277 |
width: 100%;
|
| 278 |
height: 100%;
|
| 279 |
overflow: auto;
|
| 280 |
+
background-color: rgba(0, 0, 0, 0.4);
|
| 281 |
}
|
| 282 |
.modal-content {
|
| 283 |
position: relative;
|
| 284 |
+
background: rgba(255, 255, 255, 0.1);
|
| 285 |
margin: 10% auto;
|
| 286 |
padding: 20px;
|
| 287 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 288 |
width: 80%;
|
| 289 |
max-width: 600px;
|
| 290 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
| 291 |
+
border-radius: 10px;
|
| 292 |
+
backdrop-filter: blur(5px);
|
| 293 |
+
color: #ffffff;
|
| 294 |
}
|
| 295 |
@keyframes animatetop {
|
| 296 |
from {top: -300px; opacity: 0}
|
| 297 |
to {top: 10%; opacity: 1}
|
| 298 |
}
|
| 299 |
.close {
|
| 300 |
+
color: #ffffff;
|
| 301 |
float: right;
|
| 302 |
font-size: 28px;
|
| 303 |
font-weight: bold;
|
| 304 |
cursor: pointer;
|
| 305 |
}
|
| 306 |
.close:hover {
|
| 307 |
+
color: #e0e0e0;
|
| 308 |
}
|
| 309 |
.cart-item {
|
| 310 |
display: flex;
|
| 311 |
justify-content: space-between;
|
| 312 |
align-items: center;
|
| 313 |
padding: 10px 0;
|
| 314 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
| 315 |
}
|
| 316 |
.cart-item img {
|
| 317 |
width: 50px;
|
| 318 |
height: 50px;
|
| 319 |
object-fit: contain;
|
| 320 |
+
background-color: #ffffff;
|
| 321 |
margin-right: 10px;
|
| 322 |
}
|
| 323 |
.quantity-input {
|
| 324 |
width: 60px;
|
| 325 |
padding: 5px;
|
| 326 |
margin: 10px 0;
|
| 327 |
+
border: 1px solid #ffffff;
|
| 328 |
+
border-radius: 5px;
|
| 329 |
+
background-color: rgba(255, 255, 255, 0.1);
|
| 330 |
+
color: #ffffff;
|
| 331 |
}
|
| 332 |
.clear-cart {
|
| 333 |
background-color: #e74c3c;
|
| 334 |
margin-top: 10px;
|
| 335 |
margin-right: 10px;
|
| 336 |
+
border-radius: 25px;
|
| 337 |
+
border: 2px solid #e74c3c;
|
| 338 |
}
|
| 339 |
.clear-cart:hover {
|
| 340 |
background-color: #c0392b;
|
| 341 |
+
border-color: #c0392b;
|
| 342 |
}
|
| 343 |
.order-button {
|
| 344 |
background-color: #25D366;
|
| 345 |
margin-top: 10px;
|
| 346 |
+
border-radius: 25px;
|
| 347 |
+
border: 2px solid #25D366;
|
| 348 |
}
|
| 349 |
.order-button:hover {
|
| 350 |
background-color: #20B956;
|
| 351 |
+
border-color: #20B956;
|
| 352 |
}
|
| 353 |
@media (max-width: 768px) {
|
| 354 |
body {
|
|
|
|
| 389 |
bottom: 15px;
|
| 390 |
right: 15px;
|
| 391 |
}
|
| 392 |
+
.search-container {
|
| 393 |
+
margin-bottom: 20px;
|
| 394 |
+
}
|
| 395 |
+
#search-input {
|
| 396 |
+
width: 90%;
|
| 397 |
+
}
|
| 398 |
}
|
| 399 |
@media (max-width: 480px) {
|
| 400 |
.products-grid {
|
|
|
|
| 413 |
max-height: 120px;
|
| 414 |
}
|
| 415 |
.search-container {
|
| 416 |
+
margin-bottom: 15px;
|
| 417 |
}
|
| 418 |
#search-input {
|
| 419 |
width: 90%;
|
| 420 |
+
padding: 10px;
|
| 421 |
}
|
| 422 |
.product h2 {
|
| 423 |
font-size: 0.9em;
|
|
|
|
| 437 |
</head>
|
| 438 |
<body>
|
| 439 |
<div class="container">
|
| 440 |
+
<div class="logo">
|
| 441 |
+
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/React.svg/1200px-React.svg.png" alt="Logo">
|
| 442 |
+
<h1>Morshen Alpha</h1>
|
| 443 |
+
</div>
|
| 444 |
<div class="search-container">
|
| 445 |
<input type="text" id="search-input" placeholder="Поиск по названию или описанию...">
|
| 446 |
</div>
|
|
|
|
| 613 |
let total = 0;
|
| 614 |
|
| 615 |
if (cart.length === 0) {
|
| 616 |
+
cartContent.innerHTML = '<p style="color: #ffffff;">Корзина пуста</p>';
|
| 617 |
} else {
|
| 618 |
cartContent.innerHTML = cart.map(item => {
|
| 619 |
const itemTotal = item.price * item.quantity;
|
|
|
|
| 626 |
alt="${item.name}">
|
| 627 |
` : ''}
|
| 628 |
<div>
|
| 629 |
+
<strong style="color: #ffffff;">${item.name}</strong>
|
| 630 |
+
<p style="color: #e0e0e0;">${item.price} × ${item.quantity}</p>
|
| 631 |
</div>
|
| 632 |
</div>
|
| 633 |
+
<span style="color: #ffffff;">${itemTotal}</span>
|
| 634 |
</div>
|
| 635 |
`;
|
| 636 |
}).join('');
|
|
|
|
| 709 |
return "Продукт не найден", 404
|
| 710 |
detail_html = '''
|
| 711 |
<div class="container">
|
| 712 |
+
<h2 style="color: #ffffff;">{{ product['name'] }}</h2>
|
| 713 |
<div class="swiper-container">
|
| 714 |
<div class="swiper-wrapper">
|
| 715 |
{% if product.get('photos') %}
|
|
|
|
| 730 |
<div class="swiper-button-next"></div>
|
| 731 |
<div class="swiper-button-prev"></div>
|
| 732 |
</div>
|
| 733 |
+
<p style="color: #ffffff;"><strong>Цена:</strong> {{ product['price'] }}</p>
|
| 734 |
+
<p style="color: #e0e0e0;"><strong>Описание:</strong> {{ product['description'] }}</p>
|
| 735 |
</div>
|
| 736 |
'''
|
| 737 |
return render_template_string(detail_html, product=product, repo_id=REPO_ID)
|
|
|
|
| 872 |
<title>Админ-панель</title>
|
| 873 |
<style>
|
| 874 |
body {
|
| 875 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 876 |
+
background: linear-gradient(135deg, #1a3b3b, #2a5a5a);
|
| 877 |
+
color: #ffffff;
|
| 878 |
margin: 20px;
|
| 879 |
+
line-height: 1.6;
|
| 880 |
+
}
|
| 881 |
+
.container {
|
| 882 |
+
max-width: 1200px;
|
| 883 |
+
margin: 0 auto;
|
| 884 |
+
background: rgba(255, 255, 255, 0.1);
|
| 885 |
+
border-radius: 10px;
|
| 886 |
+
padding: 20px;
|
| 887 |
+
box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
|
| 888 |
+
backdrop-filter: blur(5px);
|
| 889 |
}
|
| 890 |
h1 {
|
| 891 |
+
color: #ffffff;
|
| 892 |
+
text-align: center;
|
| 893 |
+
margin-bottom: 20px;
|
| 894 |
+
font-size: 2em;
|
| 895 |
+
font-weight: 700;
|
| 896 |
+
}
|
| 897 |
+
h2 {
|
| 898 |
+
color: #ffffff;
|
| 899 |
+
text-align: center;
|
| 900 |
+
margin-bottom: 20px;
|
| 901 |
}
|
| 902 |
form {
|
| 903 |
+
background: rgba(255, 255, 255, 0.05);
|
| 904 |
padding: 20px;
|
| 905 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 906 |
+
border-radius: 10px;
|
|
|
|
| 907 |
margin-bottom: 20px;
|
| 908 |
}
|
| 909 |
label {
|
| 910 |
display: block;
|
| 911 |
margin-top: 10px;
|
| 912 |
+
color: #e0e0e0;
|
| 913 |
}
|
| 914 |
input, textarea {
|
| 915 |
width: 100%;
|
| 916 |
padding: 8px;
|
| 917 |
margin-top: 5px;
|
| 918 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 919 |
+
border-radius: 5px;
|
| 920 |
box-sizing: border-box;
|
| 921 |
+
background: rgba(255, 255, 255, 0.1);
|
| 922 |
+
color: #ffffff;
|
| 923 |
+
}
|
| 924 |
+
input::placeholder, textarea::placeholder {
|
| 925 |
+
color: #e0e0e0;
|
| 926 |
+
opacity: 0.7;
|
| 927 |
}
|
| 928 |
button {
|
| 929 |
margin-top: 15px;
|
| 930 |
+
padding: 10px 20px;
|
| 931 |
+
background-color: #25D366;
|
| 932 |
+
color: #ffffff;
|
| 933 |
border: none;
|
| 934 |
+
border-radius: 25px;
|
| 935 |
cursor: pointer;
|
| 936 |
+
transition: background-color 0.3s ease;
|
| 937 |
+
border: 2px solid #25D366;
|
| 938 |
}
|
| 939 |
button:hover {
|
| 940 |
+
background-color: #20B956;
|
| 941 |
+
border-color: #20B956;
|
| 942 |
}
|
| 943 |
.product-list {
|
| 944 |
margin-top: 20px;
|
| 945 |
}
|
| 946 |
.product-item {
|
| 947 |
+
background: rgba(255, 255, 255, 0.05);
|
| 948 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 949 |
padding: 15px;
|
| 950 |
margin-bottom: 10px;
|
| 951 |
+
border-radius: 10px;
|
| 952 |
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
| 953 |
}
|
| 954 |
.edit-form {
|
| 955 |
margin-top: 10px;
|
| 956 |
padding: 10px;
|
| 957 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 958 |
+
border-radius: 10px;
|
| 959 |
+
background: rgba(255, 255, 255, 0.05);
|
| 960 |
+
}
|
| 961 |
+
p, strong {
|
| 962 |
+
color: #ffffff;
|
| 963 |
}
|
| 964 |
</style>
|
| 965 |
</head>
|
| 966 |
<body>
|
| 967 |
+
<div class="container">
|
| 968 |
+
<h1>Админ-панель</h1>
|
| 969 |
+
<form method="POST" enctype="multipart/form-data">
|
| 970 |
+
<input type="hidden" name="action" value="add">
|
| 971 |
+
<label for="name">Название товара:</label>
|
| 972 |
+
<input type="text" id="name" name="name" required>
|
| 973 |
+
<label for="price">Цена:</label>
|
| 974 |
+
<input type="number" id="price" name="price" step="0.01" required>
|
| 975 |
+
<label for="description">Описание:</label>
|
| 976 |
+
<textarea id="description" name="description" rows="4" required></textarea>
|
| 977 |
+
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 978 |
+
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 979 |
+
<button type="submit">Добавить товар</button>
|
| 980 |
+
</form>
|
| 981 |
+
|
| 982 |
+
<h2>Управление базой данных</h2>
|
| 983 |
+
<form method="POST" action="{{ url_for('backup') }}">
|
| 984 |
+
<button type="submit">Создать резервную копию</button>
|
| 985 |
+
</form>
|
| 986 |
+
<form method="GET" action="{{ url_for('download') }}">
|
| 987 |
+
<button type="submit">Скачать базу данных</button>
|
| 988 |
+
</form>
|
| 989 |
+
|
| 990 |
+
<h2>Список товаров</h2>
|
| 991 |
+
<div class="product-list">
|
| 992 |
+
{% for product in products %}
|
| 993 |
+
<div class="product-item">
|
| 994 |
+
<h3>{{ product['name'] }}</h3>
|
| 995 |
+
<p><strong>Цена:</strong> {{ product['price'] }}</p>
|
| 996 |
+
<p><strong>Описание:</strong> {{ product['description'] }}</p>
|
| 997 |
+
{% if product.get('photos') and product['photos']|length > 0 %}
|
| 998 |
+
<div style="background-color: #ffffff; width: 100px; height: 100px; display: flex; justify-content: center; align-items: center;">
|
| 999 |
+
<img src="https://huggingface.co/datasets/{{ repo_id }}/resolve/main/photos/{{ product['photos'][0] }}"
|
| 1000 |
+
alt="{{ product['name'] }}"
|
| 1001 |
+
style="max-width: 100px; max-height: 100px; width: auto; height: auto; object-fit: contain;">
|
| 1002 |
+
</div>
|
| 1003 |
+
{% endif %}
|
| 1004 |
+
<details>
|
| 1005 |
+
<summary>Редактировать</summary>
|
| 1006 |
+
<form method="POST" enctype="multipart/form-data" class="edit-form">
|
| 1007 |
+
<input type="hidden" name="action" value="edit">
|
| 1008 |
+
<input type="hidden" name="index" value="{{ loop.index0 }}">
|
| 1009 |
+
<label for="name">Название товара:</label>
|
| 1010 |
+
<input type="text" id="name" name="name" value="{{ product['name'] }}" required>
|
| 1011 |
+
<label for="price">Цена:</label>
|
| 1012 |
+
<input type="number" id="price" name="price" step="0.01" value="{{ product['price'] }}" required>
|
| 1013 |
+
<label for="description">Описание:</label>
|
| 1014 |
+
<textarea id="description" name="description" rows="4" required>{{ product['description'] }}</textarea>
|
| 1015 |
+
<label for="photos">Фотографии товара (максимум 2):</label>
|
| 1016 |
+
<input type="file" id="photos" name="photos" accept="image/*" multiple>
|
| 1017 |
+
<button type="submit">Сохранить изменения</button>
|
| 1018 |
+
</form>
|
| 1019 |
+
</details>
|
| 1020 |
+
<form method="POST">
|
| 1021 |
+
<input type="hidden" name="action" value="delete">
|
| 1022 |
<input type="hidden" name="index" value="{{ loop.index0 }}">
|
| 1023 |
+
<button type="submit">Удалить</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1024 |
</form>
|
| 1025 |
+
</div>
|
| 1026 |
+
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1027 |
</div>
|
|
|
|
| 1028 |
</div>
|
| 1029 |
</body>
|
| 1030 |
</html>
|