- Fiche d'identité par organisation (technicien référent, FAI, IP publiques, prestataires liés) accessible depuis un nouveau menu. - Nouveau module Prestataires dédié (catalogue léger réutilisable entre communes, avec journal de suivi des échanges) plutôt que de détourner les organisations de type "Fournisseur". - Nouveau menu Infrastructure par organisation avec schémas réseau/fonctionnel édités via draw.io embarqué (URL configurable, cf. réglages admin). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
101 lines
4.0 KiB
PHP
101 lines
4.0 KiB
PHP
<?php
|
|
|
|
use App\Models\Provider;
|
|
use Livewire\Attributes\Url;
|
|
use Livewire\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
new class extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
#[Url]
|
|
public string $search = '';
|
|
|
|
public function delete(int $providerId): void
|
|
{
|
|
$provider = Provider::findOrFail($providerId);
|
|
$provider->delete();
|
|
|
|
session()->flash('status', "Prestataire « {$provider->name} » supprimé.");
|
|
}
|
|
|
|
public function with(): array
|
|
{
|
|
return [
|
|
'providers' => Provider::query()
|
|
->when($this->search, fn ($query) => $query->where('name', 'like', "%{$this->search}%"))
|
|
->orderBy('name')
|
|
->paginate(15),
|
|
];
|
|
}
|
|
};
|
|
?>
|
|
|
|
<div>
|
|
<div class="mb-6 flex items-center justify-between">
|
|
<h1 class="text-2xl font-semibold text-slate-900">Prestataires</h1>
|
|
<a href="{{ route('providers.create') }}"
|
|
class="rounded bg-slate-900 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700">
|
|
+ Nouveau prestataire
|
|
</a>
|
|
</div>
|
|
|
|
@if (session('status'))
|
|
<div class="mb-4 rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm text-emerald-700">
|
|
{{ session('status') }}
|
|
</div>
|
|
@endif
|
|
|
|
<input type="text" wire:model.live.debounce.300ms="search" placeholder="Filtrer par nom..."
|
|
class="mb-4 w-full max-w-sm rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
|
|
|
|
<div class="overflow-hidden rounded border border-slate-200 bg-white">
|
|
<table class="min-w-full divide-y divide-slate-200 text-sm">
|
|
<thead class="bg-slate-50 text-left text-xs uppercase tracking-wide text-slate-500">
|
|
<tr>
|
|
<th class="px-4 py-3"></th>
|
|
<th class="px-4 py-3">Nom</th>
|
|
<th class="px-4 py-3">Téléphone</th>
|
|
<th class="px-4 py-3">Email</th>
|
|
<th class="px-4 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-slate-100">
|
|
@forelse ($providers as $provider)
|
|
<tr wire:key="provider-{{ $provider->id }}">
|
|
<td class="px-4 py-3">
|
|
<img src="{{ $provider->logo_url }}" alt="Logo {{ $provider->name }}"
|
|
class="h-8 w-8 rounded border border-slate-200 bg-white object-contain p-0.5">
|
|
</td>
|
|
<td class="px-4 py-3">
|
|
<a href="{{ route('providers.edit', $provider) }}" class="font-medium text-slate-900 hover:underline">
|
|
{{ $provider->name }}
|
|
</a>
|
|
</td>
|
|
<td class="px-4 py-3 text-slate-600">{{ $provider->phone ?? '—' }}</td>
|
|
<td class="px-4 py-3 text-slate-600">{{ $provider->email ?? '—' }}</td>
|
|
<td class="px-4 py-3 text-right">
|
|
<a href="{{ route('providers.edit', $provider) }}" class="text-slate-500 hover:text-slate-900">Modifier</a>
|
|
<button type="button"
|
|
wire:click="delete({{ $provider->id }})"
|
|
wire:confirm="Supprimer ce prestataire ? Cette action est irréversible."
|
|
class="ml-3 cursor-pointer text-red-500 hover:text-red-700">
|
|
Supprimer
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="5" class="px-4 py-6 text-center text-slate-400">Aucun prestataire pour le moment.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
{{ $providers->links() }}
|
|
</div>
|
|
</div>
|