Optimierung Phase 1: Aufraeumen / toter Code
1.1 Prototyp admin/users/table entfernt: Route (war durch admin/users/{id}
ohnehin unerreichbar) + Volt-Komponente table.blade.php geloescht,
ADMIN_ROUTES.md aktualisiert; Regressions-Test in PanelConsolidationTest.
1.2 16 tote Legacy-Wrapper-Views unter resources/views/admin/* geloescht
(nutzten alte Route-Parameter, nirgends via view/@include/@livewire
gerendert); admin.dashboard + .md-Doku behalten.
1.3 Tote Helfer entfernt: EnsureUserIsAdmin redundantes loadMissing('roles'),
ungenutzter statusColor-Key aus with() in admin PR edit/show,
LegacyInvoicePdfController Laufzeit-Schema::hasColumn (Spalte existiert
seit Migration) inkl. Schema-Import.
Volle Suite gruen (794 passed, 1 skipped).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a82964df2b
commit
a5f3ddd0f3
25 changed files with 9 additions and 329 deletions
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Kategorien') }}</flux:heading>
|
||||
|
||||
@livewire('admin.categories.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.companies.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Neue Firma') }}</flux:heading>
|
||||
|
||||
@livewire('admin.companies.create')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.companies.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Firma bearbeiten') }}</flux:heading>
|
||||
|
||||
@livewire('admin.companies.edit', ['companyId' => request()->route('company')])
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Firmen') }}</flux:heading>
|
||||
|
||||
@livewire('admin.companies.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.companies.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
@livewire('admin.companies.show', ['companyId' => request()->route('company')])
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Kontakte') }}</flux:heading>
|
||||
|
||||
@livewire('admin.contacts.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Gutscheine') }}</flux:heading>
|
||||
|
||||
@livewire('admin.coupons.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Rechnungen') }}</flux:heading>
|
||||
|
||||
@livewire('admin.invoices.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Zahlungen') }}</flux:heading>
|
||||
|
||||
@livewire('admin.payments.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.press-releases.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Neue Pressemitteilung') }}</flux:heading>
|
||||
|
||||
@livewire('admin.press-releases.create')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.press-releases.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Pressemitteilung bearbeiten') }}</flux:heading>
|
||||
|
||||
@livewire('admin.press-releases.edit', ['pressReleaseId' => request()->route('pressRelease')])
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Pressemitteilungen') }}</flux:heading>
|
||||
|
||||
@livewire('admin.press-releases.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.press-releases.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
@livewire('admin.press-releases.show', ['pressReleaseId' => request()->route('pressRelease')])
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.roles.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Neue Rolle erstellen') }}</flux:heading>
|
||||
|
||||
@livewire('admin.roles.create')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<div class="mb-6">
|
||||
<flux:button variant="filled" icon="arrow-left" href="{{ route('admin.roles.index') }}" wire:navigate>
|
||||
{{ __('Zurück zur Übersicht') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Rolle bearbeiten') }}</flux:heading>
|
||||
|
||||
@livewire('admin.roles.edit', ['roleId' => request()->route('role')])
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<x-layouts.app>
|
||||
<flux:main>
|
||||
<flux:heading size="xl" class="mb-6">{{ __('Rollen & Rechte') }}</flux:heading>
|
||||
|
||||
@livewire('admin.roles.index')
|
||||
</flux:main>
|
||||
</x-layouts.app>
|
||||
|
|
@ -555,13 +555,6 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung bearbeiten')] cl
|
|||
'selectedCompany' => $selectedCompany,
|
||||
'selectedCompanyContacts' => $selectedCompany ? $this->companyContacts((int) $selectedCompany->id) : Contact::query()->whereRaw('0 = 1')->get(),
|
||||
'tagSuggestions' => $this->tagSuggestionsFor($selectedCompany),
|
||||
'statusColor' => match ($this->currentStatus) {
|
||||
'published' => 'green',
|
||||
'review' => 'yellow',
|
||||
'rejected' => 'red',
|
||||
'archived' => 'blue',
|
||||
default => 'zinc',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -108,13 +108,6 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
'categoryName' => $pr->category?->translations->firstWhere('locale', 'de')?->name
|
||||
?? $pr->category?->translations->first()?->name
|
||||
?? '–',
|
||||
'statusColor' => match ($pr->status->value) {
|
||||
'published' => 'green',
|
||||
'review' => 'yellow',
|
||||
'rejected' => 'red',
|
||||
'archived' => 'blue',
|
||||
default => 'zinc',
|
||||
},
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
|
|
|||
|
|
@ -1,146 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Volt\Component;
|
||||
use Livewire\WithPagination; // Wichtig für Paginierung
|
||||
|
||||
|
||||
new #[Layout('components.layouts.app'), Title('Benutzertabelle')] class extends Component {
|
||||
use WithPagination;
|
||||
|
||||
// Optional: Such- und Filter-Properties
|
||||
public string $search = '';
|
||||
public string $statusFilter = '';
|
||||
public string $roleFilter = '';
|
||||
|
||||
// Optional: Sortierung
|
||||
public $sortBy = 'name';
|
||||
public $sortDirection = 'asc';
|
||||
|
||||
|
||||
/**
|
||||
* Mount the component.
|
||||
*/
|
||||
public function mount(): void
|
||||
{
|
||||
// Standardwerte für Sortierung setzen
|
||||
$this->sortBy = 'name';
|
||||
$this->sortDirection = 'asc';
|
||||
}
|
||||
|
||||
|
||||
public function sort($column) {
|
||||
if ($this->sortBy === $column) {
|
||||
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
|
||||
} else {
|
||||
$this->sortBy = $column;
|
||||
$this->sortDirection = 'asc';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*public function orders()
|
||||
{
|
||||
return \App\Models\Order::query()
|
||||
->tap(fn ($query) => $this->sortBy ? $query->orderBy($this->sortBy, $this->sortDirection) : $query)
|
||||
->paginate(5);
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
// Die Hauptmethode, um Daten zu laden
|
||||
#[\Livewire\Attributes\Computed]
|
||||
public function users()
|
||||
{
|
||||
return User::query()
|
||||
->when($this->search, fn($query, $search) =>
|
||||
$query->where('name', 'like', '%' . $search . '%')
|
||||
->orWhere('email', 'like', '%' . $search . '%')
|
||||
)
|
||||
->when($this->statusFilter, fn($query, $status) =>
|
||||
$query->where('status', $status)
|
||||
)
|
||||
->when($this->roleFilter, fn($query, $role) =>
|
||||
$query->where('role', $role) // oder 'role_id' wenn du IDs verwendest
|
||||
)
|
||||
->orderBy($this->sortBy, $this->sortDirection)
|
||||
->paginate(10); // 10 Einträge pro Seite
|
||||
}
|
||||
|
||||
// Optional: Lifecycle hook für das Zurücksetzen der Paginierung bei Suche/Filterung
|
||||
public function updatedSearch() { $this->resetPage(); }
|
||||
public function updatedStatusFilter() { $this->resetPage(); }
|
||||
public function updatedRoleFilter() { $this->resetPage(); }
|
||||
|
||||
// Wird für die Paginierung mit Tailwind benötigt (Standard in Livewire 3)
|
||||
// Wenn FluxUI Bootstrap-basierte Paginierung braucht, musst du das anpassen
|
||||
// public function paginationView()
|
||||
// {
|
||||
// return 'vendor.livewire.tailwind'; // oder 'livewire::bootstrap'
|
||||
// }
|
||||
|
||||
// Wenn du mit Relationen arbeitest (z.B. user->role->name)
|
||||
// public function with(): array
|
||||
// {
|
||||
// return [
|
||||
// 'users' => User::with(['role', 'group']) // Eager loading
|
||||
// // ... deine Query-Logik von oben ...
|
||||
// ->paginate(10),
|
||||
// ];
|
||||
// }
|
||||
}; ?>
|
||||
<flux:table :paginate="$this->users">
|
||||
<flux:table.columns>
|
||||
<flux:table.column>Customer</flux:table.column>
|
||||
<flux:table.column sortable :sorted="$sortBy === 'date'" :direction="$sortDirection" wire:click="sort('date')">Date</flux:table.column>
|
||||
<flux:table.column sortable :sorted="$sortBy === 'status'" :direction="$sortDirection" wire:click="sort('status')">Status</flux:table.column>
|
||||
<flux:table.column sortable :sorted="$sortBy === 'amount'" :direction="$sortDirection" wire:click="sort('amount')">Amount</flux:table.column>
|
||||
</flux:table.columns>
|
||||
|
||||
<flux:table.rows>
|
||||
@foreach ($this->users as $user)
|
||||
<flux:table.row :key="$user->id">
|
||||
<flux:table.cell class="flex items-center gap-3">
|
||||
<flux:avatar size="xs" src="{{ $user->avatar }}" />
|
||||
|
||||
{{ $user->name }}
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell class="whitespace-nowrap">{{ $user->email }}</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
<flux:badge size="sm" color="lime" inset="top bottom">RTest</flux:badge>
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell variant="strong">{{ $user->role }}</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
<flux:dropdown>
|
||||
<flux:button variant="filled" size="sm" icon="ellipsis-horizontal" inset="top bottom"></flux:button>
|
||||
<flux:menu>
|
||||
<flux:menu.item icon="plus">New post</flux:menu.item>
|
||||
<flux:menu.separator />
|
||||
<flux:menu.submenu heading="Sort by">
|
||||
<flux:menu.radio.group>
|
||||
<flux:menu.radio checked>Name</flux:menu.radio>
|
||||
<flux:menu.radio>Date</flux:menu.radio>
|
||||
<flux:menu.radio>Popularity</flux:menu.radio>
|
||||
</flux:menu.radio.group>
|
||||
</flux:menu.submenu>
|
||||
<flux:menu.submenu heading="Filter">
|
||||
<flux:menu.checkbox checked>Draft</flux:menu.checkbox>
|
||||
<flux:menu.checkbox checked>Published</flux:menu.checkbox>
|
||||
<flux:menu.checkbox>Archived</flux:menu.checkbox>
|
||||
</flux:menu.submenu>
|
||||
<flux:menu.separator />
|
||||
<flux:menu.item variant="danger" icon="trash">Delete</flux:menu.item>
|
||||
</flux:menu>
|
||||
</flux:dropdown>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endforeach
|
||||
</flux:table.rows>
|
||||
</flux:table>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue