feat: Phase 2 - admin layout, dashboard, page CRUD, subscribers, user management

This commit is contained in:
2026-04-03 20:09:20 +02:00
parent 904cf1241b
commit 78e1be3e3b
27 changed files with 404 additions and 33 deletions

View File

@@ -0,0 +1,128 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@hasSection('title')@yield('title') @endif{{ config('app.name', 'PreRegister') }}</title>
<link rel="preconnect" href="https://fonts.bunny.net">
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="font-sans antialiased bg-slate-100 text-slate-900" x-data="{ sidebarOpen: false }">
{{-- Mobile overlay --}}
<div
x-show="sidebarOpen"
x-transition.opacity
class="fixed inset-0 z-40 bg-slate-900/60 lg:hidden"
style="display: none;"
@click="sidebarOpen = false"
aria-hidden="true"
></div>
<div class="min-h-screen lg:flex">
{{-- Sidebar --}}
<aside
class="fixed inset-y-0 left-0 z-50 flex w-64 flex-col border-r border-slate-800 bg-slate-900 shadow-xl transition-transform duration-200 lg:static lg:translate-x-0"
:class="sidebarOpen ? 'translate-x-0' : '-translate-x-full lg:translate-x-0'"
aria-label="{{ __('Main navigation') }}"
>
<div class="flex h-16 shrink-0 items-center justify-between border-b border-slate-800 px-4">
<a href="{{ route('admin.dashboard') }}" class="text-lg font-semibold tracking-tight text-white">
{{ config('app.name', 'PreRegister') }}
</a>
<button
type="button"
class="rounded-lg p-2 text-slate-400 hover:bg-slate-800 hover:text-white lg:hidden"
@click="sidebarOpen = false"
aria-label="{{ __('Close menu') }}"
>
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
<nav class="flex flex-1 flex-col gap-1 p-3">
<x-admin.sidebar-link
:href="route('admin.dashboard')"
:active="request()->routeIs('admin.dashboard')"
>
<svg class="h-5 w-5 shrink-0 opacity-70 group-hover:opacity-100" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z"/>
</svg>
{{ __('Dashboard') }}
</x-admin.sidebar-link>
<x-admin.sidebar-link
:href="route('admin.pages.index')"
:active="request()->routeIs('admin.pages.*')"
>
<svg class="h-5 w-5 shrink-0 opacity-70 group-hover:opacity-100" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
{{ __('Pages') }}
</x-admin.sidebar-link>
@if (auth()->user()->isSuperadmin())
<x-admin.sidebar-link
:href="route('admin.users.index')"
:active="request()->routeIs('admin.users.*')"
>
<svg class="h-5 w-5 shrink-0 opacity-70 group-hover:opacity-100" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"/>
</svg>
{{ __('Users') }}
</x-admin.sidebar-link>
@endif
</nav>
<div class="border-t border-slate-800 p-3">
<div class="mb-2 truncate px-3 text-xs text-slate-500">{{ auth()->user()->email }}</div>
<x-admin.sidebar-link :href="route('admin.profile.edit')" :active="request()->routeIs('admin.profile.*')" class="mb-1">
{{ __('Profile') }}
</x-admin.sidebar-link>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button
type="submit"
class="flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-slate-300 transition hover:bg-slate-800/80 hover:text-white"
>
{{ __('Log out') }}
</button>
</form>
</div>
</aside>
{{-- Main column --}}
<div class="flex min-w-0 flex-1 flex-col">
<header class="sticky top-0 z-30 flex h-16 items-center gap-4 border-b border-slate-200 bg-white px-4 shadow-sm lg:hidden">
<button
type="button"
class="rounded-lg p-2 text-slate-600 hover:bg-slate-100"
@click="sidebarOpen = true"
aria-label="{{ __('Open menu') }}"
>
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
</svg>
</button>
<span class="truncate font-semibold text-slate-900">@yield('mobile_title', config('app.name', 'PreRegister'))</span>
</header>
<main class="flex-1 p-4 sm:p-6 lg:p-8">
@if (session('status'))
<div class="mb-6 rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-sm text-emerald-800" role="status">
{{ session('status') }}
</div>
@endif
@yield('content')
</main>
</div>
</div>
</body>
</html>

View File

@@ -5,14 +5,14 @@
<div class="flex">
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ route('dashboard') }}">
<a href="{{ route('admin.dashboard') }}">
<x-application-logo class="block h-9 w-auto fill-current text-gray-800" />
</a>
</div>
<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ms-10 sm:flex">
<x-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
<x-nav-link :href="route('admin.dashboard')" :active="request()->routeIs('admin.dashboard')">
{{ __('Dashboard') }}
</x-nav-link>
</div>
@@ -34,7 +34,7 @@
</x-slot>
<x-slot name="content">
<x-dropdown-link :href="route('profile.edit')">
<x-dropdown-link :href="route('admin.profile.edit')">
{{ __('Profile') }}
</x-dropdown-link>
@@ -67,7 +67,7 @@
<!-- Responsive Navigation Menu -->
<div :class="{'block': open, 'hidden': ! open}" class="hidden sm:hidden">
<div class="pt-2 pb-3 space-y-1">
<x-responsive-nav-link :href="route('dashboard')" :active="request()->routeIs('dashboard')">
<x-responsive-nav-link :href="route('admin.dashboard')" :active="request()->routeIs('admin.dashboard')">
{{ __('Dashboard') }}
</x-responsive-nav-link>
</div>
@@ -80,7 +80,7 @@
</div>
<div class="mt-3 space-y-1">
<x-responsive-nav-link :href="route('profile.edit')">
<x-responsive-nav-link :href="route('admin.profile.edit')">
{{ __('Profile') }}
</x-responsive-nav-link>