321 lines
20 KiB
PHP
Executable File
321 lines
20 KiB
PHP
Executable File
@extends('admin.layouts.app')
|
|
|
|
@section('title', '
|
|
{{ __(\'Struttura Fisica\') }} - {{ $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">Struttura Fisica</span>
|
|
</div>
|
|
</li>
|
|
</ol>
|
|
</nav>
|
|
|
|
{{-- Panel Auto-Generazione --}}
|
|
<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-4">
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100">Configurazione Automatica</h3>
|
|
<div class="d-flex gap-2">
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-auto-genera').classList.remove('hidden')"
|
|
class="bg-primary text-white fw-bold py-2 px-3 rounded transition-colors">
|
|
<i class="fas fa-magic mr-2"></i>Auto-Genera Struttura
|
|
</button>
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-auto-unita').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-home mr-2"></i>Auto-Genera Unità
|
|
</button>
|
|
</div>
|
|
</div>
|
|
<p class="text-sm text-muted dark:text-gray-400">
|
|
Utilizza gli strumenti di auto-generazione per creare rapidamente la struttura fisica del condominio
|
|
(palazzine, scale, piani) e le relative unità immobiliari.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Riepilogo Struttura --}}
|
|
@if($strutture->count() > 0)
|
|
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
|
|
<div class="p-6">
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">Riepilogo Struttura</h3>
|
|
<div class="grid row md:grid-cols-4 gap-4">
|
|
<div class="bg-blue-50 p-4 rounded-lg">
|
|
<div class="d-flex align-items-center">
|
|
<i class="fas fa-building text-2xl text-primary"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-primary">Palazzine</p>
|
|
<p class="text-2xl fw-bold text-blue-900">
|
|
{{ $strutture->has('palazzina') ? $strutture['palazzina']->count() : 0 }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-green-50 p-4 rounded-lg">
|
|
<div class="d-flex align-items-center">
|
|
<i class="fas fa-stairs text-2xl text-success"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-success">Scale</p>
|
|
<p class="text-2xl fw-bold text-green-900">
|
|
{{ $strutture->has('scala') ? $strutture['scala']->count() : 0 }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-purple-50 p-4 rounded-lg">
|
|
<div class="d-flex align-items-center">
|
|
<i class="fas fa-layer-group text-2xl text-purple-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-purple-600">Piani</p>
|
|
<p class="text-2xl fw-bold text-purple-900">
|
|
{{ $strutture->has('piano') ? $strutture['piano']->count() : 0 }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="bg-orange-50 p-4 rounded-lg">
|
|
<div class="d-flex align-items-center">
|
|
<i class="fas fa-door-open text-2xl text-orange-600"></i>
|
|
<div class="ml-3">
|
|
<p class="text-sm font-medium text-orange-600">Locali Tecnici</p>
|
|
<p class="text-2xl fw-bold text-orange-900">
|
|
{{ $strutture->has('locale') ? $strutture['locale']->count() : 0 }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Visualizzazione Struttura ad Albero --}}
|
|
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
|
|
<div class="p-6">
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-4">Struttura Gerarchica</h3>
|
|
|
|
@if($strutture->has('palazzina'))
|
|
@foreach($strutture['palazzina'] as $palazzina)
|
|
<div class="mb-6 border border-gray-200 rounded-lg p-4">
|
|
{{-- Palazzina --}}
|
|
<div class="d-flex align-items-center mb-3">
|
|
<span class="inline-d-flex align-items-center px-3 py-1 rounded-full text-sm font-medium {{ $palazzina->tipo_badge }}">
|
|
<i class="{{ $palazzina->tipo_icona }} mr-2"></i>
|
|
{{ $palazzina->nome }} ({{ $palazzina->codice }})
|
|
</span>
|
|
@if($palazzina->descrizione)
|
|
<span class="ml-3 text-sm text-muted">{{ $palazzina->descrizione }}</span>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Scale di questa palazzina --}}
|
|
@php
|
|
$scaleDelPalazzo = $strutture->has('scala') ?
|
|
$strutture['scala']->where('parent_id', $palazzina->id) : collect()
|
|
@endphp
|
|
|
|
@if($scaleDelPalazzo->count() > 0)
|
|
<div class="ml-6 gap-4">
|
|
@foreach($scaleDelPalazzo as $scala)
|
|
<div class="border-l-4 border-blue-200 pl-4">
|
|
{{-- Scala --}}
|
|
<div class="d-flex align-items-center mb-2">
|
|
<span class="inline-d-flex align-items-center px-2 py-1 rounded-full text-xs font-medium {{ $scala->tipo_badge }}">
|
|
<i class="{{ $scala->tipo_icona }} mr-1"></i>
|
|
{{ $scala->nome }} ({{ $scala->codice }})
|
|
</span>
|
|
@if($scala->descrizione)
|
|
<span class="ml-2 text-xs text-muted">{{ $scala->descrizione }}</span>
|
|
@endif
|
|
</div>
|
|
|
|
{{-- Piani di questa scala --}}
|
|
@php
|
|
$pianiDellaScala = $strutture->has('piano') ?
|
|
$strutture['piano']->where('parent_id', $scala->id) : collect()
|
|
@endphp
|
|
|
|
@if($pianiDellaScala->count() > 0)
|
|
<div class="ml-4 grid row md:grid-cols-4 lg:grid-cols-6 gap-2">
|
|
@foreach($pianiDellaScala->sortBy('codice') as $piano)
|
|
<div class="d-flex align-items-center">
|
|
<span class="inline-d-flex align-items-center px-2 py-1 rounded text-xs {{ $piano->tipo_badge }}">
|
|
<i class="{{ $piano->tipo_icona }} mr-1"></i>
|
|
{{ $piano->nome }}
|
|
</span>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
@endforeach
|
|
@endif
|
|
|
|
{{-- Locali Tecnici (non gerarchici) --}}
|
|
@if($strutture->has('locale'))
|
|
<div class="mt-6 pt-6 border-t border-gray-200">
|
|
<h4 class="text-md font-medium text-gray-900 dark:text-gray-100 mb-3">Locali Tecnici</h4>
|
|
<div class="grid row md:row lg:grid-cols-4 gap-3">
|
|
@foreach($strutture['locale'] as $locale)
|
|
<div class="d-flex align-items-center">
|
|
<span class="inline-d-flex align-items-center px-2 py-1 rounded text-sm {{ $locale->tipo_badge }}">
|
|
<i class="{{ $locale->tipo_icona }} mr-2"></i>
|
|
{{ $locale->nome }}
|
|
</span>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@else
|
|
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
|
|
<div class="p-6 text-center">
|
|
<i class="fas fa-building text-6xl text-gray-300 mb-4"></i>
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-gray-100 mb-2">Struttura fisica non configurata</h3>
|
|
<p class="text-muted dark:text-gray-400 mb-6">
|
|
Utilizza l'auto-generazione per creare rapidamente la struttura del condominio
|
|
</p>
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-auto-genera').classList.remove('hidden')"
|
|
class="bg-primary text-white fw-bold py-2 px-3 rounded">
|
|
<i class="fas fa-magic mr-2"></i>Inizia Configurazione
|
|
</button>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Modal Auto-Generazione Struttura --}}
|
|
<div id="modal-auto-genera" 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">Auto-Generazione Struttura Fisica</h3>
|
|
<form action="{{ route('admin.stabili.struttura.auto_genera', $stabile) }}" method="POST">
|
|
@csrf
|
|
<div class="gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Numero Palazzine</label>
|
|
<input type="number" name="num_palazzine" required min="1" max="20" value="1"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Scale per Palazzina</label>
|
|
<input type="number" name="num_scale_per_palazzina" required min="1" max="10" value="1"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Piani per Scala</label>
|
|
<input type="number" name="num_piani_per_scala" required min="1" max="50" value="4"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
<p class="text-xs text-muted mt-1">Include automaticamente il piano terra (Piano 0)</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Unità per Piano</label>
|
|
<input type="number" name="num_unita_per_piano" required min="1" max="20" value="2"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
<p class="text-xs text-muted mt-1">Sarà utilizzato per l'auto-generazione unità</p>
|
|
</div>
|
|
<div class="d-flex align-items-center">
|
|
<input type="checkbox" name="pulisci_esistente" value="1" id="pulisci_esistente"
|
|
class="h-4 w-4 text-primary form-control rounded">
|
|
<label for="pulisci_esistente" class="ml-2 block text-sm text-gray-700">
|
|
Sostituisci struttura esistente
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="d-flex justify-end gap-2 mt-6">
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-auto-genera').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-primary text-white fw-bold py-2 px-3 rounded">
|
|
Genera Struttura
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Modal Auto-Generazione Unità --}}
|
|
<div id="modal-auto-unita" 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">Auto-Generazione Unità Immobiliari</h3>
|
|
<form action="{{ route('admin.stabili.unita.auto_genera', $stabile) }}" method="POST">
|
|
@csrf
|
|
<div class="gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Template Nome Unità</label>
|
|
<input type="text" name="template_nome" required
|
|
value="Appartamento {piano} - Unità {numero}"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
<p class="text-xs text-muted mt-1">
|
|
Usa {piano}, {numero}, {codice} come placeholder
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Millesimi Default</label>
|
|
<input type="number" name="millesimi_default" required step="0.001" min="0" max="1000" value="10"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
<p class="text-xs text-muted mt-1">Millesimi per unità (verranno ricalcolati)</p>
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700">Unità per Piano</label>
|
|
<input type="number" name="num_unita_per_piano" required min="1" max="20" value="2"
|
|
class="mt-1 block w-full form-control rounded shadow-sm">
|
|
</div>
|
|
</div>
|
|
<div class="d-flex justify-end gap-2 mt-6">
|
|
<button type="button"
|
|
onclick="document.getElementById('modal-auto-unita').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">
|
|
Genera Unità
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
@endsection |