Initial commit: CABM-IT (ItGlue-style MSP documentation platform)
Laravel 13 + Livewire/Volt app for managing client organizations, documents, passwords, flexible assets, virtual machines, contacts, domains, todos, shortcuts, and role-based user administration.
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Organization;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
new class extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
public Organization $organization;
|
||||
|
||||
#[Url]
|
||||
public string $search = '';
|
||||
|
||||
public function delete(int $domainId): void
|
||||
{
|
||||
$domain = $this->organization->domains()->findOrFail($domainId);
|
||||
$domain->delete();
|
||||
|
||||
session()->flash('status', "Domaine \"{$domain->name}\" supprimé.");
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'domains' => $this->organization->domains()
|
||||
->when($this->search, fn ($query) => $query->where(function ($q) {
|
||||
$q->where('name', 'like', "%{$this->search}%")
|
||||
->orWhere('registrar', 'like', "%{$this->search}%");
|
||||
}))
|
||||
->orderBy('expires_at')
|
||||
->paginate(15),
|
||||
];
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
<div>
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<div>
|
||||
<p class="text-sm text-slate-500">{{ $organization->name }}</p>
|
||||
<h1 class="text-2xl font-semibold text-slate-900">Domaines</h1>
|
||||
</div>
|
||||
<a href="{{ route('organizations.domains.create', $organization) }}"
|
||||
class="rounded bg-slate-900 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700">
|
||||
+ Nouveau domaine
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<input type="text" wire:model.live.debounce.300ms="search" placeholder="Filtrer par nom ou bureau d'enregistrement..."
|
||||
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-x-auto 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">Domaine</th>
|
||||
<th class="px-4 py-3">TLD</th>
|
||||
<th class="px-4 py-3">Bureau d'enregistrement</th>
|
||||
<th class="px-4 py-3">Expiration</th>
|
||||
<th class="px-4 py-3">Renouvellement auto.</th>
|
||||
<th class="px-4 py-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
@forelse ($domains as $domain)
|
||||
@php $status = $domain->expiryStatus(); @endphp
|
||||
<tr wire:key="domain-{{ $domain->id }}">
|
||||
<td class="px-4 py-3">
|
||||
<a href="{{ route('organizations.domains.edit', [$organization, $domain]) }}"
|
||||
class="font-medium text-slate-900 hover:underline">
|
||||
{{ $domain->name }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-slate-600">{{ $domain->tld() ?? '—' }}</td>
|
||||
<td class="px-4 py-3 text-slate-600">{{ $domain->registrar ?? '—' }}</td>
|
||||
<td class="px-4 py-3">
|
||||
@if ($domain->expires_at)
|
||||
<span @class([
|
||||
'text-red-600 font-medium' => $status === 'expired',
|
||||
'text-amber-600 font-medium' => $status === 'soon',
|
||||
'text-slate-600' => $status === 'ok',
|
||||
])>
|
||||
{{ $domain->expires_at->format('Y-m-d') }}
|
||||
</span>
|
||||
@if ($status === 'expired')
|
||||
<span class="ml-2 rounded-full bg-red-100 px-2 py-0.5 text-xs font-medium text-red-700">Expiré</span>
|
||||
@elseif ($status === 'soon')
|
||||
<span class="ml-2 rounded-full bg-amber-100 px-2 py-0.5 text-xs font-medium text-amber-700">{{ $domain->expiresInDays() }}j restants</span>
|
||||
@endif
|
||||
@else
|
||||
<span class="text-slate-400">—</span>
|
||||
@endif
|
||||
</td>
|
||||
<td class="px-4 py-3 text-slate-600">{{ $domain->auto_renew ? 'Oui' : 'Non' }}</td>
|
||||
<td class="px-4 py-3 text-right whitespace-nowrap">
|
||||
<a href="{{ route('organizations.domains.edit', [$organization, $domain]) }}" class="text-slate-500 hover:text-slate-900">Modifier</a>
|
||||
<button type="button"
|
||||
wire:click="delete({{ $domain->id }})"
|
||||
wire:confirm="Supprimer ce domaine ? Cette action est irréversible."
|
||||
class="ml-3 text-red-500 hover:text-red-700">
|
||||
Supprimer
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-4 py-6 text-center text-slate-400">Aucun domaine pour le moment.</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="mt-4">
|
||||
{{ $domains->links() }}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user