maralvic commited on
Commit
bb07785
·
verified ·
1 Parent(s): 588062d

Continua não abrindo janela de inserçao de html e os botões não permitem acionamento. Corrija - Follow Up Deployment

Browse files
Files changed (1) hide show
  1. index.html +38 -8
index.html CHANGED
@@ -14,9 +14,17 @@
14
  border-radius: 8px;
15
  background-color: #ecf0f1;
16
  cursor: pointer;
 
 
 
17
  }
18
  .upload-area:hover {
19
  background-color: #d6dbdf;
 
 
 
 
 
20
  }
21
  #file-input {
22
  display: none;
@@ -74,8 +82,14 @@
74
  <h1 class="text-3xl font-bold text-center text-gray-800 mb-6">Processador de XML/HTML para CSV/XLSX</h1>
75
 
76
  <div class="upload-area" id="upload-area">
77
- <p class="text-gray-700">Clique aqui ou arraste arquivos XML ou HTML para fazer upload (máximo: 100)</p>
78
- <input type="file" id="file-input" accept=".xml,.html" multiple>
 
 
 
 
 
 
79
  </div>
80
 
81
  <div id="status-area"></div>
@@ -139,8 +153,20 @@
139
  let xlsxBlob = null;
140
 
141
  // Upload area click handler
142
- uploadArea.addEventListener('click', function() {
143
- fileInput.click();
 
 
 
 
 
 
 
 
 
 
 
 
144
  });
145
 
146
  // Drag and drop handlers
@@ -173,6 +199,8 @@
173
  processBtn.addEventListener('click', function() {
174
  if (currentFiles.length) {
175
  processFiles(currentFiles);
 
 
176
  }
177
  });
178
 
@@ -218,8 +246,8 @@
218
 
219
  for (let i = 0; i < files.length && validFiles.length + currentFiles.length < maxFiles; i++) {
220
  const file = files[i];
221
- if (file.type === 'text/xml' || file.type === 'text/html' ||
222
- file.name.endsWith('.xml') || file.name.endsWith('.html')) {
223
  validFiles.push(file);
224
  }
225
  }
@@ -231,6 +259,8 @@
231
 
232
  currentFiles = [...currentFiles, ...validFiles];
233
  processBtn.disabled = false;
 
 
234
  updateFileList();
235
  showStatus(`${currentFiles.length} arquivo(s) selecionado(s). Clique em "Processar Arquivos" para continuar.`, 'success');
236
  } else {
@@ -261,13 +291,13 @@
261
  }
262
  }
263
 
264
- function updateSelectedCount() {
265
  const selected = document.querySelectorAll('.file-checkbox:checked').length;
266
  selectedCount.textContent = `${selected} arquivo(s) selecionado(s)`;
267
  pdfBtn.disabled = selected === 0;
268
  }
269
 
270
- function removeFile(index) {
271
  currentFiles.splice(index, 1);
272
  updateFileList();
273
  if (currentFiles.length === 0) {
 
14
  border-radius: 8px;
15
  background-color: #ecf0f1;
16
  cursor: pointer;
17
+ position: relative;
18
+ overflow: hidden;
19
+ transition: all 0.3s ease;
20
  }
21
  .upload-area:hover {
22
  background-color: #d6dbdf;
23
+ border-color: #2980b9;
24
+ box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
25
+ }
26
+ .upload-area p {
27
+ pointer-events: none;
28
  }
29
  #file-input {
30
  display: none;
 
82
  <h1 class="text-3xl font-bold text-center text-gray-800 mb-6">Processador de XML/HTML para CSV/XLSX</h1>
83
 
84
  <div class="upload-area" id="upload-area">
85
+ <p class="text-gray-700 font-medium">
86
+ <svg xmlns="http://www.w3.org/2000/svg" class="h-10 w-10 mx-auto mb-2 text-blue-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
87
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
88
+ </svg>
89
+ Clique aqui ou arraste arquivos XML ou HTML<br>
90
+ <span class="text-sm text-gray-600">Formatos aceitos: .xml, .html (máximo: 100 arquivos)</span>
91
+ </p>
92
+ <input type="file" id="file-input" accept=".xml,.html,.htm,text/xml,text/html" multiple style="position: absolute; opacity: 0; width: 100%; height: 100%; top: 0; left: 0; cursor: pointer;">
93
  </div>
94
 
95
  <div id="status-area"></div>
 
153
  let xlsxBlob = null;
154
 
155
  // Upload area click handler
156
+ uploadArea.addEventListener('click', function(e) {
157
+ // Prevent double triggering
158
+ if (e.target.tagName !== 'INPUT') {
159
+ fileInput.click();
160
+ }
161
+ });
162
+
163
+ // Make sure file input change is properly handled
164
+ fileInput.addEventListener('change', function() {
165
+ if (this.files && this.files.length > 0) {
166
+ handleFiles(this.files);
167
+ // Reset input to allow selecting same file again
168
+ this.value = '';
169
+ }
170
  });
171
 
172
  // Drag and drop handlers
 
199
  processBtn.addEventListener('click', function() {
200
  if (currentFiles.length) {
201
  processFiles(currentFiles);
202
+ } else {
203
+ showStatus('Nenhum arquivo selecionado para processar.', 'error');
204
  }
205
  });
206
 
 
246
 
247
  for (let i = 0; i < files.length && validFiles.length + currentFiles.length < maxFiles; i++) {
248
  const file = files[i];
249
+ if (file.type === 'text/xml' || file.type === 'text/html' || file.type === '' ||
250
+ file.name.endsWith('.xml') || file.name.endsWith('.html') || file.name.endsWith('.htm')) {
251
  validFiles.push(file);
252
  }
253
  }
 
259
 
260
  currentFiles = [...currentFiles, ...validFiles];
261
  processBtn.disabled = false;
262
+ pdfBtn.disabled = true;
263
+ xlsxBtn.disabled = true;
264
  updateFileList();
265
  showStatus(`${currentFiles.length} arquivo(s) selecionado(s). Clique em "Processar Arquivos" para continuar.`, 'success');
266
  } else {
 
291
  }
292
  }
293
 
294
+ window.updateSelectedCount = function() {
295
  const selected = document.querySelectorAll('.file-checkbox:checked').length;
296
  selectedCount.textContent = `${selected} arquivo(s) selecionado(s)`;
297
  pdfBtn.disabled = selected === 0;
298
  }
299
 
300
+ window.removeFile = function(index) {
301
  currentFiles.splice(index, 1);
302
  updateFileList();
303
  if (currentFiles.length === 0) {