322 lines
21 KiB
PHP
322 lines
21 KiB
PHP
<x-app-layout>
|
|
<x-slot name="header">
|
|
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
|
|
{{ __('Fondi Condominiali') }} - {{ $stabile->denominazione }}
|
|
</h2>
|
|
</x-slot>
|
|
|
|
<div class="py-12">
|
|
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8 space-y-6">
|
|
|
|
{{-- Breadcrumb --}}
|
|
<nav class="flex" aria-label="Breadcrumb">
|
|
<ol class="inline-flex items-center space-x-1 md:space-x-3">
|
|
<li class="inline-flex items-center">
|
|
<a href="{{ route('admin.stabili.index') }}" class="text-gray-700 hover:text-gray-900">
|
|
<i class="fas fa-building mr-2"></i>Stabili
|
|
</a>
|
|
</li>
|
|
<li>
|
|
<div class="flex items-center">
|
|
<i class="fas fa-chevron-right text-gray-400 mx-2"></i>
|
|
<a href="{{ route('admin.stabili.show', $stabile) }}" class="text-gray-700 hover:text-gray-900">
|
|
{{ $stabile->denominazione }}
|
|
</a>
|
|
</div>
|
|
</li>
|
|
<li aria-current="page">
|
|
<div class="flex items-center">
|
|
<i class="fas fa-chevron-right text-gray-400 mx-2"></i>
|
|
<span class="text-gray-500">Fondi Condominiali</span>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
{{-- Header con sommario finanziario --}}
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
|
<div class="p-6">
|
|
<div class="flex justify-between items-center mb-6">
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">Gestione Fondi Condominiali</h3>
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-nuovo-fondo').classList.remove('hidden')"
|
|
class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded transition-colors">
|
|
<i class="fas fa-plus mr-2"></i>Nuovo Fondo
|
|
</button>
|
|
</div>
|
|
|
|
{{-- Riepilogo Finanziario --}}
|
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
|
|
<div class="bg-blue-50 p-4 rounded-lg">
|
|
<div class="flex items-center">
|
|
<i class="fas fa-piggy-bank text-3xl text-blue-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-blue-600">Fondo Ordinario</p>
|
|
<p class="text-xl font-bold text-blue-900">
|
|
€ {{ number_format($fondi->where('tipo', 'ordinario')->sum('saldo_attuale'), 2, ',', '.') }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-green-50 p-4 rounded-lg">
|
|
<div class="flex items-center">
|
|
<i class="fas fa-shield-alt text-3xl text-green-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-green-600">Fondo Riserva</p>
|
|
<p class="text-xl font-bold text-green-900">
|
|
€ {{ number_format($fondi->where('tipo', 'riserva')->sum('saldo_attuale'), 2, ',', '.') }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-purple-50 p-4 rounded-lg">
|
|
<div class="flex items-center">
|
|
<i class="fas fa-tools text-3xl text-purple-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-purple-600">Fondi Specifici</p>
|
|
<p class="text-xl font-bold text-purple-900">
|
|
€ {{ number_format($fondi->where('tipo', 'specifico')->sum('saldo_attuale'), 2, ',', '.') }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-orange-50 p-4 rounded-lg">
|
|
<div class="flex items-center">
|
|
<i class="fas fa-calculator text-3xl text-orange-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-orange-600">Totale Disponibile</p>
|
|
<p class="text-xl font-bold text-orange-900">
|
|
€ {{ number_format($fondi->sum('saldo_attuale'), 2, ',', '.') }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Lista Fondi --}}
|
|
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-sm sm:rounded-lg">
|
|
<div class="p-6">
|
|
@if($fondi->count() > 0)
|
|
{{-- Fondi Ordinari --}}
|
|
@php $fondiOrdinari = $fondi->where('tipo', 'ordinario') @endphp
|
|
@if($fondiOrdinari->count() > 0)
|
|
<div class="mb-8">
|
|
<h4 class="text-md font-medium text-gray-900 dark:text-gray-100 mb-4 flex items-center">
|
|
<i class="fas fa-piggy-bank text-blue-500 mr-2"></i>
|
|
Fondi Ordinari ({{ $fondiOrdinari->count() }})
|
|
</h4>
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
@foreach($fondiOrdinari as $fondo)
|
|
<div class="border border-blue-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="flex justify-between items-start mb-3">
|
|
<div>
|
|
<h5 class="font-medium text-gray-900 dark:text-gray-100">{{ $fondo->nome }}</h5>
|
|
<span class="text-xs {{ $fondo->tipo_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->tipo_nome }}
|
|
</span>
|
|
</div>
|
|
<div class="text-right">
|
|
<p class="text-lg font-bold text-blue-600">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-gray-500">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-gray-600 mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="flex justify-between items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="flex space-x-2">
|
|
<button class="text-green-600 hover:text-green-900 text-sm">
|
|
<i class="fas fa-plus-circle"></i> Versamento
|
|
</button>
|
|
<button class="text-red-600 hover:text-red-900 text-sm">
|
|
<i class="fas fa-minus-circle"></i> Prelievo
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Fondi Riserva --}}
|
|
@php $fondiRiserva = $fondi->where('tipo', 'riserva') @endphp
|
|
@if($fondiRiserva->count() > 0)
|
|
<div class="mb-8">
|
|
<h4 class="text-md font-medium text-gray-900 dark:text-gray-100 mb-4 flex items-center">
|
|
<i class="fas fa-shield-alt text-green-500 mr-2"></i>
|
|
Fondi Riserva ({{ $fondiRiserva->count() }})
|
|
</h4>
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
@foreach($fondiRiserva as $fondo)
|
|
<div class="border border-green-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="flex justify-between items-start mb-3">
|
|
<div>
|
|
<h5 class="font-medium text-gray-900 dark:text-gray-100">{{ $fondo->nome }}</h5>
|
|
<span class="text-xs {{ $fondo->tipo_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->tipo_nome }}
|
|
</span>
|
|
</div>
|
|
<div class="text-right">
|
|
<p class="text-lg font-bold text-green-600">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-gray-500">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-gray-600 mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="flex justify-between items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="flex space-x-2">
|
|
<button class="text-green-600 hover:text-green-900 text-sm">
|
|
<i class="fas fa-plus-circle"></i> Accumulo
|
|
</button>
|
|
<button class="text-orange-600 hover:text-orange-900 text-sm">
|
|
<i class="fas fa-eye"></i> Storico
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Fondi Specifici --}}
|
|
@php $fondiSpecifici = $fondi->where('tipo', 'specifico') @endphp
|
|
@if($fondiSpecifici->count() > 0)
|
|
<div class="mb-8">
|
|
<h4 class="text-md font-medium text-gray-900 dark:text-gray-100 mb-4 flex items-center">
|
|
<i class="fas fa-tools text-purple-500 mr-2"></i>
|
|
Fondi Specifici ({{ $fondiSpecifici->count() }})
|
|
</h4>
|
|
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
|
@foreach($fondiSpecifici as $fondo)
|
|
<div class="border border-purple-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="flex justify-between items-start mb-3">
|
|
<div>
|
|
<h5 class="font-medium text-gray-900 dark:text-gray-100">{{ $fondo->nome }}</h5>
|
|
<span class="text-xs {{ $fondo->tipo_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->tipo_nome }}
|
|
</span>
|
|
</div>
|
|
<div class="text-right">
|
|
<p class="text-lg font-bold text-purple-600">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-gray-500">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-gray-600 mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="flex justify-between items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="flex space-x-2">
|
|
<button class="text-green-600 hover:text-green-900 text-sm">
|
|
<i class="fas fa-plus-circle"></i> Alimenta
|
|
</button>
|
|
<button class="text-blue-600 hover:text-blue-900 text-sm">
|
|
<i class="fas fa-cog"></i> Gestisci
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Paginazione --}}
|
|
<div class="mt-6">
|
|
{{ $fondi->links() }}
|
|
</div>
|
|
@else
|
|
<div class="text-center py-12">
|
|
<i class="fas fa-piggy-bank text-6xl text-gray-300 mb-4"></i>
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">Nessun fondo configurato</h3>
|
|
<p class="text-gray-500 dark:text-gray-400 mb-6">Crea il primo fondo condominiale per questo stabile</p>
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-nuovo-fondo').classList.remove('hidden')"
|
|
class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
|
|
<i class="fas fa-plus mr-2"></i>Crea Primo Fondo
|
|
</button>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Modal Nuovo Fondo --}}
|
|
<div id="modal-nuovo-fondo" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
|
|
<div class="relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
|
|
<div class="mt-3">
|
|
<h3 class="text-lg font-medium text-gray-900 mb-4">Nuovo Fondo Condominiale</h3>
|
|
<form action="{{ route('admin.stabili.fondi.store', $stabile) }}" method="POST">
|
|
@csrf
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Nome Fondo</label>
|
|
<input type="text" name="nome" required
|
|
placeholder="es. Fondo Ordinario 2025"
|
|
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Tipo Fondo</label>
|
|
<select name="tipo" required class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
|
<option value="">Seleziona tipo...</option>
|
|
<option value="ordinario">Ordinario (spese correnti)</option>
|
|
<option value="straordinario">Straordinario (opere speciali)</option>
|
|
<option value="riserva">Riserva (accantonamenti)</option>
|
|
<option value="specifico">Specifico (finalizzato)</option>
|
|
</select>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Priorità</label>
|
|
<input type="number" name="priorita" required min="1" max="100" value="10"
|
|
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
|
<p class="text-xs text-gray-500 mt-1">1 = Priorità massima, 100 = Priorità minima</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Saldo Iniziale (€)</label>
|
|
<input type="number" name="saldo_iniziale" step="0.01" min="0" value="0"
|
|
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Descrizione</label>
|
|
<textarea name="descrizione" rows="3"
|
|
placeholder="Scopo e utilizzo del fondo..."
|
|
class="mt-1 block w-full border-gray-300 rounded-md shadow-sm"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="flex justify-end space-x-2 mt-6">
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-nuovo-fondo').classList.add('hidden')"
|
|
class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded">
|
|
Annulla
|
|
</button>
|
|
<button type="submit"
|
|
class="bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded">
|
|
Crea Fondo
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</x-app-layout>
|