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,143 @@
<?php
use App\Models\Organization;
use App\Models\Todo;
use App\Models\User;
use Livewire\Component;
new class extends Component
{
public Organization $organization;
public ?Todo $todo = null;
public string $title = '';
public string $description = '';
public string $category = 'infra';
public string $criticality = 'medium';
public ?string $due_date = null;
public ?int $assigned_to = null;
public function mount(Organization $organization, ?Todo $todo = null): void
{
$this->organization = $organization;
if ($todo?->exists) {
$this->todo = $todo;
$this->title = $todo->title;
$this->description = $todo->description ?? '';
$this->category = $todo->category;
$this->criticality = $todo->criticality;
$this->due_date = $todo->due_date?->format('Y-m-d');
$this->assigned_to = $todo->assigned_to;
}
}
public function save(): void
{
$validated = $this->validate([
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'category' => 'required|in:'.implode(',', array_keys(Todo::CATEGORIES)),
'criticality' => 'required|in:'.implode(',', array_keys(Todo::CRITICALITIES)),
'due_date' => 'nullable|date',
'assigned_to' => 'nullable|exists:users,id',
]);
if ($this->todo?->exists) {
$this->todo->update($validated);
session()->flash('status', "Tâche \"{$this->todo->title}\" mise à jour.");
} else {
$this->organization->todos()->create([
...$validated,
'created_by' => auth()->id(),
]);
session()->flash('status', "Tâche \"{$this->title}\" créée.");
}
$this->redirectRoute('organizations.todos.index', $this->organization, navigate: true);
}
public function with(): array
{
return [
'assignableUsers' => User::role(['Administrateur', 'Technicien'])->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">
{{ $todo?->exists ? 'Modifier la tâche' : 'Nouvelle tâche' }}
</h1>
<form wire:submit="save" class="space-y-4 rounded border border-slate-200 bg-white p-6">
<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">
@error('title') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Description</label>
<textarea wire:model="description" 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>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700">Catégorie</label>
<select wire:model="category"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@foreach (Todo::CATEGORIES as $value => $label)
<option value="{{ $value }}">{{ $label }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Criticité</label>
<select wire:model="criticality"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@foreach (Todo::CRITICALITIES as $value => $label)
<option value="{{ $value }}">{{ $label }}</option>
@endforeach
</select>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-sm font-medium text-slate-700">Date d'échéance</label>
<input type="date" wire:model="due_date"
class="mt-1 w-full rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
@error('due_date') <p class="mt-1 text-sm text-red-600">{{ $message }}</p> @enderror
</div>
<div>
<label class="block text-sm font-medium text-slate-700">Assigné à</label>
<select wire:model="assigned_to"
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 ($assignableUsers as $user)
<option value="{{ $user->id }}">{{ $user->name }}</option>
@endforeach
</select>
</div>
</div>
<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.todos.index', $organization) }}" class="text-sm text-slate-500 hover:text-slate-900">Annuler</a>
</div>
</form>
@if ($todo?->exists)
<div class="mt-8">
<livewire:related-items.panel :organization="$organization" :item="$todo" :key="'related-'.$todo->id" />
</div>
@endif
</div>