wagtail-enap-designsystem 1.2.1.194__py3-none-any.whl → 1.2.1.196__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.
- enap_designsystem/blocks/form.py +45 -28
- enap_designsystem/blocks/html_blocks.py +15 -17
- enap_designsystem/blocks/layout_blocks.py +14 -1
- enap_designsystem/migrations/0467_alter_areaaluno_body_alter_cursoeadpage_curso_and_more.py +82760 -0
- enap_designsystem/migrations/0468_alter_areaaluno_body_alter_cursoeadpage_curso_and_more.py +82575 -0
- enap_designsystem/static/enap_designsystem/blocks/capsulas.css +618 -26
- enap_designsystem/templates/enap_designsystem/blocks/carousel_responsive.html +0 -3
- enap_designsystem/templates/enap_designsystem/blocks/carousel_responsivo_snippet.html +1 -3
- enap_designsystem/templates/enap_designsystem/form_templates/formulario_page.html +147 -16
- enap_designsystem/templates/enap_designsystem/form_templates/formulario_page_landing.html +0 -1
- enap_designsystem/templates/enap_designsystem/form_templates/formulario_page_success.html +0 -1
- enap_designsystem/templates/enap_designsystem/includes/form_field.html +96 -121
- enap_designsystem/templates/enap_designsystem/pages/capsula_page.html +85 -60
- enap_designsystem/templates/enap_designsystem/pages/quiz_rota_page.html +314 -829
- enap_designsystem/wagtail_hooks.py +150 -38
- {wagtail_enap_designsystem-1.2.1.194.dist-info → wagtail_enap_designsystem-1.2.1.196.dist-info}/METADATA +1 -1
- {wagtail_enap_designsystem-1.2.1.194.dist-info → wagtail_enap_designsystem-1.2.1.196.dist-info}/RECORD +20 -18
- {wagtail_enap_designsystem-1.2.1.194.dist-info → wagtail_enap_designsystem-1.2.1.196.dist-info}/WHEEL +0 -0
- {wagtail_enap_designsystem-1.2.1.194.dist-info → wagtail_enap_designsystem-1.2.1.196.dist-info}/licenses/LICENSE +0 -0
- {wagtail_enap_designsystem-1.2.1.194.dist-info → wagtail_enap_designsystem-1.2.1.196.dist-info}/top_level.txt +0 -0
|
@@ -50,9 +50,6 @@
|
|
|
50
50
|
decoding="{% if forloop.first %}sync{% else %}async{% endif %}">
|
|
51
51
|
{% endif %}
|
|
52
52
|
|
|
53
|
-
<!-- Overlay -->
|
|
54
|
-
<div class="carousel-responsivo__overlay" aria-hidden="true"></div>
|
|
55
|
-
|
|
56
53
|
<!-- Conteúdo -->
|
|
57
54
|
<div class="carousel-responsivo__content">
|
|
58
55
|
<div class="container">
|
|
@@ -52,9 +52,7 @@
|
|
|
52
52
|
loading="{% if forloop.first %}eager{% else %}lazy{% endif %}"
|
|
53
53
|
decoding="{% if forloop.first %}sync{% else %}async{% endif %}">
|
|
54
54
|
{% endif %}
|
|
55
|
-
|
|
56
|
-
<!-- Overlay -->
|
|
57
|
-
<div class="carousel-responsivo__overlay" aria-hidden="true"></div>
|
|
55
|
+
|
|
58
56
|
|
|
59
57
|
<!-- Conteúdo -->
|
|
60
58
|
<div class="carousel-responsivo__content">
|
|
@@ -1393,7 +1393,6 @@
|
|
|
1393
1393
|
{% if page.send_confirmation_email %}
|
|
1394
1394
|
<li>Verifique sua caixa de entrada (e spam) para o e-mail de confirmação</li>
|
|
1395
1395
|
{% endif %}
|
|
1396
|
-
<li>Fique atento às comunicações sobre o evento</li>
|
|
1397
1396
|
<li>Entre em contato conosco em caso de dúvidas</li>
|
|
1398
1397
|
<li>Compartilhe este evento com seus amigos</li>
|
|
1399
1398
|
</ul>
|
|
@@ -1846,11 +1845,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
1846
1845
|
if (e.target.classList.contains('phone-field')) {
|
|
1847
1846
|
let value = e.target.value.replace(/[^\d]/g, '');
|
|
1848
1847
|
if (value.length <= 10) {
|
|
1849
|
-
value = value.replace(/(\d{2})(\d)/, '
|
|
1850
|
-
value = value.replace(/(\d{4})(\d)/, '$1
|
|
1848
|
+
value = value.replace(/(\d{2})(\d)/, '$1 $2');
|
|
1849
|
+
value = value.replace(/(\d{4})(\d)/, '$1 $2');
|
|
1851
1850
|
} else {
|
|
1852
|
-
value = value.replace(/(\d{2})(\d)/, '
|
|
1853
|
-
value = value.replace(/(\d{5})(\d)/, '$1
|
|
1851
|
+
value = value.replace(/(\d{2})(\d)/, '$1 $2');
|
|
1852
|
+
value = value.replace(/(\d{5})(\d)/, '$1 $2');
|
|
1854
1853
|
}
|
|
1855
1854
|
e.target.value = value;
|
|
1856
1855
|
}
|
|
@@ -1888,37 +1887,169 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
1888
1887
|
});
|
|
1889
1888
|
|
|
1890
1889
|
// FUNÇÕES DE UPLOAD (mantém as existentes)
|
|
1890
|
+
// Variável global para armazenar arquivos
|
|
1891
|
+
const selectedFilesMap = new Map();
|
|
1892
|
+
|
|
1893
|
+
// Função para atualizar o nome do arquivo
|
|
1891
1894
|
function updateFileName(input) {
|
|
1892
1895
|
const fieldId = input.id;
|
|
1893
1896
|
const displayDiv = document.getElementById(`file-display-${fieldId}`);
|
|
1894
1897
|
const errorDiv = document.getElementById(`file-error-${fieldId}`);
|
|
1895
1898
|
const dropzone = document.getElementById(`dropzone-${fieldId}`);
|
|
1896
1899
|
|
|
1900
|
+
// Inicializar o armazenamento para este campo se não existir
|
|
1901
|
+
if (!selectedFilesMap.has(fieldId)) {
|
|
1902
|
+
selectedFilesMap.set(fieldId, new DataTransfer());
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
// Obter o armazenamento atual
|
|
1906
|
+
let dataTransfer = selectedFilesMap.get(fieldId);
|
|
1907
|
+
|
|
1908
|
+
// Limpar mensagens de erro
|
|
1897
1909
|
errorDiv.style.display = 'none';
|
|
1898
1910
|
errorDiv.textContent = '';
|
|
1899
1911
|
|
|
1912
|
+
// Verificar novos arquivos
|
|
1900
1913
|
if (input.files && input.files.length > 0) {
|
|
1901
1914
|
const maxSize = parseInt(input.dataset.maxSize) * 1024 * 1024;
|
|
1902
|
-
const
|
|
1915
|
+
const maxFiles = parseInt(input.dataset.maxFiles || 5);
|
|
1903
1916
|
|
|
1904
|
-
|
|
1905
|
-
|
|
1917
|
+
// Verificar se excederia o limite de arquivos
|
|
1918
|
+
if (dataTransfer.files.length + input.files.length > maxFiles) {
|
|
1919
|
+
errorDiv.textContent = `Máximo de ${maxFiles} arquivo(s) permitido(s)`;
|
|
1906
1920
|
errorDiv.style.display = 'block';
|
|
1907
|
-
input.value = '';
|
|
1908
1921
|
return;
|
|
1909
1922
|
}
|
|
1910
1923
|
|
|
1924
|
+
// Validar e adicionar cada novo arquivo
|
|
1925
|
+
for (let i = 0; i < input.files.length; i++) {
|
|
1926
|
+
const file = input.files[i];
|
|
1927
|
+
|
|
1928
|
+
// Verificar tamanho
|
|
1929
|
+
if (file.size > maxSize) {
|
|
1930
|
+
errorDiv.textContent = `Arquivo "${file.name}" excede ${input.dataset.maxSize}MB`;
|
|
1931
|
+
errorDiv.style.display = 'block';
|
|
1932
|
+
continue;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
// Verificar se já existe um arquivo com esse nome
|
|
1936
|
+
let fileExists = false;
|
|
1937
|
+
for (let j = 0; j < dataTransfer.files.length; j++) {
|
|
1938
|
+
if (dataTransfer.files[j].name === file.name) {
|
|
1939
|
+
fileExists = true;
|
|
1940
|
+
break;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
if (!fileExists) {
|
|
1945
|
+
// Adicionar ao DataTransfer
|
|
1946
|
+
dataTransfer.items.add(file);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
// Atualizar o campo de input com os arquivos acumulados
|
|
1951
|
+
input.files = dataTransfer.files;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// Atualizar a exibição dos arquivos
|
|
1955
|
+
updateFilesDisplay(fieldId);
|
|
1956
|
+
}
|
|
1957
|
+
|
|
1958
|
+
// Função para atualizar a exibição dos arquivos
|
|
1959
|
+
function updateFilesDisplay(fieldId) {
|
|
1960
|
+
const displayDiv = document.getElementById(`file-display-${fieldId}`);
|
|
1961
|
+
const input = document.getElementById(fieldId);
|
|
1962
|
+
const dataTransfer = selectedFilesMap.get(fieldId);
|
|
1963
|
+
|
|
1964
|
+
if (!dataTransfer || dataTransfer.files.length === 0) {
|
|
1965
|
+
displayDiv.innerHTML = '';
|
|
1966
|
+
displayDiv.style.display = 'none';
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
let html = '';
|
|
1971
|
+
let totalSize = 0;
|
|
1972
|
+
|
|
1973
|
+
// Criar HTML para cada arquivo
|
|
1974
|
+
for (let i = 0; i < dataTransfer.files.length; i++) {
|
|
1975
|
+
const file = dataTransfer.files[i];
|
|
1976
|
+
totalSize += file.size;
|
|
1977
|
+
|
|
1911
1978
|
const fileSize = (file.size / (1024 * 1024)).toFixed(2);
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
<span style="
|
|
1917
|
-
<span style="
|
|
1979
|
+
const fileIcon = getFileIcon(file.name);
|
|
1980
|
+
|
|
1981
|
+
html += `
|
|
1982
|
+
<div class="file-item" style="display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: #f8f9fa; border-radius: 4px; margin-bottom: 0.5rem;">
|
|
1983
|
+
<span style="font-size: 1.2rem;">${fileIcon}</span>
|
|
1984
|
+
<span style="flex: 1; overflow: hidden; text-overflow: ellipsis;">${file.name}</span>
|
|
1985
|
+
<span style="color: #666; font-size: 0.8rem; white-space: nowrap;">${fileSize}MB</span>
|
|
1986
|
+
<button type="button" class="remove-file-btn"
|
|
1987
|
+
style="background: #dc3545; color: white; border: none; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: bold;"
|
|
1988
|
+
onclick="removeFile('${fieldId}', ${i})">×</button>
|
|
1989
|
+
</div>
|
|
1990
|
+
`;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
// Adicionar resumo para múltiplos arquivos
|
|
1994
|
+
if (dataTransfer.files.length > 1) {
|
|
1995
|
+
const totalSizeMB = (totalSize / (1024 * 1024)).toFixed(2);
|
|
1996
|
+
html += `
|
|
1997
|
+
<div style="text-align: right; margin-top: 5px; padding: 3px 8px; background: #f0f0f0; border-radius: 4px;">
|
|
1998
|
+
<span style="font-size: 0.9rem; font-weight: 500;">${dataTransfer.files.length} arquivos (${totalSizeMB}MB total)</span>
|
|
1918
1999
|
</div>
|
|
1919
2000
|
`;
|
|
1920
|
-
displayDiv.style.display = 'block';
|
|
1921
2001
|
}
|
|
2002
|
+
|
|
2003
|
+
// Atualizar o display
|
|
2004
|
+
displayDiv.innerHTML = html;
|
|
2005
|
+
displayDiv.style.display = 'block';
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
// Função para remover um arquivo específico
|
|
2009
|
+
function removeFile(fieldId, index) {
|
|
2010
|
+
if (!selectedFilesMap.has(fieldId)) return;
|
|
2011
|
+
|
|
2012
|
+
const dataTransfer = selectedFilesMap.get(fieldId);
|
|
2013
|
+
const newDataTransfer = new DataTransfer();
|
|
2014
|
+
|
|
2015
|
+
// Copiar todos os arquivos exceto o que deve ser removido
|
|
2016
|
+
for (let i = 0; i < dataTransfer.files.length; i++) {
|
|
2017
|
+
if (i !== index) {
|
|
2018
|
+
newDataTransfer.items.add(dataTransfer.files[i]);
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
// Atualizar a lista de arquivos
|
|
2023
|
+
selectedFilesMap.set(fieldId, newDataTransfer);
|
|
2024
|
+
|
|
2025
|
+
// Atualizar o campo input
|
|
2026
|
+
const input = document.getElementById(fieldId);
|
|
2027
|
+
input.files = newDataTransfer.files;
|
|
2028
|
+
|
|
2029
|
+
// Atualizar a exibição
|
|
2030
|
+
updateFilesDisplay(fieldId);
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// Função para tratar o drop de arquivos
|
|
2034
|
+
function handleFileDrop(e, inputId) {
|
|
2035
|
+
e.preventDefault();
|
|
2036
|
+
e.stopPropagation();
|
|
2037
|
+
|
|
2038
|
+
const input = document.getElementById(inputId);
|
|
2039
|
+
const files = e.dataTransfer.files;
|
|
2040
|
+
|
|
2041
|
+
// Criar uma cópia dos arquivos para o input
|
|
2042
|
+
const tempTransfer = new DataTransfer();
|
|
2043
|
+
for (let i = 0; i < files.length; i++) {
|
|
2044
|
+
tempTransfer.items.add(files[i]);
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
input.files = tempTransfer.files;
|
|
2048
|
+
updateFileName(input);
|
|
2049
|
+
|
|
2050
|
+
// Resetar visual
|
|
2051
|
+
e.currentTarget.style.borderColor = '#C8D1E0';
|
|
2052
|
+
e.currentTarget.style.background = '#f8f9fa';
|
|
1922
2053
|
}
|
|
1923
2054
|
|
|
1924
2055
|
function getFileIcon(filename) {
|
|
@@ -264,7 +264,6 @@
|
|
|
264
264
|
<ul>
|
|
265
265
|
<li>Verifique sua caixa de entrada (e spam) para o e-mail de confirmação</li>
|
|
266
266
|
<li>Guarde este e-mail para futura referência</li>
|
|
267
|
-
<li>Fique atento às comunicações sobre o evento</li>
|
|
268
267
|
<li>Entre em contato conosco em caso de dúvidas</li>
|
|
269
268
|
</ul>
|
|
270
269
|
</div>
|
|
@@ -296,7 +296,6 @@
|
|
|
296
296
|
<li>Verifique sua caixa de entrada (e spam) para o e-mail de confirmação</li>
|
|
297
297
|
<li>Guarde este e-mail para futura referência</li>
|
|
298
298
|
{% endif %}
|
|
299
|
-
<li>Fique atento às comunicações sobre o evento</li>
|
|
300
299
|
<li>Entre em contato conosco em caso de dúvidas</li>
|
|
301
300
|
<li>Compartilhe este evento com seus amigos</li>
|
|
302
301
|
</ul>
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
id="{{ block.block_type }}_{{ block.id }}"
|
|
606
606
|
name="{{ block.block_type }}_{{ block.id }}"
|
|
607
607
|
class="form-control phone-field"
|
|
608
|
-
placeholder="
|
|
608
|
+
placeholder="11 99999-9999"
|
|
609
609
|
{% if block.value.required %}required{% endif %}
|
|
610
610
|
value="{{ form_data|default_if_none:'' }}"
|
|
611
611
|
>
|
|
@@ -974,7 +974,7 @@
|
|
|
974
974
|
id="{{ field_block.block_type }}_{{ field_block.id }}"
|
|
975
975
|
name="{{ field_block.block_type }}_{{ field_block.id }}"
|
|
976
976
|
class="form-control phone-field"
|
|
977
|
-
placeholder="
|
|
977
|
+
placeholder="11 99999-9999"
|
|
978
978
|
{% if field_block.value.required %}required{% endif %}
|
|
979
979
|
value="{{ form_data|default_if_none:'' }}"
|
|
980
980
|
>
|
|
@@ -1196,14 +1196,14 @@
|
|
|
1196
1196
|
|
|
1197
1197
|
<input
|
|
1198
1198
|
type="file"
|
|
1199
|
-
id="{{
|
|
1200
|
-
name="{{
|
|
1199
|
+
id="{{ block.block_type }}_{{ block.id }}"
|
|
1200
|
+
name="{{ block.block_type }}_{{ block.id }}"
|
|
1201
1201
|
style="display: none;"
|
|
1202
|
-
{% if
|
|
1203
|
-
{% if
|
|
1204
|
-
accept="
|
|
1205
|
-
data-max-size="{{
|
|
1206
|
-
{% if
|
|
1202
|
+
{% if block.value.required %}required{% endif %}
|
|
1203
|
+
{% if block.value.multiple_files|default:False %}multiple{% endif %}
|
|
1204
|
+
accept="..."
|
|
1205
|
+
data-max-size="{{ block.value.max_size_mb }}"
|
|
1206
|
+
{% if block.value.multiple_files|default:False %}data-max-files="{{ block.value.max_files|default:3 }}"{% endif %}
|
|
1207
1207
|
onchange="updateFileName(this)"
|
|
1208
1208
|
>
|
|
1209
1209
|
|
|
@@ -1971,7 +1971,7 @@
|
|
|
1971
1971
|
<input
|
|
1972
1972
|
type="file"
|
|
1973
1973
|
id="{{ block.block_type }}_{{ block.id }}"
|
|
1974
|
-
name="{{ block.block_type }}_{{ block.id }}"
|
|
1974
|
+
name="{{ block.block_type }}_{{ block.id }}{% if block.value.multiple_files|default:False %}[]{% endif %}"
|
|
1975
1975
|
style="display: none;"
|
|
1976
1976
|
{% if block.value.required %}required{% endif %}
|
|
1977
1977
|
{% if block.value.multiple_files|default:False %}multiple{% endif %}
|
|
@@ -2353,129 +2353,104 @@
|
|
|
2353
2353
|
{% endif %}
|
|
2354
2354
|
|
|
2355
2355
|
<script>
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2356
|
+
// FUNÇÃO DE UPLOAD CORRIGIDA
|
|
2357
|
+
function updateFileName(input) {
|
|
2358
|
+
console.log("Função updateFileName chamada"); // Log para debug
|
|
2359
|
+
|
|
2360
|
+
const fieldId = input.id;
|
|
2361
|
+
const displayDiv = document.getElementById(`file-display-${fieldId}`);
|
|
2362
|
+
const errorDiv = document.getElementById(`file-error-${fieldId}`);
|
|
2363
|
+
const dropzone = document.getElementById(`dropzone-${fieldId}`);
|
|
2364
|
+
|
|
2365
|
+
console.log("Files selecionados:", input.files.length); // Log para debug
|
|
2366
|
+
console.log("Multiple?", input.multiple); // Log para debug
|
|
2367
|
+
|
|
2368
|
+
// Limpar erros anteriores
|
|
2369
|
+
errorDiv.style.display = 'none';
|
|
2370
|
+
errorDiv.textContent = '';
|
|
2371
|
+
displayDiv.innerHTML = ''; // Limpar a área de exibição
|
|
2372
|
+
|
|
2373
|
+
if (input.files && input.files.length > 0) {
|
|
2374
|
+
const maxSize = parseInt(input.dataset.maxSize) * 1024 * 1024;
|
|
2375
|
+
const maxFiles = input.multiple ? (parseInt(input.dataset.maxFiles) || 5) : 1;
|
|
2361
2376
|
|
|
2362
|
-
//
|
|
2363
|
-
|
|
2364
|
-
|
|
2377
|
+
// Verificar se excedeu o número máximo de arquivos
|
|
2378
|
+
if (input.files.length > maxFiles) {
|
|
2379
|
+
errorDiv.textContent = `Máximo de ${maxFiles} arquivo(s) permitido(s)`;
|
|
2380
|
+
errorDiv.style.display = 'block';
|
|
2381
|
+
input.value = '';
|
|
2382
|
+
return;
|
|
2383
|
+
}
|
|
2365
2384
|
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
errorMessages.push(`Máximo ${maxFiles} arquivo(s) permitido(s)`);
|
|
2376
|
-
hasError = true;
|
|
2377
|
-
}
|
|
2385
|
+
// Verificar tamanho de cada arquivo
|
|
2386
|
+
let totalSize = 0;
|
|
2387
|
+
let fileHtml = '';
|
|
2388
|
+
let errors = [];
|
|
2389
|
+
|
|
2390
|
+
// Processar cada arquivo
|
|
2391
|
+
for (let i = 0; i < input.files.length; i++) {
|
|
2392
|
+
const file = input.files[i];
|
|
2393
|
+
totalSize += file.size;
|
|
2378
2394
|
|
|
2379
|
-
// Verificar
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
// Verificar tamanho
|
|
2385
|
-
if (file.size > maxSize) {
|
|
2386
|
-
errorMessages.push(`"${file.name}" excede ${input.dataset.maxSize}MB`);
|
|
2387
|
-
hasError = true;
|
|
2388
|
-
continue;
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
validFiles.push(file);
|
|
2395
|
+
// Verificar tamanho individual
|
|
2396
|
+
if (file.size > maxSize) {
|
|
2397
|
+
errors.push(`Arquivo "${file.name}" excede ${input.dataset.maxSize}MB`);
|
|
2398
|
+
continue;
|
|
2392
2399
|
}
|
|
2393
2400
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
dropzone.style.borderColor = '#dc3545';
|
|
2398
|
-
dropzone.style.background = '#fff5f5';
|
|
2399
|
-
input.value = ''; // Limpar seleção
|
|
2400
|
-
displayDiv.style.display = 'none';
|
|
2401
|
-
return;
|
|
2402
|
-
}
|
|
2401
|
+
// Adicionar à lista de exibição
|
|
2402
|
+
const fileSize = (file.size / (1024 * 1024)).toFixed(2);
|
|
2403
|
+
const fileIcon = getFileIcon(file.name);
|
|
2403
2404
|
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
displayDiv.style.display = 'block';
|
|
2421
|
-
|
|
2422
|
-
// Atualizar visual do dropzone
|
|
2423
|
-
dropzone.style.borderColor = '#28a745';
|
|
2424
|
-
dropzone.style.background = '#f8fff8';
|
|
2425
|
-
|
|
2426
|
-
} else {
|
|
2427
|
-
displayDiv.style.display = 'none';
|
|
2428
|
-
dropzone.style.borderColor = '#C8D1E0';
|
|
2429
|
-
dropzone.style.background = '#f8f9fa';
|
|
2405
|
+
fileHtml += `
|
|
2406
|
+
<div style="display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: #f8f9fa; border-radius: 4px; margin-bottom: 0.5rem;">
|
|
2407
|
+
<span style="font-size: 1.2rem;">${fileIcon}</span>
|
|
2408
|
+
<span style="flex: 1; overflow: hidden; text-overflow: ellipsis;">${file.name}</span>
|
|
2409
|
+
<span style="color: #666; font-size: 0.8rem; white-space: nowrap;">${fileSize}MB</span>
|
|
2410
|
+
<span style="color: #28a745; font-weight: bold;">✓</span>
|
|
2411
|
+
</div>
|
|
2412
|
+
`;
|
|
2413
|
+
}
|
|
2414
|
+
|
|
2415
|
+
// Se houver erros, mostrar e abortar
|
|
2416
|
+
if (errors.length > 0) {
|
|
2417
|
+
errorDiv.textContent = errors.join('; ');
|
|
2418
|
+
errorDiv.style.display = 'block';
|
|
2419
|
+
input.value = '';
|
|
2420
|
+
return;
|
|
2430
2421
|
}
|
|
2431
|
-
}
|
|
2432
|
-
|
|
2433
|
-
// Função para obter ícone baseado na extensão
|
|
2434
|
-
function getFileIcon(filename) {
|
|
2435
|
-
const ext = filename.split('.').pop().toLowerCase();
|
|
2436
|
-
const icons = {
|
|
2437
|
-
'pdf': '📄',
|
|
2438
|
-
'doc': '📝', 'docx': '📝',
|
|
2439
|
-
'xls': '📊', 'xlsx': '📊',
|
|
2440
|
-
'jpg': '🖼️', 'jpeg': '🖼️', 'png': '🖼️', 'gif': '🖼️',
|
|
2441
|
-
'txt': '📄',
|
|
2442
|
-
'csv': '📋'
|
|
2443
|
-
};
|
|
2444
|
-
return icons[ext] || '📎';
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
// Drag and Drop
|
|
2448
|
-
function handleDragOver(e) {
|
|
2449
|
-
e.preventDefault();
|
|
2450
|
-
e.stopPropagation();
|
|
2451
|
-
e.currentTarget.style.borderColor = '#007bff';
|
|
2452
|
-
e.currentTarget.style.background = '#f0f8ff';
|
|
2453
|
-
}
|
|
2454
|
-
|
|
2455
|
-
function handleDragLeave(e) {
|
|
2456
|
-
e.preventDefault();
|
|
2457
|
-
e.stopPropagation();
|
|
2458
|
-
e.currentTarget.style.borderColor = '#C8D1E0';
|
|
2459
|
-
e.currentTarget.style.background = '#f8f9fa';
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
|
-
function handleFileDrop(e, inputId) {
|
|
2463
|
-
e.preventDefault();
|
|
2464
|
-
e.stopPropagation();
|
|
2465
2422
|
|
|
2466
|
-
|
|
2467
|
-
|
|
2423
|
+
// Se tudo estiver ok, exibir os arquivos
|
|
2424
|
+
displayDiv.innerHTML = fileHtml;
|
|
2468
2425
|
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2426
|
+
// Adicionar resumo para múltiplos arquivos
|
|
2427
|
+
if (input.files.length > 1) {
|
|
2428
|
+
const totalSizeMB = (totalSize / (1024 * 1024)).toFixed(2);
|
|
2429
|
+
const summaryDiv = document.createElement('div');
|
|
2430
|
+
summaryDiv.style.textAlign = 'right';
|
|
2431
|
+
summaryDiv.style.padding = '0.3rem 0.5rem';
|
|
2432
|
+
summaryDiv.style.fontSize = '0.9rem';
|
|
2433
|
+
summaryDiv.style.fontWeight = 'bold';
|
|
2434
|
+
summaryDiv.style.color = '#2A5E2C';
|
|
2435
|
+
summaryDiv.style.background = '#f0f8f0';
|
|
2436
|
+
summaryDiv.style.borderRadius = '4px';
|
|
2437
|
+
summaryDiv.style.marginTop = '0.5rem';
|
|
2438
|
+
summaryDiv.textContent = `${input.files.length} arquivos (${totalSizeMB}MB total)`;
|
|
2439
|
+
displayDiv.appendChild(summaryDiv);
|
|
2473
2440
|
}
|
|
2474
2441
|
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2442
|
+
displayDiv.style.display = 'block';
|
|
2443
|
+
|
|
2444
|
+
// Atualizar visual do dropzone
|
|
2445
|
+
dropzone.style.borderColor = '#28a745';
|
|
2446
|
+
dropzone.style.background = '#f8fff8';
|
|
2447
|
+
} else {
|
|
2448
|
+
// Não há arquivos selecionados
|
|
2449
|
+
displayDiv.style.display = 'none';
|
|
2450
|
+
dropzone.style.borderColor = '#C8D1E0';
|
|
2451
|
+
dropzone.style.background = '#f8f9fa';
|
|
2478
2452
|
}
|
|
2453
|
+
}
|
|
2479
2454
|
|
|
2480
2455
|
// Atualizar texto de rating
|
|
2481
2456
|
document.addEventListener('click', function(e) {
|