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,92 @@
@extends('layouts.admin')
@section('title', __('Dashboard'))
@section('mobile_title', __('Dashboard'))
@section('content')
<div class="mx-auto max-w-6xl">
<div class="mb-8 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Dashboard') }}</h1>
<p class="mt-1 text-sm text-slate-600">{{ __('Overview of your pre-registration activity.') }}</p>
</div>
@can('create', \App\Models\PreregistrationPage::class)
<a
href="{{ route('admin.pages.create') }}"
class="inline-flex items-center justify-center rounded-lg bg-indigo-600 px-4 py-2.5 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2"
>
<svg class="mr-2 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="M12 4v16m8-8H4"/>
</svg>
{{ __('New page') }}
</a>
@endcan
</div>
<div class="grid gap-4 sm:grid-cols-2 lg:grid-cols-3">
<div class="rounded-xl border border-slate-200 bg-white p-6 shadow-sm">
<div class="flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-indigo-100 text-indigo-700">
<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="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>
</div>
<div>
<p class="text-sm font-medium text-slate-500">{{ __('Total pages') }}</p>
<p class="text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($totalPages) }}</p>
</div>
</div>
<p class="mt-4 text-xs text-slate-500">
@if (auth()->user()->isSuperadmin())
{{ __('All pre-registration pages in the system.') }}
@else
{{ __('Pages you own.') }}
@endif
</p>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-6 shadow-sm">
<div class="flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-emerald-100 text-emerald-700">
<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="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"/>
</svg>
</div>
<div>
<p class="text-sm font-medium text-slate-500">{{ __('Total subscribers') }}</p>
<p class="text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($totalSubscribers) }}</p>
</div>
</div>
<p class="mt-4 text-xs text-slate-500">{{ __('Across all pages in this overview.') }}</p>
</div>
<div class="rounded-xl border border-slate-200 bg-white p-6 shadow-sm sm:col-span-2 lg:col-span-1">
<div class="flex items-center gap-3">
<div class="flex h-10 w-10 items-center justify-center rounded-lg bg-amber-100 text-amber-800">
<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="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
</div>
<div>
<p class="text-sm font-medium text-slate-500">{{ __('Active pages') }}</p>
<p class="text-2xl font-semibold tabular-nums text-slate-900">{{ number_format($activePages) }}</p>
</div>
</div>
<p class="mt-4 text-xs text-slate-500">{{ __('Currently within the start and end date window.') }}</p>
</div>
</div>
@can('create', \App\Models\PreregistrationPage::class)
<div class="mt-8 rounded-xl border border-dashed border-slate-300 bg-white/80 p-6 text-center">
<p class="text-sm text-slate-600">{{ __('Ready to launch a new campaign?') }}</p>
<a
href="{{ route('admin.pages.create') }}"
class="mt-3 inline-flex text-sm font-semibold text-indigo-600 hover:text-indigo-500"
>
{{ __('Create a pre-registration page') }}
</a>
</div>
@endcan
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', __('New page'))
@section('mobile_title', __('New page'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Create page') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('Form will be added in Step 8.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', __('Edit') . ' — ' . $page->title)
@section('mobile_title', __('Edit'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Edit page') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('Form will be added in Step 8.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', __('Pages'))
@section('mobile_title', __('Pages'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Pre-registration pages') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('Page list and CRUD will be added in the next step.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', $page->title)
@section('mobile_title', $page->title)
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ $page->title }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('Detail view placeholder.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', __('New user'))
@section('mobile_title', __('New user'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Create user') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('Form will be added in Step 10.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,13 @@
@extends('layouts.admin')
@section('title', __('Edit user'))
@section('mobile_title', __('Edit user'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Edit user') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ $user->email }}</p>
<p class="mt-2 text-sm text-slate-600">{{ __('Form will be added in Step 10.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,12 @@
@extends('layouts.admin')
@section('title', __('Users'))
@section('mobile_title', __('Users'))
@section('content')
<div class="mx-auto max-w-6xl">
<h1 class="text-2xl font-semibold text-slate-900">{{ __('Users') }}</h1>
<p class="mt-2 text-sm text-slate-600">{{ __('User management will be completed in a later step.') }}</p>
</div>
@endsection

View File

@@ -0,0 +1,15 @@
@props([
'href',
'active' => false,
])
@php
$base = 'group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition';
$classes = $active
? $base . ' bg-slate-800 text-white'
: $base . ' text-slate-300 hover:bg-slate-800/80 hover:text-white';
@endphp
<a href="{{ $href }}" {{ $attributes->merge(['class' => $classes]) }}>
{{ $slot }}
</a>

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>

View File

@@ -15,7 +15,7 @@
>{{ __('Delete Account') }}</x-danger-button>
<x-modal name="confirm-user-deletion" :show="$errors->userDeletion->isNotEmpty()" focusable>
<form method="post" action="{{ route('profile.destroy') }}" class="p-6">
<form method="post" action="{{ route('admin.profile.destroy') }}" class="p-6">
@csrf
@method('delete')

View File

@@ -13,7 +13,7 @@
@csrf
</form>
<form method="post" action="{{ route('profile.update') }}" class="mt-6 space-y-6">
<form method="post" action="{{ route('admin.profile.update') }}" class="mt-6 space-y-6">
@csrf
@method('patch')