199 lines
12 KiB
PHP
199 lines
12 KiB
PHP
<x-filament-panels::page>
|
|
<div class="mx-auto max-w-7xl space-y-4">
|
|
<x-filament.components.page-breadcrumbs
|
|
:breadcrumbs="[
|
|
['label' => 'Contabilità', 'url' => null],
|
|
['label' => 'Fatture ricevute (P7M)', 'url' => null],
|
|
]"
|
|
/>
|
|
|
|
<div x-data="{ tab: 'fe' }" class="space-y-4">
|
|
<x-filament::tabs label="Fatture ricevute">
|
|
<x-filament::tabs.item
|
|
alpine-active="tab === 'fe'"
|
|
x-on:click="tab = 'fe'"
|
|
icon="heroicon-o-document-text"
|
|
>
|
|
FE importate
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
alpine-active="tab === 'scarichi'"
|
|
x-on:click="tab = 'scarichi'"
|
|
icon="heroicon-o-arrow-down-tray"
|
|
>
|
|
Scarichi da Cassetto Fiscale
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
alpine-active="tab === 'ade'"
|
|
x-on:click="tab = 'ade'"
|
|
icon="heroicon-o-clipboard-document-list"
|
|
>
|
|
Lista AdE
|
|
</x-filament::tabs.item>
|
|
</x-filament::tabs>
|
|
|
|
<div x-show="tab === 'fe'">
|
|
<div class="mb-3 rounded-lg border border-sky-200 bg-sky-50 px-4 py-3 text-sm text-sky-900">
|
|
<div class="font-semibold">Stabile attivo per archivio FE</div>
|
|
<div class="mt-1">{{ $this->activeStabileLabel }}</div>
|
|
<div class="mt-1 text-xs text-sky-700">L'elenco mostra solo le fatture collegate allo stabile attivo selezionato nella topbar.</div>
|
|
</div>
|
|
|
|
{{ $this->table }}
|
|
|
|
<div class="mt-2 text-sm text-gray-500">
|
|
Totale fatture: <span class="font-semibold text-gray-700">{{ $this->getArchivioRigheVisteCount() }}</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div x-show="tab === 'scarichi'" x-cloak>
|
|
@php($anno = (int) ($this->cassettoAnno ?? now()->year))
|
|
@php($nowTs = now()->timestamp)
|
|
@php($quarterStatus = $this->getCassettoQuarterStatus($anno))
|
|
@php($cassettoLogs = $this->getCassettoDownloadLogs())
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">Scarichi da Cassetto Fiscale</x-slot>
|
|
|
|
<div class="mb-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900">
|
|
<div class="font-semibold">Destinazione scarico corrente</div>
|
|
<div class="mt-1">{{ $this->activeStabileLabel }}</div>
|
|
<div class="mt-1 text-xs text-amber-700">I trimestri scaricati in questa tab vengono associati allo stabile attivo visibile in topbar al momento del click.</div>
|
|
</div>
|
|
|
|
<div class="flex flex-wrap items-center justify-between gap-3">
|
|
<div class="text-sm text-gray-500">
|
|
Verifica trimestri già scaricati (se completo, evita ulteriori scarichi).
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2">
|
|
<div class="text-xs text-gray-600">Anno</div>
|
|
<select wire:model.live="cassettoAnno" class="fi-input fi-input-wrp fi-select-input text-xs">
|
|
@php($y = (int) now()->year)
|
|
@for($i = 0; $i < 6; $i++)
|
|
@php($yy = $y - $i)
|
|
<option value="{{ $yy }}">{{ $yy }}</option>
|
|
@endfor
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
@if(!empty($quarterStatus))
|
|
<div class="mt-3 overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-left text-gray-500">
|
|
<th class="py-2 pr-4">Trimestre</th>
|
|
<th class="py-2 pr-4">Scarica</th>
|
|
<th class="py-2 pr-4">Periodo</th>
|
|
<th class="py-2 pr-4">Stato</th>
|
|
<th class="py-2 pr-4">Ultimo log</th>
|
|
<th class="py-2 pr-4">Importate</th>
|
|
<th class="py-2 pr-4">Duplicate</th>
|
|
<th class="py-2">Errori</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@foreach($quarterStatus as $row)
|
|
<tr>
|
|
<td class="py-2 pr-4 font-semibold text-gray-800">{{ $row['quarter'] }}</td>
|
|
<td class="py-2 pr-4">
|
|
@php($isComplete = ($row['stato'] ?? '') === 'COMPLETO')
|
|
@php($key = $row['quarter'] . '-' . $anno)
|
|
@php($clickTs = (int) ($this->quarterDownloads[$key] ?? 0))
|
|
@php($isBusy = $clickTs > 0 && ($nowTs - $clickTs) < 120)
|
|
@php($isRunning = ($row['stato'] ?? '') === 'IN CORSO')
|
|
<button
|
|
type="button"
|
|
class="netgescon-btn netgescon-btn-sm {{ ($isComplete || $isBusy || $isRunning) ? 'netgescon-btn-outline-secondary opacity-50 cursor-not-allowed' : 'netgescon-btn-primary' }}"
|
|
{{ ($isComplete || $isBusy || $isRunning) ? 'disabled' : '' }}
|
|
wire:loading.attr="disabled"
|
|
wire:target="downloadCassettoQuarter"
|
|
wire:click="downloadCassettoQuarter('{{ $row['quarter'] }}','{{ $row['dal'] }}','{{ $row['al'] }}',{{ $anno }})"
|
|
>
|
|
<span wire:loading.remove wire:target="downloadCassettoQuarter">Scarica</span>
|
|
<span wire:loading wire:target="downloadCassettoQuarter">Avvio…</span>
|
|
</button>
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ \Carbon\Carbon::parse($row['dal'])->format('d-m-Y') }} → {{ \Carbon\Carbon::parse($row['al'])->format('d-m-Y') }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ $row['stato'] }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
@if(!empty($row['created_at']))
|
|
{{ \Carbon\Carbon::parse($row['created_at'])->format('d-m-Y H:i') }}
|
|
@if(!empty($row['log_id']))
|
|
<span class="text-gray-500">#{{ (int) $row['log_id'] }}</span>
|
|
@endif
|
|
@else
|
|
—
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ (int) $row['imported'] }} / {{ (int) $row['files_total'] }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">{{ (int) $row['duplicates'] }}</td>
|
|
<td class="py-2 whitespace-nowrap">{{ (int) $row['errors'] }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
|
|
@if($cassettoLogs->isNotEmpty())
|
|
<div class="mt-6 overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead>
|
|
<tr class="text-left text-gray-500">
|
|
<th class="py-2 pr-4">Data</th>
|
|
<th class="py-2 pr-4">Periodo</th>
|
|
<th class="py-2 pr-4">Metadati</th>
|
|
<th class="py-2 pr-4">Stato</th>
|
|
<th class="py-2 pr-4">Importate</th>
|
|
<th class="py-2 pr-4">Duplicate</th>
|
|
<th class="py-2 pr-4">Errori</th>
|
|
<th class="py-2">Messaggio</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@foreach($cassettoLogs as $log)
|
|
<tr>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ \Carbon\Carbon::parse($log->created_at)->format('d-m-Y H:i') }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ \Carbon\Carbon::parse($log->dal)->format('d-m-Y') }} → {{ \Carbon\Carbon::parse($log->al)->format('d-m-Y') }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ $log->metadati ? 'Sì' : 'No' }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ strtoupper((string) $log->status) }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">
|
|
{{ (int) $log->imported }} / {{ (int) $log->files_total }}
|
|
</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">{{ (int) $log->duplicates }}</td>
|
|
<td class="py-2 pr-4 whitespace-nowrap">{{ (int) $log->errors }}</td>
|
|
<td class="py-2 break-words">{{ $log->message }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
|
|
<div x-show="tab === 'ade'" x-cloak>
|
|
<livewire:contabilita.stg-fatture-ade-table />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament-panels::page>
|