Ajoute dossiers et association de site aux schémas d'infrastructure
- Navigation par dossiers dans la section Infrastructure (créer, parcourir, fil d'ariane), isolée du navigateur Documents comme les schémas eux-mêmes. - Un schéma peut être associé à un site de l'organisation, avec filtre par site dans la liste. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3e5878192e
commit
c1c6d56d1e
@@ -9,17 +9,19 @@ new class extends Component
|
||||
public Organization $organization;
|
||||
public Document $document;
|
||||
public string $backRoute = 'organizations.documents.index';
|
||||
public ?int $folderId = null;
|
||||
|
||||
public bool $renaming = false;
|
||||
public string $name = '';
|
||||
|
||||
public function mount(Organization $organization, Document $document, string $backRoute = 'organizations.documents.index'): void
|
||||
public function mount(Organization $organization, Document $document, string $backRoute = 'organizations.documents.index', ?int $folderId = null): void
|
||||
{
|
||||
abort_unless($document->isDiagram(), 404);
|
||||
|
||||
$this->organization = $organization;
|
||||
$this->document = $document;
|
||||
$this->backRoute = $backRoute;
|
||||
$this->folderId = $folderId;
|
||||
$this->name = $document->name;
|
||||
}
|
||||
|
||||
@@ -31,6 +33,11 @@ new class extends Component
|
||||
$this->renaming = false;
|
||||
}
|
||||
|
||||
public function updateLocation(?int $locationId): void
|
||||
{
|
||||
$this->document->update(['location_id' => $locationId]);
|
||||
}
|
||||
|
||||
public function saveDiagram(string $xml): void
|
||||
{
|
||||
$contentChanged = $this->document->content !== $xml;
|
||||
@@ -46,6 +53,13 @@ new class extends Component
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'locations' => $this->organization->locations()->orderBy('name')->get(),
|
||||
];
|
||||
}
|
||||
};
|
||||
?>
|
||||
|
||||
@@ -66,7 +80,18 @@ new class extends Component
|
||||
<span class="text-sm text-slate-400 opacity-0 group-hover:opacity-100">Renommer</span>
|
||||
</button>
|
||||
@endif
|
||||
<a href="{{ route($backRoute, $organization) }}" class="text-sm text-slate-500 hover:text-slate-900">Retour</a>
|
||||
<a href="{{ route($backRoute, [$organization, 'folderId' => $folderId]) }}" class="text-sm text-slate-500 hover:text-slate-900">Retour</a>
|
||||
</div>
|
||||
|
||||
<div class="mb-4 flex items-center gap-2">
|
||||
<label class="text-sm font-medium text-slate-700">Site associé</label>
|
||||
<select wire:change="updateLocation($event.target.value === '' ? null : $event.target.value)"
|
||||
class="rounded border-slate-300 text-sm shadow-sm focus:border-slate-500 focus:ring-slate-500">
|
||||
<option value="">Aucun</option>
|
||||
@foreach ($locations as $location)
|
||||
<option value="{{ $location->id }}" @selected($document->location_id === $location->id)>{{ $location->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user