fix(unita-immobiliare): load in_da_ec payments & clean up UI top bar layout matching ASCII wireframe (task-d095b0e23b)
This commit is contained in:
parent
f341b3edd3
commit
01c387e3ba
|
|
@ -881,26 +881,55 @@ public function getEstrattoContoNominativoDettaglioProperty(): array
|
||||||
|
|
||||||
$dettaglioIncassi = [];
|
$dettaglioIncassi = [];
|
||||||
$totaleIncassato = 0.0;
|
$totaleIncassato = 0.0;
|
||||||
if ($idCond > 0 && DbSchema::connection('gescon_import')->hasTable('incassi')) {
|
if ($idCond > 0) {
|
||||||
$incassiRows = DB::connection('gescon_import')->table('incassi')
|
if (DbSchema::connection('gescon_import')->hasTable('in_da_ec')) {
|
||||||
->where('cod_stabile', $codStabile)
|
$ecRows = DB::connection('gescon_import')->table('in_da_ec')
|
||||||
->where('id_cond', $idCond)
|
->where('cod_stabile', $codStabile)
|
||||||
->orderBy('data_pagamento')
|
->where(function ($q) use ($idCond) {
|
||||||
->get();
|
$q->where('id_condomino', (string) $idCond)
|
||||||
|
->orWhere('id_condomino', (int) $idCond);
|
||||||
|
})
|
||||||
|
->orderBy('data_pag')
|
||||||
|
->get();
|
||||||
|
|
||||||
foreach ($incassiRows as $inc) {
|
foreach ($ecRows as $inc) {
|
||||||
$imp = (float) ($inc->importo_euro ?? $inc->importo_pagato_euro ?? 0);
|
$imp = (float) ($inc->importo ?? 0);
|
||||||
$yearRef = (string) ($inc->anno_rif ?? '');
|
$yearRef = (string) ($inc->legacy_year ?? '');
|
||||||
$humanYr = $yearRef !== '' ? $this->resolveHumanYearLabel($yearRef, $codStabile) : '—';
|
$humanYr = $yearRef !== '' ? $this->resolveHumanYearLabel($yearRef, $codStabile) : '—';
|
||||||
|
$dtPag = ! empty($inc->data_pag) ? date('d/m/Y', strtotime((string) $inc->data_pag)) : '—';
|
||||||
|
|
||||||
$dettaglioIncassi[] = [
|
$dettaglioIncassi[] = [
|
||||||
'data_pagamento' => (string) ($inc->data_pagamento ?? '—'),
|
'data_pagamento' => $dtPag,
|
||||||
'cod_cassa' => (string) ($inc->cod_cassa ?? '—'),
|
'cod_cassa' => (string) ($inc->num_incasso ?? ($inc->protocollo ?? 'EC')),
|
||||||
'anno_rif' => $humanYr,
|
'anno_rif' => $humanYr,
|
||||||
'importo_euro' => $imp,
|
'importo_euro' => $imp,
|
||||||
'descrizione' => (string) ($inc->descrizione ?? '—'),
|
'descrizione' => trim((string) ($inc->nome_condomino ?? '')) . ($inc->descrizione_aggintiva ? ' — ' . trim((string) $inc->descrizione_aggintiva) : ''),
|
||||||
];
|
];
|
||||||
$totaleIncassato += $imp;
|
$totaleIncassato += $imp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($dettaglioIncassi) && DbSchema::connection('gescon_import')->hasTable('incassi')) {
|
||||||
|
$incassiRows = DB::connection('gescon_import')->table('incassi')
|
||||||
|
->where('cod_stabile', $codStabile)
|
||||||
|
->where('id_cond', $idCond)
|
||||||
|
->orderBy('data_pagamento')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($incassiRows as $inc) {
|
||||||
|
$imp = (float) ($inc->importo_euro ?? $inc->importo_pagato_euro ?? 0);
|
||||||
|
$yearRef = (string) ($inc->anno_rif ?? '');
|
||||||
|
$humanYr = $yearRef !== '' ? $this->resolveHumanYearLabel($yearRef, $codStabile) : '—';
|
||||||
|
|
||||||
|
$dettaglioIncassi[] = [
|
||||||
|
'data_pagamento' => (string) ($inc->data_pagamento ?? '—'),
|
||||||
|
'cod_cassa' => (string) ($inc->cod_cassa ?? '—'),
|
||||||
|
'anno_rif' => $humanYr,
|
||||||
|
'importo_euro' => $imp,
|
||||||
|
'descrizione' => (string) ($inc->descrizione ?? '—'),
|
||||||
|
];
|
||||||
|
$totaleIncassato += $imp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,18 +60,6 @@ class="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-me
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<x-filament::section class="p-4!">
|
|
||||||
@include('filament.components.page-breadcrumbs', [
|
|
||||||
'breadcrumbs' => [
|
|
||||||
['label' => 'Condomini', 'url' => route('admin.dashboards.condomini')],
|
|
||||||
['label' => 'Unità immobiliari', 'url' => \App\Filament\Pages\Condomini\UnitaImmobiliariArchivio::getUrl(panel: 'admin-filament')],
|
|
||||||
['label' => 'Scheda unità'],
|
|
||||||
],
|
|
||||||
'backUrl' => $this->getBackUrl(),
|
|
||||||
'backLabel' => 'Torna indietro',
|
|
||||||
])
|
|
||||||
</x-filament::section>
|
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$unitaOptions = $this->getUnitaOptions();
|
$unitaOptions = $this->getUnitaOptions();
|
||||||
$prevUrl = $this->getPrevUnitaUrl();
|
$prevUrl = $this->getPrevUnitaUrl();
|
||||||
|
|
@ -83,53 +71,53 @@ class="inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-me
|
||||||
];
|
];
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-filament::section class="p-4!">
|
{{-- CONTROLLI COMPATTI SELEZIONE UNITÀ & VISTA --}}
|
||||||
<div class="flex flex-wrap items-end justify-between gap-4">
|
<div class="mb-3 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-white p-2.5 shadow-xs">
|
||||||
<div class="flex items-end gap-2">
|
<div class="flex flex-wrap items-center gap-2.5">
|
||||||
<div class="flex flex-col items-center gap-1">
|
<a href="{{ $this->getBackUrl() }}" class="inline-flex items-center gap-1 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-600 transition hover:bg-slate-100 hover:text-slate-900">
|
||||||
<span class="text-[10px] text-gray-500">Prec.</span>
|
<span>←</span>
|
||||||
@if($prevUrl)
|
<span>Torna indietro</span>
|
||||||
<a class="fi-btn fi-btn-color-gray fi-btn-size-sm" href="{{ $prevUrl }}">←</a>
|
</a>
|
||||||
@else
|
<span class="text-slate-300">|</span>
|
||||||
<span class="fi-btn fi-btn-color-gray fi-btn-size-sm opacity-40">←</span>
|
|
||||||
@endif
|
<div class="flex items-center gap-1.5">
|
||||||
|
@if($prevUrl)
|
||||||
|
<a class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-700 transition hover:bg-slate-100" href="{{ $prevUrl }}">← Prec.</a>
|
||||||
|
@else
|
||||||
|
<span class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-400 opacity-50">← Prec.</span>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="min-w-64 max-w-xl">
|
||||||
|
{{ $this->getSchema('unitaPicker') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="min-w-72 max-w-xl flex flex-col items-start gap-1">
|
@if($nextUrl)
|
||||||
<span class="text-[10px] text-gray-500">Unità</span>
|
<a class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-700 transition hover:bg-slate-100" href="{{ $nextUrl }}">Succ. →</a>
|
||||||
<div class="w-full">{{ $this->getSchema('unitaPicker') }}</div>
|
@else
|
||||||
</div>
|
<span class="inline-flex items-center justify-center rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1 text-xs font-semibold text-slate-400 opacity-50">Succ. →</span>
|
||||||
|
@endif
|
||||||
<div class="flex flex-col items-center gap-1">
|
|
||||||
<span class="text-[10px] text-gray-500">Succ.</span>
|
|
||||||
@if($nextUrl)
|
|
||||||
<a class="fi-btn fi-btn-color-gray fi-btn-size-sm" href="{{ $nextUrl }}">→</a>
|
|
||||||
@else
|
|
||||||
<span class="fi-btn fi-btn-color-gray fi-btn-size-sm opacity-40">→</span>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-wrap items-center gap-2">
|
|
||||||
<span class="text-xs font-medium text-gray-500">Vista:</span>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="toggleMostraStorico"
|
|
||||||
class="rounded-lg border px-3 py-2 text-xs font-semibold transition {{ $mostraStorico ? 'border-amber-300 bg-amber-50 text-amber-700 shadow-sm' : 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50' }}">
|
|
||||||
{{ $mostraStorico ? 'Mostra storico (Attivo)' : 'Solo gestione selezionata' }}
|
|
||||||
</button>
|
|
||||||
<span class="text-xs font-medium text-gray-500 ml-2">Visibilità:</span>
|
|
||||||
@foreach($visibilityOptions as $key => $label)
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
wire:click="setUnitaVisibilita('{{ $key }}')"
|
|
||||||
class="rounded-lg border px-3 py-2 text-xs font-semibold transition {{ $this->unitaVisibilita === $key ? 'border-primary-300 bg-primary-50 text-primary-700 shadow-sm' : 'border-gray-200 bg-white text-gray-700 hover:border-gray-300 hover:bg-gray-50' }}">
|
|
||||||
{{ $label }}
|
|
||||||
</button>
|
|
||||||
@endforeach
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</x-filament::section>
|
|
||||||
|
<div class="flex flex-wrap items-center gap-2">
|
||||||
|
<span class="text-xs font-medium text-slate-500">Vista:</span>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="toggleMostraStorico"
|
||||||
|
class="rounded-lg border px-2.5 py-1 text-xs font-semibold transition {{ $mostraStorico ? 'border-amber-300 bg-amber-50 text-amber-700 shadow-xs' : 'border-slate-200 bg-slate-50 text-slate-700 hover:bg-slate-100' }}">
|
||||||
|
{{ $mostraStorico ? 'Mostra storico (Attivo)' : 'Solo gestione selezionata' }}
|
||||||
|
</button>
|
||||||
|
<span class="text-xs font-medium text-slate-500 ml-1">Visibilità:</span>
|
||||||
|
@foreach($visibilityOptions as $key => $label)
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="setUnitaVisibilita('{{ $key }}')"
|
||||||
|
class="rounded-lg border px-2.5 py-1 text-xs font-semibold transition {{ $this->unitaVisibilita === $key ? 'border-indigo-300 bg-indigo-50 text-indigo-700 shadow-xs' : 'border-slate-200 bg-slate-50 text-slate-700 hover:bg-slate-100' }}">
|
||||||
|
{{ $label }}
|
||||||
|
</button>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if(!$unita)
|
@if(!$unita)
|
||||||
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-500">Nessuna unità immobiliare trovata.</div>
|
<div class="rounded-xl border border-dashed border-gray-200 bg-white p-6 text-center text-gray-500">Nessuna unità immobiliare trovata.</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user