1056 lines
69 KiB
PHP
1056 lines
69 KiB
PHP
<x-filament-panels::page>
|
|
@php
|
|
$query = request()->query();
|
|
$tab = $this->tab ?? 'bilancio';
|
|
$tab = in_array($tab, ['bilancio', 'crediti', 'debiti', 'conguagli', 'dettaglio'], true) ? $tab : 'bilancio';
|
|
|
|
$fmt = fn($v) => number_format((float) ($v ?? 0), 2, ',', '.');
|
|
$stabile = optional(\App\Support\StabileContext::getActiveStabile(auth()->user()));
|
|
@endphp
|
|
|
|
<div class="space-y-6">
|
|
<div class="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
|
|
<div>
|
|
<div class="text-sm text-gray-500">Stabile attivo</div>
|
|
<div class="text-lg font-semibold">{{ $stabile->denominazione ?? '—' }}</div>
|
|
<div class="text-sm text-gray-500">Codice: <span class="font-medium text-gray-700">{{ $stabile->codice_stabile ?? '—' }}</span></div>
|
|
</div>
|
|
|
|
<form method="get" class="flex flex-col gap-3 md:flex-row md:items-end">
|
|
<input type="hidden" name="tab" value="{{ $tab }}" />
|
|
@if (request()->query('dett'))
|
|
<input type="hidden" name="dett" value="{{ request()->query('dett') }}" />
|
|
@endif
|
|
|
|
<div class="w-64">
|
|
<div class="text-xs text-gray-500 mb-1">Periodo legacy</div>
|
|
<x-filament::input.wrapper>
|
|
<select name="legacy_year" class="w-full bg-transparent">
|
|
<option value="">Tutti</option>
|
|
@foreach($legacyYears as $y)
|
|
<option value="{{ $y }}" @selected((string) ($legacyYear ?? $this->legacyYear ?? '') === (string) $y)>{{ $this->legacyYearLabels[$y] ?? $y }}</option>
|
|
@endforeach
|
|
</select>
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div class="w-56">
|
|
<div class="text-xs text-gray-500 mb-1">Data bilancio di partenza</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="date" name="data" value="{{ $dataBilancio ?? '' }}" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div class="w-56">
|
|
<div class="text-xs text-gray-500 mb-1">Saldo iniziale (manuale)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" name="saldo_manuale" value="{{ $saldoBancaManuale ?? '' }}" placeholder="es. 1.234,56" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<x-filament::button type="submit">Aggiorna</x-filament::button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<x-filament::tabs>
|
|
<x-filament::tabs.item
|
|
:active="$tab === 'bilancio'"
|
|
:href="\App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($query, ['tab' => 'bilancio', 'dett' => null]))"
|
|
wire:click.prevent="$set('tab','bilancio'); $set('dett', null)"
|
|
>
|
|
Bilancio
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
:active="$tab === 'crediti'"
|
|
:href="\App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($query, ['tab' => 'crediti', 'dett' => null]))"
|
|
wire:click.prevent="$set('tab','crediti'); $set('dett', null)"
|
|
>
|
|
Crediti
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
:active="$tab === 'debiti'"
|
|
:href="\App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($query, ['tab' => 'debiti', 'dett' => null]))"
|
|
wire:click.prevent="$set('tab','debiti'); $set('dett', null)"
|
|
>
|
|
Debiti
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
:active="$tab === 'conguagli'"
|
|
:href="\App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($query, ['tab' => 'conguagli', 'dett' => null]))"
|
|
wire:click.prevent="$set('tab','conguagli'); $set('dett', null)"
|
|
>
|
|
Conguagli (Excel)
|
|
</x-filament::tabs.item>
|
|
|
|
<x-filament::tabs.item
|
|
:active="$tab === 'dettaglio'"
|
|
:href="\App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($query, ['tab' => 'dettaglio']))"
|
|
wire:click.prevent="$set('tab','dettaglio')"
|
|
>
|
|
Dettaglio
|
|
</x-filament::tabs.item>
|
|
</x-filament::tabs>
|
|
|
|
@if ($tab === 'dettaglio')
|
|
<x-filament::section>
|
|
<x-slot name="heading">{{ $detailMeta['titolo'] ?? 'Dettaglio' }}</x-slot>
|
|
|
|
@if (($detailMeta['tipo'] ?? null) === 'cre_deb_preced')
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-4">C/D</th>
|
|
<th class="py-2 pr-4">Cod. voce</th>
|
|
<th class="py-2 pr-4">Voce</th>
|
|
<th class="py-2 pr-4">Descrizione</th>
|
|
<th class="py-2 pr-4">Straord.</th>
|
|
<th class="py-2 pr-4 text-right">Importo €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($detailRows ?? []) as $r)
|
|
<tr>
|
|
<td class="py-2 pr-4">{{ $r['c_d'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['cod_voc'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['des_voce'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['descrizione'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['n_stra'] ?? '—' }}</td>
|
|
<td class="py-2 pr-4 text-right">{{ $fmt($r['importo_euro'] ?? 0) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="py-3 text-gray-500">Nessun dato disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@elseif (($detailMeta['tipo'] ?? null) === 'dett_tab')
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-4">Tabella</th>
|
|
<th class="py-2 pr-4">Condomino</th>
|
|
<th class="py-2 pr-4">Inquilino</th>
|
|
<th class="py-2 pr-4">MM</th>
|
|
<th class="py-2 pr-4">Straord.</th>
|
|
<th class="py-2 pr-4 text-right">Cons. €</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($detailRows ?? []) as $r)
|
|
<tr>
|
|
<td class="py-2 pr-4">{{ $r['cod_tab'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['id_cond'] }}</td>
|
|
<td class="py-2 pr-4">{{ $r['cond_inquil'] ?: '—' }}</td>
|
|
<td class="py-2 pr-4">{{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '—' }}</td>
|
|
<td class="py-2 pr-4">{{ $r['n_stra'] ?? '—' }}</td>
|
|
<td class="py-2 pr-4 text-right">{{ $fmt($r['cons_euro'] ?? 0) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="py-3 text-gray-500">Nessun dato disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="text-sm text-gray-500">Seleziona un dettaglio dal tab Bilancio.</div>
|
|
@endif
|
|
</x-filament::section>
|
|
@elseif ($tab === 'conguagli')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Conguagli (stile Excel)</x-slot>
|
|
<x-slot name="description">Raggruppati per condomino e per tabella CONG.* (include straordinarie quando presenti).</x-slot>
|
|
|
|
@php
|
|
$manualConguagliEnabled = \Illuminate\Support\Facades\Schema::hasTable('contabilita_situazione_iniziale_conguagli');
|
|
@endphp
|
|
|
|
@if ($manualConguagliEnabled)
|
|
<form wire:submit.prevent="addConguaglioManuale" class="mb-4 grid grid-cols-1 md:grid-cols-4 gap-3">
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Tabella</div>
|
|
<x-filament::input.wrapper>
|
|
<select wire:model="formConguaglio.cod_tab" class="w-full bg-transparent">
|
|
<option value="CONG.O">CONG.O (Ordinaria)</option>
|
|
<option value="CONG.R">CONG.R (Riscaldamento)</option>
|
|
<option value="CONG.S">CONG.S</option>
|
|
<option value="CONG">CONG</option>
|
|
</select>
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">n_stra (opzionale)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model="formConguaglio.n_stra" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Condomino (id_cond)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formConguaglio.id_cond" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Consuntivo € (positivo=incasso, negativo=rimborso)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formConguaglio.cons_euro" class="w-full bg-transparent" placeholder="es. 123,45 oppure -50,00" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div class="md:col-span-4">
|
|
<x-filament::button type="submit">Aggiungi conguaglio (manuale)</x-filament::button>
|
|
</div>
|
|
</form>
|
|
@endif
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-4">Condomino</th>
|
|
@foreach(($conguagliExcelCols ?? []) as $c)
|
|
<th class="py-2 pr-4 text-right whitespace-nowrap">{{ $c['label'] }}</th>
|
|
@endforeach
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($conguagliExcel ?? []) as $r)
|
|
<tr>
|
|
<td class="py-2 pr-4">
|
|
<div class="font-medium">{{ $r['id_cond'] }}</div>
|
|
<div class="text-xs text-gray-500">{{ $r['cond_label'] ?? '' }}</div>
|
|
</td>
|
|
@foreach(($conguagliExcelCols ?? []) as $c)
|
|
@php $v = $r['cells'][$c['key']] ?? 0.0; @endphp
|
|
<td class="py-2 pr-4 text-right">{{ $fmt($v) }}</td>
|
|
@endforeach
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td class="py-3 text-gray-500" colspan="{{ 1 + count($conguagliExcelCols ?? []) }}">Nessun conguaglio disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-6">
|
|
<div class="text-sm font-semibold mb-2">Modifica righe (dett_tab)</div>
|
|
|
|
<div class="text-xs text-gray-500 mb-2">Suggerimento: clicca una riga per modificarla (una alla volta).</div>
|
|
|
|
<form wire:submit.prevent="addDettTabRow" class="mb-3 grid grid-cols-1 md:grid-cols-6 gap-2">
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Tabella</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formDettTabAdd.cod_tab" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">id_cond</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formDettTabAdd.id_cond" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">n_stra</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model="formDettTabAdd.n_stra" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">cons_euro</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formDettTabAdd.cons_euro" class="w-full bg-transparent" placeholder="es. 10,00 o -5,00" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">mm</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formDettTabAdd.mm" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="flex items-end">
|
|
<x-filament::button type="submit">Aggiungi riga</x-filament::button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-3">Tabella</th>
|
|
<th class="py-2 pr-3">id_cond</th>
|
|
<th class="py-2 pr-3">Condomino</th>
|
|
<th class="py-2 pr-3">n_stra</th>
|
|
<th class="py-2 pr-3 text-right">Cons. €</th>
|
|
<th class="py-2 pr-3 text-right">MM</th>
|
|
<th class="py-2 pr-3">Unico</th>
|
|
<th class="py-2 pr-3">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($dettTabRows ?? []) as $r)
|
|
@php $id = (int) ($r['id'] ?? 0); @endphp
|
|
@php $isEditing = (int) ($this->editingDettTabId ?? 0) === $id; @endphp
|
|
<tr class="cursor-pointer" wire:click="editDettTabRow({{ $id }})">
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.cod_tab" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="font-medium">{{ $r['cod_tab'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.id_cond" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $r['id_cond'] }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
<div class="text-xs text-gray-500">{{ $r['cond_label'] ?? '' }}</div>
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model.defer="dettTabEdit.{{ $id }}.n_stra" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $r['n_stra'] ?? '—' }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 text-right">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.cons_euro" class="w-full bg-transparent text-right" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $fmt($r['cons_euro'] ?? 0) }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 text-right">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="dettTabEdit.{{ $id }}.mm" class="w-full bg-transparent text-right" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $r['mm'] !== null ? number_format((float) $r['mm'], 3, ',', '.') : '—' }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<input type="checkbox" wire:model.defer="dettTabEdit.{{ $id }}.unico" wire:click.stop />
|
|
@else
|
|
<span class="text-gray-500">{{ !empty($r['unico']) ? '✓' : '—' }}</span>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">
|
|
@if($isEditing)
|
|
<x-filament::button size="sm" wire:click.stop="saveDettTabRow({{ $id }})">Salva</x-filament::button>
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="cancelEditDettTabRow">Annulla</x-filament::button>
|
|
<x-filament::button size="sm" color="danger" wire:click.stop="deleteDettTabRow({{ $id }})">Elimina</x-filament::button>
|
|
@else
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="editDettTabRow({{ $id }})">Modifica</x-filament::button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="8" class="py-3 text-gray-500">Nessuna riga dett_tab disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
@elseif ($tab === 'crediti')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Crediti</x-slot>
|
|
@php
|
|
$manualVociEnabled = \Illuminate\Support\Facades\Schema::hasTable('contabilita_situazione_iniziale_voci');
|
|
@endphp
|
|
|
|
@if ($manualVociEnabled)
|
|
<form wire:submit.prevent="addVoceManuale" class="grid grid-cols-1 md:grid-cols-4 gap-3">
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Gestione</div>
|
|
<x-filament::input.wrapper>
|
|
<select wire:model="formVoce.gestione" class="w-full bg-transparent">
|
|
<option value="ordinaria">Ordinaria</option>
|
|
<option value="riscaldamento">Riscaldamento</option>
|
|
<option value="straordinaria">Straordinaria</option>
|
|
</select>
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">n_stra (solo se Straordinaria)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model="formVoce.n_stra" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Codice (opzionale)</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formVoce.codice" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Importo €</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formVoce.importo_euro" class="w-full bg-transparent" placeholder="es. 1.234,56" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div class="md:col-span-4">
|
|
<div class="text-xs text-gray-500 mb-1">Descrizione</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formVoce.descrizione" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
|
|
<div class="md:col-span-4">
|
|
<x-filament::button type="submit" wire:click="$set('formVoce.categoria','crediti')">Aggiungi credito (manuale)</x-filament::button>
|
|
</div>
|
|
</form>
|
|
@endif
|
|
|
|
<div class="mt-6">
|
|
<div class="text-sm font-semibold mb-2">Crediti legacy (Cre_Deb_preced)</div>
|
|
|
|
<div class="text-xs text-gray-500 mb-2">Suggerimento: clicca una riga per modificarla (una alla volta).</div>
|
|
|
|
<form wire:submit.prevent="addCreDebRow('C')" class="mb-3 grid grid-cols-1 md:grid-cols-6 gap-2">
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Cod_voc</div>
|
|
<x-filament::input.wrapper>
|
|
@if(!empty($vocSpeOptions ?? []))
|
|
<select wire:model="formCreDebAdd.cod_voc" class="w-full bg-transparent">
|
|
<option value="">—</option>
|
|
@foreach(($vocSpeOptions ?? []) as $k => $v)
|
|
<option value="{{ $k }}">{{ $v }}</option>
|
|
@endforeach
|
|
</select>
|
|
@else
|
|
<input type="text" wire:model="formCreDebAdd.cod_voc" class="w-full bg-transparent" />
|
|
@endif
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<div class="text-xs text-gray-500 mb-1">Des_voce</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.des_voce" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<div class="text-xs text-gray-500 mb-1">Descrizione</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.descrizione" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Importo €</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.importo_euro" class="w-full bg-transparent" placeholder="es. 100,00" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-6">
|
|
<x-filament::button type="submit">Aggiungi riga credito</x-filament::button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-3">Cod_voc</th>
|
|
<th class="py-2 pr-3">Des_voce</th>
|
|
<th class="py-2 pr-3">Descrizione</th>
|
|
<th class="py-2 pr-3">n_stra</th>
|
|
<th class="py-2 pr-3 text-right">Importo €</th>
|
|
<th class="py-2 pr-3">Incl.</th>
|
|
<th class="py-2 pr-3">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($creDebRows ?? []) as $r)
|
|
@php $id = (int) ($r['id'] ?? 0); @endphp
|
|
@php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp
|
|
<tr class="cursor-pointer" wire:click="selectCreDebRow({{ $id }})">
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.cod_voc" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="font-medium">{{ $r['cod_voc'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.des_voce" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="font-medium">{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.descrizione" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="text-gray-700">{{ $r['descrizione'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model.defer="creDebEdit.{{ $id }}.n_stra" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $r['n_stra'] ?? '—' }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 text-right">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.importo_euro" class="w-full bg-transparent text-right" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $fmt($r['importo_euro'] ?? 0) }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<input type="checkbox" wire:model.defer="creDebEdit.{{ $id }}.incluso" wire:click.stop />
|
|
@else
|
|
<span class="text-gray-500">{{ !empty($r['incluso']) ? '✓' : '—' }}</span>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">
|
|
@if($isEditing)
|
|
<x-filament::button size="sm" wire:click.stop="saveCreDebRow({{ $id }})">Salva</x-filament::button>
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="cancelEditCreDebRow">Annulla</x-filament::button>
|
|
<x-filament::button size="sm" color="danger" wire:click.stop="deleteCreDebRow({{ $id }})">Elimina</x-filament::button>
|
|
@else
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="editCreDebRow({{ $id }})">Modifica</x-filament::button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="py-3 text-gray-500">Nessun credito legacy disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@php
|
|
$totCreditiInclusi = 0.0;
|
|
foreach (($creDebRows ?? []) as $rr) {
|
|
if (!empty($rr['incluso'])) {
|
|
$totCreditiInclusi += (float) str_replace(',', '.', (string) ($rr['importo_euro'] ?? 0));
|
|
}
|
|
}
|
|
@endphp
|
|
<div class="mt-2 text-sm text-gray-600">Totale crediti (solo inclusi): <span class="font-semibold">{{ $fmt($totCreditiInclusi) }}</span></div>
|
|
</div>
|
|
</x-filament::section>
|
|
@elseif ($tab === 'debiti')
|
|
<x-filament::section>
|
|
<x-slot name="heading">Debiti</x-slot>
|
|
|
|
<div class="mt-6">
|
|
<div class="text-sm font-semibold mb-2">Debiti legacy (Cre_Deb_preced)</div>
|
|
|
|
<div class="text-xs text-gray-500 mb-2">Suggerimento: clicca una riga per modificarla (una alla volta).</div>
|
|
|
|
<form wire:submit.prevent="addCreDebRow('D')" class="mb-3 grid grid-cols-1 md:grid-cols-6 gap-2">
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Cod_voc</div>
|
|
<x-filament::input.wrapper>
|
|
@if(!empty($vocSpeOptions ?? []))
|
|
<select wire:model="formCreDebAdd.cod_voc" class="w-full bg-transparent">
|
|
<option value="">—</option>
|
|
@foreach(($vocSpeOptions ?? []) as $k => $v)
|
|
<option value="{{ $k }}">{{ $v }}</option>
|
|
@endforeach
|
|
</select>
|
|
@else
|
|
<input type="text" wire:model="formCreDebAdd.cod_voc" class="w-full bg-transparent" />
|
|
@endif
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<div class="text-xs text-gray-500 mb-1">Des_voce</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.des_voce" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<div class="text-xs text-gray-500 mb-1">Descrizione</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.descrizione" class="w-full bg-transparent" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div>
|
|
<div class="text-xs text-gray-500 mb-1">Importo €</div>
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model="formCreDebAdd.importo_euro" class="w-full bg-transparent" placeholder="es. 100,00" />
|
|
</x-filament::input.wrapper>
|
|
</div>
|
|
<div class="md:col-span-6">
|
|
<x-filament::button type="submit">Aggiungi riga debito</x-filament::button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-3">Cod_voc</th>
|
|
<th class="py-2 pr-3">Des_voce</th>
|
|
<th class="py-2 pr-3">Descrizione</th>
|
|
<th class="py-2 pr-3">n_stra</th>
|
|
<th class="py-2 pr-3 text-right">Importo €</th>
|
|
<th class="py-2 pr-3">Incl.</th>
|
|
<th class="py-2 pr-3">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($creDebRows ?? []) as $r)
|
|
@php $id = (int) ($r['id'] ?? 0); @endphp
|
|
@php $isEditing = (int) ($this->editingCreDebId ?? 0) === $id; @endphp
|
|
<tr class="cursor-pointer" wire:click="selectCreDebRow({{ $id }})">
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.cod_voc" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="font-medium">{{ $r['cod_voc'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.des_voce" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="font-medium">{{ ($r['voc_spe_descriz'] ?? '') !== '' ? $r['voc_spe_descriz'] : ($r['des_voce'] ?? '') }}</div>
|
|
@if(($r['voc_spe_preventivo_euro'] ?? null) !== null || ($r['voc_spe_consuntivo_euro'] ?? null) !== null)
|
|
<div class="text-xs text-gray-500">
|
|
@if(($r['voc_spe_preventivo_euro'] ?? null) !== null) Prev: {{ $fmt($r['voc_spe_preventivo_euro']) }} @endif
|
|
@if(($r['voc_spe_consuntivo_euro'] ?? null) !== null) · Cons: {{ $fmt($r['voc_spe_consuntivo_euro']) }} @endif
|
|
</div>
|
|
@endif
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.descrizione" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
<div class="text-gray-700">{{ $r['descrizione'] }}</div>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="number" wire:model.defer="creDebEdit.{{ $id }}.n_stra" class="w-full bg-transparent" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $r['n_stra'] ?? '—' }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 text-right">
|
|
@if($isEditing)
|
|
<x-filament::input.wrapper>
|
|
<input type="text" wire:model.defer="creDebEdit.{{ $id }}.importo_euro" class="w-full bg-transparent text-right" wire:click.stop />
|
|
</x-filament::input.wrapper>
|
|
@else
|
|
{{ $fmt($r['importo_euro'] ?? 0) }}
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3">
|
|
@if($isEditing)
|
|
<input type="checkbox" wire:model.defer="creDebEdit.{{ $id }}.incluso" wire:click.stop />
|
|
@else
|
|
<span class="text-gray-500">{{ !empty($r['incluso']) ? '✓' : '—' }}</span>
|
|
@endif
|
|
</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">
|
|
@if($isEditing)
|
|
<x-filament::button size="sm" wire:click.stop="saveCreDebRow({{ $id }})">Salva</x-filament::button>
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="cancelEditCreDebRow">Annulla</x-filament::button>
|
|
<x-filament::button size="sm" color="danger" wire:click.stop="deleteCreDebRow({{ $id }})">Elimina</x-filament::button>
|
|
@else
|
|
<x-filament::button size="sm" color="gray" wire:click.stop="editCreDebRow({{ $id }})">Modifica</x-filament::button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="7" class="py-3 text-gray-500">Nessun debito legacy disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@php
|
|
$totDebitiInclusi = 0.0;
|
|
foreach (($creDebRows ?? []) as $rr) {
|
|
if (!empty($rr['incluso'])) {
|
|
$totDebitiInclusi += (float) str_replace(',', '.', (string) ($rr['importo_euro'] ?? 0));
|
|
}
|
|
}
|
|
@endphp
|
|
<div class="mt-2 text-sm text-gray-600">Totale debiti (solo inclusi): <span class="font-semibold">{{ $fmt($totDebitiInclusi) }}</span></div>
|
|
|
|
@php
|
|
$selected = null;
|
|
if (!empty($this->selectedCreDebId)) {
|
|
foreach (($creDebRows ?? []) as $rr) {
|
|
if ((int)($rr['id'] ?? 0) === (int)$this->selectedCreDebId) { $selected = $rr; break; }
|
|
}
|
|
}
|
|
@endphp
|
|
|
|
@if($selected)
|
|
<div class="mt-4">
|
|
<x-filament::section>
|
|
<x-slot name="heading">Dettaglio riga selezionata</x-slot>
|
|
|
|
<div class="mb-3">
|
|
<x-filament::tabs>
|
|
<x-filament::tabs.item
|
|
:active="$detailTab === 'voce'"
|
|
wire:click="setDetailTab('voce')"
|
|
>Voce</x-filament::tabs.item>
|
|
<x-filament::tabs.item
|
|
:active="$detailTab === 'fe'"
|
|
wire:click="setDetailTab('fe')"
|
|
>Fatture FE</x-filament::tabs.item>
|
|
<x-filament::tabs.item
|
|
:active="$detailTab === 'ra'"
|
|
wire:click="setDetailTab('ra')"
|
|
>Registro RA</x-filament::tabs.item>
|
|
</x-filament::tabs>
|
|
</div>
|
|
|
|
@if($detailTab === 'voce')
|
|
<div class="text-sm text-gray-700">
|
|
<div><span class="text-gray-500">Cod_voc:</span> <span class="font-medium">{{ $selected['cod_voc'] }}</span></div>
|
|
<div><span class="text-gray-500">Voce (voc_spe.descriz):</span> <span class="font-medium">{{ ($selected['voc_spe_descriz'] ?? '') !== '' ? $selected['voc_spe_descriz'] : '—' }}</span></div>
|
|
<div class="mt-1 text-gray-500">
|
|
Preventivo €: <span class="font-medium">{{ ($selected['voc_spe_preventivo_euro'] ?? null) !== null ? $fmt($selected['voc_spe_preventivo_euro']) : '—' }}</span>
|
|
· Consuntivo €: <span class="font-medium">{{ ($selected['voc_spe_consuntivo_euro'] ?? null) !== null ? $fmt($selected['voc_spe_consuntivo_euro']) : '—' }}</span>
|
|
</div>
|
|
</div>
|
|
@elseif($detailTab === 'fe')
|
|
<div class="text-xs text-gray-500 mb-2">Fatture passive non pagate (ordinate dalle più vecchie). Usa “Collega” per associare la fattura a questo debito.</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-3">Data</th>
|
|
<th class="py-2 pr-3">N.</th>
|
|
<th class="py-2 pr-3">Fornitore</th>
|
|
<th class="py-2 pr-3 text-right">Totale</th>
|
|
<th class="py-2 pr-3">Stato</th>
|
|
<th class="py-2 pr-3">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($feRows ?? []) as $f)
|
|
@php $fid = (int) ($f['id'] ?? 0); @endphp
|
|
@php $isLinked = in_array($fid, ($linkedFeIds ?? []), true); @endphp
|
|
<tr>
|
|
<td class="py-2 pr-3 whitespace-nowrap">{{ $f['data_fattura'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">{{ $f['numero_fattura'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3">{{ $f['fornitore_denominazione'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3 text-right">{{ ($f['totale'] ?? null) !== null ? $fmt($f['totale']) : '—' }}</td>
|
|
<td class="py-2 pr-3">{{ $f['stato'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">
|
|
@if($isLinked)
|
|
<x-filament::button size="sm" color="danger" wire:click.stop="unlinkFatturaElettronica({{ $fid }})">Scollega</x-filament::button>
|
|
@else
|
|
<x-filament::button size="sm" wire:click.stop="linkFatturaElettronica({{ $fid }})">Collega</x-filament::button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="py-3 text-gray-500">Nessuna fattura FE da pagare trovata.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@else
|
|
<div class="text-xs text-gray-500 mb-2">Registro ritenute “da versare”/“compensata” per lo stabile. Collega la ritenuta a questo debito (Erario) quando serve.</div>
|
|
<div class="overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-3">Data</th>
|
|
<th class="py-2 pr-3">Prog.</th>
|
|
<th class="py-2 pr-3">Fornitore</th>
|
|
<th class="py-2 pr-3 text-right">Ritenuta</th>
|
|
<th class="py-2 pr-3">Stato</th>
|
|
<th class="py-2 pr-3">Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($raRows ?? []) as $ra)
|
|
@php $rid = (int) ($ra['id'] ?? 0); @endphp
|
|
@php $isLinked = in_array($rid, ($linkedRaIds ?? []), true); @endphp
|
|
<tr>
|
|
<td class="py-2 pr-3 whitespace-nowrap">{{ $ra['data_competenza'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">{{ $ra['numero_progressivo'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3">{{ ($ra['fornitore'] ?? '') !== '' ? $ra['fornitore'] : '—' }}</td>
|
|
<td class="py-2 pr-3 text-right">{{ ($ra['importo_ritenuta'] ?? null) !== null ? $fmt($ra['importo_ritenuta']) : '—' }}</td>
|
|
<td class="py-2 pr-3">{{ $ra['stato_versamento'] ?? '—' }}</td>
|
|
<td class="py-2 pr-3 whitespace-nowrap">
|
|
@if($isLinked)
|
|
<x-filament::button size="sm" color="danger" wire:click.stop="unlinkRegistroRa({{ $rid }})">Scollega</x-filament::button>
|
|
@else
|
|
<x-filament::button size="sm" wire:click.stop="linkRegistroRa({{ $rid }})">Collega</x-filament::button>
|
|
@endif
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="6" class="py-3 text-gray-500">Nessuna ritenuta RA “da versare” trovata.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
@endif
|
|
</x-filament::section>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</x-filament::section>
|
|
@else
|
|
@php
|
|
$baseParams = array_merge($query, ['tab' => 'dettaglio']);
|
|
$link = fn(string $dett) => \App\Filament\Pages\Contabilita\SituazioneIniziale::getUrl(panel: 'admin-filament', parameters: array_merge($baseParams, ['dett' => $dett]));
|
|
|
|
$saldoBancaTot = $bilancio['banca']['saldo_letto'] ?? null;
|
|
$saldoBancaTot = is_numeric($saldoBancaTot) ? (float) $saldoBancaTot : null;
|
|
$saldoBancaAtt = $saldoBancaTot !== null && $saldoBancaTot >= 0 ? $saldoBancaTot : null;
|
|
$saldoBancaPas = $saldoBancaTot !== null && $saldoBancaTot < 0 ? abs($saldoBancaTot) : null;
|
|
|
|
$delta = $bilancio['banca']['delta_letto'] ?? null; // banca - finanziario
|
|
$delta = is_numeric($delta) ? (float) $delta : null;
|
|
$mancanza = $delta !== null ? abs($delta) : null;
|
|
@endphp
|
|
|
|
<div class="space-y-4">
|
|
<x-filament::section>
|
|
<x-slot name="heading">SALDO BANCA INIZIALE ALLA DATA</x-slot>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-sm font-semibold">ATTIVITÀ</div>
|
|
<div class="mt-2 text-2xl font-semibold">{{ $saldoBancaAtt !== null ? $fmt($saldoBancaAtt) : '—' }}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-sm font-semibold">PASSIVITÀ</div>
|
|
<div class="mt-2 text-2xl font-semibold">{{ $saldoBancaPas !== null ? $fmt($saldoBancaPas) : '—' }}</div>
|
|
</div>
|
|
|
|
<div class="md:col-span-2">
|
|
<div class="text-sm text-gray-500">Risorse finanziarie (tutti i conti) alla data</div>
|
|
<div class="mt-2 overflow-x-auto">
|
|
<table class="min-w-full text-sm">
|
|
<thead class="text-left text-gray-500">
|
|
<tr>
|
|
<th class="py-2 pr-4">Conto</th>
|
|
<th class="py-2 pr-4 text-right">Saldo</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y">
|
|
@forelse(($risorseFinanziarie ?? []) as $r)
|
|
<tr>
|
|
<td class="py-2 pr-4">{{ $r['label'] }}</td>
|
|
<td class="py-2 pr-4 text-right">{{ $fmt($r['saldo'] ?? 0) }}</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="2" class="py-3 text-gray-500">Nessun conto bancario disponibile.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-3 text-sm text-gray-500">FINANZIARIO (Attività - Passività): <span class="font-semibold">{{ $fmt($bilancio['finanziario'] ?? 0) }}</span></div>
|
|
<div class="text-sm text-gray-500">Delta banca - finanziario: <span class="font-semibold">{{ $delta !== null ? $fmt($delta) : '—' }}</span></div>
|
|
@if ($delta !== null)
|
|
@if (abs($delta) <= 0.01)
|
|
<div class="mt-1 text-sm font-semibold">Quadratura OK (0)</div>
|
|
@elseif ($delta < 0)
|
|
<div class="mt-1 text-sm text-gray-700">Mancano PASSIVITÀ (oppure ci sono ATTIVITÀ in eccesso) per: <span class="font-semibold">{{ $mancanza !== null ? $fmt($mancanza) : '—' }}</span></div>
|
|
@else
|
|
<div class="mt-1 text-sm text-gray-700">Mancano ATTIVITÀ (oppure ci sono PASSIVITÀ in eccesso) per: <span class="font-semibold">{{ $mancanza !== null ? $fmt($mancanza) : '—' }}</span></div>
|
|
@endif
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">ORDINARIA</x-slot>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-sm font-semibold">ATTIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA INCASSARE (+)</span>
|
|
<a class="font-medium" href="{{ $link('cong_pos_ordinaria') }}">{{ $fmt($bilancio['ordinaria']['cong_pos'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CREDITI</span>
|
|
<a class="font-medium" href="{{ $link('crediti_ordinaria') }}">{{ $fmt($bilancio['ordinaria']['crediti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-sm font-semibold">PASSIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA RIMBORSARE (-)</span>
|
|
<a class="font-medium" href="{{ $link('cong_neg_ordinaria') }}">{{ $fmt($bilancio['ordinaria']['cong_neg'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">DEBITI</span>
|
|
<a class="font-medium" href="{{ $link('debiti_ordinaria') }}">{{ $fmt($bilancio['ordinaria']['debiti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">RISCALDAMENTO</x-slot>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-sm font-semibold">ATTIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA INCASSARE (+)</span>
|
|
<a class="font-medium" href="{{ $link('cong_pos_riscaldamento') }}">{{ $fmt($bilancio['riscaldamento']['cong_pos'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CREDITI</span>
|
|
<a class="font-medium" href="{{ $link('crediti_riscaldamento') }}">{{ $fmt($bilancio['riscaldamento']['crediti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-sm font-semibold">PASSIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA RIMBORSARE (-)</span>
|
|
<a class="font-medium" href="{{ $link('cong_neg_riscaldamento') }}">{{ $fmt($bilancio['riscaldamento']['cong_neg'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">DEBITI</span>
|
|
<a class="font-medium" href="{{ $link('debiti_riscaldamento') }}">{{ $fmt($bilancio['riscaldamento']['debiti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">TUTTE LE SPESE STRAORDINARIE</x-slot>
|
|
<div class="space-y-4">
|
|
@forelse(($bilancio['straordinarie'] ?? []) as $straKey => $row)
|
|
<div class="rounded-lg border p-4">
|
|
<div class="font-semibold">{{ $row['label'] ?? $row['titolo'] ?? ('Straordinaria #' . ($row['n_stra'] ?? $straKey)) }}</div>
|
|
<div class="mt-3 grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-sm font-semibold">ATTIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA INCASSARE (+)</span>
|
|
<a class="font-medium" href="{{ $link('cong_pos_stra_' . ($row['key'] ?? $straKey)) }}">{{ $fmt($row['cong_pos'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CREDITI</span>
|
|
<a class="font-medium" href="{{ $link('crediti_stra_' . ($row['key'] ?? $straKey)) }}">{{ $fmt($row['crediti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-sm font-semibold">PASSIVITÀ</div>
|
|
<div class="mt-2 space-y-2 text-sm">
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">CONGUAGLI DA RIMBORSARE (-)</span>
|
|
<a class="font-medium" href="{{ $link('cong_neg_stra_' . ($row['key'] ?? $straKey)) }}">{{ $fmt($row['cong_neg'] ?? 0) }}</a>
|
|
</div>
|
|
<div class="flex items-center justify-between gap-3">
|
|
<span class="text-gray-500">DEBITI</span>
|
|
<a class="font-medium" href="{{ $link('debiti_stra_' . ($row['key'] ?? $straKey)) }}">{{ $fmt($row['debiti'] ?? 0) }}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<div class="text-sm text-gray-500">Nessuna straordinaria trovata.</div>
|
|
@endforelse
|
|
</div>
|
|
</x-filament::section>
|
|
|
|
<x-filament::section>
|
|
<x-slot name="heading">TOTALI GENERALI (STABILE)</x-slot>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div>
|
|
<div class="text-sm font-semibold">Tot. ATTIVITÀ</div>
|
|
<div class="mt-2 text-2xl font-semibold">{{ $fmt($bilancio['tot_attivita'] ?? 0) }}</div>
|
|
</div>
|
|
<div>
|
|
<div class="text-sm font-semibold">Tot. PASSIVITÀ</div>
|
|
<div class="mt-2 text-2xl font-semibold">{{ $fmt($bilancio['tot_passivita'] ?? 0) }}</div>
|
|
</div>
|
|
<div class="md:col-span-2">
|
|
<div class="text-sm text-gray-500">FINANZIARIO (Attività - Passività): <span class="font-semibold">{{ $fmt($bilancio['finanziario'] ?? 0) }}</span></div>
|
|
</div>
|
|
</div>
|
|
</x-filament::section>
|
|
</div>
|
|
|
|
@endif
|
|
</div>
|
|
</x-filament-panels::page>
|