Kgshop commited on
Commit
e3c8b1d
·
verified ·
1 Parent(s): 370af8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +83 -115
app.py CHANGED
@@ -10,17 +10,14 @@ from huggingface_hub.utils import RepositoryNotFoundError
10
  from werkzeug.utils import secure_filename
11
 
12
  app = Flask(__name__)
13
- DATA_FILE = 'data_lizabrand.json'
14
 
15
- # Настройки Hugging Face
16
- REPO_ID = "Kgshop/clients"
17
  HF_TOKEN_WRITE = os.getenv("HF_TOKEN")
18
  HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
19
 
20
- # Ссылка на логотип
21
- LOGO_URL = "https://cdn-avatars.huggingface.co/v1/production/uploads/67c280ccb9d3dfdee58ecfdd/hyc6QWsSZ6FejTAAqDGUS.jpeg"
22
 
23
- # Настройка логирования
24
  logging.basicConfig(level=logging.DEBUG)
25
 
26
  def load_data():
@@ -96,7 +93,7 @@ def periodic_backup():
96
  @app.route('/')
97
  def catalog():
98
  data = load_data()
99
- products = data['products']
100
  categories = data['categories']
101
 
102
  catalog_html = '''
@@ -105,11 +102,19 @@ def catalog():
105
  <head>
106
  <meta charset="UTF-8">
107
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
108
- <title>Liza Brand - женская одежда оптом </title>
109
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
110
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
111
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
112
  <style>
 
 
 
 
 
 
 
 
113
  * {
114
  margin: 0;
115
  padding: 0;
@@ -117,14 +122,10 @@ def catalog():
117
  }
118
  body {
119
  font-family: 'Poppins', sans-serif;
120
- background: linear-gradient(135deg, #f0f2f5, #e9ecef);
121
- color: #2d3748;
122
  line-height: 1.6;
123
- transition: background 0.3s, color 0.3s;
124
- }
125
- body.dark-mode {
126
- background: linear-gradient(135deg, #1a202c, #2d3748);
127
- color: #e2e8f0;
128
  }
129
  .container {
130
  max-width: 1300px;
@@ -136,14 +137,14 @@ def catalog():
136
  justify-content: space-between;
137
  align-items: center;
138
  padding: 15px 0;
139
- border-bottom: 1px solid #e2e8f0;
140
  }
141
  .header-logo {
142
  width: 60px;
143
  height: 60px;
144
  border-radius: 50%;
145
  object-fit: cover;
146
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
147
  transition: transform 0.3s ease, box-shadow 0.3s ease;
148
  }
149
  .header-logo:hover {
@@ -154,17 +155,7 @@ def catalog():
154
  font-size: 1.5rem;
155
  font-weight: 600;
156
  margin-left: 15px;
157
- }
158
- .theme-toggle {
159
- background: none;
160
- border: none;
161
- font-size: 1.5rem;
162
- cursor: pointer;
163
- color: #4a5568;
164
- transition: color 0.3s ease;
165
- }
166
- .theme-toggle:hover {
167
- color: #3b82f6;
168
  }
169
  .filters-container {
170
  margin: 20px 0;
@@ -182,31 +173,32 @@ def catalog():
182
  max-width: 600px;
183
  padding: 12px 18px;
184
  font-size: 1rem;
185
- border: 1px solid #e2e8f0;
186
  border-radius: 8px;
187
  outline: none;
188
- box-shadow: 0 2px 5px rgba(0,0,0,0.05);
189
  transition: all 0.3s ease;
190
  }
191
  #search-input:focus {
192
- border-color: #3b82f6;
193
- box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
194
  }
195
  .category-filter {
196
  padding: 8px 16px;
197
- border: 1px solid #e2e8f0;
198
  border-radius: 8px;
199
- background-color: #fff;
 
200
  cursor: pointer;
201
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
202
  font-size: 0.9rem;
203
  font-weight: 400;
204
  }
205
  .category-filter.active, .category-filter:hover {
206
- background-color: #3b82f6;
207
- color: white;
208
- border-color: #3b82f6;
209
- box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
210
  }
211
  .products-grid {
212
  display: grid;
@@ -215,17 +207,13 @@ def catalog():
215
  padding: 10px;
216
  }
217
  .product {
218
- background: #fff;
219
  border-radius: 15px;
220
  padding: 15px;
221
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
222
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
223
  overflow: hidden;
224
  }
225
- body.dark-mode .product {
226
- background: #2d3748;
227
- color: #fff;
228
- }
229
  .product:hover {
230
  transform: translateY(-5px) scale(1.02);
231
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
@@ -274,17 +262,14 @@ def catalog():
274
  text-overflow: ellipsis;
275
  white-space: nowrap;
276
  }
277
- body.dark-mode .product-description {
278
- color: #a0aec0;
279
- }
280
  .product-button {
281
  display: block;
282
  width: 100%;
283
  padding: 8px;
284
  border: none;
285
  border-radius: 8px;
286
- background-color: #3b82f6;
287
- color: white;
288
  font-size: 0.8rem;
289
  font-weight: 500;
290
  cursor: pointer;
@@ -294,23 +279,23 @@ def catalog():
294
  text-decoration: none;
295
  }
296
  .product-button:hover {
297
- background-color: #2563eb;
298
- box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
299
  transform: translateY(-2px);
300
  }
301
  .add-to-cart {
302
- background-color: #10b981;
303
  }
304
  .add-to-cart:hover {
305
- background-color: #059669;
306
- box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
307
  }
308
  #cart-button {
309
  position: fixed;
310
  bottom: 20px;
311
  right: 20px;
312
  background-color: #ef4444;
313
- color: white;
314
  border: none;
315
  border-radius: 50%;
316
  width: 50px;
@@ -334,7 +319,7 @@ def catalog():
334
  backdrop-filter: blur(5px);
335
  }
336
  .modal-content {
337
- background: #fff;
338
  margin: 5% auto;
339
  padding: 20px;
340
  border-radius: 15px;
@@ -343,10 +328,6 @@ def catalog():
343
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
344
  animation: slideIn 0.3s ease-out;
345
  }
346
- body.dark-mode .modal-content {
347
- background: #2d3748;
348
- color: #e2e8f0;
349
- }
350
  @keyframes slideIn {
351
  from { transform: translateY(-50px); opacity: 0; }
352
  to { transform: translateY(0); opacity: 1; }
@@ -359,23 +340,14 @@ def catalog():
359
  transition: color 0.3s;
360
  }
361
  .close:hover {
362
- color: #2d3748;
363
- }
364
- body.dark-mode .close {
365
- color: #a0aec0;
366
- }
367
- body.dark-mode .close:hover {
368
- color: #fff;
369
  }
370
  .cart-item {
371
  display: flex;
372
  justify-content: space-between;
373
  align-items: center;
374
  padding: 15px 0;
375
- border-bottom: 1px solid #e2e8f0;
376
- }
377
- body.dark-mode .cart-item {
378
- border-bottom: 1px solid #4a5568;
379
  }
380
  .cart-item img {
381
  width: 50px;
@@ -388,7 +360,7 @@ def catalog():
388
  width: 100%;
389
  max-width: 150px;
390
  padding: 8px;
391
- border: 1px solid #e2e8f0;
392
  border-radius: 8px;
393
  font-size: 1rem;
394
  margin: 5px 0;
@@ -401,11 +373,16 @@ def catalog():
401
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
402
  }
403
  .order-button {
404
- background-color: #10b981;
405
  }
406
  .order-button:hover {
407
- background-color: #059669;
408
- box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
 
 
 
 
 
409
  }
410
  </style>
411
  </head>
@@ -414,9 +391,6 @@ def catalog():
414
  <div class="header">
415
  <img src="''' + LOGO_URL + '''" alt="Logo" class="header-logo">
416
  <h1>Каталог</h1>
417
- <button class="theme-toggle" onclick="toggleTheme()">
418
- <i class="fas fa-moon"></i>
419
- </button>
420
  </div>
421
  <div class="filters-container">
422
  <button class="category-filter active" data-category="all">Все категории</button>
@@ -450,7 +424,6 @@ def catalog():
450
  </div>
451
  </div>
452
 
453
- <!-- Product Modal -->
454
  <div id="productModal" class="modal">
455
  <div class="modal-content">
456
  <span class="close" onclick="closeModal('productModal')">×</span>
@@ -458,7 +431,6 @@ def catalog():
458
  </div>
459
  </div>
460
 
461
- <!-- Quantity and Color Modal -->
462
  <div id="quantityModal" class="modal">
463
  <div class="modal-content">
464
  <span class="close" onclick="closeModal('quantityModal')">×</span>
@@ -469,7 +441,6 @@ def catalog():
469
  </div>
470
  </div>
471
 
472
- <!-- Cart Modal -->
473
  <div id="cartModal" class="modal">
474
  <div class="modal-content">
475
  <span class="close" onclick="closeModal('cartModal')">×</span>
@@ -492,19 +463,6 @@ def catalog():
492
  const products = {{ products|tojson }};
493
  let selectedProductIndex = null;
494
 
495
- function toggleTheme() {
496
- document.body.classList.toggle('dark-mode');
497
- const icon = document.querySelector('.theme-toggle i');
498
- icon.classList.toggle('fa-moon');
499
- icon.classList.toggle('fa-sun');
500
- localStorage.setItem('theme', document.body.classList.contains('dark-mode') ? 'dark' : 'light');
501
- }
502
-
503
- if (localStorage.getItem('theme') === 'dark') {
504
- document.body.classList.add('dark-mode');
505
- document.querySelector('.theme-toggle i').classList.replace('fa-moon', 'fa-sun');
506
- }
507
-
508
  function openModal(index) {
509
  loadProductDetails(index);
510
  document.getElementById('productModal').style.display = "block";
@@ -634,7 +592,7 @@ def catalog():
634
  orderText += `${index + 1}. ${item.name} - ${item.price} с × ${item.quantity} (Цвет: ${item.color})%0A`;
635
  });
636
  orderText += `Итого: ${total} с`;
637
- window.open(`https://api.whatsapp.com/send?phone=996703138588&text=${orderText}`, '_blank');
638
  }
639
 
640
  function clearCart() {
@@ -753,7 +711,7 @@ def admin():
753
  photos_list = []
754
 
755
  if photos_files:
756
- for photo in photos_files[:10]: # Ограничение до 10 фото
757
  if photo and photo.filename:
758
  photo_filename = secure_filename(photo.filename)
759
  uploads_dir = 'uploads'
@@ -783,7 +741,8 @@ def admin():
783
  'description': description,
784
  'category': category if category in categories else 'Без категории',
785
  'photos': photos_list,
786
- 'colors': colors if colors else []
 
787
  }
788
  products.append(new_product)
789
  save_data(data)
@@ -800,7 +759,7 @@ def admin():
800
 
801
  if photos_files and any(photo.filename for photo in photos_files):
802
  new_photos_list = []
803
- for photo in photos_files[:10]: # Ограничение до 10 фото
804
  if photo and photo.filename:
805
  photo_filename = secure_filename(photo.filename)
806
  uploads_dir = 'uploads'
@@ -844,10 +803,18 @@ def admin():
844
  <title>Админ-панель</title>
845
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
846
  <style>
 
 
 
 
 
 
 
 
847
  body {
848
  font-family: 'Poppins', sans-serif;
849
- background: linear-gradient(135deg, #f0f2f5, #e9ecef);
850
- color: #2d3748;
851
  padding: 20px;
852
  }
853
  .container {
@@ -858,14 +825,14 @@ def admin():
858
  display: flex;
859
  align-items: center;
860
  padding: 15px 0;
861
- border-bottom: 1px solid #e2e8f0;
862
  }
863
  .header-logo {
864
  width: 60px;
865
  height: 60px;
866
  border-radius: 50%;
867
  object-fit: cover;
868
- box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
869
  transition: transform 0.3s ease, box-shadow 0.3s ease;
870
  margin-right: 15px;
871
  }
@@ -876,12 +843,13 @@ def admin():
876
  h1, h2 {
877
  font-weight: 600;
878
  margin-bottom: 20px;
 
879
  }
880
  form {
881
- background: #fff;
882
  padding: 20px;
883
  border-radius: 15px;
884
- box-shadow: 0 4px 15px rgba(0,0,0,0.1);
885
  margin-bottom: 30px;
886
  }
887
  label {
@@ -893,30 +861,30 @@ def admin():
893
  width: 100%;
894
  padding: 12px;
895
  margin-top: 5px;
896
- border: 1px solid #e2e8f0;
897
  border-radius: 8px;
898
  font-size: 1rem;
899
  transition: all 0.3s ease;
900
  }
901
  input:focus, textarea:focus, select:focus {
902
- border-color: #3b82f6;
903
- box-shadow: 0 0 5px rgba(59, 130, 246, 0.3);
904
  outline: none;
905
  }
906
  button {
907
  padding: 12px 20px;
908
  border: none;
909
  border-radius: 8px;
910
- background-color: #3b82f6;
911
- color: white;
912
  font-weight: 500;
913
  cursor: pointer;
914
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
915
  margin-top: 15px;
916
  }
917
  button:hover {
918
- background-color: #2563eb;
919
- box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
920
  transform: translateY(-2px);
921
  }
922
  .delete-button {
@@ -931,10 +899,10 @@ def admin():
931
  gap: 20px;
932
  }
933
  .product-item, .category-item {
934
- background: #fff;
935
  padding: 20px;
936
  border-radius: 15px;
937
- box-shadow: 0 4px 15px rgba(0,0,0,0.1);
938
  }
939
  .edit-form {
940
  margin-top: 15px;
@@ -948,10 +916,10 @@ def admin():
948
  margin-top: 5px;
949
  }
950
  .add-color-btn {
951
- background-color: #10b981;
952
  }
953
  .add-color-btn:hover {
954
- background-color: #059669;
955
  }
956
  </style>
957
  </head>
 
10
  from werkzeug.utils import secure_filename
11
 
12
  app = Flask(__name__)
13
+ DATA_FILE = 'dataasdem.json'
14
 
15
+ REPO_ID = "flpolprojects/Clients"
 
16
  HF_TOKEN_WRITE = os.getenv("HF_TOKEN")
17
  HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
18
 
19
+ LOGO_URL = "https://cdn-avatars.huggingface.co/v1/production/uploads/67b22aaeae9b6a59f1cfb849/NQvBksXzJItYt6hfFjyaB.jpeg"
 
20
 
 
21
  logging.basicConfig(level=logging.DEBUG)
22
 
23
  def load_data():
 
93
  @app.route('/')
94
  def catalog():
95
  data = load_data()
96
+ products = sorted(data['products'], key=lambda x: x.get('added_at', ''), reverse=True)
97
  categories = data['categories']
98
 
99
  catalog_html = '''
 
