12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
240
resources/views/livewire/admin/footer-codes/index.blade.php
Normal file
240
resources/views/livewire/admin/footer-codes/index.blade.php
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\FooterCode;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Volt\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
new #[Layout('components.layouts.app'), Title('Footer-Codes')] class extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
public string $search = '';
|
||||
|
||||
public string $portalFilter = 'all';
|
||||
|
||||
public string $statusFilter = 'all';
|
||||
|
||||
public function updatedSearch(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedPortalFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedStatusFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function toggleActive(int $id): void
|
||||
{
|
||||
$footerCode = FooterCode::query()->find($id);
|
||||
|
||||
if (! $footerCode) {
|
||||
return;
|
||||
}
|
||||
|
||||
$footerCode->update(['is_active' => ! $footerCode->is_active]);
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
$term = trim($this->search);
|
||||
|
||||
$codes = FooterCode::query()
|
||||
->withCount('categories')
|
||||
->when($this->portalFilter !== 'all', fn ($q) => $q->where('portal', $this->portalFilter))
|
||||
->when($this->statusFilter === 'active', fn ($q) => $q->where('is_active', true))
|
||||
->when($this->statusFilter === 'inactive', fn ($q) => $q->where('is_active', false))
|
||||
->when($this->statusFilter === 'global', fn ($q) => $q->where('is_global', true))
|
||||
->when(filled($term), function ($q) use ($term): void {
|
||||
$q->where(function ($q) use ($term): void {
|
||||
$q->where('title', 'like', '%'.$term.'%')
|
||||
->orWhere('content', 'like', '%'.$term.'%');
|
||||
});
|
||||
})
|
||||
->orderByDesc('is_global')
|
||||
->orderBy('priority')
|
||||
->orderBy('title')
|
||||
->paginate(25);
|
||||
|
||||
return [
|
||||
'codes' => $codes,
|
||||
'portalOptions' => Portal::cases(),
|
||||
'totals' => [
|
||||
'total' => FooterCode::query()->count(),
|
||||
'active' => FooterCode::query()->where('is_active', true)->count(),
|
||||
'global' => FooterCode::query()->where('is_global', true)->count(),
|
||||
],
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div class="space-y-6">
|
||||
@if(session('success'))
|
||||
<flux:callout color="green" icon="check-circle">{{ session('success') }}</flux:callout>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<flux:callout color="red" icon="exclamation-triangle">{{ session('error') }}</flux:callout>
|
||||
@endif
|
||||
|
||||
<flux:card>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<flux:heading size="xl">{{ __('Footer-Codes') }}</flux:heading>
|
||||
<flux:subheading>
|
||||
{{ __('Snippets, die unter Pressemitteilungen ausgespielt werden.') }}
|
||||
</flux:subheading>
|
||||
</div>
|
||||
<flux:button
|
||||
variant="primary"
|
||||
icon="plus"
|
||||
:href="route('admin.footer-codes.create')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Footer-Code anlegen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
||||
<flux:card>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:text class="text-sm text-zinc-500">{{ __('Gesamt') }}</flux:text>
|
||||
<flux:text size="xl" weight="bold">{{ $totals['total'] }}</flux:text>
|
||||
</div>
|
||||
<flux:icon.code-bracket-square class="size-8 text-blue-500" />
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:text class="text-sm text-zinc-500">{{ __('Aktiv') }}</flux:text>
|
||||
<flux:text size="xl" weight="bold">{{ $totals['active'] }}</flux:text>
|
||||
</div>
|
||||
<flux:icon.bolt class="size-8 text-green-500" />
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card>
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:text class="text-sm text-zinc-500">{{ __('Global') }}</flux:text>
|
||||
<flux:text size="xl" weight="bold">{{ $totals['global'] }}</flux:text>
|
||||
</div>
|
||||
<flux:icon.globe-alt class="size-8 text-purple-500" />
|
||||
</div>
|
||||
</flux:card>
|
||||
</div>
|
||||
|
||||
<flux:card>
|
||||
<div class="grid gap-3 md:grid-cols-[1fr,auto,auto]">
|
||||
<flux:input
|
||||
wire:model.live.debounce.300ms="search"
|
||||
placeholder="{{ __('Titel oder Inhalt suchen…') }}"
|
||||
icon="magnifying-glass"
|
||||
/>
|
||||
|
||||
<flux:select wire:model.live="portalFilter">
|
||||
<option value="all">{{ __('Alle Portale') }}</option>
|
||||
@foreach($portalOptions as $option)
|
||||
<option value="{{ $option->value }}">{{ $option->label() }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
|
||||
<flux:select wire:model.live="statusFilter">
|
||||
<option value="all">{{ __('Alle Status') }}</option>
|
||||
<option value="active">{{ __('Aktiv') }}</option>
|
||||
<option value="inactive">{{ __('Inaktiv') }}</option>
|
||||
<option value="global">{{ __('Global') }}</option>
|
||||
</flux:select>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card>
|
||||
<flux:table>
|
||||
<flux:table.columns>
|
||||
<flux:table.column>{{ __('Titel') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Portal') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Sprache') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Kategorien') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Priorität') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Status') }}</flux:table.column>
|
||||
<flux:table.column align="end">{{ __('Aktionen') }}</flux:table.column>
|
||||
</flux:table.columns>
|
||||
|
||||
<flux:table.rows>
|
||||
@forelse($codes as $code)
|
||||
<flux:table.row :key="'fc-'.$code->id">
|
||||
<flux:table.cell>
|
||||
<div class="flex items-center gap-2">
|
||||
@if($code->is_global)
|
||||
<flux:badge color="purple" size="xs" icon="globe-alt">{{ __('Global') }}</flux:badge>
|
||||
@endif
|
||||
<span class="font-medium">{{ $code->title }}</span>
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
<flux:table.cell>
|
||||
<flux:badge color="zinc" size="sm">{{ $code->portal->label() }}</flux:badge>
|
||||
</flux:table.cell>
|
||||
<flux:table.cell>
|
||||
{{ $code->language ? strtoupper($code->language) : '–' }}
|
||||
</flux:table.cell>
|
||||
<flux:table.cell>
|
||||
@if($code->is_global)
|
||||
<span class="text-zinc-500">{{ __('alle') }}</span>
|
||||
@else
|
||||
{{ $code->categories_count }}
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
<flux:table.cell>{{ $code->priority }}</flux:table.cell>
|
||||
<flux:table.cell>
|
||||
<flux:badge :color="$code->is_active ? 'green' : 'zinc'" size="sm">
|
||||
{{ $code->is_active ? __('Aktiv') : __('Inaktiv') }}
|
||||
</flux:badge>
|
||||
</flux:table.cell>
|
||||
<flux:table.cell align="end">
|
||||
<div class="flex items-center justify-end gap-1">
|
||||
<flux:button
|
||||
size="xs"
|
||||
variant="ghost"
|
||||
:icon="$code->is_active ? 'pause' : 'play'"
|
||||
wire:click="toggleActive({{ $code->id }})"
|
||||
:title="$code->is_active ? __('Deaktivieren') : __('Aktivieren')"
|
||||
/>
|
||||
<flux:button
|
||||
size="xs"
|
||||
variant="ghost"
|
||||
icon="pencil"
|
||||
:href="route('admin.footer-codes.edit', $code->id)"
|
||||
wire:navigate
|
||||
:title="__('Bearbeiten')"
|
||||
/>
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@empty
|
||||
<flux:table.row>
|
||||
<flux:table.cell :colspan="7">
|
||||
<div class="py-8 text-center text-zinc-500">
|
||||
{{ __('Keine Footer-Codes gefunden.') }}
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endforelse
|
||||
</flux:table.rows>
|
||||
</flux:table>
|
||||
|
||||
<div class="mt-4">
|
||||
{{ $codes->links() }}
|
||||
</div>
|
||||
</flux:card>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue