12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
78
resources/views/livewire/admin/presets/create.blade.php
Normal file
78
resources/views/livewire/admin/presets/create.blade.php
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
use App\Models\AdminPreset;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Volt\Component;
|
||||
|
||||
new #[Layout('components.layouts.app'), Title('Neue Voreinstellung')] class extends Component
|
||||
{
|
||||
public string $key = '';
|
||||
|
||||
public string $area = 'press_releases';
|
||||
|
||||
public string $type = 'text';
|
||||
|
||||
public string $label = '';
|
||||
|
||||
public string $value = '';
|
||||
|
||||
public string $payload = '';
|
||||
|
||||
public bool $isActive = true;
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$validated = $this->validate([
|
||||
'key' => ['required', 'string', 'max:255', 'regex:/^[a-z0-9_.-]+$/', Rule::unique('admin_presets', 'key')],
|
||||
'area' => ['required', 'string', 'max:100'],
|
||||
'type' => ['required', Rule::in(['text', 'number', 'boolean', 'json'])],
|
||||
'label' => ['required', 'string', 'max:255'],
|
||||
'value' => ['nullable', 'string'],
|
||||
'payload' => ['nullable', 'json'],
|
||||
'isActive' => ['boolean'],
|
||||
]);
|
||||
|
||||
AdminPreset::query()->create([
|
||||
'key' => $validated['key'],
|
||||
'area' => $validated['area'],
|
||||
'type' => $validated['type'],
|
||||
'label' => $validated['label'],
|
||||
'value' => $validated['value'] ?: null,
|
||||
'payload' => filled($validated['payload']) ? json_decode($validated['payload'], true) : null,
|
||||
'is_active' => $validated['isActive'],
|
||||
]);
|
||||
|
||||
session()->flash('success', __('Voreinstellung wurde angelegt.'));
|
||||
|
||||
$this->redirect(route('admin.presets.index'), navigate: true);
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<form wire:submit="save" class="space-y-6">
|
||||
<flux:card>
|
||||
<div class="flex items-center justify-between gap-4">
|
||||
<div>
|
||||
<flux:heading size="lg">{{ __('Neue Voreinstellung') }}</flux:heading>
|
||||
<flux:subheading>{{ __('Texte, Zahlen oder JSON-Werte zentral fuer Admin-Funktionen pflegen.') }}</flux:subheading>
|
||||
</div>
|
||||
<flux:button variant="ghost" icon="arrow-left" href="{{ route('admin.presets.index') }}" wire:navigate>
|
||||
{{ __('Zurück') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
@include('livewire.admin.presets.partials.form-fields')
|
||||
|
||||
<flux:card>
|
||||
<div class="flex justify-end gap-3">
|
||||
<flux:button variant="ghost" href="{{ route('admin.presets.index') }}" wire:navigate>
|
||||
{{ __('Abbrechen') }}
|
||||
</flux:button>
|
||||
<flux:button type="submit" variant="primary">
|
||||
{{ __('Voreinstellung erstellen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</flux:card>
|
||||
</form>
|
||||
Loading…
Add table
Add a link
Reference in a new issue