102
  <head>
103
  <meta charset="UTF-8">
104
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
105
+ <title>Asdem - нижнее белье оптом </title>
106
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
107
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
108
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
109
  <style>
110
+ :root {
111
+ --primary-color: #F48FB1;
112
+ --secondary-color: #CE93D8;
113
+ --text-color: #333;
114
+ --bg-color: #FCE4EC;
115
+ --light-text: #fff;
116
+ --shadow-color: rgba(0, 0, 0, 0.1);
117
+ }
118
  * {
119
  margin: 0;
120
  padding: 0;
 
122
  }
123
  body {
124
  font-family: 'Poppins', sans-serif;
125
+ background-color: var(--bg-color);
126
+ color: var(--text-color);
127
  line-height: 1.6;
128
+ transition: background-color 0.3s, color 0.3s;
 
 
 
 
129
  }
130
  .container {
131
  max-width: 1300px;
 
137
  justify-content: space-between;
138
  align-items: center;
139
  padding: 15px 0;
140
+ border-bottom: 1px solid var(--primary-color);
141
  }
142
  .header-logo {
143
  width: 60px;
144
  height: 60px;
145
  border-radius: 50%;
146
  object-fit: cover;
147
+ box-shadow: 0 4px 15px var(--shadow-color);
148
  transition: transform 0.3s ease, box-shadow 0.3s ease;
149
  }
