20-02-2026
This commit is contained in:
parent
854ce02bf6
commit
4d6b4930b2
128 changed files with 18247 additions and 2093 deletions
355
resources/views/livewire/admin/partners/edit.blade.php
Normal file
355
resources/views/livewire/admin/partners/edit.blade.php
Normal file
|
|
@ -0,0 +1,355 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Partner;
|
||||
use App\Models\Hub;
|
||||
use Livewire\Volt\Component;
|
||||
use function Livewire\Volt\{layout, title};
|
||||
|
||||
layout('components.layouts.app');
|
||||
title('Partner bearbeiten');
|
||||
|
||||
new class extends Component {
|
||||
public Partner $partner;
|
||||
|
||||
// Basis-Felder
|
||||
public string $companyName = '';
|
||||
public string $displayName = '';
|
||||
public string $street = '';
|
||||
public string $houseNumber = '';
|
||||
public string $zip = '';
|
||||
public string $city = '';
|
||||
public string $phone = '';
|
||||
public string $website = '';
|
||||
public ?int $hubId = null;
|
||||
public bool $isActive = true;
|
||||
|
||||
// Profil-Felder (Phase 1 Migrationen)
|
||||
public string $storyText = '';
|
||||
public int|string $foundedYear = '';
|
||||
public string $specialtiesInput = '';
|
||||
|
||||
/**
|
||||
* Öffnungszeiten als strukturiertes Array.
|
||||
*
|
||||
* @var array<string, array{open: string, close: string, closed: bool}>
|
||||
*/
|
||||
public array $openingHours = [
|
||||
'monday' => ['open' => '09:00', 'close' => '18:00', 'closed' => false],
|
||||
'tuesday' => ['open' => '09:00', 'close' => '18:00', 'closed' => false],
|
||||
'wednesday' => ['open' => '09:00', 'close' => '18:00', 'closed' => false],
|
||||
'thursday' => ['open' => '09:00', 'close' => '18:00', 'closed' => false],
|
||||
'friday' => ['open' => '09:00', 'close' => '18:00', 'closed' => false],
|
||||
'saturday' => ['open' => '10:00', 'close' => '16:00', 'closed' => false],
|
||||
'sunday' => ['open' => '', 'close' => '', 'closed' => true],
|
||||
];
|
||||
|
||||
public function mount(int $partnerId): void
|
||||
{
|
||||
$this->partner = Partner::findOrFail($partnerId);
|
||||
$this->authorize('update', $this->partner);
|
||||
|
||||
$this->companyName = $this->partner->company_name ?? '';
|
||||
$this->displayName = $this->partner->display_name ?? '';
|
||||
$this->street = $this->partner->street ?? '';
|
||||
$this->houseNumber = $this->partner->house_number ?? '';
|
||||
$this->zip = $this->partner->zip ?? '';
|
||||
$this->city = $this->partner->city ?? '';
|
||||
$this->phone = $this->partner->phone ?? '';
|
||||
$this->website = $this->partner->website ?? '';
|
||||
$this->hubId = $this->partner->hub_id;
|
||||
$this->isActive = $this->partner->is_active;
|
||||
$this->storyText = $this->partner->story_text ?? '';
|
||||
$this->foundedYear = $this->partner->founded_year ?? '';
|
||||
$this->specialtiesInput = $this->partner->specialties
|
||||
? implode(', ', $this->partner->specialties)
|
||||
: '';
|
||||
|
||||
if ($this->partner->opening_hours) {
|
||||
$this->openingHours = array_merge($this->openingHours, $this->partner->opening_hours);
|
||||
}
|
||||
}
|
||||
|
||||
public function save(): void
|
||||
{
|
||||
$this->authorize('update', $this->partner);
|
||||
|
||||
$this->validate([
|
||||
'companyName' => 'required|string|max:255',
|
||||
'displayName' => 'nullable|string|max:255',
|
||||
'street' => 'nullable|string|max:255',
|
||||
'houseNumber' => 'nullable|string|max:20',
|
||||
'zip' => 'nullable|string|max:10',
|
||||
'city' => 'nullable|string|max:100',
|
||||
'phone' => 'nullable|string|max:50',
|
||||
'website' => 'nullable|url|max:255',
|
||||
'hubId' => 'nullable|exists:hubs,id',
|
||||
'storyText' => 'nullable|string|max:2000',
|
||||
'foundedYear' => 'nullable|integer|min:1800|max:' . now()->year,
|
||||
'specialtiesInput' => 'nullable|string|max:500',
|
||||
], [
|
||||
'companyName.required' => __('Bitte geben Sie einen Firmennamen ein.'),
|
||||
'website.url' => __('Bitte geben Sie eine gültige URL ein (z.B. https://example.de).'),
|
||||
'foundedYear.integer' => __('Bitte geben Sie eine gültige Jahreszahl ein.'),
|
||||
'foundedYear.min' => __('Das Gründungsjahr muss nach 1800 liegen.'),
|
||||
'foundedYear.max' => __('Das Gründungsjahr darf nicht in der Zukunft liegen.'),
|
||||
]);
|
||||
|
||||
$specialties = array_filter(
|
||||
array_map('trim', explode(',', $this->specialtiesInput))
|
||||
);
|
||||
|
||||
$this->partner->update([
|
||||
'company_name' => $this->companyName,
|
||||
'display_name' => $this->displayName ?: null,
|
||||
'street' => $this->street ?: null,
|
||||
'house_number' => $this->houseNumber ?: null,
|
||||
'zip' => $this->zip ?: null,
|
||||
'city' => $this->city ?: null,
|
||||
'phone' => $this->phone ?: null,
|
||||
'website' => $this->website ?: null,
|
||||
'hub_id' => $this->hubId,
|
||||
'is_active' => $this->isActive,
|
||||
'story_text' => $this->storyText ?: null,
|
||||
'founded_year' => $this->foundedYear ?: null,
|
||||
'specialties' => array_values($specialties),
|
||||
'opening_hours' => $this->openingHours,
|
||||
]);
|
||||
|
||||
session()->flash('message', __('Partner-Profil erfolgreich gespeichert.'));
|
||||
}
|
||||
|
||||
/** @return array<string, string> */
|
||||
protected function dayLabels(): array
|
||||
{
|
||||
return [
|
||||
'monday' => __('Montag'),
|
||||
'tuesday' => __('Dienstag'),
|
||||
'wednesday' => __('Mittwoch'),
|
||||
'thursday' => __('Donnerstag'),
|
||||
'friday' => __('Freitag'),
|
||||
'saturday' => __('Samstag'),
|
||||
'sunday' => __('Sonntag'),
|
||||
];
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
return [
|
||||
'hubs' => Hub::orderBy('name')->get(['id', 'name']),
|
||||
'dayLabels' => $this->dayLabels(),
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div class="space-y-6 p-6">
|
||||
{{-- Header --}}
|
||||
<div class="flex items-center gap-4">
|
||||
<flux:button href="{{ route('admin.partners.index') }}" variant="ghost" icon="arrow-left" />
|
||||
<div>
|
||||
<flux:heading size="xl" class="mb-1">{{ $partner->company_name }}</flux:heading>
|
||||
<flux:subheading>{{ __('Partner-Profil bearbeiten') }}</flux:subheading>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (session()->has('message'))
|
||||
<flux:callout variant="success" icon="check-circle">
|
||||
{{ session('message') }}
|
||||
</flux:callout>
|
||||
@endif
|
||||
|
||||
<form wire:submit="save" class="space-y-6">
|
||||
|
||||
{{-- Basisdaten --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="mb-4">
|
||||
<flux:heading size="lg">{{ __('Basisdaten') }}</flux:heading>
|
||||
</div>
|
||||
<flux:separator class="mb-6" />
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Firmenname') }}</flux:label>
|
||||
<flux:input wire:model="companyName" icon="building-office" />
|
||||
@error('companyName') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Anzeigename (optional)') }}</flux:label>
|
||||
<flux:description>{{ __('Öffentlich sichtbarer Name, falls abweichend') }}</flux:description>
|
||||
<flux:input wire:model="displayName" />
|
||||
@error('displayName') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<flux:field class="md:col-span-2">
|
||||
<flux:label>{{ __('Straße') }}</flux:label>
|
||||
<flux:input wire:model="street" />
|
||||
@error('street') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Hausnummer') }}</flux:label>
|
||||
<flux:input wire:model="houseNumber" />
|
||||
@error('houseNumber') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('PLZ') }}</flux:label>
|
||||
<flux:input wire:model="zip" />
|
||||
@error('zip') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field class="md:col-span-2">
|
||||
<flux:label>{{ __('Stadt') }}</flux:label>
|
||||
<flux:input wire:model="city" />
|
||||
@error('city') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Telefon') }}</flux:label>
|
||||
<flux:input wire:model="phone" type="tel" icon="phone" />
|
||||
@error('phone') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Website') }}</flux:label>
|
||||
<flux:input wire:model="website" type="url" placeholder="https://example.de" icon="globe-alt" />
|
||||
@error('website') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Hub / Region') }}</flux:label>
|
||||
<flux:select wire:model="hubId">
|
||||
<flux:select.option :value="null">{{ __('– Kein Hub –') }}</flux:select.option>
|
||||
@foreach ($hubs as $hub)
|
||||
<flux:select.option :value="$hub->id">{{ $hub->name }}</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
@error('hubId') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Status') }}</flux:label>
|
||||
<flux:switch wire:model="isActive" label="{{ __('Partner ist aktiv') }}" />
|
||||
</flux:field>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
{{-- Story & Profil --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="mb-4">
|
||||
<flux:heading size="lg">{{ __('Story & Profil') }}</flux:heading>
|
||||
<flux:subheading>{{ __('Erzählen Sie die Geschichte des Partners') }}</flux:subheading>
|
||||
</div>
|
||||
<flux:separator class="mb-6" />
|
||||
|
||||
<div class="space-y-4">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Story-Text') }}</flux:label>
|
||||
<flux:description>{{ __('Kurze Geschichte des Unternehmens – max. 2.000 Zeichen') }}</flux:description>
|
||||
<flux:textarea
|
||||
wire:model="storyText"
|
||||
placeholder="{{ __('Seit 1950 steht unser Haus für...') }}"
|
||||
rows="5"
|
||||
/>
|
||||
<div class="mt-1 text-right text-xs text-zinc-400">
|
||||
{{ strlen($storyText) }} / 2000
|
||||
</div>
|
||||
@error('storyText') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Gründungsjahr') }}</flux:label>
|
||||
<flux:input
|
||||
wire:model="foundedYear"
|
||||
type="number"
|
||||
min="1800"
|
||||
:max="date('Y')"
|
||||
placeholder="{{ __('z.B. 1985') }}"
|
||||
icon="calendar"
|
||||
/>
|
||||
@error('foundedYear') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Fachgebiete / Spezialisierungen') }}</flux:label>
|
||||
<flux:description>{{ __('Kommagetrennt, z.B. Polstermöbel, Küchen, Matratzen') }}</flux:description>
|
||||
<flux:input
|
||||
wire:model="specialtiesInput"
|
||||
placeholder="{{ __('Polstermöbel, Küchen, Matratzen') }}"
|
||||
/>
|
||||
@error('specialtiesInput') <flux:error>{{ $message }}</flux:error> @enderror
|
||||
</flux:field>
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
{{-- Öffnungszeiten --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="mb-4">
|
||||
<flux:heading size="lg">{{ __('Öffnungszeiten') }}</flux:heading>
|
||||
</div>
|
||||
<flux:separator class="mb-6" />
|
||||
|
||||
<div class="space-y-3">
|
||||
@foreach ($dayLabels as $dayKey => $dayLabel)
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="w-28 text-sm font-medium text-zinc-700 dark:text-zinc-300">
|
||||
{{ $dayLabel }}
|
||||
</div>
|
||||
|
||||
<flux:switch
|
||||
wire:model.live="openingHours.{{ $dayKey }}.closed"
|
||||
label="{{ __('Geschlossen') }}"
|
||||
/>
|
||||
|
||||
@unless ($openingHours[$dayKey]['closed'] ?? false)
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:input
|
||||
wire:model="openingHours.{{ $dayKey }}.open"
|
||||
type="time"
|
||||
class="w-28"
|
||||
/>
|
||||
<span class="text-zinc-500">–</span>
|
||||
<flux:input
|
||||
wire:model="openingHours.{{ $dayKey }}.close"
|
||||
type="time"
|
||||
class="w-28"
|
||||
/>
|
||||
</div>
|
||||
@endunless
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
{{-- Aktionen --}}
|
||||
<div class="flex justify-end gap-3">
|
||||
<flux:button href="{{ route('admin.partners.index') }}" variant="ghost">
|
||||
{{ __('Abbrechen') }}
|
||||
</flux:button>
|
||||
<flux:button
|
||||
type="submit"
|
||||
variant="primary"
|
||||
icon="check"
|
||||
wire:loading.attr="disabled"
|
||||
wire:target="save"
|
||||
>
|
||||
<span wire:loading.remove wire:target="save">{{ __('Speichern') }}</span>
|
||||
<span wire:loading wire:target="save">
|
||||
<flux:icon.arrow-path class="animate-spin inline-block mr-1 h-4 w-4" />
|
||||
{{ __('Wird gespeichert...') }}
|
||||
</span>
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
220
resources/views/livewire/admin/partners/index.blade.php
Normal file
220
resources/views/livewire/admin/partners/index.blade.php
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Partner;
|
||||
use Livewire\Volt\Component;
|
||||
use Livewire\WithPagination;
|
||||
use function Livewire\Volt\{layout, title};
|
||||
|
||||
layout('components.layouts.app');
|
||||
title('Partner-Verwaltung');
|
||||
|
||||
new class extends Component {
|
||||
use WithPagination;
|
||||
|
||||
public string $search = '';
|
||||
public string $typeFilter = '';
|
||||
public bool $onlyActive = false;
|
||||
|
||||
public function updatedSearch(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedTypeFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedOnlyActive(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
$this->authorize('viewAny', Partner::class);
|
||||
|
||||
$partners = Partner::query()
|
||||
->with(['hub', 'users'])
|
||||
->when($this->search, fn ($q) => $q->where(function ($q) {
|
||||
$q->where('company_name', 'like', "%{$this->search}%")
|
||||
->orWhere('city', 'like', "%{$this->search}%")
|
||||
->orWhere('email', 'like', "%{$this->search}%");
|
||||
}))
|
||||
->when($this->typeFilter, fn ($q) => $q->where('type', $this->typeFilter))
|
||||
->when($this->onlyActive, fn ($q) => $q->where('is_active', true))
|
||||
->orderBy('company_name')
|
||||
->paginate(20);
|
||||
|
||||
return [
|
||||
'partners' => $partners,
|
||||
'totalCount' => Partner::count(),
|
||||
'activeCount' => Partner::where('is_active', true)->count(),
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div class="space-y-6 p-6">
|
||||
{{-- Header --}}
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:heading size="xl" class="mb-2">{{ __('Partner-Verwaltung') }}</flux:heading>
|
||||
<flux:subheading>{{ __('Alle registrierten Partner auf der Plattform') }}</flux:subheading>
|
||||
</div>
|
||||
<flux:button
|
||||
href="{{ route('admin.partners.invite') }}"
|
||||
variant="primary"
|
||||
icon="plus"
|
||||
>
|
||||
{{ __('Partner einladen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
|
||||
{{-- Statistics --}}
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Gesamt') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $totalCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/20">
|
||||
<flux:icon.building-office class="h-6 w-6 text-blue-600 dark:text-blue-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Aktiv') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $activeCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900/20">
|
||||
<flux:icon.check-circle class="h-6 w-6 text-green-600 dark:text-green-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Inaktiv') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $totalCount - $activeCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-zinc-100 dark:bg-zinc-800">
|
||||
<flux:icon.x-circle class="h-6 w-6 text-zinc-600 dark:text-zinc-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
</div>
|
||||
|
||||
{{-- Filter --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex flex-wrap items-end gap-4">
|
||||
<flux:field class="flex-1">
|
||||
<flux:label>{{ __('Suche') }}</flux:label>
|
||||
<flux:input
|
||||
wire:model.live.debounce.300ms="search"
|
||||
placeholder="{{ __('Firmenname, Stadt oder E-Mail...') }}"
|
||||
icon="magnifying-glass"
|
||||
/>
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Partner-Typ') }}</flux:label>
|
||||
<flux:select wire:model.live="typeFilter">
|
||||
<flux:select.option value="">{{ __('Alle Typen') }}</flux:select.option>
|
||||
<flux:select.option value="retailer">{{ __('Händler') }}</flux:select.option>
|
||||
<flux:select.option value="manufacturer">{{ __('Hersteller') }}</flux:select.option>
|
||||
<flux:select.option value="estate_agent">{{ __('Makler') }}</flux:select.option>
|
||||
</flux:select>
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Status') }}</flux:label>
|
||||
<flux:switch wire:model.live="onlyActive" label="{{ __('Nur aktive') }}" />
|
||||
</flux:field>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
{{-- Partner-Tabelle --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<flux:table>
|
||||
<flux:table.columns>
|
||||
<flux:table.column>{{ __('Partner') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Typ') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Hub') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Benutzer') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Status') }}</flux:table.column>
|
||||
<flux:table.column></flux:table.column>
|
||||
</flux:table.columns>
|
||||
|
||||
<flux:table.rows>
|
||||
@forelse ($partners as $partner)
|
||||
<flux:table.row>
|
||||
<flux:table.cell>
|
||||
<div class="font-medium text-zinc-900 dark:text-white">
|
||||
{{ $partner->company_name }}
|
||||
</div>
|
||||
@if ($partner->city)
|
||||
<div class="text-sm text-zinc-500">{{ $partner->zip }} {{ $partner->city }}</div>
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
<flux:badge size="sm" color="{{ match($partner->type?->value ?? $partner->type) {
|
||||
'retailer' => 'blue',
|
||||
'manufacturer' => 'purple',
|
||||
'estate_agent' => 'amber',
|
||||
default => 'zinc'
|
||||
} }}">
|
||||
{{ $partner->type?->label() ?? ucfirst($partner->type ?? '–') }}
|
||||
</flux:badge>
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
{{ $partner->hub?->name ?? '–' }}
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
{{ $partner->users->count() }}
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
@if ($partner->is_active)
|
||||
<flux:badge size="sm" color="green">{{ __('Aktiv') }}</flux:badge>
|
||||
@else
|
||||
<flux:badge size="sm" color="zinc">{{ __('Inaktiv') }}</flux:badge>
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
<flux:button
|
||||
href="{{ route('admin.partners.edit', $partner->id) }}"
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
icon="pencil"
|
||||
>
|
||||
{{ __('Bearbeiten') }}
|
||||
</flux:button>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@empty
|
||||
<flux:table.row>
|
||||
<flux:table.cell colspan="6" class="py-12 text-center text-zinc-500">
|
||||
<flux:icon.building-office class="mx-auto mb-2 h-12 w-12 text-zinc-400" />
|
||||
<div>{{ __('Keine Partner gefunden') }}</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endforelse
|
||||
</flux:table.rows>
|
||||
</flux:table>
|
||||
|
||||
@if ($partners->hasPages())
|
||||
<div class="mt-4">
|
||||
{{ $partners->links() }}
|
||||
</div>
|
||||
@endif
|
||||
</flux:card>
|
||||
</div>
|
||||
563
resources/views/livewire/admin/products/index.blade.php
Normal file
563
resources/views/livewire/admin/products/index.blade.php
Normal file
|
|
@ -0,0 +1,563 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\ProductStatus;
|
||||
use App\Enums\ProductType;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Volt\Component;
|
||||
use Livewire\WithPagination;
|
||||
use function Livewire\Volt\{layout, title};
|
||||
|
||||
layout('components.layouts.app');
|
||||
title('Produkt-Verwaltung');
|
||||
|
||||
new class extends Component {
|
||||
use WithPagination;
|
||||
|
||||
public string $search = '';
|
||||
public string $statusFilter = '';
|
||||
public string $productTypeFilter = '';
|
||||
public string $categoryFilter = '';
|
||||
public string $partnerFilter = '';
|
||||
public string $curationNotes = '';
|
||||
public string $rejectionReason = '';
|
||||
public ?int $correctingProductId = null;
|
||||
public ?int $rejectingProductId = null;
|
||||
|
||||
public function updatedSearch(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedStatusFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedProductTypeFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedCategoryFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedPartnerFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function approve(int $productId): void
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$product = Product::findOrFail($productId);
|
||||
$product->update([
|
||||
'status' => ProductStatus::Active,
|
||||
'is_curated' => true,
|
||||
'curated_at' => now(),
|
||||
'curated_by' => auth()->id(),
|
||||
'curation_notes' => null,
|
||||
]);
|
||||
|
||||
$product->activities()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'action' => 'approved',
|
||||
'note' => null,
|
||||
]);
|
||||
|
||||
Flux::toast(variant: 'success', text: __('Produkt ":name" wurde freigegeben.', ['name' => $product->name]), duration: 5000);
|
||||
}
|
||||
|
||||
public function openCorrection(int $productId): void
|
||||
{
|
||||
$this->correctingProductId = $productId;
|
||||
$this->curationNotes = '';
|
||||
$this->rejectingProductId = null;
|
||||
$this->rejectionReason = '';
|
||||
}
|
||||
|
||||
public function cancelCorrection(): void
|
||||
{
|
||||
$this->correctingProductId = null;
|
||||
$this->curationNotes = '';
|
||||
}
|
||||
|
||||
public function sendCorrection(int $productId): void
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$this->validate([
|
||||
'curationNotes' => 'required|string|max:5000',
|
||||
], [
|
||||
'curationNotes.required' => __('Bitte geben Sie eine Korrekturanweisung ein.'),
|
||||
]);
|
||||
|
||||
$product = Product::findOrFail($productId);
|
||||
$product->update([
|
||||
'status' => ProductStatus::Correction,
|
||||
'is_curated' => false,
|
||||
'curation_notes' => $this->curationNotes,
|
||||
]);
|
||||
|
||||
$product->activities()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'action' => 'correction',
|
||||
'note' => $this->curationNotes,
|
||||
]);
|
||||
|
||||
$this->correctingProductId = null;
|
||||
$this->curationNotes = '';
|
||||
|
||||
Flux::toast(variant: 'success', text: __('Korrekturanweisung für ":name" wurde gesendet.', ['name' => $product->name]), duration: 5000);
|
||||
}
|
||||
|
||||
public function openRejection(int $productId): void
|
||||
{
|
||||
$this->rejectingProductId = $productId;
|
||||
$this->rejectionReason = '';
|
||||
$this->correctingProductId = null;
|
||||
$this->curationNotes = '';
|
||||
}
|
||||
|
||||
public function cancelRejection(): void
|
||||
{
|
||||
$this->rejectingProductId = null;
|
||||
$this->rejectionReason = '';
|
||||
}
|
||||
|
||||
public function reject(int $productId): void
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$this->validate([
|
||||
'rejectionReason' => 'required|string|max:5000',
|
||||
], [
|
||||
'rejectionReason.required' => __('Bitte geben Sie einen Ablehnungsgrund ein.'),
|
||||
]);
|
||||
|
||||
$product = Product::findOrFail($productId);
|
||||
$product->update([
|
||||
'status' => ProductStatus::Archived,
|
||||
'is_curated' => false,
|
||||
'curation_notes' => $this->rejectionReason,
|
||||
]);
|
||||
|
||||
$product->activities()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'action' => 'rejected',
|
||||
'note' => $this->rejectionReason,
|
||||
]);
|
||||
|
||||
$this->rejectingProductId = null;
|
||||
$this->rejectionReason = '';
|
||||
|
||||
Flux::toast(variant: 'success', text: __('Produkt ":name" wurde abgelehnt.', ['name' => $product->name]), duration: 5000);
|
||||
}
|
||||
|
||||
public function archiveProduct(int $productId): void
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$product = Product::findOrFail($productId);
|
||||
$product->update(['status' => ProductStatus::Archived]);
|
||||
$product->activities()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'action' => 'archived',
|
||||
'note' => null,
|
||||
]);
|
||||
|
||||
Flux::toast(variant: 'success', text: __('Produkt ":name" wurde archiviert.', ['name' => $product->name]), duration: 5000);
|
||||
}
|
||||
|
||||
public function markAsSold(int $productId): void
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$product = Product::findOrFail($productId);
|
||||
$product->update(['status' => ProductStatus::Sold]);
|
||||
$product->activities()->create([
|
||||
'user_id' => auth()->id(),
|
||||
'action' => 'sold',
|
||||
'note' => null,
|
||||
]);
|
||||
|
||||
Flux::toast(variant: 'success', text: __('Produkt ":name" als verkauft markiert.', ['name' => $product->name]), duration: 5000);
|
||||
}
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
$this->authorize('curate', Product::class);
|
||||
|
||||
$query = Product::query()
|
||||
->with(['partner', 'categories', 'media'])
|
||||
->when($this->search, fn($q) => $q->where(function ($q) {
|
||||
$q->where('name', 'like', "%{$this->search}%")
|
||||
->orWhere('b2in_article_number', 'like', "%{$this->search}%")
|
||||
->orWhere('partner_product_number', 'like', "%{$this->search}%");
|
||||
}))
|
||||
->when($this->statusFilter, fn($q) => $q->where('status', $this->statusFilter))
|
||||
->when($this->productTypeFilter, fn($q) => $q->where('product_type', $this->productTypeFilter))
|
||||
->when($this->categoryFilter, fn($q) => $q->whereHas('categories', fn($q) => $q->where('categories.id', $this->categoryFilter)))
|
||||
->when($this->partnerFilter, fn($q) => $q->where('partner_id', $this->partnerFilter));
|
||||
|
||||
$products = $query->latest()->paginate(25);
|
||||
|
||||
$categories = Category::orderBy('name')->get();
|
||||
$partners = \App\Models\Partner::orderBy('company_name')->get(['id', 'company_name']);
|
||||
|
||||
$statusCounts = Product::query()
|
||||
->selectRaw("status, count(*) as count")
|
||||
->groupBy('status')
|
||||
->pluck('count', 'status');
|
||||
|
||||
return [
|
||||
'products' => $products,
|
||||
'categories' => $categories,
|
||||
'partners' => $partners,
|
||||
'totalCount' => Product::count(),
|
||||
'pendingCount' => $statusCounts[ProductStatus::Pending->value] ?? 0,
|
||||
'correctionCount' => $statusCounts[ProductStatus::Correction->value] ?? 0,
|
||||
'activeCount' => $statusCounts[ProductStatus::Active->value] ?? 0,
|
||||
];
|
||||
}
|
||||
}; ?>
|
||||
|
||||
<div class="space-y-6 p-6">
|
||||
{{-- Header --}}
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:heading size="xl" class="mb-2">{{ __('Produkt-Verwaltung') }}</flux:heading>
|
||||
<flux:subheading>{{ __('Alle Produkte verwalten, freigeben und bearbeiten') }}</flux:subheading>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<flux:button variant="primary" icon="plus" href="{{ route('products.create.teaser') }}">
|
||||
{{ __('Neues Teaser-Produkt') }}
|
||||
</flux:button>
|
||||
<flux:button variant="primary" icon="plus" href="{{ route('products.create.standard') }}">
|
||||
{{ __('Neues Standard-Produkt') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Statistiken --}}
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-4">
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Gesamt') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $totalCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-blue-100 dark:bg-blue-900/20">
|
||||
<flux:icon.shopping-bag class="h-6 w-6 text-blue-600 dark:text-blue-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card class="shadow-elegant cursor-pointer" wire:click="$set('statusFilter', 'pending')">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Zur Freigabe') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $pendingCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-amber-100 dark:bg-amber-900/20">
|
||||
<flux:icon.clock class="h-6 w-6 text-amber-600 dark:text-amber-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card class="shadow-elegant cursor-pointer" wire:click="$set('statusFilter', 'correction')">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('In Korrektur') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $correctionCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-orange-100 dark:bg-orange-900/20">
|
||||
<flux:icon.arrow-uturn-left class="h-6 w-6 text-orange-600 dark:text-orange-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
<flux:card class="shadow-elegant cursor-pointer" wire:click="$set('statusFilter', 'active')">
|
||||
<div class="flex items-center justify-between">
|
||||
<div>
|
||||
<flux:subheading>{{ __('Freigegeben') }}</flux:subheading>
|
||||
<flux:heading size="2xl" class="mt-2">{{ $activeCount }}</flux:heading>
|
||||
</div>
|
||||
<div class="flex h-12 w-12 items-center justify-center rounded-lg bg-green-100 dark:bg-green-900/20">
|
||||
<flux:icon.check-circle class="h-6 w-6 text-green-600 dark:text-green-400" />
|
||||
</div>
|
||||
</div>
|
||||
</flux:card>
|
||||
</div>
|
||||
|
||||
{{-- Filter --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<div class="flex flex-wrap items-end gap-4">
|
||||
<flux:field class="flex-1">
|
||||
<flux:label>{{ __('Suche') }}</flux:label>
|
||||
<flux:input wire:model.live.debounce.300ms="search"
|
||||
placeholder="{{ __('Name, Artikelnummer...') }}" icon="magnifying-glass" />
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Status') }}</flux:label>
|
||||
<flux:select wire:model.live="statusFilter">
|
||||
<flux:select.option value="">{{ __('Alle Status') }}</flux:select.option>
|
||||
@foreach (ProductStatus::cases() as $status)
|
||||
<flux:select.option value="{{ $status->value }}">{{ $status->label() }}</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Produkttyp') }}</flux:label>
|
||||
<flux:select wire:model.live="productTypeFilter">
|
||||
<flux:select.option value="">{{ __('Alle Typen') }}</flux:select.option>
|
||||
<flux:select.option value="local_stock">{{ __('Teaser (Local Express)') }}</flux:select.option>
|
||||
<flux:select.option value="smart_order">{{ __('Standard (Smart Club)') }}</flux:select.option>
|
||||
</flux:select>
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Händler') }}</flux:label>
|
||||
<flux:select wire:model.live="partnerFilter">
|
||||
<flux:select.option value="">{{ __('Alle Händler') }}</flux:select.option>
|
||||
@foreach ($partners as $partner)
|
||||
<flux:select.option :value="$partner->id">{{ $partner->company_name }}</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</flux:field>
|
||||
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Kategorie') }}</flux:label>
|
||||
<flux:select wire:model.live="categoryFilter">
|
||||
<flux:select.option value="">{{ __('Alle Kategorien') }}</flux:select.option>
|
||||
@foreach ($categories as $category)
|
||||
<flux:select.option :value="$category->id">{{ $category->name }}</flux:select.option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</flux:field>
|
||||
</div>
|
||||
</flux:card>
|
||||
|
||||
{{-- Produkttabelle --}}
|
||||
<flux:card class="shadow-elegant">
|
||||
<flux:table>
|
||||
<flux:table.columns>
|
||||
<flux:table.column>{{ __('Produkt') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Händler') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Kategorie') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Status') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Kuration') }}</flux:table.column>
|
||||
<flux:table.column>{{ __('Erstellt') }}</flux:table.column>
|
||||
<flux:table.column></flux:table.column>
|
||||
</flux:table.columns>
|
||||
|
||||
<flux:table.rows>
|
||||
@forelse($products as $product)
|
||||
<flux:table.row wire:key="product-{{ $product->id }}">
|
||||
{{-- Produkt --}}
|
||||
<flux:table.cell>
|
||||
<div class="flex items-center gap-3">
|
||||
@php
|
||||
$thumbnail = $product->media->sortBy('order_column')->first();
|
||||
@endphp
|
||||
@if ($thumbnail)
|
||||
<img src="{{ Storage::url($thumbnail->file_path) }}"
|
||||
alt="{{ $thumbnail->alt_text ?? $product->name }}"
|
||||
class="h-12 w-12 shrink-0 rounded-lg border border-zinc-200 object-cover dark:border-zinc-700" />
|
||||
@else
|
||||
<div
|
||||
class="flex h-12 w-12 shrink-0 items-center justify-center rounded-lg border border-zinc-200 bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800">
|
||||
<flux:icon.photo class="h-5 w-5 text-zinc-400" />
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
<div class="font-medium text-zinc-900 dark:text-white">
|
||||
{{ $product->name }}
|
||||
</div>
|
||||
<div class="flex items-center gap-2 mt-1">
|
||||
<flux:badge size="sm"
|
||||
color="{{ $product->product_type?->value === 'local_stock' ? 'amber' : 'blue' }}">
|
||||
{{ $product->product_type?->label() ?? '–' }}
|
||||
</flux:badge>
|
||||
@if ($product->b2in_article_number)
|
||||
<span class="text-xs text-zinc-400">{{ $product->b2in_article_number }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Händler --}}
|
||||
<flux:table.cell>
|
||||
<span class="text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{{ $product->partner?->company_name ?? '–' }}
|
||||
</span>
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Kategorie --}}
|
||||
<flux:table.cell>
|
||||
<span class="text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{{ $product->categories->first()?->name ?? '–' }}
|
||||
</span>
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Status --}}
|
||||
<flux:table.cell>
|
||||
<flux:badge size="sm" color="{{ $product->status?->color() ?? 'zinc' }}">
|
||||
{{ $product->status?->label() ?? '–' }}
|
||||
</flux:badge>
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Kuration --}}
|
||||
<flux:table.cell>
|
||||
@if ($product->status === ProductStatus::Pending)
|
||||
<div class="flex items-center gap-1">
|
||||
<flux:button wire:click="approve({{ $product->id }})"
|
||||
wire:loading.attr="disabled"
|
||||
size="xs" variant="primary" icon="check"
|
||||
title="{{ __('Freigeben') }}" />
|
||||
<flux:button wire:click="openCorrection({{ $product->id }})"
|
||||
wire:loading.attr="disabled"
|
||||
size="xs" variant="filled" icon="arrow-uturn-left"
|
||||
title="{{ __('Korrektur') }}" />
|
||||
<flux:button wire:click="openRejection({{ $product->id }})"
|
||||
wire:loading.attr="disabled"
|
||||
size="xs" variant="danger" icon="x-mark"
|
||||
title="{{ __('Ablehnen') }}" />
|
||||
</div>
|
||||
@elseif ($product->status === ProductStatus::Correction)
|
||||
<flux:badge size="sm" color="orange" icon="arrow-uturn-left">
|
||||
{{ __('Warte auf Korrektur') }}
|
||||
</flux:badge>
|
||||
@elseif ($product->is_curated)
|
||||
<flux:badge size="sm" color="green" icon="check-circle">
|
||||
{{ __('Freigegeben') }}
|
||||
</flux:badge>
|
||||
@else
|
||||
<span class="text-xs text-zinc-400">–</span>
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Erstellt --}}
|
||||
<flux:table.cell>
|
||||
<span class="text-sm text-zinc-500">
|
||||
{{ $product->created_at?->format('d.m.Y') }}
|
||||
</span>
|
||||
</flux:table.cell>
|
||||
|
||||
{{-- Aktionen --}}
|
||||
<flux:table.cell>
|
||||
<div class="flex items-center gap-1">
|
||||
<flux:button
|
||||
href="{{ $product->product_type === ProductType::LocalStock ? route('products.edit.teaser', $product) : route('products.edit.standard', $product) }}"
|
||||
size="sm" variant="ghost" icon="pencil"
|
||||
title="{{ __('Bearbeiten') }}" />
|
||||
@if (!in_array($product->status, [ProductStatus::Archived, ProductStatus::Sold]))
|
||||
<flux:dropdown>
|
||||
<flux:button size="sm" variant="ghost" icon="ellipsis-vertical" />
|
||||
<flux:menu>
|
||||
<flux:menu.item wire:click="markAsSold({{ $product->id }})"
|
||||
wire:confirm="{{ __('Produkt wirklich als verkauft markieren?') }}"
|
||||
icon="check-badge">
|
||||
{{ __('Als verkauft') }}
|
||||
</flux:menu.item>
|
||||
<flux:menu.item wire:click="archiveProduct({{ $product->id }})"
|
||||
wire:confirm="{{ __('Produkt wirklich archivieren?') }}"
|
||||
icon="archive-box" variant="danger">
|
||||
{{ __('Archivieren') }}
|
||||
</flux:menu.item>
|
||||
</flux:menu>
|
||||
</flux:dropdown>
|
||||
@endif
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
|
||||
{{-- Inline Korrektur-Formular --}}
|
||||
@if ($correctingProductId === $product->id)
|
||||
<flux:table.row wire:key="correction-{{ $product->id }}">
|
||||
<flux:table.cell colspan="7">
|
||||
<div class="rounded-lg border border-orange-200 bg-orange-50 p-4 dark:border-orange-800 dark:bg-orange-950/30">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Korrekturanweisung für ":name"', ['name' => $product->name]) }}</flux:label>
|
||||
<flux:textarea wire:model="curationNotes" rows="3"
|
||||
placeholder="{{ __('Bitte beschreiben Sie, was der Partner korrigieren soll...') }}" />
|
||||
<flux:error name="curationNotes" />
|
||||
</flux:field>
|
||||
<div class="mt-3 flex gap-2">
|
||||
<flux:button wire:click="sendCorrection({{ $product->id }})"
|
||||
wire:loading.attr="disabled" variant="primary" size="sm"
|
||||
icon="paper-airplane">
|
||||
{{ __('Korrektur senden') }}
|
||||
</flux:button>
|
||||
<flux:button wire:click="cancelCorrection" variant="ghost" size="sm">
|
||||
{{ __('Abbrechen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endif
|
||||
|
||||
{{-- Inline Ablehnungs-Formular --}}
|
||||
@if ($rejectingProductId === $product->id)
|
||||
<flux:table.row wire:key="rejection-{{ $product->id }}">
|
||||
<flux:table.cell colspan="7">
|
||||
<div class="rounded-lg border border-red-200 bg-red-50 p-4 dark:border-red-800 dark:bg-red-950/30">
|
||||
<flux:field>
|
||||
<flux:label>{{ __('Ablehnungsgrund für ":name"', ['name' => $product->name]) }}</flux:label>
|
||||
<flux:textarea wire:model="rejectionReason" rows="3"
|
||||
placeholder="{{ __('Bitte geben Sie den Grund für die Ablehnung an...') }}" />
|
||||
<flux:error name="rejectionReason" />
|
||||
</flux:field>
|
||||
<div class="mt-3 flex gap-2">
|
||||
<flux:button wire:click="reject({{ $product->id }})"
|
||||
wire:loading.attr="disabled" variant="danger" size="sm"
|
||||
icon="x-mark">
|
||||
{{ __('Ablehnen') }}
|
||||
</flux:button>
|
||||
<flux:button wire:click="cancelRejection" variant="ghost" size="sm">
|
||||
{{ __('Abbrechen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endif
|
||||
|
||||
{{-- Korrekturhinweis anzeigen --}}
|
||||
@if ($product->status === ProductStatus::Correction && $product->curation_notes)
|
||||
<flux:table.row wire:key="correction-notes-{{ $product->id }}">
|
||||
<flux:table.cell colspan="7">
|
||||
<flux:callout variant="warning" icon="exclamation-triangle">
|
||||
<flux:callout.heading>{{ __('Korrekturanweisung') }}</flux:callout.heading>
|
||||
<flux:callout.text>{{ $product->curation_notes }}</flux:callout.text>
|
||||
</flux:callout>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endif
|
||||
@empty
|
||||
<flux:table.row>
|
||||
<flux:table.cell colspan="7" class="py-12 text-center text-zinc-500">
|
||||
<flux:icon.shopping-bag class="mx-auto mb-2 h-12 w-12 text-zinc-400" />
|
||||
<div>{{ __('Keine Produkte gefunden') }}</div>
|
||||
</flux:table.cell>
|
||||
</flux:table.row>
|
||||
@endforelse
|
||||
</flux:table.rows>
|
||||
</flux:table>
|
||||
|
||||
@if ($products->hasPages())
|
||||
<div class="mt-4">
|
||||
{{ $products->links() }}
|
||||
</div>
|
||||
@endif
|
||||
</flux:card>
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue