moisesboy commited on
Commit
ba14ed3
·
verified ·
1 Parent(s): 2c7b899

Promote version c08d833 to main

Browse files

Promoted commit c08d8339d489e6e18e95ba7a0e0bd9682269ee89 to main branch

Files changed (1) hide show
  1. index.html +3 -316
index.html CHANGED
@@ -394,25 +394,13 @@
394
  <p class="text-xs opacity-60 mt-1">Este campo é opcional. Seu número será mantido em sigilo absoluto.</p>
395
  </div>
396
  </div>
 
397
  <!-- Submit -->
398
  <div class="pt-4">
399
- <button id="submitBtn" type="submit" class="w-full bg-yellow-400 bg-opacity-60 hover:bg-opacity-80 text-black font-medium py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center space-x-2">
400
  <i data-feather="send" class="w-5 h-5"></i>
401
  <span>Enviar Denúncia</span>
402
  </button>
403
- <div id="loadingBar" class="hidden mt-4">
404
- <div class="bg-yellow-400 bg-opacity-20 rounded-full h-2">
405
- <div class="bg-yellow-400 h-2 rounded-full animate-pulse" style="width: 0%" id="progressBar"></div>
406
- </div>
407
- <p class="text-center text-yellow-400 mt-2 text-sm">Enviando denúncia...</p>
408
- </div>
409
- <div id="successMessage" class="hidden mt-4 text-center">
410
- <div class="bg-green-500 bg-opacity-20 border border-green-400 rounded-lg p-4">
411
- <i data-feather="check-circle" class="w-8 h-8 text-green-400 mx-auto"></i>
412
- <p class="text-green-400 text-lg font-semibold mt-2">Denúncia enviada com sucesso!</p>
413
- <p id="protocolNumber" class="text-sm opacity-70 mt-1"></p>
414
- </div>
415
- </div>
416
  <p class="text-xs text-center mt-2 opacity-70">Todas as informações serão tratadas com sigilo</p>
417
  <p class="text-xs text-center mt-2 text-yellow-200 font-semibold">
418
  Esta página não substitui os canais oficiais:
@@ -558,306 +546,5 @@
558
  }
559
  }
560
  </script>
561
- <script>
562
- // Initialize feather icons
563
- feather.replace();
564
-
565
- // Generate protocol number
566
- function generateProtocolNumber() {
567
- const now = new Date();
568
- const day = String(now.getDate()).padStart(2, '0');
569
- const month = String(now.getMonth() + 1).padStart(2, '0');
570
- const year = String(now.getFullYear()).slice(-2);
571
- return `DD${day}${month}${year}`;
572
- }
573
-
574
- // Collect all form data
575
- function collectFormData() {
576
- const formData = new FormData();
577
-
578
- // Basic info
579
- formData.append('protocol_number', generateProtocolNumber());
580
- formData.append('crime_type', document.querySelector('input[name="crimeType"]:checked')?.value || '');
581
-
582
- // Dynamic fields based on crime type
583
- const crimeType = document.querySelector('input[name="crimeType"]:checked')?.value;
584
- switch(crimeType) {
585
- case 'drugs':
586
- const drugInputs = document.querySelectorAll('#drugFields input, #drugFields select');
587
- drugInputs.forEach(input => {
588
- if (input.value) {
589
- formData.append(`drugs_${input.parentElement.querySelector('label')?.textContent?.trim()}`, input.value);
590
- }
591
- });
592
- break;
593
- case 'weapons':
594
- const weaponsInputs = document.querySelectorAll('#weaponsFields input');
595
- weaponsInputs.forEach(input => {
596
- if (input.value) {
597
- formData.append(`weapons_${input.parentElement.querySelector('label')?.textContent?.trim()}`, input.value);
598
- }
599
- });
600
- break;
601
- case 'homicide':
602
- const homicideInputs = document.querySelectorAll('#homicideFields input');
603
- homicideInputs.forEach(input => {
604
- if (input.value) {
605
- formData.append(`homicide_${input.parentElement.querySelector('label')?.textContent?.trim()}`, input.value);
606
- }
607
- });
608
- break;
609
- case 'theft':
610
- const theftInputs = document.querySelectorAll('#theftFields input');
611
- theftInputs.forEach(input => {
612
- if (input.value) {
613
- formData.append(`theft_${input.parentElement.querySelector('label')?.textContent?.trim()}`, input.value);
614
- }
615
- });
616
- break;
617
- }
618
-
619
- // Authors info with (se souber) label
620
- const authorsBlocks = document.querySelectorAll('.author-block');
621
- authorsBlocks.forEach((block, index) => {
622
- const inputs = block.querySelectorAll('input, textarea');
623
- inputs.forEach(input => {
624
- const label = input.parentElement.querySelector('label')?.textContent?.trim() || '';
625
- const isRequired = !label.includes('(se souber)') && !label.includes('(Opcional)');
626
-
627
- let fieldLabel = label;
628
- if (!isRequired && !label.includes('se souber')) {
629
- const cleanLabel = label.replace('*', '').trim();
630
- fieldLabel = `${cleanLabel} (se souber)`;
631
- }
632
-
633
- if (input.value || !isRequired) {
634
- formData.append(`author_${index + 1}_${fieldLabel}`, input.value || '');
635
- }
636
- });
637
- });
638
-
639
- // Photos and videos
640
- const files = document.querySelectorAll('input[type="file"]');
641
- let fileCount = 0;
642
- files.forEach((fileInput) => {
643
- if (fileInput.files.length > 0) {
644
- formData.append(`file_${fileCount}`, fileInput.files[0]);
645
- fileCount++;
646
- }
647
- });
648
-
649
- // Description
650
- const description = document.querySelector('textarea[placeholder*="Descreva com detalhes"]');
651
- if (description?.value) {
652
- formData.append('description', description.value);
653
- }
654
-
655
- // Contact
656
- const contact = document.querySelector('input[type="tel"]');
657
- if (contact?.value) {
658
- formData.append('contact_phone', contact.value);
659
- }
660
-
661
- return formData;
662
- }
663
-
664
- // Form submission
665
- document.querySelector('form').addEventListener('submit', async (e) => {
666
- e.preventDefault();
667
-
668
- const submitBtn = document.getElementById('submitBtn');
669
- const loadingBar = document.getElementById('loadingBar');
670
- const successMessage = document.getElementById('successMessage');
671
- const protocolNumber = document.getElementById('protocolNumber');
672
- const progressBar = document.getElementById('progressBar');
673
-
674
- // Disable submit button
675
- submitBtn.disabled = true;
676
- submitBtn.classList.add('opacity-50', 'cursor-not-allowed');
677
- loadingBar.classList.remove('hidden');
678
-
679
- // Animate progress bar
680
- let progress = 0;
681
- const interval = setInterval(() => {
682
- progress += Math.random() * 10;
683
- if (progress > 90) progress = 90;
684
- progressBar.style.width = `${progress}%`;
685
- }, 100);
686
-
687
- try {
688
- const formData = collectFormData();
689
-
690
- const response = await fetch('https://n8n.mohena.xyz/webhook/dadoswebDD', {
691
- method: 'POST',
692
- body: formData
693
- });
694
-
695
- if (response.ok) {
696
- clearInterval(interval);
697
- progressBar.style.width = '100%';
698
-
699
- setTimeout(() => {
700
- loadingBar.classList.add('hidden');
701
- successMessage.classList.remove('hidden');
702
- protocolNumber.textContent = `Protocolo: ${formData.get('protocol_number')}`;
703
-
704
- // Reset form
705
- document.querySelector('form').reset();
706
- document.getElementById('authorsSection').classList.add('hidden');
707
- document.getElementById('drugFields').classList.add('hidden');
708
- document.getElementById('weaponsFields').classList.add('hidden');
709
- document.getElementById('homicideFields').classList.add('hidden');
710
- document.getElementById('theftFields').classList.add('hidden');
711
-
712
- // Clean extra fields
713
- document.querySelectorAll('.author-block:not(:first-child)').forEach(block => block.remove());
714
-
715
- }, 500);
716
- } else {
717
- throw new Error('Erro ao enviar denúncia');
718
- }
719
-
720
- } catch (error) {
721
- alert('Erro ao enviar denúncia. Por favor, tente novamente.');
722
- console.error('Error:', error);
723
- submitBtn.disabled = false;
724
- submitBtn.classList.remove('opacity-50', 'cursor-not-allowed');
725
- loadingBar.classList.add('hidden');
726
- clearInterval(interval);
727
- }
728
- });
729
-
730
- // Show/hide dynamic fields based on crime type
731
- document.querySelectorAll('input[name="crimeType"]').forEach(radio => {
732
- radio.addEventListener('change', function() {
733
- // Hide all dynamic sections
734
- document.getElementById('drugFields').classList.add('hidden');
735
- document.getElementById('weaponsFields').classList.add('hidden');
736
- document.getElementById('homicideFields').classList.add('hidden');
737
- document.getElementById('theftFields').classList.add('hidden');
738
- // Show relevant section
739
- if (this.value === 'drugs') {
740
- document.getElementById('drugFields').classList.remove('hidden');
741
- } else if (this.value === 'weapons') {
742
- document.getElementById('weaponsFields').classList.remove('hidden');
743
- } else if (this.value === 'homicide') {
744
- document.getElementById('homicideFields').classList.remove('hidden');
745
- } else if (this.value === 'theft') {
746
- document.getElementById('theftFields').classList.remove('hidden');
747
- }
748
- // Show authors section
749
- document.getElementById('authorsSection').classList.remove('hidden');
750
- });
751
- });
752
- // Add author field
753
- function addAuthorField() {
754
- const container = document.getElementById('authorsContainer');
755
- const authorCount = container.querySelectorAll('.author-block').length + 1;
756
- const div = document.createElement('div');
757
- div.className = 'author-block space-y-4 border border-white border-opacity-20 rounded-lg p-4 mt-4';
758
- div.innerHTML = `
759
- <div class="flex justify-between items-center">
760
- <h3 class="text-lg font-medium">Autor ${authorCount}</h3>
761
- <button type="button" onclick="this.parentElement.parentElement.remove()" class="bg-yellow-400 bg-opacity-80 hover:bg-opacity-100 text-black px-3 py-1 rounded-lg flex items-center text-sm">
762
- <i data-feather="x" class="w-4 h-4 mr-1"></i> Remover
763
- </button>
764
- </div>
765
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
766
- <div>
767
- <label class="block text-sm font-medium mb-1">Nome do Indivíduo (se souber)</label>
768
- <input type="text" class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
769
- </div>
770
- <div>
771
- <label class="block text-sm font-medium mb-1">Vulgo/Apelido (se souber)</label>
772
- <input type="text" class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
773
- </div>
774
- </div>
775
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
776
- <div>
777
- <label class="block text-sm font-medium mb-1">Rede Social (se souber)</label>
778
- <input type="url" class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="https://instagram.com/...">
779
- </div>
780
- <div>
781
- <label class="block text-sm font-medium mb-1">Documento (se souber)</label>
782
- <input type="text" class="flex-1 input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="RG, CPF, CNH...">
783
- </div>
784
- </div>
785
- <div class="grid grid-cols-1 md:grid-cols-4 gap-4">
786
- <div>
787
- <label class="block text-sm font-medium mb-1">Rua *</label>
788
- <input type="text" required class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
789
- </div>
790
- <div>
791
- <label class="block text-sm font-medium mb-1">Número *</label>
792
- <input type="text" required class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
793
- </div>
794
- <div>
795
- <label class="block text-sm font-medium mb-1">Bairro *</label>
796
- <input type="text" required class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
797
- </div>
798
- <div>
799
- <label class="block text-sm font-medium mb-1">Cidade *</label>
800
- <input type="text" required class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary">
801
- </div>
802
- </div>
803
- <div>
804
- <label class="block text-sm font-medium mb-1">Características do Local (se souber)</label>
805
- <input type="text" class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="Ex: Casa com muro alto, câmeras, etc.">
806
- </div>
807
- <div>
808
- <label class="block text-sm font-medium mb-1">Características do Autor (se souber)</label>
809
- <textarea rows="3" class="w-full input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="Tatuagens, sinais, altura, cor dos olhos, etc."></textarea>
810
- </div>
811
- <div>
812
- <label class="block text-sm font-medium mb-1">Veículo (se aplicável)</label>
813
- <div class="vehicleContainer">
814
- <div class="flex space-x-2">
815
- <input type="text" class="flex-1 input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="Modelo, Cor, Placa">
816
- <button type="button" onclick="addVehicleField(this)" class="add-btn bg-secondary bg-opacity-80 hover:bg-opacity-100 text-white px-3 rounded-lg flex items-center">
817
- <i data-feather="plus" class="w-5 h-5"></i>
818
- </button>
819
- </div>
820
- </div>
821
- </div>
822
- `;
823
- container.appendChild(div);
824
- feather.replace();
825
- }
826
-
827
- // Add vehicle field (generic)
828
- function addVehicleField(button) {
829
- const container = button.parentElement.parentElement;
830
- const div = document.createElement('div');
831
- div.className = 'flex space-x-2 mt-2';
832
- div.innerHTML = `
833
- <input type="text" class="flex-1 input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary" placeholder="Modelo, Cor, Placa">
834
- <button type="button" onclick="this.parentElement.remove()" class="bg-yellow-400 bg-opacity-80 hover:bg-opacity-100 text-black px-3 rounded-lg flex items-center">
835
- <i data-feather="x" class="w-5 h-5"></i>
836
- </button>
837
- `;
838
- container.appendChild(div);
839
- feather.replace();
840
- }
841
-
842
- // Add photo field
843
- function addPhotoField() {
844
- const container = document.getElementById('photosContainer');
845
- const div = document.createElement('div');
846
- div.className = 'flex space-x-2 mt-2';
847
- div.innerHTML = `
848
- <input type="file" accept="image/*,video/*" class="flex-1 input-glass rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-primary file:mr-4 file:py-2 file:px-4 file:rounded-lg file:border-0 file:text-sm file:font-semibold file:bg-primary file:text-white hover:file:bg-opacity-80">
849
- <button type="button" onclick="this.parentElement.remove()" class="bg-yellow-400 bg-opacity-80 hover:bg-opacity-100 text-black px-3 rounded-lg flex items-center">
850
- <i data-feather="x" class="w-5 h-5"></i>
851
- </button>
852
- `;
853
- // Limit to 5 files
854
- if (container.querySelectorAll('input[type="file"]').length < 5) {
855
- container.appendChild(div);
856
- feather.replace();
857
- } else {
858
- alert('Máximo de 5 arquivos atingido');
859
- }
860
- }
861
- </script>
862
  </body>
863
- </html>
 
394
  <p class="text-xs opacity-60 mt-1">Este campo é opcional. Seu número será mantido em sigilo absoluto.</p>
395
  </div>
396
  </div>
397
+
398
  <!-- Submit -->
399
  <div class="pt-4">
400
+ <button type="submit" class="w-full bg-yellow-400 bg-opacity-60 hover:bg-opacity-80 text-black font-medium py-3 px-4 rounded-lg transition duration-300 flex items-center justify-center space-x-2">
401
  <i data-feather="send" class="w-5 h-5"></i>
402
  <span>Enviar Denúncia</span>
403
  </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  <p class="text-xs text-center mt-2 opacity-70">Todas as informações serão tratadas com sigilo</p>
405
  <p class="text-xs text-center mt-2 text-yellow-200 font-semibold">
406
  Esta página não substitui os canais oficiais:
 
546
  }
547
  }
548
  </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  </body>
550
+ </html>