feat(catasto): estensione ricerca nominativi e bottone cima TAB B per integrazione Torre
This commit is contained in:
parent
c77fcae9a0
commit
4705a2d0f3
|
|
@ -326,12 +326,28 @@ public function loadUnitaList(): void
|
|||
->orderBy('interno');
|
||||
|
||||
if (trim($this->search) !== '') {
|
||||
$query->where(function($q) {
|
||||
$q->where('interno', 'like', '%' . $this->search . '%')
|
||||
->orWhere('scala', 'like', '%' . $this->search . '%')
|
||||
->orWhere('piano', 'like', '%' . $this->search . '%');
|
||||
$searchTerm = '%' . trim($this->search) . '%';
|
||||
$query->where(function($q) use ($searchTerm) {
|
||||
$q->where('interno', 'like', $searchTerm)
|
||||
->orWhere('scala', 'like', $searchTerm)
|
||||
->orWhere('piano', 'like', $searchTerm);
|
||||
if (Schema::hasColumn('unita_immobiliari', 'subalterno')) {
|
||||
$q->orWhere('subalterno', 'like', '%' . $this->search . '%');
|
||||
$q->orWhere('subalterno', 'like', $searchTerm);
|
||||
}
|
||||
if (Schema::hasTable('unita_immobiliare_nominativi')) {
|
||||
$q->orWhereIn('id', function($subQuery) use ($searchTerm) {
|
||||
$subQuery->select('unita_immobiliare_id')
|
||||
->from('unita_immobiliare_nominativi')
|
||||
->where('nominativo', 'like', $searchTerm);
|
||||
});
|
||||
}
|
||||
if (Schema::hasTable('anagrafiche') && Schema::hasTable('unita_anagrafica_periodo')) {
|
||||
$q->orWhereIn('id', function($subQuery) use ($searchTerm) {
|
||||
$subQuery->select('uap.unita_immobiliare_id')
|
||||
->from('unita_anagrafica_periodo as uap')
|
||||
->join('anagrafiche as a', 'a.id', '=', 'uap.anagrafica_id')
|
||||
->where(DB::raw("COALESCE(a.cognome, '') || ' ' || COALESCE(a.nome, '')"), 'like', $searchTerm);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -398,9 +398,14 @@ class="bg-emerald-600 hover:bg-emerald-700 text-white font-bold px-1.5 py-0.5 ro
|
|||
<div class="hub-spalla-sinistra col-span-12 lg:col-span-4 bg-white dark:bg-gray-900 rounded-xl p-4 shadow-sm space-y-4 border border-gray-200 dark:border-gray-800">
|
||||
<div class="flex items-center justify-between border-b pb-2">
|
||||
<h3 class="text-xs font-bold text-gray-900 dark:text-white uppercase tracking-wider">Unità Stabile</h3>
|
||||
<button type="button" wire:click="toggleSort" class="text-xxs font-semibold text-primary-600 hover:underline">
|
||||
Ordina: {{ strtoupper($sortDirection) }}
|
||||
</button>
|
||||
<div class="flex items-center gap-2">
|
||||
<button type="button" onclick="window.scrollTo({top: 0, behavior: 'smooth'})" class="text-[10px] font-bold text-gray-500 hover:text-primary-600 flex items-center gap-0.5">
|
||||
⬆️ Cima
|
||||
</button>
|
||||
<button type="button" wire:click="toggleSort" class="text-xxs font-semibold text-primary-600 hover:underline">
|
||||
Ordina: {{ strtoupper($sortDirection) }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Filtro Stato Unità -->
|
||||
|
|
@ -425,7 +430,7 @@ class="text-[10px] font-bold px-2.5 py-1 rounded-lg transition-colors {{ $filtro
|
|||
<input
|
||||
type="text"
|
||||
wire:model.live="search"
|
||||
placeholder="Cerca scala, int, piano..."
|
||||
placeholder="Cerca nominativo, scala, int, piano..."
|
||||
class="w-full text-xs rounded-lg border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 px-3 py-1.5 text-gray-800 dark:text-gray-200 placeholder-gray-400"
|
||||
/>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user