91 lines
3.8 KiB
PHP
91 lines
3.8 KiB
PHP
{{-- Vista lista stabili per caricamento AJAX --}}
|
|
<div class="card">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h5 class="mb-0">
|
|
<i class="fas fa-building me-2"></i>Gestione Stabili
|
|
</h5>
|
|
<button class="btn btn-primary btn-sm" onclick="showCreateStabileForm()">
|
|
<i class="fas fa-plus me-2"></i>Nuovo Stabile
|
|
</button>
|
|
</div>
|
|
<div class="card-body">
|
|
@if(isset($stabili) && $stabili->count() > 0)
|
|
<div class="table-responsive">
|
|
<table class="table table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Denominazione</th>
|
|
<th>Codice</th>
|
|
<th>Indirizzo</th>
|
|
<th>Città</th>
|
|
<th>Azioni</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($stabili as $stabile)
|
|
<tr>
|
|
<td>
|
|
<strong>{{ $stabile->denominazione }}</strong>
|
|
@if($stabile->note)
|
|
<br><small class="text-muted">{{ Str::limit($stabile->note, 50) }}</small>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<span class="badge bg-info">{{ $stabile->codice_stabile ?? 'N/D' }}</span>
|
|
</td>
|
|
<td>{{ $stabile->indirizzo ?? 'N/D' }}</td>
|
|
<td>{{ $stabile->citta ?? 'N/D' }}</td>
|
|
<td>
|
|
<div class="btn-group btn-group-sm">
|
|
<a href="{{ route('mgmt.admin.stabili.show', $stabile) }}" class="btn btn-outline-primary">
|
|
<i class="fas fa-eye"></i>
|
|
</a>
|
|
<a href="{{ route('mgmt.admin.stabili.edit', $stabile) }}" class="btn btn-outline-warning">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
@if(method_exists($stabili, 'links'))
|
|
<div class="d-flex justify-content-center">
|
|
{{ $stabili->links() }}
|
|
</div>
|
|
@endif
|
|
@else
|
|
<div class="text-center py-4">
|
|
<i class="fas fa-building fa-3x text-muted mb-3"></i>
|
|
<h5 class="text-muted">Nessuno stabile presente</h5>
|
|
<p class="text-muted">Inizia creando il primo stabile del sistema.</p>
|
|
<button class="btn btn-primary" onclick="showCreateStabileForm()">
|
|
<i class="fas fa-plus me-2"></i>Crea Primo Stabile
|
|
</button>
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Script per gestione azioni --}}
|
|
<script>
|
|
$(document).ready(function() {
|
|
// Gestione click sui link delle azioni che dovrebbero restare nella stessa area
|
|
$(document).on('click', '.btn-outline-primary, .btn-outline-warning', function(e) {
|
|
e.preventDefault();
|
|
var url = $(this).attr('href');
|
|
|
|
// Carica il contenuto nella stessa area dinamica
|
|
$.get(url)
|
|
.done(function(data) {
|
|
$('#dynamic-content-container').html(data);
|
|
})
|
|
.fail(function() {
|
|
alert('Errore nel caricamento della pagina');
|
|
});
|
|
});
|
|
});
|
|
</script>
|