61 lines
2.9 KiB
PHP
61 lines
2.9 KiB
PHP
@extends('layouts.app')
|
|
|
|
@section('content')
|
|
<div class="container">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h2>Gestion des Communes</h2>
|
|
<a href="{{ route('admin.municipalities.create') }}" class="btn btn-primary">Ajouter une Commune</a>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>Nom</th>
|
|
<th>Code Postal</th>
|
|
<th>Statut</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach($municipalities as $municipality)
|
|
<tr class="{{ $municipality->is_active ? '' : 'table-warning' }}">
|
|
<td>{{ $municipality->name }}</td>
|
|
<td>{{ $municipality->zip_code }}</td>
|
|
<td>
|
|
@if($municipality->is_active)
|
|
<span class="badge bg-success">Active</span>
|
|
@else
|
|
<span class="badge bg-secondary">Désactivée</span>
|
|
@endif
|
|
</td>
|
|
<td>
|
|
<div class="d-flex gap-2">
|
|
<a href="{{ route('admin.municipalities.edit', $municipality) }}" class="btn btn-sm btn-outline-primary">Modifier</a>
|
|
|
|
<form action="{{ route('admin.municipalities.toggle', $municipality) }}" method="POST">
|
|
@csrf
|
|
<button type="submit" class="btn btn-sm {{ $municipality->is_active ? 'btn-outline-secondary' : 'btn-outline-success' }}">
|
|
{{ $municipality->is_active ? 'Désactiver' : 'Activer' }}
|
|
</button>
|
|
</form>
|
|
|
|
<form action="{{ route('admin.municipalities.destroy', $municipality) }}" method="POST" onsubmit="return confirm('Êtes-vous sûr de vouloir supprimer cette commune ?');">
|
|
@csrf
|
|
@method('DELETE')
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">Supprimer</button>
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|