150
  .header-logo:hover {
 
155
  font-size: 1.5rem;
156
  font-weight: 600;
157
  margin-left: 15px;
158
+ color: var(--primary-color);
 
 
 
 
 
 
 
 
 
 
159
  }
160
  .filters-container {
161
  margin: 20px 0;
 
173
  max-width: 600px;
174
  padding: 12px 18px;
175
  font-size: 1rem;
176
+ border: 1px solid var(--secondary-color);
177
  border-radius: 8px;
178
  outline: none;
179
+ box-shadow: 0 2px 5px var(--shadow-color);
180
  transition: all 0.3s ease;
181
  }
182
  #search-input:focus {
183
+ border-color: var(--primary-color);
184
+ box-shadow: 0 4px 15px rgba(244, 143, 177, 0.3);
185
  }
186
  .category-filter {
187
  padding: 8px 16px;
188
+ border: 1px solid var(--secondary-color);
189
  border-radius: 8px;
190
+ background-color: var(--light-text);
191
+ color: var(--text-color);
192
  cursor: pointer;
193
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
194
  font-size: 0.9rem;
195
  font-weight: 400;
196
  }
197
  .category-filter.active, .category-filter:hover {
198
+ background-color: var(--primary-color);
199
+ color: var(--light-text);
200
+ border-color: var(--primary-color);
201
+ box-shadow: 0 2px 10px rgba(244, 143, 177, 0.4);
202
  }
