This commit is contained in:
Mark Gregory
2026-07-24 11:24:48 +01:00
parent d8d39d5810
commit 2b30f3b03d
2 changed files with 71 additions and 10 deletions
@@ -1,9 +1,32 @@
<x-layouts.app :title="isset($record) ? __('Edit Form') : __('Create Form')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Form</h1></div><form method="POST" action="{{ isset($record) ? route('administration.forms.update', $record) : route('administration.forms.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Name</label><input type="text" name="name" value="{{ old('name', $record->name ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('name')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Slug</label><input type="text" name="slug" value="{{ old('slug', $record->slug ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('slug')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Description</label><textarea name="description" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('description', $record->description ?? '') }}</textarea>@error('description')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Schema (JSON)</label><textarea name="schema_json" rows="6" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('schema_json', isset($record) ? json_encode($record->schema, JSON_PRETTY_PRINT) : '') }}</textarea></div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.forms.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
<div class="mx-auto max-w-4xl space-y-6">
<div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Form</h1></div>
<form method="POST"
action="{{ isset($record) ? route('administration.forms.update', $record) : route('administration.forms.store') }}"
class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record)
@method('PUT')
@endisset
<div><label class="mb-1 block text-sm font-medium">Name</label><input type="text" name="name"
value="{{ old('name', $record->name ?? '') }}"
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('name')
<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Slug</label><input type="text" name="slug"
value="{{ old('slug', $record->slug ?? '') }}"
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('slug')
<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Description</label><textarea name="description" rows="4"
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('description', $record->description ?? '') }}</textarea>@error('description')
<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Schema (JSON)</label><textarea name="schema_json"
rows="6"
class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('schema_json', isset($record) ? json_encode($record->schema, JSON_PRETTY_PRINT) : '') }}</textarea>
</div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled"
value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3">
<button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save
</button>
<a href="{{ route('administration.forms.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div>
</form>
</div>
</x-layouts.app>
@@ -1,5 +1,43 @@
<x-layouts.app :title="__('Forms')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Forms</h1><p class="text-sm text-zinc-500">Manage forms content.</p></div><a href="{{ route('administration.forms.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Name</th><th class="px-4 py-3 text-left">Slug</th><th class="px-4 py-3 text-left">Description</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->name) ? json_encode($record->name) : Str::limit((string) $record->name, 70) }}</td><td class="px-4 py-3">{{ is_array($record->slug) ? json_encode($record->slug) : Str::limit((string) $record->slug, 70) }}</td><td class="px-4 py-3">{{ is_array($record->description) ? json_encode($record->description) : Str::limit((string) $record->description, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.forms.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.forms.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
<div class="space-y-6">
<div class="flex items-center justify-between">
<div><h1 class="text-2xl font-semibold">Forms</h1>
<p class="text-sm text-zinc-500">Manage forms content.</p></div>
<a href="{{ route('administration.forms.create') }}"
class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a>
</div>
@if(session('status'))
<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>
@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900">
<table class="w-full text-sm">
<thead class="bg-zinc-50 dark:bg-zinc-800">
<tr>
<th class="px-4 py-3 text-left">Name</th>
<th class="px-4 py-3 text-left">Slug</th>
<th class="px-4 py-3 text-left">Description</th>
<th class="px-4 py-3 text-right">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)
<tr>
<td class="px-4 py-3">{{ is_array($record->name) ? json_encode($record->name) : Str::limit((string) $record->name, 70) }}</td>
<td class="px-4 py-3">{{ is_array($record->slug) ? json_encode($record->slug) : Str::limit((string) $record->slug, 70) }}</td>
<td class="px-4 py-3">{{ is_array($record->description) ? json_encode($record->description) : Str::limit((string) $record->description, 70) }}</td>
<td class="px-4 py-3 text-right"><a class="mr-3 underline"
href="{{ route('administration.forms.edit', $record) }}">Edit</a>
<form class="inline" method="POST"
action="{{ route('administration.forms.destroy', $record) }}">@csrf @method('DELETE')
<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete
</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td>
</tr>
@endforelse</tbody>
</table>
</div>{{ $records->links() }}</div>
</x-layouts.app>