netgescon-day0/resources/views/filament/pages/contabilita/voci-spesa-prospetto.blade.php

195 lines
12 KiB
PHP
Executable File

<x-filament-panels::page>
<div class="space-y-3">
<div class="rounded-lg border overflow-hidden">
<div class="bg-danger-600 px-4 py-3">
<div class="text-white text-sm font-semibold">Voci di spesa</div>
</div>
<div class="bg-warning-50 px-4 py-4 space-y-2">
@if(($this->tipoGestioneTab ?? 'ordinaria') === 'acqua')
<div class="mb-4 p-4 rounded-lg bg-blue-50 border border-blue-200 flex flex-col md:flex-row items-center justify-between gap-4">
<div class="flex items-center gap-3">
<svg class="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M11.25 11.25l.041-.02a.75.75 0 111.086 1.086L13 13.75l.04.02a.75.75 0 11-1.08 1.08l-.71-.71a.75.75 0 010-1.06l.71-.71z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v.008H12v-.008zm0-6.75C6.885 2.25 2.25 6.885 2.25 12s4.635 9.75 9.75 9.75 9.75-4.635 9.75-9.75S17.115 2.25 12 2.25z" />
</svg>
<div>
<div class="text-sm font-semibold text-blue-900">Configurazione e Letture Acqua</div>
<div class="text-xs text-blue-700">Le tariffe, i consumi e le letture dell'acqua sono gestite nella sezione Servizi e Utenze dello Stabile.</div>
</div>
</div>
<x-filament::button
color="info"
tag="a"
href="/admin-filament/condomini/servizi-utenze"
icon="heroicon-m-arrow-right"
>
Vai a Servizi / Utenze Acqua
</x-filament::button>
</div>
@endif
<div class="flex flex-wrap items-center justify-between gap-3">
@php
$tabs = [
'ordinaria' => 'ORDINARIE',
'acqua' => 'ACQUA',
'riscaldamento' => 'RISCALDAMENTO',
'straordinaria' => 'STRAORDINARIE',
];
@endphp
<div class="flex flex-wrap gap-2">
@foreach($tabs as $key => $label)
@php
$active = ($this->tipoGestioneTab ?? 'ordinaria') === $key;
$btnClass = $active
? 'fi-btn fi-btn-color-primary fi-btn-size-sm'
: 'fi-btn fi-btn-color-gray fi-btn-size-sm';
@endphp
<button
type="button"
wire:click="setTipoGestioneTab('{{ $key }}')"
class="{{ $btnClass }}"
>
{{ $label }}
</button>
@endforeach
</div>
<div class="flex flex-wrap items-center gap-3">
<div class="flex items-center gap-2">
<div class="text-xs font-medium text-gray-700">Anno</div>
<select
wire:model.live="gestioneContabileId"
class="fi-input fi-input-wrp fi-select-input text-xs"
>
<option value="">Tutte</option>
@foreach($this->getGestioniOptions() as $id => $label)
<option value="{{ $id }}">{{ $label }}</option>
@endforeach
</select>
</div>
<div class="flex items-center gap-2">
<div class="text-xs font-medium text-gray-700">Preset ripartizione</div>
<select
wire:model.live="presetRipartizione"
class="fi-input fi-input-wrp fi-select-input text-xs"
>
<option value="manuale">Manuale</option>
<option value="confedilizia">Confedilizia</option>
</select>
</div>
<label class="flex items-center gap-2 text-xs font-medium text-gray-700">
<input type="checkbox" wire:model.live="hideFirstTwoTabelle" class="fi-checkbox-input">
Nascondi prime 2 tabelle
</label>
</div>
</div>
<div class="rounded-lg border bg-white text-[12px] leading-tight [&_th]:py-1.5 [&_td]:py-1.5 [&_.fi-ta-cell]:py-1 [&_.fi-ta-actions]:gap-1 [&_.fi-ta-actions]:whitespace-nowrap">
{{ $this->table }}
</div>
@php($tabellaOptions = $this->getTabelleMillesimaliOptions())
@php($focus = $this->getDettaglioTabellaFocus())
@if(!empty($tabellaOptions))
<div class="rounded-lg border bg-white px-3 py-2">
<div class="flex flex-wrap items-center justify-between gap-2">
<div class="text-xs font-semibold text-gray-700">Dettaglio tabella</div>
<div class="flex items-center gap-2">
<div class="text-xs text-gray-600">Tabella</div>
<select wire:model.live="tabellaFocusId" class="fi-input fi-input-wrp fi-select-input text-xs">
@foreach($tabellaOptions as $id => $label)
<option value="{{ $id }}">{{ $label }}</option>
@endforeach
</select>
</div>
</div>
<div class="mt-2 rounded-md border bg-gray-50 px-3 py-2 text-xs flex flex-wrap items-center justify-between gap-2">
<div class="text-gray-700 font-semibold">{{ $focus['label'] ?? '' }}</div>
<div class="flex flex-wrap gap-4">
<div><span class="text-gray-500">Voci:</span> <span class="font-semibold">{{ (int) ($focus['count'] ?? 0) }}</span></div>
<div><span class="text-gray-500">Totale Prev:</span> <span class="font-semibold">{{ number_format((float) ($focus['totale_prev'] ?? 0), 2, ',', '.') }}</span></div>
<div><span class="text-gray-500">Totale Cons:</span> <span class="font-semibold">{{ number_format((float) ($focus['totale_cons'] ?? 0), 2, ',', '.') }}</span></div>
</div>
</div>
@php($voci = is_array($focus['voci'] ?? null) ? $focus['voci'] : [])
<div class="mt-2 overflow-x-auto">
<table class="min-w-full text-[12px] leading-tight">
<thead class="text-[11px] text-gray-500">
<tr class="border-b">
<th class="py-2 pr-3 text-left">Cod.</th>
<th class="py-2 pr-3 text-left">Descrizione</th>
<th class="py-2 pr-3 text-right">Prev</th>
<th class="py-2 pr-3 text-right">Cons</th>
<th class="py-2 pr-3 text-right">%Prop</th>
<th class="py-2 pr-3 text-right">%Inq</th>
<th class="py-2 pr-0 text-right">Attiva</th>
</tr>
</thead>
<tbody class="divide-y">
@forelse($voci as $v)
@php($code = (string) ($v['codice'] ?? ''))
@php($desc = (string) ($v['descrizione'] ?? ''))
<tr>
<td class="py-1.5 pr-3 text-gray-700 font-semibold">{{ $code !== '' ? $code : '' }}</td>
<td class="py-1.5 pr-3 text-gray-700">{{ $desc !== '' ? $desc : '' }}</td>
<td class="py-1.5 pr-3 text-right">{{ number_format((float) ($v['prev'] ?? 0), 2, ',', '.') }}</td>
<td class="py-1.5 pr-3 text-right">{{ number_format((float) ($v['cons'] ?? 0), 2, ',', '.') }}</td>
<td class="py-1.5 pr-3 text-right">{{ number_format((float) ($v['prop'] ?? 0), 2, ',', '.') }}</td>
<td class="py-1.5 pr-3 text-right">{{ number_format((float) ($v['inq'] ?? 0), 2, ',', '.') }}</td>
<td class="py-1.5 pr-0 text-right">{{ !empty($v['attiva']) ? '' : 'No' }}</td>
</tr>
@empty
<tr>
<td colspan="7" class="py-3 text-gray-500">Nessuna voce associata alla tabella selezionata.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endif
<div class="flex items-center justify-end">
<div class="rounded-lg border bg-white px-3 py-2 text-xs flex gap-4">
<div>
<span class="text-gray-500">Totale Prev:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotalePreventivo(), 2, ',', '.') }}</span>
</div>
<div>
<span class="text-gray-500">Totale Cons:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotaleConsuntivo(), 2, ',', '.') }}</span>
</div>
@if(($this->tipoGestioneTab ?? 'ordinaria') !== 'acqua' && ((float) $this->getTotalePreventivoAcqua() > 0 || (float) $this->getTotaleConsuntivoAcqua() > 0))
<div>
<span class="text-gray-500">ACQUA Prev:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotalePreventivoAcqua(), 2, ',', '.') }}</span>
</div>
<div>
<span class="text-gray-500">ACQUA Cons:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotaleConsuntivoAcqua(), 2, ',', '.') }}</span>
</div>
<div>
<span class="text-gray-500">Totale Gen. Prev:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotalePreventivoGenerale(), 2, ',', '.') }}</span>
</div>
<div>
<span class="text-gray-500">Totale Gen. Cons:</span>
<span class="font-semibold">{{ number_format((float) $this->getTotaleConsuntivoGenerale(), 2, ',', '.') }}</span>
</div>
@endif
</div>
</div>
</div>
</div>
</div>
</x-filament-panels::page>