-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
556 lines (487 loc) · 26.9 KB
/
index.html
File metadata and controls
556 lines (487 loc) · 26.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Генератор Отчётов Авто</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
* { font-family: 'Inter', sans-serif; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #1e1e2e; }
::-webkit-scrollbar-thumb { background: #4a4a6a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #5a5a7a; }
.gradient-bg { background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%); }
.card-gradient { background: linear-gradient(145deg, #1e1e32 0%, #252540 100%); }
.btn-primary {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
transition: all 0.3s ease;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}
.btn-secondary { background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); }
.btn-danger { background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%); }
.btn-blue { background: linear-gradient(135deg, #4285f4 0%, #34a853 100%); }
.file-drop-zone {
border: 3px dashed #4a4a6a;
transition: all 0.3s ease;
}
.file-drop-zone:hover, .file-drop-zone.dragover {
border-color: #667eea;
background: rgba(102, 126, 234, 0.1);
}
.report-content-editable[contenteditable="true"] {
cursor: text;
}
.report-content-editable[contenteditable="true"]:focus {
box-shadow: 0 0 0 3px rgba(74, 74, 138, 0.3);
}
.report-content-editable p {
margin: 10px 0;
}
.report-content-editable h1,
.report-content-editable h2,
.report-content-editable h3 {
margin: 15px 0 10px 0;
}
/* Мобильная навигация */
.bottom-nav {
display: none;
}
@media (max-width: 768px) {
#sidebar {
display: none !important;
}
.bottom-nav {
display: flex !important;
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.95);
border-top: 1px solid rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
z-index: 100;
padding: 8px 0;
}
.bottom-nav-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
padding: 8px;
color: rgba(255, 255, 255, 0.6);
transition: all 0.2s;
text-decoration: none;
}
.bottom-nav-item.active {
color: #667eea;
}
.bottom-nav-item i {
font-size: 20px;
}
.bottom-nav-item span {
font-size: 11px;
}
main {
padding-bottom: 80px !important;
}
.page {
padding: 16px !important;
}
/* Оптимизация истории для мобильных */
.card-gradient {
padding: 12px !important;
margin-bottom: 12px !important;
}
#reports-list .card-gradient h3 {
font-size: 16px !important;
}
#reports-list .card-gradient p,
#reports-list .card-gradient span {
font-size: 12px !important;
}
.report-card {
padding: 10px !important;
}
/* Компактные кнопки действий */
.report-card button {
padding: 6px 10px !important;
font-size: 11px !important;
}
/* Оптимизация страницы отчета */
#report-content {
padding: 8px !important;
}
.report-content-editable {
zoom: 0.5;
transform-origin: top left;
padding: 10px !important;
}
/* Панель управления отчетом */
#report-content > div:first-child {
flex-direction: column !important;
gap: 8px !important;
padding: 12px !important;
}
#report-content button {
width: 100% !important;
justify-content: center !important;
padding: 10px !important;
}
/* Компактные кнопки экспорта/драйва */
#report-content .flex.gap-3 button {
padding: 8px 12px !important;
font-size: 12px !important;
}
#report-content .flex.gap-3 button i {
font-size: 12px !important;
}
}
.image-preview { transition: all 0.3s ease; }
.image-preview:hover { transform: scale(1.05); }
.sidebar-item { transition: all 0.2s ease; }
.sidebar-item:hover, .sidebar-item.active {
background: rgba(102, 126, 234, 0.2);
border-left: 3px solid #667eea;
}
.modal-overlay {
background: rgba(0, 0, 0, 0.7);
backdrop-filter: blur(5px);
}
.report-card { transition: all 0.3s ease; }
.report-card:hover {
transform: translateY(-5px);
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}
.loading-spinner {
border: 4px solid rgba(255, 255, 255, 0.1);
border-left-color: #667eea;
animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.fade-in { animation: fadeIn 0.5s ease; }
.toast { animation: slideIn 0.3s ease; }
/* Стили для отчёта при печати */
@media print {
body { background: white !important; }
.report-container { max-width: 100% !important; }
}
</style>
</head>
<body class="gradient-bg min-h-screen text-white">
<div id="app" class="flex h-screen">
<!-- Боковая панель -->
<aside id="sidebar" class="w-72 bg-black/30 flex flex-col border-r border-white/10">
<div class="p-6 border-b border-white/10">
<div class="flex items-center gap-3">
<div class="w-12 h-12 rounded-xl bg-gradient-to-br from-purple-500 to-pink-500 flex items-center justify-center">
<i class="fas fa-car text-2xl"></i>
</div>
<div>
<h1 class="text-lg font-bold">Авто Отчёты</h1>
<p class="text-xs text-gray-400">v2.0 • GPT + Gemini</p>
</div>
</div>
</div>
<nav class="flex-1 overflow-y-auto p-4">
<div class="mb-6">
<button onclick="showPage('create')" class="sidebar-item active w-full text-left px-4 py-3 rounded-lg flex items-center gap-3" data-page="create">
<i class="fas fa-plus-circle text-purple-400"></i>
<span>Создать отчёт</span>
</button>
</div>
<div class="mb-4">
<h3 class="text-xs text-gray-500 uppercase tracking-wider mb-2 px-4">История</h3>
<button onclick="showPage('history')" class="sidebar-item w-full text-left px-4 py-3 rounded-lg flex items-center gap-3" data-page="history">
<i class="fas fa-history text-blue-400"></i>
<span>Все отчёты</span>
<span id="reports-count" class="ml-auto bg-purple-600 text-xs px-2 py-1 rounded-full">0</span>
</button>
</div>
<div class="mb-4">
<h3 class="text-xs text-gray-500 uppercase tracking-wider mb-2 px-4">Автомобили</h3>
<div id="cars-list" class="space-y-1"></div>
</div>
</nav>
<div class="p-4 border-t border-white/10">
<button onclick="showPage('settings')" class="sidebar-item w-full text-left px-4 py-3 rounded-lg flex items-center gap-3" data-page="settings">
<i class="fas fa-cog text-gray-400"></i>
<span>Настройки</span>
</button>
</div>
</aside>
<!-- Основной контент -->
<main class="flex-1 overflow-y-auto">
<!-- Страница создания отчёта -->
<div id="page-create" class="page p-8 fade-in">
<div class="max-w-5xl mx-auto">
<h2 class="text-3xl font-bold mb-2">Создать новый отчёт</h2>
<p class="text-gray-400 mb-8">Загрузите скриншоты китайского отчёта об автомобиле (поддерживаются большие изображения)</p>
<!-- Зона загрузки файлов -->
<div id="drop-zone" class="file-drop-zone rounded-2xl p-12 text-center mb-8 cursor-pointer"
onclick="selectFiles()" ondragover="handleDragOver(event)" ondragleave="handleDragLeave(event)" ondrop="handleDrop(event)">
<div class="mb-4">
<i class="fas fa-cloud-upload-alt text-6xl text-purple-400"></i>
</div>
<h3 class="text-xl font-semibold mb-2">Перетащите изображения сюда</h3>
<p class="text-gray-400 mb-4">или нажмите для выбора файлов</p>
<p class="text-sm text-gray-500">JPG, PNG, WebP • Большие изображения автоматически обрабатываются</p>
</div>
<!-- Параметры отчёта -->
<div id="report-options" class="hidden mb-6 card-gradient rounded-xl p-6">
<h3 class="text-lg font-semibold mb-4">Выбор тарифа</h3>
<div class="space-y-3">
<label class="flex items-center gap-3 cursor-pointer p-3 rounded-lg hover:bg-white/5 transition">
<input type="radio" name="report-tariff" value="full" id="tariff-full" checked class="w-5 h-5 border-white/20 bg-black/30 text-purple-600 focus:ring-purple-500">
<div>
<span class="font-semibold">Полный отчет</span>
<p class="text-sm text-gray-400">Техническое состояние + страховые случаи</p>
</div>
</label>
<label class="flex items-center gap-3 cursor-pointer p-3 rounded-lg hover:bg-white/5 transition">
<input type="radio" name="report-tariff" value="short" id="tariff-short" class="w-5 h-5 border-white/20 bg-black/30 text-purple-600 focus:ring-purple-500">
<div>
<span class="font-semibold">Короткий отчет</span>
<p class="text-sm text-gray-400">Только техническое обслуживание (без страховых случаев)</p>
</div>
</label>
<label class="flex items-center gap-3 cursor-pointer p-3 rounded-lg hover:bg-white/5 transition">
<input type="radio" name="report-tariff" value="insurance" id="tariff-insurance" class="w-5 h-5 border-white/20 bg-black/30 text-orange-600 focus:ring-orange-500">
<div>
<span class="font-semibold">Только страховой отчет</span>
<p class="text-sm text-gray-400">Содержит только блоки, связанные со страховыми случаями и историей ремонтов</p>
</div>
</label>
</div>
</div>
<!-- Превью загруженных изображений -->
<div id="images-preview" class="hidden mb-8">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-semibold">Загруженные изображения (<span id="images-count">0</span>)</h3>
<button onclick="clearImages()" class="text-red-400 hover:text-red-300 text-sm">
<i class="fas fa-trash mr-1"></i> Очистить все
</button>
</div>
<div id="images-grid" class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"></div>
</div>
<!-- Кнопка генерации -->
<div id="generate-section" class="hidden">
<button onclick="generateReport()" id="generate-btn" class="btn-primary w-full py-4 rounded-xl text-lg font-semibold flex items-center justify-center gap-3">
<i class="fas fa-magic"></i>
Сгенерировать отчёт
</button>
</div>
<!-- Прогресс генерации -->
<div id="progress-section" class="hidden card-gradient rounded-2xl p-8 text-center">
<div class="loading-spinner w-16 h-16 rounded-full mx-auto mb-6"></div>
<h3 class="text-xl font-semibold mb-2">Генерация отчёта...</h3>
<p id="progress-status" class="text-gray-400">Анализ изображений...</p>
<div class="mt-6 bg-black/30 rounded-full h-2 overflow-hidden">
<div id="progress-bar" class="h-full bg-gradient-to-r from-purple-500 to-pink-500 transition-all duration-500" style="width: 0%"></div>
</div>
</div>
</div>
</div>
<!-- Страница истории -->
<div id="page-history" class="page hidden p-8 fade-in">
<div class="max-w-6xl mx-auto">
<div class="flex items-center justify-between mb-8">
<div>
<h2 class="text-3xl font-bold mb-2">История отчётов</h2>
<p class="text-gray-400">Все сгенерированные отчёты</p>
</div>
<input type="text" id="search-reports" placeholder="Поиск по VIN..."
class="bg-black/30 border border-white/10 rounded-lg px-4 py-2 focus:outline-none focus:border-purple-500 w-64"
oninput="filterReports()">
</div>
<div id="reports-list" class="space-y-4"></div>
<div id="no-reports" class="hidden text-center py-16">
<i class="fas fa-folder-open text-6xl text-gray-600 mb-4"></i>
<h3 class="text-xl text-gray-400">Нет сохранённых отчётов</h3>
<p class="text-gray-500 mt-2">Создайте первый отчёт, загрузив изображения</p>
</div>
</div>
</div>
<!-- Страница автомобиля -->
<div id="page-car" class="page hidden p-8 fade-in">
<div class="max-w-6xl mx-auto">
<button onclick="showPage('history')" class="text-gray-400 hover:text-white mb-6 flex items-center gap-2">
<i class="fas fa-arrow-left"></i> Назад к списку
</button>
<div id="car-details"></div>
</div>
</div>
<!-- Страница просмотра отчёта -->
<div id="page-report" class="page hidden p-8 fade-in">
<div class="max-w-5xl mx-auto">
<div class="flex items-center justify-between mb-6">
<button onclick="showPage('history')" class="text-gray-400 hover:text-white flex items-center gap-2">
<i class="fas fa-arrow-left"></i> Назад
</button>
<div class="flex gap-3" style = " font-size: 8px;
padding: 8px 12px;">
<button onclick="exportToPDF()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded-lg flex items-center gap-2" title="Экспорт PDF">
<i class="fas fa-file-pdf"></i> Экспорт PDF
</button>
<button onclick="openDriveLink()" class="btn-blue px-4 py-2 rounded-lg flex items-center gap-2" title="Открыть в Google Drive">
<i class="fab fa-google-drive"></i> Google Drive
</button>
<button onclick="copyReportLink()" class="bg-purple-600 hover:bg-purple-700 px-4 py-2 rounded-lg flex items-center gap-2" title="Копировать ссылку на Drive">
<i class="fas fa-link"></i> Копировать ссылку
</button>
</div>
</div>
<div id="report-content" class="card-gradient rounded-2xl p-8 prose prose-invert max-w-none overflow-auto"></div>
</div>
</div>
<!-- Страница настроек -->
<div id="page-settings" class="page hidden p-8 fade-in">
<div class="max-w-3xl mx-auto">
<h2 class="text-3xl font-bold mb-2">Настройки</h2>
<p class="text-gray-400 mb-8">Конфигурация API и внешнего вида</p>
<div class="space-y-6">
<!-- Выбор AI провайдера -->
<div class="card-gradient rounded-2xl p-6">
<h3 class="text-lg font-semibold mb-4 flex items-center gap-2">
<i class="fas fa-robot text-purple-400"></i>
AI Провайдер
</h3>
<select id="ai-provider" class="w-full bg-black/30 border border-white/10 rounded-lg px-4 py-3 focus:outline-none focus:border-purple-500">
<option value="openai">OpenAI GPT-4 Vision</option>
<option value="gemini">Google Gemini 2.5 Flash</option>
</select>
<p class="text-xs text-gray-500 mt-2">Gemini быстрее и дешевле, GPT часто точнее</p>
</div>
<!-- API ключ OpenAI -->
<div class="card-gradient rounded-2xl p-6">
<h3 class="text-lg font-semibold mb-4 flex items-center gap-2">
<i class="fas fa-key text-green-400"></i>
OpenAI API Key
</h3>
<div class="relative">
<input type="password" id="openai-key" placeholder="sk-..."
class="w-full bg-black/30 border border-white/10 rounded-lg px-4 py-3 pr-20 focus:outline-none focus:border-purple-500">
<button onclick="toggleKeyVisibility('openai-key')" class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-white">
<i class="fas fa-eye"></i>
</button>
</div>
<a href="https://platform.openai.com/api-keys" target="_blank" class="text-purple-400 hover:text-purple-300 text-sm mt-2 inline-block">
Получить ключ <i class="fas fa-external-link-alt ml-1"></i>
</a>
</div>
<!-- API ключ Gemini -->
<div class="card-gradient rounded-2xl p-6">
<h3 class="text-lg font-semibold mb-4 flex items-center gap-2">
<i class="fas fa-key text-blue-400"></i>
Google Gemini API Key
</h3>
<div class="relative">
<input type="password" id="gemini-key" placeholder="AIza..."
class="w-full bg-black/30 border border-white/10 rounded-lg px-4 py-3 pr-20 focus:outline-none focus:border-purple-500">
<button onclick="toggleKeyVisibility('gemini-key')" class="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-white">
<i class="fas fa-eye"></i>
</button>
</div>
<a href="https://aistudio.google.com/apikey" target="_blank" class="text-blue-400 hover:text-blue-300 text-sm mt-2 inline-block">
Получить ключ (бесплатно) <i class="fas fa-external-link-alt ml-1"></i>
</a>
</div>
<!-- Логотип -->
<div class="card-gradient rounded-2xl p-6">
<h3 class="text-lg font-semibold mb-4 flex items-center gap-2">
<i class="fas fa-image text-pink-400"></i>
Логотип для отчётов
</h3>
<div class="flex gap-4 mb-4">
<div class="flex-1">
<label class="block text-sm text-gray-400 mb-2">URL изображения</label>
<input type="text" id="logo-url" placeholder="https://..."
class="w-full bg-black/30 border border-white/10 rounded-lg px-4 py-3 focus:outline-none focus:border-purple-500">
</div>
<div class="flex-shrink-0">
<label class="block text-sm text-gray-400 mb-2">Или загрузить</label>
<label class="cursor-pointer bg-purple-600 hover:bg-purple-700 px-4 py-3 rounded-lg inline-flex items-center gap-2">
<i class="fas fa-upload"></i>
<input type="file" accept="image/*" class="hidden" onchange="handleLogoUpload(event)">
Файл
</label>
</div>
</div>
<div id="logo-preview" class="hidden mt-4 p-4 bg-white rounded-lg">
<img id="logo-img" src="" alt="Logo preview" class="max-h-16 object-contain">
</div>
</div>
<!-- Управление хранилищем -->
<div class="card-gradient rounded-2xl p-6">
<h3 class="text-lg font-semibold mb-4 flex items-center gap-2">
<i class="fas fa-database text-blue-400"></i>
Управление хранилищем
</h3>
<div id="storage-stats" class="bg-black/30 rounded-lg p-4 mb-4">
<p class="text-gray-400 text-sm">Загрузка статистики...</p>
</div>
<div class="flex flex-wrap gap-3">
<button onclick="showStorageStats()" class="px-4 py-2 bg-blue-600 rounded-lg hover:bg-blue-700 transition flex items-center gap-2">
<i class="fas fa-sync-alt"></i>
Обновить
</button>
<button onclick="exportBackup()" class="px-4 py-2 bg-green-600 rounded-lg hover:bg-green-700 transition flex items-center gap-2">
<i class="fas fa-download"></i>
Экспорт бэкапа
</button>
<label class="px-4 py-2 bg-purple-600 rounded-lg hover:bg-purple-700 transition flex items-center gap-2 cursor-pointer">
<i class="fas fa-upload"></i>
Импорт бэкапа
<input type="file" accept=".json" onchange="importBackup(event)" class="hidden">
</label>
</div>
</div>
<!-- Кнопка сохранения -->
<button onclick="saveSettings()" class="btn-primary w-full py-4 rounded-xl text-lg font-semibold">
<i class="fas fa-save mr-2"></i> Сохранить настройки
</button>
</div>
</div>
</div>
</main>
</div>
<!-- Мобильная навигация -->
<nav class="bottom-nav">
<button onclick="showPage('create')" class="bottom-nav-item active" data-page="create">
<i class="fas fa-plus-circle"></i>
<span>Создать</span>
</button>
<button onclick="showPage('history')" class="bottom-nav-item" data-page="history">
<i class="fas fa-history"></i>
<span>История</span>
</button>
<button onclick="showPage('settings')" class="bottom-nav-item" data-page="settings">
<i class="fas fa-cog"></i>
<span>Настройки</span>
</button>
</nav>
<!-- Модальное окно для просмотра изображения -->
<div id="image-modal" class="fixed inset-0 modal-overlay hidden items-center justify-center z-50" onclick="closeImageModal(event)">
<div class="max-w-4xl max-h-[90vh] p-4">
<img id="modal-image" src="" alt="" class="max-w-full max-h-[85vh] rounded-lg shadow-2xl">
</div>
<button class="absolute top-4 right-4 text-white text-3xl hover:text-gray-300" onclick="closeImageModal()">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Toast уведомления -->
<div id="toast-container" class="fixed bottom-4 right-4 space-y-2 z-50"></div>
<!-- Скрытый input для веб-версии -->
<input type="file" id="file-input" multiple accept="image/*" class="hidden" onchange="handleFileSelect(event)">
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script src="./static/app.js"></script>
</body>
</html>