|
|
@@ -645,8 +645,12 @@ class RecordOUT extends Component
|
|
|
try {
|
|
|
$importCount = 0;
|
|
|
$errorsCount = 0;
|
|
|
+ $totalFiles = count($this->receiptFiles);
|
|
|
|
|
|
- foreach ($this->receiptFiles as $receiptFile) {
|
|
|
+ // disabilita select
|
|
|
+ $this->emit('import-started');
|
|
|
+
|
|
|
+ foreach ($this->receiptFiles as $index => $receiptFile) {
|
|
|
try {
|
|
|
// Carica e analizza il file XML
|
|
|
$xmlString = file_get_contents($receiptFile->getRealPath());
|
|
|
@@ -683,18 +687,22 @@ class RecordOUT extends Component
|
|
|
Log::error('Errore durante l\'importazione della fattura: ' . $e->getMessage());
|
|
|
$errorsCount++;
|
|
|
}
|
|
|
+
|
|
|
+ $progress = ($index + 1) / $totalFiles * 100;
|
|
|
+ $this->emit('update-progress', $progress);
|
|
|
}
|
|
|
|
|
|
- // Mostra messaggi appropriati
|
|
|
$this->showResultMessages($importCount, $errorsCount);
|
|
|
} catch (\Exception $e) {
|
|
|
Log::error('Errore durante l\'importazione dei file XML: ' . $e->getMessage());
|
|
|
session()->flash('error', 'Errore durante l\'importazione: ' . $e->getMessage());
|
|
|
- }
|
|
|
+ } finally {
|
|
|
+ $this->emit('import-finished');
|
|
|
|
|
|
- $this->closeImportModal();
|
|
|
+ $this->closeImportModal();
|
|
|
+ $this->emit('load-data-table');
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
/**
|
|
|
* Estrae i dati dalla fattura elettronica XML
|
|
|
*/
|