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:
jeremy bayse
2026-08-16 13:28:12 +02:00
commit 8f22dca9c8
209 changed files with 23324 additions and 0 deletions
@@ -0,0 +1,153 @@
<?php
use App\Models\Contact;
use App\Models\Organization;
use Livewire\Component;
new class extends Component
{
public Organization $organization;
public ?Contact $contact = null;
public string $first_name = '';
public string $last_name = '';
public string $title = '';
public string $email = '';
public string $phone = '';
public string $mobile = '';
public ?int $location_id = null;
public bool $is_important = false;
public string $notes = '';
public function mount(Organization $organization, ?Contact $contact = null): void
{
$this->organization = $organization;
if ($contact?->exists) {
$this->contact = $contact;
$this->first_name = $contact->first_name;
$this->last_name = $contact->last_name;
$this->title = $contact->title ?? '';
$this->email = $contact->email ?? '';
$this->phone = $contact->phone ?? '';
$this->mobile = $contact->mobile ?? '';
$this->location_id = $contact->location_id;
$this->is_important = $contact->is_important;
$this->notes = $contact->notes ?? '';
}
}
public function save(): void
{
$validated = $this->validate([
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'title' => 'nullable|string|max:255',
'email' => 'nullable|email|max:255',
'phone' => 'nullable|string|max:255',
'mobile' => 'nullable|string|max:255',
'location_id' => 'nullable|exists:locations,id',
'is_important' => 'boolean',
'notes' => 'nullable|string',
]);
if ($this->contact?->exists) {
$this->contact->update($validated);
session()->flash('status', "Contact \"{$this->contact->full_name}\" mis à jour.");
} else {
$this->organization->contacts()->create($validated);
session()->flash('status', "Contact \"{$this->first_name} {$this->last_name}\" créé.");
}
$this->redirectRoute('organizations.contacts.index', $this->organization, navigate: true);
}
public function with(): array
{
return [
'locations' => $this->organization->locations()->orderBy('name')->get(),
];
}
};
?>
<div class="max-w-2xl">
<p class="text-sm text-slate-500">{{ $organization->name }}</p>
<h1 class="mb-6 text-2xl font-semibold text-slate-900">
{{ $contact?->exists ? 'Modifier le contact' : 'Nouveau contact' }}
</h1>
<form wire:submit="save" class="space-y-4 rounded border border-slate-200 bg-white p-6">
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700">Prénom</label>
<input type="text" wire:model="first_name"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@error('first_name') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Nom</label>
<input type="text" wire:model="last_name"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@error('last_name') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700">Titre</label>
<input type="text" wire:model="title"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Site</label>
<select wire:model="location_id"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
<option value="">—</option>
@foreach ($locations as $location)
<option value="{{ $location->id }}">{{ $location->name }}</option>
@endforeach
</select>
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Email</label>
<input type="email" wire:model="email"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@error('email') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700">Téléphone</label>
<input type="text" wire:model="phone"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Mobile</label>
<input type="text" wire:model="mobile"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
</div>
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Notes</label>
<textarea wire:model="notes" rows="3"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500"></textarea>
</div>
<label class="flex items-center gap-2 text-sm text-slate-700">
<input type="checkbox" wire:model="is_important" class="rounded border-slate-300">
Contact important
</label>
<div class="flex items-center gap-3 pt-2">
<button type="submit"
class="rounded bg-slate-900 px-4 py-2 text-sm font-medium text-white hover:bg-slate-700">
Enregistrer
</button>
<a href="{{ route('organizations.contacts.index', $organization) }}" class="text-sm text-slate-500 hover:text-slate-900">Annuler</a>
</div>
</form>
</div>