Files
ABSDEV/Modules/Settings/Resources/views/index.blade.php
T

56 lines
3.9 KiB
PHP

<x-layouts.app :title="__('Site settings')">
<div class="mx-auto max-w-6xl space-y-6">
<div class="flex flex-wrap items-end justify-between gap-4">
<div>
<p class="text-sm font-medium text-orange-600">Single source of truth</p>
<h1 class="text-3xl font-semibold">Site settings</h1>
<p class="mt-2 max-w-3xl text-sm text-zinc-500">
Global identity, branding, contact details and SEO are entered once here and reused by every theme, page, header and footer.
</p>
</div>
<a href="{{ route('administration.menus.index') }}" class="rounded-lg border border-zinc-300 px-4 py-2 text-sm font-medium dark:border-zinc-700">Manage menus</a>
</div>
@if (session('status'))
<div class="rounded-xl border border-emerald-200 bg-emerald-50 p-4 text-sm text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200">{{ session('status') }}</div>
@endif
<form method="POST" action="{{ route('administration.settings.update') }}" class="space-y-6">
@csrf
@method('PUT')
@foreach ($sections as $section => $fields)
<section class="overflow-hidden rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
<div class="border-b border-zinc-200 px-6 py-4 dark:border-zinc-700">
<h2 class="text-lg font-semibold">{{ $section }}</h2>
</div>
<div class="grid gap-5 p-6 md:grid-cols-2">
@foreach ($fields as $key => $field)
<label class="block {{ ($field['type'] ?? '') === 'textarea' ? 'md:col-span-2' : '' }}">
<span class="text-sm font-medium">{{ $field['label'] }}</span>
@if (! empty($field['help']))<span class="mt-1 block text-xs text-zinc-500">{{ $field['help'] }}</span>@endif
@if (($field['type'] ?? 'text') === 'textarea')
<textarea name="settings[{{ $key }}]" rows="4" class="mt-2 w-full rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950">{{ old("settings.$key", $values[$key] ?? '') }}</textarea>
@elseif (($field['type'] ?? 'text') === 'select')
<select name="settings[{{ $key }}]" class="mt-2 w-full rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950">
@foreach (($field['options'] ?? []) as $optionValue => $optionLabel)
<option value="{{ $optionValue }}" @selected(old("settings.$key", $values[$key] ?? '') === $optionValue)>{{ $optionLabel }}</option>
@endforeach
</select>
@else
<input type="{{ $field['type'] ?? 'text' }}" name="settings[{{ $key }}]" value="{{ old("settings.$key", $values[$key] ?? '') }}" placeholder="{{ $field['placeholder'] ?? '' }}" class="mt-2 w-full rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950">
@endif
@error("settings.$key")<span class="mt-1 block text-sm text-red-600">{{ $message }}</span>@enderror
</label>
@endforeach
</div>
</section>
@endforeach
<div class="sticky bottom-4 flex justify-end rounded-2xl border border-zinc-200 bg-white/95 p-4 shadow-xl backdrop-blur dark:border-zinc-700 dark:bg-zinc-900/95">
<flux:button type="submit" variant="primary">Save site settings</flux:button>
</div>
</form>
</div>
</x-layouts.app>