203
  .products-grid {
204
  display: grid;
 
207
  padding: 10px;
208
  }
209
  .product {
210
+ background: var(--light-text);
211
  border-radius: 15px;
212
  padding: 15px;
213
+ box-shadow: 0 4px 15px var(--shadow-color);
214
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
215
  overflow: hidden;
216
  }
 
 
 
 
217
  .product:hover {
218
  transform: translateY(-5px) scale(1.02);
219
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
 
262
  text-overflow: ellipsis;
263
  white-space: nowrap;
264
  }
 
 
 
265
  .product-button {
266
  display: block;
267
  width: 100%;
268
  padding: 8px;
269
  border: none;
270
  border-radius: 8px;
271
+ background-color: var(--primary-color);
272
+ color: var(--light-text);
273
  font-size: 0.8rem;
274
  font-weight: 500;
275
  cursor: pointer;
 
279
  text-decoration: none;
280
  }
281
  .product-button:hover {
282
+ background-color: #E91E63;
283
+ box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
284
  transform: translateY(-2px);
285
  }
286
  .add-to-cart {
287
+ background-color: var(--secondary-color);
288
  }
289
  .add-to-cart:hover {
290
+ background-color: #BA68C8;
291
+ box-shadow: 0 4px 15px rgba(186, 104, 200, 0.4);
292
  }
