|
|
@@ -326,18 +326,17 @@
|
|
|
</div>
|
|
|
<div class="modal-footer" style="background-color: #FFF!important;">
|
|
|
<button type="button" class="btn--ui lightGrey me-2" data-bs-dismiss="modal">ANNULLA</button>
|
|
|
- <button type="button" class="btn--ui primary" wire:click="exportWithDateRange" @if($isExporting) disabled @endif>
|
|
|
- @if($isExporting)
|
|
|
- <div class="d-flex align-items-center">
|
|
|
- <div class="spinner-border spinner-border-sm me-2" role="status">
|
|
|
- <span class="visually-hidden">Loading...</span>
|
|
|
- </div>
|
|
|
- <span id="exportButtonText">ELABORAZIONE...</span>
|
|
|
+ <button type="button" class="btn--ui primary" onclick="handleExportClick()" id="exportButton">
|
|
|
+ <span id="loadingState" style="display: none;">
|
|
|
+ <div class="spinner-border spinner-border-sm me-2" role="status">
|
|
|
+ <span class="visually-hidden">Loading...</span>
|
|
|
</div>
|
|
|
- @else
|
|
|
- <i class="fas fa-download me-1" id="exportIcon"></i>
|
|
|
- <span id="exportButtonText">ESPORTA</span>
|
|
|
- @endif
|
|
|
+ ELABORAZIONE...
|
|
|
+ </span>
|
|
|
+ <span id="normalState">
|
|
|
+ <i class="fas fa-download me-1"></i>
|
|
|
+ ESPORTA
|
|
|
+ </span>
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -1128,5 +1127,32 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+ function handleExportClick() {
|
|
|
+ showExportLoading();
|
|
|
+
|
|
|
+ @this.call('exportWithDateRange');
|
|
|
+ }
|
|
|
+
|
|
|
+ function showExportLoading() {
|
|
|
+ document.getElementById('normalState').style.display = 'none';
|
|
|
+ document.getElementById('loadingState').style.display = 'inline-flex';
|
|
|
+ document.getElementById('exportButton').disabled = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ function hideExportLoading() {
|
|
|
+ document.getElementById('normalState').style.display = 'inline-flex';
|
|
|
+ document.getElementById('loadingState').style.display = 'none';
|
|
|
+ document.getElementById('exportButton').disabled = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Listen for when export is complete
|
|
|
+ Livewire.on('export-complete', function() {
|
|
|
+ hideExportLoading();
|
|
|
+ });
|
|
|
+
|
|
|
+ Livewire.on('hide-export-modal', function() {
|
|
|
+ hideExportLoading();
|
|
|
+ });
|
|
|
</script>
|
|
|
@endpush
|