feat: replace the navigation with a dashboard and per-area boards

This commit is contained in:
fromme committed 2026-09-13 18:08:39 +02:00
1 parent d63df2cc1b
commit bce8f58be3
26 files changed
+810 -328

No files matched your search

+56
View File
@@ -4,6 +4,18 @@ declare(strict_types=1);
namespace App\Entity;
/**
* The kinds of thing that can be booked.
*
* **This enum is the extension point.** The dashboard builds one tile per case, the board route
* accepts one slug per case, and the floor plan is looked up by convention from the case's
* value. Adding a third bookable kind is therefore: a case here, a
* `templates/board/plan/_<value>.html.twig` with its geometry, and rows in `app:seed`. Nothing
* else needs editing — in particular no template lists the kinds by hand.
*
* The backing values are persisted in `resource.type`, which is why they stay English while the
* URLs do not: `slug()` is what appears in a path, so the routes read German like the rest.
*/
enum ResourceType: string
{
case DESK = 'desk';
@@ -16,4 +28,48 @@ enum ResourceType: string
self::PARKING => 'Parkplatz',
};
}
public function plural(): string
{
return match ($this) {
self::DESK => 'Schreibtische',
self::PARKING => 'Parkplätze',
};
}
public function description(): string
{
return match ($this) {
self::DESK => 'Einen Platz im Büro reservieren.',
self::PARKING => 'Einen Stellplatz reservieren.',
};
}
public function icon(): string
{
return match ($this) {
self::DESK => 'lucide:armchair',
self::PARKING => 'lucide:car',
};
}
/** What appears in a URL. */
public function slug(): string
{
return match ($this) {
self::DESK => 'schreibtische',
self::PARKING => 'parkplaetze',
};
}
public static function fromSlug(string $slug): self
{
foreach (self::cases() as $case) {
if ($case->slug() === $slug) {
return $case;
}
}
throw new \ValueError(\sprintf('"%s" ist kein bekannter Buchungsbereich.', $slug));
}
}