293
  #cart-button {
294
  position: fixed;
295
  bottom: 20px;
296
  right: 20px;
297
  background-color: #ef4444;
298
+ color: var(--light-text);
299
  border: none;
300
  border-radius: 50%;
301
  width: 50px;
 
319
  backdrop-filter: blur(5px);
320
  }
321
  .modal-content {
322
+ background: var(--light-text);
323
  margin: 5% auto;
324
  padding: 20px;
325
  border-radius: 15px;
 
328
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
329
  animation: slideIn 0.3s ease-out;
330
  }
 
 
 
 
331
  @keyframes slideIn {
332
  from { transform: translateY(-50px); opacity: 0; }
333
  to { transform: translateY(0); opacity: 1; }
 
340
  transition: color 0.3s;
341
  }
342
  .close:hover {
343
+ color: var(--primary-color);
 
 
 
 
 
 
344
  }
345
  .cart-item {
346
  display: flex;
347
  justify-content: space-between;
348
  align-items: center;
349
  padding: 15px 0;
350
+ border-bottom: 1px solid var(--secondary-color);
 
 
 
351
  }
352
  .cart-item img {
353
  width: 50px;
 
360
  width: 100%;
361
  max-width: 150px;
362
  padding: 8px;
363
+ border: 1px solid var(--secondary-color);
364
  border-radius: 8px;
365
  font-size: 1rem;
366
  margin: 5px 0;
 
373
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
374
  }
375
  .order-button {
376
+ background-color: var(--secondary-color);
377
  }
378
  .order-button:hover {
379
+ background-color: #BA68C8;
380
+ box-shadow: 0 4px 15px rgba(186, 104, 200, 0.4);
381
+ }
382
+ @media (max-width: 768px) {
383
+ .products-grid {
384
+ grid-template-columns: repeat(2, minmax(150px, 1fr));
385
+ }
386
  }
387
  </style>
388
  </head>
 
391
  <div class="header">
392
  <img src="''' + LOGO_URL + '''" alt="Logo" class="header-logo">
393
  <h1>Каталог</h1>
 
 
 
394
  </div>
395
  <div class="filters-container">
396
  <button class="category-filter active" data-category="all">Все категории</button>
 
424
  </div>
425
  </div>
426
 
 
427
  <div id="productModal" class="modal">
428
  <div class="modal-content">
429
  <span class="close" onclick="closeModal('productModal')">×</span>
 
431
  </div>
432
  </div>
433
 
 
434
  <div id="quantityModal" class="modal">
435
  <div class="modal-content">
436
  <span class="close" onclick="closeModal('quantityModal')">×</span>
 
441
  </div>
442
  </div>
443
 
 
444
  <div id="cartModal" class="modal">
445
  <div class="modal-content">
446
  <span class="close" onclick="closeModal('cartModal')">×</span>
 
463
  const products = {{ products|tojson }};
