wagtail-enap-designsystem 1.2.1.119__py3-none-any.whl → 1.2.1.120__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of wagtail-enap-designsystem might be problematic. Click here for more details.

@@ -0,0 +1,1707 @@
1
+ {% extends "enap_designsystem/base.html" %}
2
+ {% load static wagtailcore_tags %}
3
+
4
+ {% block title %}
5
+ <title>{{ page.page_title }}</title>
6
+ {% endblock %}
7
+
8
+ {%block govnavbar %}
9
+ <div style="background-color: #071E41;">
10
+ <div class="menu">
11
+ <div class="logo">
12
+ <img style="width: 51px; height: 18px;" src="{% static 'enap_designsystem/icons/logo-white.png' %}" alt="Logo GovBR" height="40">
13
+ </div>
14
+ <a href="https://www.gov.br/secom/pt-br/acesso-a-informacao/comunicabr">Comunica BR</a>
15
+ <div class="separator"></div>
16
+ <a href="https://www.gov.br/acessoainformacao/pt-br">Acesso à informação</a>
17
+ <div class="separator"></div>
18
+ <a href="https://www.gov.br/pt-br/participacao-social/">Participe</a>
19
+ <div class="separator"></div>
20
+ <a href="https://www4.planalto.gov.br/legislacao/">Legislação</a>
21
+ <div class="separator"></div>
22
+ <a href="https://www.gov.br/pt-br/orgaos-do-governo">Órgãos do Governo</a>
23
+ </div>
24
+ </div>
25
+ {% endblock %}
26
+
27
+ {% block navbar %}
28
+ {% if page.navbar %}
29
+ {% include "enap_designsystem/blocks/navbar/navbar_block.html" with navbar=page.navbar %}
30
+ {% else %}
31
+ <p style="color: red;">DEBUG: Nenhuma Navbar foi definida.</p>
32
+ {% endif %}
33
+ {% endblock %}
34
+
35
+ {% block stylecss %}
36
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
37
+ <style>
38
+ :root {
39
+ --votacao-primary-blue: #1e3a8a;
40
+ --votacao-primary-teal: #007D7A;
41
+ --votacao-secondary-teal: #0891b2;
42
+ --votacao-accent-teal: #0d9488;
43
+ --votacao-success-green: #059669;
44
+ --votacao-error-red: #dc2626;
45
+ --votacao-warning-orange: #ea580c;
46
+
47
+ --votacao-gray-50: #f9fafb;
48
+ --votacao-gray-100: #f3f4f6;
49
+ --votacao-gray-200: #e5e7eb;
50
+ --votacao-gray-300: #d1d5db;
51
+ --votacao-gray-400: #9ca3af;
52
+ --votacao-gray-500: #6b7280;
53
+ --votacao-gray-600: #4b5563;
54
+ --votacao-gray-700: #374151;
55
+ --votacao-gray-800: #1f2937;
56
+ --votacao-gray-900: #111827;
57
+
58
+ --votacao-bg-primary: #ffffff;
59
+ --votacao-bg-secondary: var(--votacao-gray-50);
60
+ --votacao-bg-accent: var(--votacao-gray-100);
61
+
62
+ --votacao-text-primary: var(--votacao-gray-900);
63
+ --votacao-text-secondary: var(--votacao-gray-600);
64
+ --votacao-text-muted: var(--votacao-gray-500);
65
+
66
+ --votacao-border-light: var(--votacao-gray-200);
67
+ --votacao-border-medium: var(--votacao-gray-300);
68
+ --votacao-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
69
+ --votacao-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
70
+ --votacao-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
71
+ --votacao-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
72
+ }
73
+
74
+ .sistema-votacao-wrapper {
75
+ background: #F5F7FA;
76
+ color: var(--votacao-text-primary);
77
+ min-height: 100vh;
78
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
79
+ line-height: 1.6;
80
+ }
81
+
82
+ .sistema-votacao-container {
83
+ max-width: 1200px;
84
+ margin: 0 auto;
85
+ padding: 2rem 1rem;
86
+ }
87
+
88
+ .sistema-votacao-header {
89
+ text-align: center;
90
+ margin-bottom: 3rem;
91
+ background: var(--votacao-bg-primary);
92
+ border-radius: 16px;
93
+ padding: 3rem 2rem;
94
+ box-shadow: var(--votacao-shadow-md);
95
+ border: 1px solid var(--votacao-border-light);
96
+ color: white;
97
+ }
98
+
99
+ .sistema-votacao-header.has-background {
100
+ position: relative;
101
+ }
102
+
103
+ .sistema-votacao-header.has-background::before {
104
+ content: '';
105
+ position: absolute;
106
+ top: 0;
107
+ left: 0;
108
+ width: 100%;
109
+ height: 100%;
110
+ background: rgba(0, 0, 0, 0.5);
111
+ border-radius: 16px;
112
+ z-index: 1;
113
+ }
114
+
115
+ .sistema-votacao-header .votacao-content {
116
+ position: relative;
117
+ z-index: 2;
118
+ }
119
+
120
+ .sistema-votacao-icon {
121
+ background: var(--votacao-primary-teal);
122
+ color: white;
123
+ width: 80px;
124
+ height: 80px;
125
+ border-radius: 20px;
126
+ display: inline-flex;
127
+ align-items: center;
128
+ justify-content: center;
129
+ font-size: 2rem;
130
+ margin-bottom: 1.5rem;
131
+ }
132
+
133
+ .sistema-votacao-title {
134
+ font-size: 2.5rem;
135
+ font-weight: 700;
136
+ margin-bottom: 0.75rem;
137
+ }
138
+
139
+ .sistema-votacao-subtitle {
140
+ font-size: 1.125rem;
141
+ color: white;
142
+ margin: 0;
143
+ }
144
+
145
+ .sistema-votacao-descricao p{
146
+ margin-top: 1.5rem;
147
+ color: white;
148
+ }
149
+
150
+ .sistema-progresso-section {
151
+ position: fixed;
152
+ bottom: 0;
153
+ display: flex;
154
+ align-items: center;
155
+ background: var(--votacao-bg-primary);
156
+ border-radius: 12px;
157
+ padding: 1rem 2rem;
158
+ box-shadow: var(--votacao-shadow-md);
159
+ border: 1px solid var(--votacao-border-light);
160
+ z-index: 400;
161
+ right : 40px;
162
+ display: grid;
163
+ gap: 20px;
164
+ }
165
+
166
+ .sistema-progresso-header {
167
+ display: flex;
168
+ justify-content: space-between;
169
+ align-items: center;
170
+ flex-direction: column;
171
+ }
172
+
173
+ .sistema-progresso-title {
174
+ font-size: 1.25rem;
175
+ font-weight: 700;
176
+ margin: 0;
177
+ color: var(--votacao-text-primary);
178
+ }
179
+
180
+ .sistema-progresso-status {
181
+ color: var(--votacao-text-secondary);
182
+ font-size: 0.875rem;
183
+ font-weight: 500;
184
+ }
185
+
186
+ .sistema-progresso-bar {
187
+ width: 100%;
188
+ height: 12px;
189
+ background: var(--votacao-gray-200);
190
+ border-radius: 6px;
191
+ overflow: hidden;
192
+ }
193
+
194
+ .sistema-progresso-fill {
195
+ height: 100%;
196
+ background: linear-gradient(90deg, var(--votacao-primary-teal), var(--votacao-secondary-teal));
197
+ border-radius: 6px;
198
+ transition: width 0.5s ease;
199
+ }
200
+
201
+ .sistema-progresso-text {
202
+ margin-top: 0.75rem;
203
+ color: var(--votacao-text-muted);
204
+ font-size: 0.875rem;
205
+ text-align: center;
206
+ margin: 0;
207
+ }
208
+
209
+ .sistema-tabs-container {
210
+ margin-bottom: 3rem;
211
+ background: #EBEFF5;
212
+ border-radius: 20px;
213
+ box-shadow: var(--votacao-shadow-md);
214
+ border: 1px solid #C8D1E0;
215
+ }
216
+
217
+ .sistema-tabs-nav {
218
+ display: flex;
219
+ gap: 0.5rem;
220
+ overflow-x: auto;
221
+ background: var(--votacao-bg-primary);
222
+ padding: 1rem;
223
+ border-radius: 20px 20px 0 0;
224
+ box-shadow: var(--votacao-shadow-sm);
225
+ border: 1px solid var(--votacao-border-light);
226
+ }
227
+
228
+ .sistema-tab-button {
229
+ background: #007D7A;
230
+ color: white;
231
+ border: 1px solid transparent;
232
+ padding: 0.75rem 1.5rem;
233
+ border-radius: 50px;
234
+ cursor: pointer;
235
+ transition: all 0.3s ease;
236
+ white-space: nowrap;
237
+ font-weight: 500;
238
+ font-size: 0.9rem;
239
+ }
240
+
241
+ .sistema-tab-button:hover {
242
+ color: var(--votacao-primary-teal);
243
+ background: var(--votacao-gray-50);
244
+ }
245
+
246
+ .sistema-tab-button.active {
247
+ background: #025257;
248
+ color: white;
249
+ font-weight: 600;
250
+ }
251
+
252
+ .sistema-tab-button i {
253
+ margin-right: 0.5rem;
254
+ }
255
+
256
+ .sistema-tab-content {
257
+ display: none;
258
+ padding: 1rem;
259
+ }
260
+
261
+ .sistema-tab-content.active {
262
+ display: block;
263
+ }
264
+
265
+ .sistema-categoria-header {
266
+ margin-bottom: 2.5rem;
267
+ text-align: center;
268
+ }
269
+
270
+ .sistema-categoria-title {
271
+ font-size: 2rem;
272
+ font-weight: 700;
273
+ margin-bottom: 0.5rem;
274
+ color: #024248;
275
+ }
276
+
277
+ .sistema-categoria-subtitle {
278
+ color: var(--votacao-text-secondary);
279
+ font-size: 1.1rem;
280
+ }
281
+
282
+ .sistema-projetos-grid {
283
+ display: grid;
284
+ grid-template-columns: 1fr 1fr;
285
+ gap: 2rem;
286
+ margin-bottom: 3rem;
287
+ }
288
+
289
+ @media (max-width: 768px) {
290
+ .sistema-projetos-grid {
291
+ grid-template-columns: 1fr;
292
+ }
293
+ }
294
+
295
+ .sistema-projeto-card {
296
+ background: var(--votacao-bg-primary);
297
+ border-radius: 16px;
298
+ overflow: hidden;
299
+ transition: all 0.3s ease;
300
+ border: 1px solid var(--votacao-border-light);
301
+ box-shadow: var(--votacao-shadow-md);
302
+ padding: 16px;
303
+ border-radius: 20px;
304
+ display: grid;
305
+ grid-template-rows: auto 1fr;
306
+ }
307
+
308
+ .sistema-projeto-card:hover {
309
+ box-shadow: var(--votacao-shadow-xl);
310
+ border-color: var(--votacao-primary-teal);
311
+ background: #EBEFF5;
312
+ }
313
+
314
+ .sistema-projeto-video {
315
+ position: relative;
316
+ width: 100%;
317
+ height: 200px;
318
+ background: var(--votacao-gray-100);
319
+ overflow: hidden;
320
+ }
321
+
322
+ .sistema-projeto-video iframe,
323
+ .sistema-projeto-video video {
324
+ width: 100%;
325
+ height: 100%;
326
+ border: none;
327
+ }
328
+
329
+ .sistema-video-placeholder {
330
+ display: flex;
331
+ align-items: center;
332
+ justify-content: center;
333
+ height: 100%;
334
+ color: var(--votacao-text-muted);
335
+ font-size: 3rem;
336
+ background: var(--votacao-gray-100);
337
+ }
338
+
339
+ .sistema-projeto-content {
340
+ padding:10px 0;
341
+ display: flex;
342
+ flex-direction: column;
343
+ justify-content: space-between;
344
+ }
345
+
346
+ .sistema-projeto-title {
347
+ font-size: 1.25rem;
348
+ font-weight: 700;
349
+ margin-bottom: 1.25rem;
350
+ color: #024248;
351
+ line-height: 1.4;
352
+ }
353
+
354
+ .sistema-projeto-equipe {
355
+ display: flex;
356
+ align-items: center;
357
+ gap: 0.75rem;
358
+ margin-bottom: 1.25rem;
359
+ }
360
+
361
+ .sistema-equipe-icon {
362
+ width: 40px;
363
+ height: 40px;
364
+ background: var(--votacao-primary-teal);
365
+ color: white;
366
+ border-radius: 10px;
367
+ display: flex;
368
+ align-items: center;
369
+ justify-content: center;
370
+ font-size: 1rem;
371
+ flex-shrink: 0;
372
+ }
373
+
374
+ .sistema-equipe-icon img {
375
+ width: 100%;
376
+ height: 100%;
377
+ object-fit: cover;
378
+ border-radius: 10px;
379
+ }
380
+
381
+ .sistema-equipe-nome {
382
+ font-weight: 600;
383
+ color: var(--votacao-text-primary);
384
+ font-size: 1rem;
385
+ }
386
+
387
+ .sistema-apresentadores {
388
+ display: flex;
389
+ flex-wrap: wrap;
390
+ gap: 0.5rem;
391
+ margin-bottom: 1.25rem;
392
+ }
393
+
394
+ .sistema-apresentadores label {
395
+ color: var(--votacao-text-secondary);
396
+ font-size: 0.875rem;
397
+ margin-right: 0.5rem;
398
+ font-weight: 500;
399
+ }
400
+
401
+ .sistema-apresentador-badge {
402
+ background: var(--votacao-gray-100);
403
+ color: var(--votacao-text-secondary);
404
+ padding: 0.375rem 0.875rem;
405
+ border-radius: 50px;
406
+ font-size: 0.875rem;
407
+ border: 1px solid var(--votacao-border-light);
408
+ font-weight: 500;
409
+ }
410
+
411
+ .sistema-projeto-descricao {
412
+ color: var(--votacao-text-secondary);
413
+ line-height: 1.6;
414
+ margin-bottom: 1.5rem;
415
+ }
416
+
417
+ .sistema-projeto-contato {
418
+ display: flex;
419
+ align-items: center;
420
+ gap: 0.5rem;
421
+ color: var(--votacao-text-muted);
422
+ font-size: 0.875rem;
423
+ margin-bottom: 2rem;
424
+ }
425
+
426
+ .sistema-btn-votar {
427
+ width: 100%;
428
+ background: #007D7A;
429
+ color: white;
430
+ border: none;
431
+ padding: 1rem 1.5rem;
432
+ border-radius: 50px;
433
+ font-weight: 600;
434
+ font-size: 1rem;
435
+ cursor: pointer;
436
+ transition: all 0.3s ease;
437
+ text-transform: none;
438
+ }
439
+
440
+ .sistema-btn-votar:hover:not(:disabled) {
441
+ background: #006969;
442
+ transform: translateY(-1px);
443
+ box-shadow: var(--votacao-shadow-md);
444
+ }
445
+
446
+ .sistema-btn-votar:disabled {
447
+ background: var(--votacao-gray-300);
448
+ color: var(--votacao-gray-500);
449
+ cursor: not-allowed;
450
+ transform: none;
451
+ }
452
+
453
+ .sistema-btn-votar.votado {
454
+ background: var(--votacao-success-green);
455
+ color: white;
456
+ }
457
+
458
+ .sistema-btn-votar.votado:hover {
459
+ background: var(--votacao-success-green);
460
+ }
461
+
462
+ .sistema-votos-counter {
463
+ display: flex;
464
+ align-items: center;
465
+ justify-content: center;
466
+ gap: 0.5rem;
467
+ margin-top: 1rem;
468
+ color: var(--votacao-text-muted);
469
+ font-size: 0.875rem;
470
+ }
471
+
472
+ .sistema-votos-counter i {
473
+ color: var(--votacao-error-red);
474
+ }
475
+
476
+ .sistema-loading {
477
+ opacity: 0.7;
478
+ pointer-events: none;
479
+ }
480
+
481
+ .sistema-btn-votar.loading::after {
482
+ content: '';
483
+ width: 16px;
484
+ height: 16px;
485
+ border: 2px solid transparent;
486
+ border-top: 2px solid currentColor;
487
+ border-radius: 50%;
488
+ animation: sistema-spin 1s linear infinite;
489
+ margin-left: 0.75rem;
490
+ }
491
+
492
+ @keyframes sistema-spin {
493
+ to { transform: rotate(360deg); }
494
+ }
495
+
496
+ .sistema-btn-finalizar {
497
+ bottom: 2rem;
498
+ right: 2rem;
499
+ background: var(--votacao-bg-primary);
500
+ color: var(--votacao-text-secondary);
501
+ border: 1px solid var(--votacao-border-medium);
502
+ padding: 0.875rem 1.25rem;
503
+ border-radius: 50px;
504
+ font-weight: 500;
505
+ cursor: pointer;
506
+ transition: all 0.3s ease;
507
+ box-shadow: var(--votacao-shadow-lg);
508
+ z-index: 500;
509
+ font-size: 0.875rem;
510
+ }
511
+
512
+ .sistema-btn-finalizar:hover {
513
+ background: var(--votacao-gray-50);
514
+ border-color: var(--votacao-primary-teal);
515
+ color: var(--votacao-primary-teal);
516
+ transform: translateY(-2px);
517
+ box-shadow: var(--votacao-shadow-xl);
518
+ }
519
+
520
+ .sistema-btn-finalizar i {
521
+ margin-right: 0.5rem;
522
+ }
523
+
524
+ .sistema-modal-overlay {
525
+ position: fixed;
526
+ top: 0;
527
+ left: 0;
528
+ width: 100%;
529
+ height: 100%;
530
+ background: rgba(0, 0, 0, 0.5);
531
+ display: none;
532
+ justify-content: center;
533
+ align-items: center;
534
+ z-index: 1000;
535
+ backdrop-filter: blur(4px);
536
+ }
537
+
538
+ .sistema-modal-overlay.show {
539
+ display: flex;
540
+ }
541
+
542
+ .sistema-modal-content {
543
+ background: var(--votacao-bg-primary);
544
+ border-radius: 20px;
545
+ padding: 2.5rem;
546
+ width: 90%;
547
+ color: var(--votacao-text-primary);
548
+ border: 1px solid var(--votacao-border-light);
549
+ box-shadow: var(--votacao-shadow-xl);
550
+ max-height: 80vh;
551
+ overflow-y: auto;
552
+ }
553
+
554
+ .sistema-modal-header {
555
+ text-align: center;
556
+ margin-bottom: 2rem;
557
+ }
558
+
559
+ .sistema-modal-title {
560
+ font-size: 1.5rem;
561
+ font-weight: 700;
562
+ margin-bottom: 0.75rem;
563
+ color: var(--votacao-primary-blue);
564
+ }
565
+
566
+ .sistema-modal-subtitle {
567
+ color: var(--votacao-text-secondary);
568
+ font-size: 1rem;
569
+ }
570
+
571
+ .sistema-modal-actions {
572
+ display: flex;
573
+ gap: 1rem;
574
+ margin-top: 2rem;
575
+ }
576
+
577
+ .sistema-btn-continuar {
578
+ flex: 1;
579
+ background: var(--votacao-primary-teal);
580
+ color: white;
581
+ border: none;
582
+ padding: 1rem 1.5rem;
583
+ border-radius: 50px;
584
+ font-weight: 600;
585
+ cursor: pointer;
586
+ transition: all 0.3s ease;
587
+ font-size: 1rem;
588
+ }
589
+
590
+ .sistema-btn-continuar:hover {
591
+ background: var(--votacao-accent-teal);
592
+ transform: translateY(-1px);
593
+ }
594
+
595
+ .sistema-btn-parar {
596
+ flex: 1;
597
+ background: transparent;
598
+ color: var(--votacao-primary-teal);
599
+ border: 1px solid var(--votacao-primary-teal);
600
+ padding: 1rem 1.5rem;
601
+ border-radius: 50px;
602
+ font-weight: 600;
603
+ cursor: pointer;
604
+ transition: all 0.3s ease;
605
+ font-size: 1rem;
606
+ }
607
+
608
+ .sistema-btn-parar:hover {
609
+ background: var(--votacao-gray-50);
610
+ }
611
+
612
+ .sistema-proxima-categoria-preview {
613
+ background: var(--votacao-bg-accent);
614
+ border-radius: 12px;
615
+ padding: 1.5rem;
616
+ margin: 1.5rem 0;
617
+ border: 1px solid var(--votacao-border-light);
618
+ }
619
+
620
+ .sistema-preview-header {
621
+ display: flex;
622
+ align-items: center;
623
+ gap: 0.75rem;
624
+ margin-bottom: 1rem;
625
+ }
626
+
627
+ .sistema-preview-icon {
628
+ background: var(--votacao-primary-teal);
629
+ color: white;
630
+ width: 40px;
631
+ height: 40px;
632
+ border-radius: 10px;
633
+ display: flex;
634
+ align-items: center;
635
+ justify-content: center;
636
+ font-size: 1.125rem;
637
+ }
638
+
639
+ .sistema-preview-title {
640
+ font-weight: 700;
641
+ font-size: 1.125rem;
642
+ margin: 0;
643
+ color: var(--votacao-text-primary);
644
+ }
645
+
646
+ .sistema-preview-projetos {
647
+ display: grid;
648
+ gap: 0.75rem;
649
+ max-height: 300px;
650
+ overflow-y: auto;
651
+ }
652
+
653
+ .sistema-preview-projeto {
654
+ background: var(--votacao-bg-primary);
655
+ padding: 1rem;
656
+ border-radius: 8px;
657
+ border: 1px solid var(--votacao-border-light);
658
+ }
659
+
660
+ .sistema-preview-projeto-titulo {
661
+ font-weight: 600;
662
+ font-size: 0.9rem;
663
+ margin-bottom: 0.25rem;
664
+ color: var(--votacao-text-primary);
665
+ }
666
+
667
+ .sistema-preview-projeto-equipe {
668
+ font-size: 0.8rem;
669
+ color: var(--votacao-text-secondary);
670
+ }
671
+
672
+ .sistema-modal-conclusao {
673
+ position: fixed;
674
+ top: 0;
675
+ left: 0;
676
+ width: 100%;
677
+ height: 100%;
678
+ background: rgba(0, 0, 0, 0.6);
679
+ display: none;
680
+ justify-content: center;
681
+ align-items: center;
682
+ z-index: 1100;
683
+ backdrop-filter: blur(6px);
684
+ }
685
+
686
+ .sistema-modal-conclusao.show {
687
+ display: flex;
688
+ }
689
+
690
+ .sistema-modal-conclusao-content {
691
+ background: var(--votacao-bg-primary);
692
+ border-radius: 24px;
693
+ padding: 3rem 2rem;
694
+ max-width: 450px;
695
+ width: 90%;
696
+ color: var(--votacao-text-primary);
697
+ text-align: center;
698
+ border: 1px solid var(--votacao-border-light);
699
+ box-shadow: var(--votacao-shadow-xl);
700
+ position: relative;
701
+ overflow: hidden;
702
+ }
703
+
704
+ .sistema-modal-conclusao-content::before {
705
+ content: '';
706
+ position: absolute;
707
+ top: 0;
708
+ left: 0;
709
+ right: 0;
710
+ height: 4px;
711
+ background: linear-gradient(90deg, var(--votacao-primary-teal), var(--votacao-secondary-teal));
712
+ }
713
+
714
+ .sistema-conclusao-icon {
715
+ background: var(--votacao-success-green);
716
+ color: white;
717
+ width: 80px;
718
+ height: 80px;
719
+ border-radius: 50%;
720
+ display: inline-flex;
721
+ align-items: center;
722
+ justify-content: center;
723
+ font-size: 2.5rem;
724
+ margin-bottom: 1.5rem;
725
+ animation: sistema-celebracao 0.6s ease-out;
726
+ }
727
+
728
+ @keyframes sistema-celebracao {
729
+ 0% { transform: scale(0.8) rotate(-10deg); opacity: 0; }
730
+ 50% { transform: scale(1.1) rotate(5deg); }
731
+ 100% { transform: scale(1) rotate(0deg); opacity: 1; }
732
+ }
733
+
734
+ .sistema-conclusao-title {
735
+ font-size: 1.75rem;
736
+ font-weight: 700;
737
+ margin-bottom: 1rem;
738
+ color: var(--votacao-primary-blue);
739
+ }
740
+
741
+ .sistema-conclusao-subtitle {
742
+ color: var(--votacao-text-secondary);
743
+ font-size: 1.1rem;
744
+ margin-bottom: 2rem;
745
+ line-height: 1.5;
746
+ }
747
+
748
+ .sistema-conclusao-stats {
749
+ background: var(--votacao-bg-accent);
750
+ border-radius: 12px;
751
+ padding: 1.5rem;
752
+ margin: 2rem 0;
753
+ border: 1px solid var(--votacao-border-light);
754
+ }
755
+
756
+ .sistema-conclusao-stats-title {
757
+ font-weight: 600;
758
+ margin-bottom: 1rem;
759
+ color: var(--votacao-text-primary);
760
+ }
761
+
762
+ .sistema-stats-grid {
763
+ display: grid;
764
+ grid-template-columns: 1fr 1fr;
765
+ gap: 1rem;
766
+ }
767
+
768
+ .sistema-stat-item {
769
+ text-align: center;
770
+ }
771
+
772
+ .sistema-stat-number {
773
+ font-size: 1.5rem;
774
+ font-weight: 700;
775
+ color: var(--votacao-primary-teal);
776
+ display: block;
777
+ }
778
+
779
+ .sistema-stat-label {
780
+ font-size: 0.875rem;
781
+ color: var(--votacao-text-secondary);
782
+ }
783
+
784
+ .sistema-conclusao-actions {
785
+ display: flex;
786
+ gap: 1rem;
787
+ margin-top: 2rem;
788
+ }
789
+
790
+ .sistema-btn-votar-novamente {
791
+ flex: 1;
792
+ background: var(--votacao-primary-teal);
793
+ color: white;
794
+ border: none;
795
+ padding: 1rem 1.5rem;
796
+ border-radius: 50px;
797
+ font-weight: 600;
798
+ cursor: pointer;
799
+ transition: all 0.3s ease;
800
+ font-size: 1rem;
801
+ }
802
+
803
+ .sistema-btn-votar-novamente:hover {
804
+ background: var(--votacao-accent-teal);
805
+ transform: translateY(-1px);
806
+ }
807
+
808
+ .sistema-btn-encerrar-definitivo {
809
+ flex: 1;
810
+ background: transparent;
811
+ color: var(--votacao-text-secondary);
812
+ border: 1px solid var(--votacao-border-medium);
813
+ padding: 1rem 1.5rem;
814
+ border-radius: 50px;
815
+ font-weight: 600;
816
+ cursor: pointer;
817
+ transition: all 0.3s ease;
818
+ font-size: 1rem;
819
+ }
820
+
821
+ .sistema-btn-encerrar-definitivo:hover {
822
+ background: var(--votacao-gray-50);
823
+ border-color: var(--votacao-gray-400);
824
+ }
825
+
826
+ .sistema-feedback-message {
827
+ position: fixed;
828
+ top: 2rem;
829
+ right: 2rem;
830
+ background: var(--votacao-success-green);
831
+ color: white;
832
+ padding: 1rem 1.5rem;
833
+ border-radius: 12px;
834
+ font-weight: 600;
835
+ transform: translateX(400px);
836
+ transition: transform 0.3s ease;
837
+ z-index: 1200;
838
+ box-shadow: var(--votacao-shadow-lg);
839
+ }
840
+
841
+ .sistema-feedback-message.show {
842
+ transform: translateX(0);
843
+ }
844
+
845
+ .sistema-feedback-message.error {
846
+ background: var(--votacao-error-red);
847
+ }
848
+
849
+ .sistema-empty-state {
850
+ text-align: center;
851
+ padding: 4rem 2rem;
852
+ color: var(--votacao-text-muted);
853
+ background: var(--votacao-bg-primary);
854
+ border-radius: 12px;
855
+ border: 1px solid var(--votacao-border-light);
856
+ }
857
+
858
+ .sistema-empty-state i {
859
+ font-size: 3rem;
860
+ margin-bottom: 1rem;
861
+ display: block;
862
+ color: var(--votacao-gray-400);
863
+ }
864
+
865
+ .sistema-empty-state h3 {
866
+ margin-bottom: 0.5rem;
867
+ color: var(--votacao-text-secondary);
868
+ }
869
+
870
+ @media (max-width: 768px) {
871
+ .sistema-votacao-container {
872
+ padding: 1rem;
873
+ }
874
+
875
+ .sistema-votacao-title {
876
+ font-size: 2rem;
877
+ }
878
+
879
+ .sistema-tabs-nav {
880
+ gap: 0.25rem;
881
+ padding: 0.75rem;
882
+ }
883
+
884
+ .sistema-tab-button {
885
+ padding: 0.5rem 1rem;
886
+ font-size: 0.875rem;
887
+ }
888
+
889
+ .sistema-projetos-grid {
890
+ grid-template-columns: 1fr;
891
+ gap: 1.5rem;
892
+ }
893
+
894
+ .sistema-projeto-content {
895
+ padding: 1.5rem;
896
+ }
897
+
898
+ .sistema-modal-content,
899
+ .sistema-modal-conclusao-content {
900
+ padding: 2rem 1.5rem;
901
+ margin: 1rem;
902
+ }
903
+
904
+ .sistema-conclusao-actions,
905
+ .sistema-modal-actions {
906
+ flex-direction: column;
907
+ }
908
+
909
+ .sistema-stats-grid {
910
+ grid-template-columns: 1fr;
911
+ gap: 0.5rem;
912
+ }
913
+
914
+ .sistema-btn-finalizar {
915
+ font-size: 0.8rem;
916
+ padding: 0.75rem 1rem;
917
+ }
918
+ }
919
+
920
+ .sistema-votacao-encerrada {
921
+ opacity: 0.7;
922
+ }
923
+
924
+ .sistema-votacao-encerrada .sistema-btn-votar {
925
+ background: var(--votacao-gray-300);
926
+ color: var(--votacao-gray-500);
927
+ cursor: not-allowed;
928
+ }
929
+
930
+ .sistema-tab-button:focus,
931
+ .sistema-btn-votar:focus,
932
+ .sistema-btn-continuar:focus,
933
+ .sistema-btn-parar:focus,
934
+ .sistema-btn-finalizar:focus {
935
+ outline: 2px solid var(--votacao-primary-teal);
936
+ outline-offset: 2px;
937
+ }
938
+ </style>
939
+ {% endblock %}
940
+
941
+ {% block content %}
942
+ <div class="sistema-votacao-wrapper">
943
+ <div class="sistema-votacao-container">
944
+ <!-- Header -->
945
+ <div class="sistema-votacao-header{% if page.imagem_fundo %} has-background{% endif %}"
946
+ {% if page.imagem_fundo %}
947
+ {% for block in page.imagem_fundo %}
948
+ style="background-image: url('{{ block.value.file.url }}');"
949
+ {% endfor %}
950
+ {% endif %}>
951
+ <div class="votacao-content">
952
+ <div class="sistema-votacao-icon">
953
+ <i class="fas fa-vote-yea"></i>
954
+ </div>
955
+ <h1 class="sistema-votacao-title">{{ page.title }}</h1>
956
+ <p class="sistema-votacao-subtitle">{{ page.subtitulo }}</p>
957
+
958
+ {% if page.descricao_header %}
959
+ <div class="sistema-votacao-descricao">
960
+ {{ page.descricao_header|richtext }}
961
+ </div>
962
+ {% endif %}
963
+ </div>
964
+ </div>
965
+
966
+ <!-- Progresso da Votação -->
967
+ {% if page.mostrar_progresso and categorias %}
968
+ <div class="sistema-progresso-section">
969
+ <div class="sistema-progresso-header">
970
+ <h2 class="sistema-progresso-title">Progresso da Votação</h2>
971
+ <span class="sistema-progresso-status" id="progresso-status">0 de {{ total_categorias }} categorias</span>
972
+ </div>
973
+
974
+ <!-- Botão Finalizar Votação -->
975
+ <button class="sistema-btn-finalizar" onclick="SistemaVotacao.finalizarVotacao()">
976
+ <i class="fas fa-check-circle"></i>
977
+ <span>Finalizar Votação</span>
978
+ </button>
979
+ </div>
980
+ {% endif %}
981
+
982
+ <!-- Tabs das Categorias -->
983
+ {% if categorias %}
984
+ <div class="sistema-tabs-container">
985
+ <div class="sistema-tabs-nav">
986
+ {% for categoria in categorias %}
987
+ <button class="sistema-tab-button {% if forloop.first %}active{% endif %}"
988
+ data-tab-target="categoria-{{ categoria.id }}"
989
+ data-categoria-id="{{ categoria.id }}">
990
+ {% if categoria.icone %}
991
+ <i class="fas {{ categoria.icone }}"></i>
992
+ {% endif %}
993
+ {{ categoria.nome }}
994
+ </button>
995
+ {% endfor %}
996
+ </div>
997
+
998
+ <!-- Conteúdo das Tabs -->
999
+ {% for categoria in categorias %}
1000
+ <div class="sistema-tab-content {% if forloop.first %}active{% endif %}"
1001
+ id="categoria-{{ categoria.id }}"
1002
+ data-categoria-id="{{ categoria.id }}">
1003
+
1004
+ <div class="sistema-categoria-header">
1005
+ <h2 class="sistema-categoria-title">{{ categoria.nome }}</h2>
1006
+ <p class="sistema-categoria-subtitle">Selecione o melhor projeto desta categoria</p>
1007
+ </div>
1008
+
1009
+ <!-- Grid de Projetos -->
1010
+ <div class="sistema-projetos-grid">
1011
+ {% for projeto in categoria.projetos.all %}
1012
+ {% if projeto.ativo %}
1013
+ <div class="sistema-projeto-card" data-projeto-id="{{ projeto.id }}">
1014
+
1015
+ <!-- Vídeo -->
1016
+ <div class="sistema-projeto-video">
1017
+ {% if projeto.video_embed_url %}
1018
+ <iframe src="{{ projeto.video_embed_url }}"
1019
+ allowfullscreen></iframe>
1020
+ {% elif projeto.video_arquivo %}
1021
+ <video controls>
1022
+ <source src="{{ projeto.video_arquivo.url }}" type="video/mp4">
1023
+ </video>
1024
+ {% else %}
1025
+ <div class="sistema-video-placeholder">
1026
+ <i class="fas fa-play-circle"></i>
1027
+ </div>
1028
+ {% endif %}
1029
+ </div>
1030
+
1031
+ <!-- Conteúdo -->
1032
+ <div class="sistema-projeto-content">
1033
+ <div>
1034
+ <h3 class="sistema-projeto-title">{{ projeto.titulo }}</h3>
1035
+
1036
+ <!-- Equipe -->
1037
+ <div class="sistema-projeto-equipe">
1038
+ <div class="sistema-equipe-icon">
1039
+ {% if projeto.icone_equipe %}
1040
+ <img src="{{ projeto.icone_equipe.url }}" alt="{{ projeto.nome_equipe }}">
1041
+ {% else %}
1042
+ <i class="fas fa-users"></i>
1043
+ {% endif %}
1044
+ </div>
1045
+ <span class="sistema-equipe-nome">{{ projeto.nome_equipe }}</span>
1046
+ </div>
1047
+
1048
+ <!-- Apresentadores -->
1049
+ {% if projeto.apresentadores.all %}
1050
+ <div class="sistema-apresentadores">
1051
+ <label>Apresentadores:</label>
1052
+ {% for apresentador in projeto.apresentadores.all %}
1053
+ <span class="sistema-apresentador-badge">{{ apresentador.nome }}</span>
1054
+ {% endfor %}
1055
+ </div>
1056
+ {% endif %}
1057
+
1058
+ <!-- Descrição -->
1059
+ <div class="sistema-projeto-descricao">
1060
+ {{ projeto.descricao|richtext }}
1061
+ </div>
1062
+
1063
+ <!-- Contato -->
1064
+ {% if projeto.email_contato %}
1065
+ <div class="sistema-projeto-contato">
1066
+ <i class="fas fa-envelope"></i>
1067
+ <span>{{ projeto.email_contato }}</span>
1068
+ </div>
1069
+ {% endif %}
1070
+ </div>
1071
+
1072
+ <!-- Botão Votar -->
1073
+ <button class="sistema-btn-votar"
1074
+ data-projeto-id="{{ projeto.id }}"
1075
+ data-categoria-id="{{ categoria.id }}"
1076
+ onclick="SistemaVotacao.votar({{ projeto.id }}, {{ categoria.id }}, this)">
1077
+ Votar neste Projeto
1078
+ </button>
1079
+
1080
+ </div>
1081
+ </div>
1082
+ {% endif %}
1083
+ {% empty %}
1084
+ <div class="sistema-empty-state" style="grid-column: 1 / -1;">
1085
+ <i class="fas fa-inbox"></i>
1086
+ <h3>Nenhum projeto cadastrado</h3>
1087
+ <p>Ainda não há projetos cadastrados nesta categoria.</p>
1088
+ </div>
1089
+ {% endfor %}
1090
+ </div>
1091
+ </div>
1092
+ {% endfor %}
1093
+ </div>
1094
+ {% else %}
1095
+ <div class="sistema-empty-state">
1096
+ <i class="fas fa-cog"></i>
1097
+ <h3>Sistema em Configuração</h3>
1098
+ <p>As categorias e projetos ainda não foram configurados.</p>
1099
+ </div>
1100
+ {% endif %}
1101
+ </div>
1102
+ </div>
1103
+
1104
+ <!-- Modal de Conclusão -->
1105
+ <div id="modal-conclusao" class="sistema-modal-conclusao">
1106
+ <div class="sistema-modal-conclusao-content">
1107
+ <div class="sistema-conclusao-icon">
1108
+ <i class="fas fa-trophy"></i>
1109
+ </div>
1110
+ <h3 class="sistema-conclusao-title">Parabéns!</h3>
1111
+ <p class="sistema-conclusao-subtitle">Você votou em todas as categorias disponíveis!</p>
1112
+
1113
+ <div class="sistema-conclusao-stats">
1114
+ <div class="sistema-conclusao-stats-title">Sua Participação</div>
1115
+ <div class="sistema-stats-grid">
1116
+ <div class="sistema-stat-item">
1117
+ <span class="sistema-stat-number" id="total-categorias-votadas">{{ total_categorias }}</span>
1118
+ <span class="sistema-stat-label">Categorias</span>
1119
+ </div>
1120
+ <div class="sistema-stat-item">
1121
+ <span class="sistema-stat-number" id="total-projetos-visualizados">-</span>
1122
+ <span class="sistema-stat-label">Projetos</span>
1123
+ </div>
1124
+ </div>
1125
+ </div>
1126
+
1127
+ <div class="sistema-conclusao-actions">
1128
+ <button class="sistema-btn-votar-novamente" onclick="SistemaVotacao.reiniciarVotacao()">
1129
+ <i class="fas fa-redo"></i>
1130
+ Votar Novamente
1131
+ </button>
1132
+ <button class="sistema-btn-encerrar-definitivo" onclick="SistemaVotacao.encerrarDefinitivo()">
1133
+ <i class="fas fa-check"></i>
1134
+ Encerrar
1135
+ </button>
1136
+ </div>
1137
+ </div>
1138
+ </div>
1139
+
1140
+ <!-- Modal de Escolha Pós-Voto -->
1141
+ <div id="modal-pos-voto" class="sistema-modal-overlay">
1142
+ <div class="sistema-modal-content">
1143
+ <div class="sistema-modal-header">
1144
+ <h3 class="sistema-modal-title">Voto registrado com sucesso!</h3>
1145
+ </div>
1146
+
1147
+ <!-- Progresso da Votação no Modal -->
1148
+ {% if page.mostrar_progresso and categorias %}
1149
+ <div class="sistema-progresso-section" style="position: static; margin: 1.5rem 0; padding: 1.5rem; right: auto; bottom: auto;">
1150
+ <div class="sistema-progresso-header">
1151
+ <h2 class="sistema-progresso-title">Progresso da Votação</h2>
1152
+ <span class="sistema-progresso-status" id="progresso-status-modal">0 de {{ total_categorias }} categorias</span>
1153
+ </div>
1154
+ <div class="sistema-progresso-bar">
1155
+ <div class="sistema-progresso-fill" id="progresso-fill-modal" style="width: 0%"></div>
1156
+ </div>
1157
+ <p class="sistema-progresso-text" id="progresso-text-modal">0% concluído</p>
1158
+ </div>
1159
+ {% endif %}
1160
+
1161
+ <div id="preview-proxima-categoria" class="sistema-proxima-categoria-preview">
1162
+ <!-- Conteúdo será preenchido dinamicamente -->
1163
+ </div>
1164
+
1165
+ <div class="sistema-modal-actions">
1166
+ <button class="sistema-btn-continuar" onclick="SistemaVotacao.continuarVotacao()">
1167
+ <i class="fas fa-arrow-right"></i>
1168
+ Continuar Votando
1169
+ </button>
1170
+ <button class="sistema-btn-finalizar" onclick="SistemaVotacao.finalizarVotacao()">
1171
+ <i class="fas fa-check-circle"></i>
1172
+ <span>Finalizar Votação</span>
1173
+ </button>
1174
+ </div>
1175
+ </div>
1176
+ </div>
1177
+
1178
+ <!-- Mensagem de Feedback -->
1179
+ <div id="feedback-message" class="sistema-feedback-message"></div>
1180
+ {% endblock %}
1181
+
1182
+ {% block footer %}
1183
+ {% include "enap_designsystem/includes/footer.html" %}
1184
+ {% endblock %}
1185
+
1186
+ {% block scriptjs %}
1187
+ <!-- CSRF Token -->
1188
+ <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">
1189
+
1190
+ <script>
1191
+ // Sistema de Votação - Versão Corrigida e Otimizada
1192
+ const SistemaVotacao = {
1193
+ // Estado da aplicação
1194
+ votosCategoria: new Set(),
1195
+ categoriasOrdem: [],
1196
+ proximaCategoriaData: null,
1197
+ elementos: {},
1198
+ configuracao: {
1199
+ votacaoAtiva: {% if votacao_ativa %}true{% else %}false{% endif %},
1200
+ totalCategorias: {{ total_categorias|default:0 }},
1201
+ permitirMultiplosVotos: {% if page.permitir_multiplos_votos %}true{% else %}false{% endif %}
1202
+ },
1203
+
1204
+ // Inicialização
1205
+ init() {
1206
+ console.log('🚀 Inicializando Sistema de Votação...');
1207
+
1208
+ // Cache dos elementos DOM
1209
+ this.cacheElementos();
1210
+
1211
+ // Configurar tabs
1212
+ this.configurarTabs();
1213
+
1214
+ // Configurar categorias
1215
+ this.configurarCategorias();
1216
+
1217
+ // Configurar eventos dos modais
1218
+ this.configurarModais();
1219
+
1220
+ // Configurar CSRF
1221
+ this.configurarCSRF();
1222
+
1223
+ console.log('✅ Sistema inicializado com sucesso');
1224
+ console.log('📊 Configuração:', this.configuracao);
1225
+ console.log('🏷️ Categorias encontradas:', this.categoriasOrdem.length);
1226
+ },
1227
+
1228
+ // Cache de elementos DOM
1229
+ cacheElementos() {
1230
+ this.elementos = {
1231
+ tabButtons: document.querySelectorAll('.sistema-tab-button'),
1232
+ tabContents: document.querySelectorAll('.sistema-tab-content'),
1233
+ progressoFill: document.getElementById('progresso-fill'),
1234
+ progressoStatus: document.getElementById('progresso-status'),
1235
+ progressoText: document.querySelector('.sistema-progresso-text'),
1236
+ // Elementos do progresso no modal
1237
+ progressoFillModal: document.getElementById('progresso-fill-modal'),
1238
+ progressoStatusModal: document.getElementById('progresso-status-modal'),
1239
+ progressoTextModal: document.getElementById('progresso-text-modal'),
1240
+ modalPosVoto: document.getElementById('modal-pos-voto'),
1241
+ modalConclusao: document.getElementById('modal-conclusao'),
1242
+ previewProxima: document.getElementById('preview-proxima-categoria'),
1243
+ feedbackMessage: document.getElementById('feedback-message')
1244
+ };
1245
+ },
1246
+
1247
+ // Configurar sistema de tabs
1248
+ configurarTabs() {
1249
+ console.log('🎯 Configurando tabs...');
1250
+
1251
+ this.elementos.tabButtons.forEach((button, index) => {
1252
+ const targetId = button.getAttribute('data-tab-target');
1253
+ const categoriaId = button.getAttribute('data-categoria-id');
1254
+
1255
+ console.log(`Tab ${index}: ${targetId} (categoria: ${categoriaId})`);
1256
+
1257
+ // Adicionar event listener
1258
+ button.addEventListener('click', (e) => {
1259
+ e.preventDefault();
1260
+ this.trocarTab(targetId, button);
1261
+ });
1262
+ });
1263
+ },
1264
+
1265
+ // Trocar tab ativa
1266
+ trocarTab(targetId, clickedButton) {
1267
+ console.log('🔄 Trocando tab para:', targetId);
1268
+
1269
+ const targetContent = document.getElementById(targetId);
1270
+
1271
+ if (!targetContent) {
1272
+ console.error('❌ Conteúdo não encontrado:', targetId);
1273
+ return;
1274
+ }
1275
+
1276
+ // Remover active de todos
1277
+ this.elementos.tabButtons.forEach(btn => btn.classList.remove('active'));
1278
+ this.elementos.tabContents.forEach(content => content.classList.remove('active'));
1279
+
1280
+ // Ativar clicado
1281
+ clickedButton.classList.add('active');
1282
+ targetContent.classList.add('active');
1283
+
1284
+ // Scroll suave
1285
+ setTimeout(() => {
1286
+ const header = targetContent.querySelector('.sistema-categoria-header');
1287
+ if (header) {
1288
+ header.scrollIntoView({ behavior: 'smooth', block: 'start' });
1289
+ }
1290
+ }, 100);
1291
+ },
1292
+
1293
+ // Configurar categorias
1294
+ configurarCategorias() {
1295
+ this.elementos.tabButtons.forEach(button => {
1296
+ const categoriaId = parseInt(button.getAttribute('data-categoria-id'));
1297
+ const iconElement = button.querySelector('i');
1298
+
1299
+ this.categoriasOrdem.push({
1300
+ id: categoriaId,
1301
+ nome: button.textContent.trim(),
1302
+ icone: iconElement ? iconElement.className : 'fas fa-folder'
1303
+ });
1304
+ });
1305
+
1306
+ console.log('🏷️ Categorias configuradas:', this.categoriasOrdem);
1307
+ },
1308
+
1309
+ // Configurar modais
1310
+ configurarModais() {
1311
+ // Fechar modal ao clicar fora
1312
+ if (this.elementos.modalPosVoto) {
1313
+ this.elementos.modalPosVoto.addEventListener('click', (e) => {
1314
+ if (e.target === this.elementos.modalPosVoto) {
1315
+ this.pararVotacao();
1316
+ }
1317
+ });
1318
+ }
1319
+
1320
+ if (this.elementos.modalConclusao) {
1321
+ this.elementos.modalConclusao.addEventListener('click', (e) => {
1322
+ if (e.target === this.elementos.modalConclusao) {
1323
+ this.encerrarDefinitivo();
1324
+ }
1325
+ });
1326
+ }
1327
+ },
1328
+
1329
+ // Configurar CSRF Token
1330
+ configurarCSRF() {
1331
+ const csrfToken = document.querySelector('[name=csrfmiddlewaretoken]');
1332
+ if (!csrfToken) {
1333
+ console.warn('⚠️ CSRF token não encontrado, criando...');
1334
+ const token = document.createElement('input');
1335
+ token.type = 'hidden';
1336
+ token.name = 'csrfmiddlewaretoken';
1337
+ token.value = '{{ csrf_token }}';
1338
+ document.body.appendChild(token);
1339
+ }
1340
+ },
1341
+
1342
+ // Função principal de votação
1343
+ async votar(projetoId, categoriaId, button) {
1344
+ console.log('🗳️ Votando...', { projetoId, categoriaId });
1345
+
1346
+ if (!this.configuracao.votacaoAtiva) {
1347
+ this.showFeedback('Votação não está ativa no momento.', 'error');
1348
+ return;
1349
+ }
1350
+
1351
+ // Estado de loading
1352
+ this.setLoadingState(button, true);
1353
+
1354
+ try {
1355
+ const response = await fetch('{% url "votar_projeto" %}', {
1356
+ method: 'POST',
1357
+ headers: {
1358
+ 'Content-Type': 'application/json',
1359
+ 'X-CSRFToken': this.getCsrfToken()
1360
+ },
1361
+ body: JSON.stringify({
1362
+ projeto_id: projetoId,
1363
+ categoria_id: categoriaId
1364
+ })
1365
+ });
1366
+
1367
+ const data = await response.json();
1368
+
1369
+ if (data.success) {
1370
+ this.processarVotoSucesso(projetoId, categoriaId, button, data);
1371
+ } else {
1372
+ throw new Error(data.message || 'Erro ao registrar voto');
1373
+ }
1374
+
1375
+ } catch (error) {
1376
+ console.error('❌ Erro ao votar:', error);
1377
+ this.showFeedback(error.message || 'Erro ao registrar voto. Tente novamente.', 'error');
1378
+ this.setLoadingState(button, false);
1379
+ }
1380
+ },
1381
+
1382
+ // Processar voto bem-sucedido
1383
+ processarVotoSucesso(projetoId, categoriaId, button, data) {
1384
+ console.log('✅ Voto registrado com sucesso');
1385
+
1386
+ // Atualizar contador se existir
1387
+ const contador = document.getElementById(`votos-${projetoId}`);
1388
+ if (contador) {
1389
+ contador.textContent = data.total_votos || 0;
1390
+ }
1391
+
1392
+ // Marcar como votado
1393
+ button.classList.add('votado');
1394
+ button.textContent = 'Obrigado pelo seu voto!';
1395
+
1396
+ // Adicionar categoria aos votados
1397
+ this.votosCategoria.add(categoriaId);
1398
+ this.atualizarProgresso();
1399
+
1400
+ // Desabilitar outros botões se necessário
1401
+ if (!this.configuracao.permitirMultiplosVotos) {
1402
+ this.desabilitarOutrosBotoes(categoriaId, button);
1403
+ }
1404
+
1405
+ // Mostrar próximo passo após delay
1406
+ setTimeout(() => {
1407
+ this.mostrarModalPosVoto(categoriaId);
1408
+ }, 1500);
1409
+ },
1410
+
1411
+ // Desabilitar outros botões da categoria
1412
+ desabilitarOutrosBotoes(categoriaId, buttonAtivo) {
1413
+ const categoryButtons = document.querySelectorAll(`[data-categoria-id="${categoriaId}"] .sistema-btn-votar`);
1414
+ categoryButtons.forEach(btn => {
1415
+ if (btn !== buttonAtivo) {
1416
+ btn.disabled = true;
1417
+ btn.textContent = 'Você já votou nesta categoria';
1418
+ }
1419
+ });
1420
+ },
1421
+
1422
+ // Estado de loading do botão
1423
+ setLoadingState(button, loading) {
1424
+ if (loading) {
1425
+ button.classList.add('loading');
1426
+ button.disabled = true;
1427
+ button.textContent = 'Votando...';
1428
+ } else {
1429
+ button.classList.remove('loading');
1430
+ button.disabled = false;
1431
+ button.textContent = 'Votar neste Projeto';
1432
+ }
1433
+ },
1434
+
1435
+ // Mostrar modal pós-voto
1436
+ mostrarModalPosVoto(categoriaAtualId) {
1437
+ const indiceAtual = this.categoriasOrdem.findIndex(cat => cat.id === parseInt(categoriaAtualId));
1438
+ const proximoIndice = indiceAtual + 1;
1439
+
1440
+ if (proximoIndice < this.categoriasOrdem.length) {
1441
+ this.proximaCategoriaData = this.categoriasOrdem[proximoIndice];
1442
+ this.gerarPreviewProximaCategoria(this.proximaCategoriaData.id);
1443
+ this.elementos.modalPosVoto.classList.add('show');
1444
+ } else {
1445
+ this.mostrarModalConclusao();
1446
+ }
1447
+ },
1448
+
1449
+ // Gerar preview da próxima categoria - VERSÃO SEM LIMITE
1450
+ gerarPreviewProximaCategoria(proximaCategoriaId) {
1451
+ const proximaCategoria = document.getElementById(`categoria-${proximaCategoriaId}`);
1452
+ const projetos = proximaCategoria ? proximaCategoria.querySelectorAll('.sistema-projeto-card') : [];
1453
+
1454
+ let previewHTML = '';
1455
+
1456
+ if (projetos.length > 0) {
1457
+ const categoriaInfo = this.categoriasOrdem.find(cat => cat.id === proximaCategoriaId);
1458
+
1459
+ previewHTML = `
1460
+ <div class="sistema-preview-header">
1461
+ <div class="sistema-preview-icon">
1462
+ <i class="${categoriaInfo.icone}"></i>
1463
+ </div>
1464
+ <h4 class="sistema-preview-title">Próxima Categoria: ${categoriaInfo.nome}</h4>
1465
+ </div>
1466
+ <div class="sistema-preview-projetos">
1467
+ `;
1468
+
1469
+ // Mostrar TODOS os projetos (sem limite)
1470
+ projetos.forEach(projeto => {
1471
+ const titulo = projeto.querySelector('.sistema-projeto-title')?.textContent || 'Projeto';
1472
+ const equipe = projeto.querySelector('.sistema-equipe-nome')?.textContent || 'Equipe';
1473
+
1474
+ previewHTML += `
1475
+ <div class="sistema-preview-projeto">
1476
+ <div class="sistema-preview-projeto-titulo">${titulo}</div>
1477
+ <div class="sistema-preview-projeto-equipe">por ${equipe}</div>
1478
+ </div>
1479
+ `;
1480
+ });
1481
+
1482
+ previewHTML += `</div>`;
1483
+ } else {
1484
+ previewHTML = `
1485
+ <div class="sistema-preview-header">
1486
+ <div class="sistema-preview-icon">
1487
+ <i class="fas fa-info-circle"></i>
1488
+ </div>
1489
+ <h4 class="sistema-preview-title">Próxima categoria disponível</h4>
1490
+ </div>
1491
+ <p style="text-align: center; color: var(--votacao-text-muted); margin: 1rem 0;">
1492
+ Explore mais projetos na próxima categoria!
1493
+ </p>
1494
+ `;
1495
+ }
1496
+
1497
+ if (this.elementos.previewProxima) {
1498
+ this.elementos.previewProxima.innerHTML = previewHTML;
1499
+ }
1500
+ },
1501
+
1502
+ // Continuar votação
1503
+ continuarVotacao() {
1504
+ this.elementos.modalPosVoto.classList.remove('show');
1505
+
1506
+ if (this.proximaCategoriaData) {
1507
+ const proximaTab = document.querySelector(`[data-categoria-id="${this.proximaCategoriaData.id}"]`);
1508
+ if (proximaTab) {
1509
+ proximaTab.click();
1510
+
1511
+ setTimeout(() => {
1512
+ const categoriaHeader = document.querySelector('.sistema-categoria-header');
1513
+ if (categoriaHeader) {
1514
+ categoriaHeader.scrollIntoView({
1515
+ behavior: 'smooth',
1516
+ block: 'start'
1517
+ });
1518
+ }
1519
+ }, 100);
1520
+ }
1521
+ }
1522
+ },
1523
+
1524
+ // Parar votação
1525
+ pararVotacao() {
1526
+ this.elementos.modalPosVoto.classList.remove('show');
1527
+ this.showFeedback('Obrigado pela sua participação na votação!', 'success');
1528
+ },
1529
+
1530
+ // Mostrar modal de conclusão
1531
+ mostrarModalConclusao() {
1532
+ const totalProjetos = document.querySelectorAll('.sistema-projeto-card').length;
1533
+ const projetosElement = document.getElementById('total-projetos-visualizados');
1534
+ if (projetosElement) {
1535
+ projetosElement.textContent = totalProjetos;
1536
+ }
1537
+
1538
+ this.elementos.modalConclusao.classList.add('show');
1539
+ },
1540
+
1541
+ // Reiniciar votação
1542
+ reiniciarVotacao() {
1543
+ console.log('🔄 Reiniciando votação...');
1544
+
1545
+ this.elementos.modalConclusao.classList.remove('show');
1546
+
1547
+ // Reset estado
1548
+ this.votosCategoria.clear();
1549
+ this.proximaCategoriaData = null;
1550
+
1551
+ // Reset botões
1552
+ const botoesVotar = document.querySelectorAll('.sistema-btn-votar');
1553
+ botoesVotar.forEach(botao => {
1554
+ botao.classList.remove('votado', 'loading');
1555
+ botao.disabled = false;
1556
+ botao.textContent = 'Votar neste Projeto';
1557
+ });
1558
+
1559
+ // Reset progresso
1560
+ this.atualizarProgresso();
1561
+
1562
+ // Voltar primeira tab
1563
+ const primeiraTab = document.querySelector('.sistema-tab-button');
1564
+ if (primeiraTab) {
1565
+ primeiraTab.click();
1566
+ }
1567
+
1568
+ window.scrollTo({ top: 0, behavior: 'smooth' });
1569
+ this.showFeedback('Nova votação iniciada! Vote novamente.', 'success');
1570
+ },
1571
+
1572
+ // Encerrar definitivo
1573
+ encerrarDefinitivo() {
1574
+ this.elementos.modalConclusao.classList.remove('show');
1575
+ this.showFeedback('Obrigado pela sua participação na votação!', 'success');
1576
+ },
1577
+
1578
+ // Finalizar votação
1579
+ finalizarVotacao() {
1580
+ if (this.votosCategoria.size === 0) {
1581
+ this.showFeedback('Você ainda não votou em nenhuma categoria.', 'error');
1582
+ return;
1583
+ }
1584
+
1585
+ const categoriasRestantes = this.configuracao.totalCategorias - this.votosCategoria.size;
1586
+
1587
+ let mensagem = 'Tem certeza que deseja finalizar sua votação?';
1588
+ if (categoriasRestantes > 0) {
1589
+ mensagem += `\n\nAinda há ${categoriasRestantes} categoria${categoriasRestantes > 1 ? 's' : ''} para conhecer.`;
1590
+ }
1591
+ mensagem += '\n\nA página será recarregada para iniciar uma nova votação.';
1592
+
1593
+ if (confirm(mensagem)) {
1594
+ // Mostrar feedback antes de recarregar
1595
+ this.showFeedback('Obrigado pela sua participação! Recarregando...', 'success');
1596
+
1597
+ // Recarregar a página após um pequeno delay
1598
+ setTimeout(() => {
1599
+ window.location.reload();
1600
+ }, 1500);
1601
+ }
1602
+ },
1603
+
1604
+ // Atualizar progresso
1605
+ atualizarProgresso() {
1606
+ const votadas = this.votosCategoria.size;
1607
+ const percentual = Math.round((votadas / this.configuracao.totalCategorias) * 100);
1608
+
1609
+ // Atualizar barra principal
1610
+ if (this.elementos.progressoFill) {
1611
+ this.elementos.progressoFill.style.width = `${percentual}%`;
1612
+ }
1613
+ if (this.elementos.progressoStatus) {
1614
+ this.elementos.progressoStatus.textContent = `${votadas} de ${this.configuracao.totalCategorias} categorias`;
1615
+ }
1616
+ if (this.elementos.progressoText) {
1617
+ this.elementos.progressoText.textContent = `${percentual}% concluído`;
1618
+ }
1619
+
1620
+ // Atualizar barra do modal
1621
+ if (this.elementos.progressoFillModal) {
1622
+ this.elementos.progressoFillModal.style.width = `${percentual}%`;
1623
+ }
1624
+ if (this.elementos.progressoStatusModal) {
1625
+ this.elementos.progressoStatusModal.textContent = `${votadas} de ${this.configuracao.totalCategorias} categorias`;
1626
+ }
1627
+ if (this.elementos.progressoTextModal) {
1628
+ this.elementos.progressoTextModal.textContent = `${percentual}% concluído`;
1629
+ }
1630
+ },
1631
+
1632
+ // Mostrar feedback
1633
+ showFeedback(message, type = 'success') {
1634
+ if (!this.elementos.feedbackMessage) return;
1635
+
1636
+ this.elementos.feedbackMessage.textContent = message;
1637
+ this.elementos.feedbackMessage.className = `sistema-feedback-message ${type}`;
1638
+ this.elementos.feedbackMessage.classList.add('show');
1639
+
1640
+ setTimeout(() => {
1641
+ this.elementos.feedbackMessage.classList.remove('show');
1642
+ }, 3000);
1643
+ },
1644
+
1645
+ // Obter CSRF token
1646
+ getCsrfToken() {
1647
+ const csrfInput = document.querySelector('[name=csrfmiddlewaretoken]');
1648
+ if (csrfInput) {
1649
+ return csrfInput.value;
1650
+ }
1651
+
1652
+ // Fallback do cookie
1653
+ const cookies = document.cookie.split(';');
1654
+ for (let cookie of cookies) {
1655
+ const [name, value] = cookie.trim().split('=');
1656
+ if (name === 'csrftoken') {
1657
+ return value;
1658
+ }
1659
+ }
1660
+
1661
+ return '';
1662
+ },
1663
+
1664
+ // Debug - testar funcionalidades
1665
+ debug: {
1666
+ testarTab(categoriaId) {
1667
+ const button = document.querySelector(`[data-categoria-id="${categoriaId}"]`);
1668
+ if (button) {
1669
+ console.log('🧪 Testando clique na categoria:', categoriaId);
1670
+ button.click();
1671
+ } else {
1672
+ console.error('❌ Botão não encontrado para categoria:', categoriaId);
1673
+ }
1674
+ },
1675
+
1676
+ infoTabs() {
1677
+ console.log('=== DEBUG TABS ===');
1678
+ console.log('Botões:', document.querySelectorAll('.sistema-tab-button').length);
1679
+ console.log('Conteúdos:', document.querySelectorAll('.sistema-tab-content').length);
1680
+
1681
+ document.querySelectorAll('.sistema-tab-button').forEach((btn, i) => {
1682
+ console.log(`Botão ${i}:`, {
1683
+ target: btn.getAttribute('data-tab-target'),
1684
+ categoriaId: btn.getAttribute('data-categoria-id'),
1685
+ ativo: btn.classList.contains('active')
1686
+ });
1687
+ });
1688
+ },
1689
+
1690
+ infoEstado() {
1691
+ console.log('=== ESTADO ATUAL ===');
1692
+ console.log('Votos por categoria:', Array.from(SistemaVotacao.votosCategoria));
1693
+ console.log('Configuração:', SistemaVotacao.configuracao);
1694
+ console.log('Categorias:', SistemaVotacao.categoriasOrdem);
1695
+ }
1696
+ }
1697
+ };
1698
+
1699
+ // Inicialização quando DOM carregar
1700
+ document.addEventListener('DOMContentLoaded', function() {
1701
+ SistemaVotacao.init();
1702
+ });
1703
+
1704
+ // Expor funções globalmente para compatibilidade
1705
+ window.SistemaVotacao = SistemaVotacao;
1706
+ </script>
1707
+ {% endblock %}