326 lines
21 KiB
PHP
Executable File
326 lines
21 KiB
PHP
Executable File
@extends('admin.layouts.app')
|
|
|
|
@section('title', '
|
|
{{ __(\'Fondi Condominiali\') }} - {{ $stabile->denominazione }}
|
|
')
|
|
|
|
@section('content')
|
|
|
|
|
|
|
|
<div class="py-5">
|
|
<div class="container-fluid mx-auto sm:px-4 lg:px-8 space-y-6">
|
|
|
|
{{-- Breadcrumb --}}
|
|
<nav class="d-flex" aria-label="Breadcrumb">
|
|
<ol class="inline-d-flex align-items-center space-x-1 md:gap-3">
|
|
<li class="inline-d-flex align-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="d-flex align-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="d-flex align-items-center">
|
|
<i class="fas fa-chevron-right text-gray-400 mx-2"></i>
|
|
<span class="text-muted">Fondi Condominiali</span>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
{{-- Header con sommario finanziario --}}
|
|
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
|
|
<div class="p-6">
|
|
<div class="d-flex justify-content-between align-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-success hover:bg-green-700 text-white fw-bold py-2 px-3 rounded transition-colors">
|
|
<i class="fas fa-plus mr-2"></i>Nuovo Fondo
|
|
</button>
|
|
</div>
|
|
|
|
{{-- Riepilogo Finanziario --}}
|
|
<div class="grid row md:grid-cols-4 gap-4 mb-6">
|
|
<div class="bg-blue-50 p-4 rounded-lg">
|
|
<div class="d-flex align-items-center">
|
|
<i class="fas fa-piggy-bank text-3xl text-primary"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-primary">Fondo Ordinario</p>
|
|
<p class="text-xl fw-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="d-flex align-items-center">
|
|
<i class="fas fa-shield-alt text-3xl text-success"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-success">Fondo Riserva</p>
|
|
<p class="text-xl fw-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="d-flex align-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 fw-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="d-flex align-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 fw-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-dark overflow-hidden shadow-sm rounded">
|
|
<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 d-flex align-items-center">
|
|
<i class="fas fa-piggy-bank text-blue-500 mr-2"></i>
|
|
Fondi Ordinari ({{ $fondiOrdinari->count() }})
|
|
</h4>
|
|
<div class="grid row lg:row gap-4">
|
|
@foreach($fondiOrdinari as $fondo)
|
|
<div class="border border-blue-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="d-flex justify-content-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 fw-bold text-primary">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-muted">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-muted mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="d-flex gap-2">
|
|
<button class="text-success hover:text-green-900 text-sm">
|
|
<i class="fas fa-plus-circle"></i> Versamento
|
|
</button>
|
|
<button class="text-danger 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 d-flex align-items-center">
|
|
<i class="fas fa-shield-alt text-green-500 mr-2"></i>
|
|
Fondi Riserva ({{ $fondiRiserva->count() }})
|
|
</h4>
|
|
<div class="grid row lg:row gap-4">
|
|
@foreach($fondiRiserva as $fondo)
|
|
<div class="border border-green-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="d-flex justify-content-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 fw-bold text-success">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-muted">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-muted mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="d-flex gap-2">
|
|
<button class="text-success 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 d-flex align-items-center">
|
|
<i class="fas fa-tools text-purple-500 mr-2"></i>
|
|
Fondi Specifici ({{ $fondiSpecifici->count() }})
|
|
</h4>
|
|
<div class="grid row lg:row gap-4">
|
|
@foreach($fondiSpecifici as $fondo)
|
|
<div class="border border-purple-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
|
<div class="d-flex justify-content-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 fw-bold text-purple-600">
|
|
€ {{ number_format($fondo->saldo_attuale, 2, ',', '.') }}
|
|
</p>
|
|
<span class="text-xs text-muted">Priorità {{ $fondo->priorita }}</span>
|
|
</div>
|
|
</div>
|
|
@if($fondo->descrizione)
|
|
<p class="text-sm text-muted mb-3">{{ $fondo->descrizione }}</p>
|
|
@endif
|
|
<div class="d-flex justify-content-between align-items-center">
|
|
<span class="text-xs {{ $fondo->stato_badge }} px-2 py-1 rounded-full">
|
|
{{ $fondo->stato_nome }}
|
|
</span>
|
|
<div class="d-flex gap-2">
|
|
<button class="text-success hover:text-green-900 text-sm">
|
|
<i class="fas fa-plus-circle"></i> Alimenta
|
|
</button>
|
|
<button class="text-primary 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-5">
|
|
<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-muted 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-success hover:bg-green-700 text-white fw-bold py-2 px-3 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 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="gap-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 form-control rounded 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 form-control rounded 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 form-control rounded shadow-sm">
|
|
<p class="text-xs text-muted 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 form-control rounded 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 form-control rounded shadow-sm"></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="d-flex justify-end gap-2 mt-6">
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-nuovo-fondo').classList.add('hidden')"
|
|
class="bg-gray-300 hover:bg-gray-400 text-dark fw-bold py-2 px-3 rounded">
|
|
Annulla
|
|
</button>
|
|
<button type="submit"
|
|
class="bg-success hover:bg-green-700 text-white fw-bold py-2 px-3 rounded">
|
|
Crea Fondo
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@endsection |