netgescon-day0/resources/views/filament/pages/condomini/assemblee-hub.blade.php

174 lines
12 KiB
PHP
Executable File

<x-filament-panels::page>
<div class="space-y-6">
@if(! $this->stabileAttivo)
<div class="rounded-xl border border-amber-300 bg-amber-50 p-4 text-sm text-amber-800">
Nessuno stabile attivo disponibile. Seleziona prima uno stabile per aprire l'hub assemblee.
</div>
@else
<!-- Header & Stats -->
<div class="rounded-xl border bg-white p-5 shadow-sm">
<div class="flex flex-wrap items-center justify-between gap-4">
<div>
<div class="text-xl font-bold text-slate-900">{{ $this->stabileAttivo->denominazione ?: 'Stabile attivo' }}</div>
<div class="mt-1 text-xs text-slate-500">
HUB Assemblee Condominiali: gestisci l'Ordine del Giorno, invia convocazioni con token WhatsApp, effettua check-in e ricevi voti in tempo reale.
</div>
</div>
<div class="flex items-center space-x-3">
<button onclick="document.getElementById('modal-nuova-assemblea').classList.remove('hidden')" class="inline-flex items-center px-4 py-2 bg-blue-600 hover:bg-blue-500 text-white rounded-lg text-xs font-bold shadow-md transition-all active:scale-95">
<i class="fas fa-plus mr-1.5"></i> Nuova Assemblea
</button>
</div>
</div>
</div>
<!-- Stats Row -->
<div class="grid gap-4 md:grid-cols-4">
<div class="rounded-xl border bg-white p-4 shadow-xs">
<div class="text-xs font-semibold uppercase tracking-wider text-slate-400">Assemblee totali</div>
<div class="mt-2 text-3xl font-bold text-slate-800">{{ (int) ($this->stats['totale'] ?? 0) }}</div>
</div>
<div class="rounded-xl border bg-white p-4 shadow-xs">
<div class="text-xs font-semibold uppercase tracking-wider text-slate-400">Convocate</div>
<div class="mt-2 text-3xl font-bold text-amber-600">{{ (int) ($this->stats['convocate'] ?? 0) }}</div>
</div>
<div class="rounded-xl border bg-white p-4 shadow-xs">
<div class="text-xs font-semibold uppercase tracking-wider text-slate-400">In calendario</div>
<div class="mt-2 text-3xl font-bold text-blue-600">{{ (int) ($this->stats['in_calendario'] ?? 0) }}</div>
</div>
<div class="rounded-xl border bg-white p-4 shadow-xs">
<div class="text-xs font-semibold uppercase tracking-wider text-slate-400">Con verbale</div>
<div class="mt-2 text-3xl font-bold text-emerald-600">{{ (int) ($this->stats['con_verbale'] ?? 0) }}</div>
</div>
</div>
<!-- Elenco cronologico in tabella full-width -->
<div class="rounded-xl border bg-white shadow-sm overflow-hidden">
<div class="px-6 py-4 border-b">
<h3 class="text-sm font-bold text-slate-800 uppercase tracking-wider flex items-center"><i class="fas fa-history mr-2 text-blue-500"></i>Cronologia assemblee dello stabile</h3>
</div>
<div class="overflow-x-auto">
<table class="w-full text-left border-collapse text-xs">
<thead>
<tr class="bg-slate-100 text-slate-700 font-bold uppercase border-b text-[10px] tracking-wider">
<th class="p-4">Assemblea / Tipo</th>
<th class="p-4">Data 1ª Convocazione</th>
<th class="p-4">Data 2ª Convocazione</th>
<th class="p-4">Luogo</th>
<th class="p-4 text-center">Stato</th>
<th class="p-4 text-center">OdG</th>
<th class="p-4 text-center">Convocati</th>
<th class="p-4 text-center">Presenti</th>
<th class="p-4 text-center">Azioni</th>
</tr>
</thead>
<tbody class="divide-y">
@forelse($this->assembleeRows as $assemblea)
<tr class="hover:bg-slate-50/50">
<td class="p-4 font-bold text-slate-900 capitalize">
Assemblea {{ $assemblea->tipo ?: 'Ordinaria' }}
</td>
<td class="p-4 text-slate-600">
{{ $assemblea->data_prima_convocazione ? $assemblea->data_prima_convocazione->format('d/m/Y H:i') : 'n/d' }}
</td>
<td class="p-4 text-slate-600 font-semibold">
{{ $assemblea->data_seconda_convocazione ? $assemblea->data_seconda_convocazione->format('d/m/Y H:i') : 'n/d' }}
</td>
<td class="p-4 text-slate-500">
{{ \Illuminate\Support\Str::limit($assemblea->luogo ?: 'Presso uffici', 40) }}
</td>
<td class="p-4 text-center">
<span class="text-[9px] font-extrabold uppercase px-2 py-0.5 rounded {{ $assemblea->stato === 'convocata' ? 'bg-amber-100 text-amber-700 border border-amber-200' : ($assemblea->stato === 'svolta' ? 'bg-emerald-100 text-emerald-700 border border-emerald-200' : 'bg-slate-100 text-slate-700 border border-slate-200') }}">
{{ $assemblea->stato ?: 'Bozza' }}
</span>
</td>
<td class="p-4 text-center font-bold text-slate-800">{{ (int)$assemblea->ordine_giorno_count }}</td>
<td class="p-4 text-center font-bold text-slate-800">{{ (int)$assemblea->convocazioni_count }}</td>
<td class="p-4 text-center font-bold text-slate-800">{{ (int)$assemblea->presenze_count }}</td>
<td class="p-4 text-center flex items-center justify-center space-x-2">
<a href="{{ \App\Filament\Pages\Condomini\GestioneAssemblea::getUrl(['record' => $assemblea->id]) }}" class="px-2.5 py-1.5 bg-blue-50 text-blue-700 border border-blue-200 hover:bg-blue-100 rounded-lg text-xxs font-bold transition flex items-center">
<i class="fas fa-cog mr-1"></i> Gestisci
</a>
<button onclick="confirm('Vuoi eliminare questa assemblea?') && @this.eliminaAssemblea({{ $assemblea->id }})" class="px-2.5 py-1.5 bg-red-50 text-red-700 border border-red-200 hover:bg-red-100 rounded-lg text-xxs font-bold transition">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
@empty
<tr>
<td colspan="9" class="p-8 text-center text-slate-400 italic">
Nessuna assemblea registrata per questo stabile. Clicca su "Nuova Assemblea" per crearne una.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
@endif
</div>
<!-- Modal Nuova Assemblea -->
<div id="modal-nuova-assemblea" class="fixed inset-0 z-50 overflow-y-auto hidden bg-slate-900/60 backdrop-blur-xs flex items-center justify-center p-4">
<div class="bg-white rounded-xl max-w-lg w-full border shadow-2xl overflow-hidden">
<div class="bg-slate-900 text-white px-5 py-4 flex items-center justify-between">
<h3 class="text-sm font-bold uppercase tracking-wider"><i class="fas fa-plus mr-1.5 text-blue-400"></i>Nuova Assemblea</h3>
<button onclick="document.getElementById('modal-nuova-assemblea').classList.add('hidden')" class="text-slate-400 hover:text-white"><i class="fas fa-times text-md"></i></button>
</div>
<div class="p-5 space-y-4">
<div class="grid gap-4 grid-cols-2">
<div>
<label class="block text-xxs font-bold text-slate-500 uppercase mb-1">Tipo Assemblea</label>
<select wire:model="nuovaTipo" class="w-full text-xs rounded-lg border-slate-300">
<option value="ordinaria">Ordinaria</option>
<option value="straordinaria">Straordinaria</option>
</select>
</div>
<div>
<label class="block text-xxs font-bold text-slate-500 uppercase mb-1">Luogo</label>
<input type="text" wire:model="nuovaLuogo" placeholder="Es. Ufficio o Skype" class="w-full text-xs rounded-lg border-slate-300">
</div>
</div>
<div class="grid gap-4 grid-cols-2">
<div>
<label class="block text-xxs font-bold text-slate-500 uppercase mb-1">Data 1ª Convocazione</label>
<input type="datetime-local" wire:model="nuovaData1" class="w-full text-xs rounded-lg border-slate-300">
</div>
<div>
<label class="block text-xxs font-bold text-slate-500 uppercase mb-1">Data 2ª Convocazione</label>
<input type="datetime-local" wire:model="nuovaData2" class="w-full text-xs rounded-lg border-slate-300">
</div>
</div>
<div>
<label class="block text-xxs font-bold text-slate-500 uppercase mb-1">Note / OdG Iniziale</label>
<textarea wire:model="nuovaNote" rows="3" placeholder="Note per convocazione..." class="w-full text-xs rounded-lg border-slate-300"></textarea>
</div>
</div>
<div class="bg-slate-50 px-5 py-3 flex justify-end space-x-2 border-t">
<button onclick="document.getElementById('modal-nuova-assemblea').classList.add('hidden')" class="px-4 py-2 bg-slate-200 hover:bg-slate-300 text-slate-700 rounded-lg text-xs font-bold transition">Annulla</button>
<button wire:click="creaNuovaAssemblea" class="px-4 py-2 bg-blue-600 hover:bg-blue-500 text-white rounded-lg text-xs font-bold transition shadow-md shadow-blue-500/10">Crea Assemblea</button>
</div>
</div>
</div>
<script>
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape') {
document.getElementById('modal-nuova-assemblea').classList.add('hidden');
}
});
document.addEventListener('notify', (e) => {
if (typeof Filament !== 'undefined' && Filament.notify) {
Filament.notify(e.detail.status, e.detail.message);
} else {
alert(e.detail.message);
}
});
</script>
</x-filament-panels::page>