464
  let selectedProductIndex = null;
465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
466
  function openModal(index) {
467
  loadProductDetails(index);
468
  document.getElementById('productModal').style.display = "block";
 
592
  orderText += `${index + 1}. ${item.name} - ${item.price} с × ${item.quantity} (Цвет: ${item.color})%0A`;
593
  });
594
  orderText += `Итого: ${total} с`;
595
+ window.open(`https://api.whatsapp.com/send?phone=996772179559&text=${orderText}`, '_blank');
596
  }
597
 
598
  function clearCart() {
 
711
  photos_list = []
712
 
713
  if photos_files:
714
+ for photo in photos_files[:10]:
715
  if photo and photo.filename:
716
  photo_filename = secure_filename(photo.filename)
717
  uploads_dir = 'uploads'
 
741
  'description': description,
742
  'category': category if category in categories else 'Без категории',
743
  'photos': photos_list,
744
+ 'colors': colors if colors else [],
745
+ 'added_at': datetime.now().isoformat()
746
  }
747
  products.append(new_product)
748
  save_data(data)
 
759
 
760
  if photos_files and any(photo.filename for photo in photos_files):
761
  new_photos_list = []
762
+ for photo in photos_files[:10]:
763
  if photo and photo.filename:
764
  photo_filename = secure_filename(photo.filename)
765
  uploads_dir = 'uploads'
 
803
  <title>Админ-панель</title>
804
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
805
  <style>
806
+ :root {
807
+ --primary-color: #F48FB1;
808
+ --secondary-color: #CE93D8;
809
+ --text-color: #333;
810
+ --bg-color: #FCE4EC;
811
+ --light-text: #fff;
812
+ --shadow-color: rgba(0, 0, 0, 0.1);
813
+ }
814
  body {
815
  font-family: 'Poppins', sans-serif;
816
+ background: var(--bg-color);
817
+ color: var(--text-color);
818
  padding: 20px;
819
  }
820
  .container {
 
825
  display: flex;
826
  align-items: center;
827
  padding: 15px 0;
828
+ border-bottom: 1px solid var(--primary-color);
829
  }
830
  .header-logo {
831
  width: 60px;
832
  height: 60px;
833
  border-radius: 50%;
834
  object-fit: cover;
835
+ box-shadow: 0 4px 15px var(--shadow-color);
836
  transition: transform 0.3s ease, box-shadow 0.3s ease;
837
  margin-right: 15px;
838
  }
 
843
  h1, h2 {
844
  font-weight: 600;
845
  margin-bottom: 20px;
846
+ color: var(--primary-color);
847
  }
848
  form {
849
+ background: var(--light-text);
850
  padding: 20px;
851
  border-radius: 15px;
852
+ box-shadow: 0 4px 15px var(--shadow-color);
853
  margin-bottom: 30px;
854
  }
855
  label {
 
861
  width: 100%;
862
  padding: 12px;
863
  margin-top: 5px;
864
+ border: 1px solid var(--secondary-color);
865
  border-radius: 8px;
866
  font-size: 1rem;
867
  transition: all 0.3s ease;
868
  }
869
  input:focus, textarea:focus, select:focus {
870
+ border-color: var(--primary-color);
871
+ box-shadow: 0 0 5px rgba(244, 143, 177, 0.3);
872
  outline: none;
873
  }
874
  button {
875
  padding: 12px 20px;
876
  border: none;
877
  border-radius: 8px;
878
+ background-color: var(--primary-color);
879
+ color: var(--light-text);
880
  font-weight: 500;
881
  cursor: pointer;
882
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
883
  margin-top: 15px;
884
  }
885
  button:hover {
886
+ background-color: #E91E63;
887
+ box-shadow: 0 4px 15px rgba(233, 30, 99, 0.4);
888
  transform: translateY(-2px);
889
  }
890
  .delete-button {
 
899
  gap: 20px;
900
  }
901
  .product-item, .category-item {
902
+ background: var(--light-text);
903
  padding: 20px;
904
  border-radius: 15px;
905
+ box-shadow: 0 4px 15px var(--shadow-color);
906
  }
907
  .edit-form {
908
  margin-top: 15px;
 
916
  margin-top: 5px;
917
  }
918
  .add-color-btn {
919
+ background-color: var(--secondary-color);
920
  }
921
  .add-color-btn:hover {
922
+ background-color: #BA68C8;
923
  }
924
  </style>
925
  </head>