netgescon-day0/resources/views/admin/banche/index.blade.php

132 lines
5.7 KiB
PHP
Executable File

@extends('admin.layouts.app')
@section('title', '
{{ __(\'Gestione Banche\') }}
')
@section('content')
<div class="py-5">
<div class="container-fluid mx-auto sm:px-4 lg:px-8">
<div class="bg-white dark:bg-dark overflow-hidden shadow-sm rounded">
<div class="p-6 text-gray-900 dark:text-gray-100">
<div class="d-d-flex justify-content-between align-align-items-center mb-4">
<h1 class="h3 mb-0 text-dark">
<i class="fas fa-university"></i>
Gestione Banche
</h1>
<a href="{{ route('admin.banche.create') }}" class="btn btn-primary">
<i class="fas fa-plus"></i>
Nuova Banca
</a>
</div>
@if(session('success'))
<div class="alert alert-success alert-dismissible fade show" role="alert">
{{ session('success') }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
@endif
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Elenco Banche</h6>
</div>
<div class="card-body">
@if($banche->count() > 0)
<div class="table-responsive">
<table class="table table-bordered" id="dataTable">
<thead>
<tr>
<th>Denominazione</th>
<th>Codice ABI</th>
<th>Codice CAB</th>
<th>IBAN</th>
<th>Saldo Corrente</th>
<th class="text-center">Azioni</th>
</tr>
</thead>
<tbody>
@foreach($banche as $banca)
<tr>
<td>
<strong>{{ $banca->denominazione }}</strong>
@if($banca->filiale)
<br><small class="text-muted">{{ $banca->filiale }}</small>
@endif
</td>
<td>{{ $banca->codice_abi }}</td>
<td>{{ $banca->codice_cab }}</td>
<td>
<code>{{ $banca->iban }}</code>
</td>
<td class="text-right">
<span class="badge badge-{{ $banca->saldo_corrente >= 0 ? 'success' : 'danger' }}">
{{ number_format($banca->saldo_corrente, 2, ',', '.') }}
</span>
</td>
<td class="text-center">
<a href="{{ route('admin.banche.show', $banca) }}" class="btn btn-sm btn-info" title="Visualizza">
<i class="fas fa-eye"></i>
</a>
<a href="{{ route('admin.banche.edit', $banca) }}" class="btn btn-sm btn-warning" title="Modifica">
<i class="fas fa-edit"></i>
</a>
<form action="{{ route('admin.banche.destroy', $banca) }}" method="POST" class="d-inline" onsubmit="return confirm('Sei sicuro di voler eliminare questa banca?')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-sm btn-danger" title="Elimina">
<i class="fas fa-trash"></i>
</button>
</form>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
<div class="d-d-flex justify-content-center">
{{ $banche->links() }}
</div>
@else
<div class="text-center py-3">
<i class="fas fa-university fa-3x text-gray-300 mb-3"></i>
<h5 class="text-muted">Nessuna banca presente</h5>
<p class="text-gray-400 mb-4">Inizia aggiungendo la prima banca del condominio.</p>
<a href="{{ route('admin.banche.create') }}" class="btn btn-primary">
<i class="fas fa-plus"></i>
Aggiungi Prima Banca
</a>
</div>
@endif
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
$(document).ready(function() {
$('#dataTable').DataTable({
"language": {
"url": "//cdn.datatables.net/plug-ins/1.10.24/i18n/Italian.json"
},
"pageLength": 25,
"order": [[ 0, "asc" ]],
"columnDefs": [
{ "orderable": false, "targets": -1 }
]
});
});
</script>
@endpush
@endsection