|
@@ -118,29 +118,6 @@
|
|
|
window.livewire.emit('refresh');
|
|
window.livewire.emit('refresh');
|
|
|
}, 200);
|
|
}, 200);
|
|
|
});
|
|
});
|
|
|
-
|
|
|
|
|
- document.getElementById('allegati').addEventListener('change', function(e) {
|
|
|
|
|
- const maxFileSize = 2 * 1024 * 1024; // 2MB in bytes
|
|
|
|
|
- const errorElement = document.getElementById('file-size-error');
|
|
|
|
|
- errorElement.style.display = 'none';
|
|
|
|
|
- errorElement.textContent = '';
|
|
|
|
|
-
|
|
|
|
|
- if (this.files.length > 0) {
|
|
|
|
|
- for (let i = 0; i < this.files.length; i++) {
|
|
|
|
|
- const file = this.files[i];
|
|
|
|
|
- console.log('File ' + (i+1) + ' size: ' + file.size + ' bytes');
|
|
|
|
|
-
|
|
|
|
|
- if (file.size > maxFileSize) {
|
|
|
|
|
- errorElement.style.display = 'block';
|
|
|
|
|
- errorElement.textContent = 'Errore: Il file "' + file.name + '" è troppo grande (' +
|
|
|
|
|
- Math.round(file.size / 1024 / 1024 * 10) / 10 + 'MB). La dimensione massima è 2MB.';
|
|
|
|
|
- // Clear the file input
|
|
|
|
|
- this.value = '';
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
@endpush
|
|
@endpush
|