156 lines
7 KiB
PHP
156 lines
7 KiB
PHP
<?php
|
|
|
|
use App\Services\Customer\CustomerCompanyContext;
|
|
use Livewire\Attributes\Layout;
|
|
use Livewire\Attributes\Title;
|
|
use Livewire\Volt\Component;
|
|
use Livewire\WithPagination;
|
|
|
|
new #[Layout('components.layouts.app'), Title('Meine Firmen')] class extends Component
|
|
{
|
|
use WithPagination;
|
|
|
|
public string $search = '';
|
|
|
|
public function updatedSearch(): void
|
|
{
|
|
$this->resetPage();
|
|
}
|
|
|
|
public function with(): array
|
|
{
|
|
$user = auth()->user();
|
|
$context = app(CustomerCompanyContext::class);
|
|
|
|
$pressKits = $context->accessibleCompanyQuery($user)
|
|
->withCount(['contacts', 'pressReleases'])
|
|
->when(filled($this->search), function ($query): void {
|
|
$search = trim($this->search);
|
|
|
|
$query->where(function ($query) use ($search): void {
|
|
$query->where('name', 'like', '%'.$search.'%')
|
|
->orWhere('email', 'like', '%'.$search.'%')
|
|
->orWhere('slug', 'like', '%'.$search.'%');
|
|
});
|
|
})
|
|
->orderBy('name')
|
|
->simplePaginate(24);
|
|
|
|
return [
|
|
'pressKits' => $pressKits,
|
|
'context' => $context,
|
|
'user' => $user,
|
|
];
|
|
}
|
|
}; ?>
|
|
|
|
<div class="space-y-8">
|
|
{{-- ============== PAGE HEADER ============== --}}
|
|
<header class="grid items-end gap-8" style="grid-template-columns:1fr auto;">
|
|
<div class="min-w-0">
|
|
<div class="flex items-center gap-3 mb-3 flex-nowrap whitespace-nowrap">
|
|
<span class="badge hub dot">{{ __('User Backend') }}</span>
|
|
<span class="eyebrow muted">{{ __('Mein Bereich · Firmen') }}</span>
|
|
</div>
|
|
<h1 class="text-[30px] font-bold tracking-[-0.6px] leading-[1.15] m-0 text-[color:var(--color-ink)]">
|
|
{{ __('Meine Firmen') }}
|
|
</h1>
|
|
<p class="text-[13px] leading-[1.55] mt-2 m-0 max-w-[640px] text-[color:var(--color-ink-2)]">
|
|
{{ __('Verwalten Sie Firmen, Pressekontakte und zugeordnete Pressemitteilungen.') }}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2 flex-shrink-0">
|
|
<flux:button variant="primary" icon="plus" href="{{ route('me.profile') }}" wire:navigate>
|
|
{{ __('Firma anlegen anfragen') }}
|
|
</flux:button>
|
|
</div>
|
|
</header>
|
|
|
|
{{-- ============== FILTER-PANEL ============== --}}
|
|
<article class="panel">
|
|
<div class="panel-head">
|
|
<span class="section-eyebrow">{{ __('Filter & Suche') }}</span>
|
|
</div>
|
|
<div class="p-5">
|
|
<flux:input wire:model.live.debounce.300ms="search" icon="magnifying-glass" placeholder="{{ __('Firma suchen...') }}" />
|
|
</div>
|
|
</article>
|
|
|
|
{{-- ============== FIRMEN-CARDS ============== --}}
|
|
<section class="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
|
|
@forelse ($pressKits as $company)
|
|
<article class="panel flex flex-col">
|
|
<div class="panel-head">
|
|
<div class="min-w-0">
|
|
<span class="section-eyebrow truncate">{{ $company->name }}</span>
|
|
</div>
|
|
@if ($company->is_active)
|
|
<span class="badge ok dot">{{ __('Aktiv') }}</span>
|
|
@else
|
|
<span class="badge err dot">{{ __('Inaktiv') }}</span>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="p-5 space-y-4 flex-1">
|
|
<div class="text-[11.5px] text-[color:var(--color-ink-3)] truncate">
|
|
{{ $company->slug }}
|
|
</div>
|
|
|
|
<div class="flex flex-wrap gap-2">
|
|
<span class="badge hub">{{ $company->portal?->label() ?? __('Portal unbekannt') }}</span>
|
|
<span class="badge hub">{{ $context->roleLabelFor($company, $user) }}</span>
|
|
@if ($company->disable_footer_code)
|
|
<span class="badge warn">{{ __('Footer-Code aus') }}</span>
|
|
@endif
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-3 pt-1">
|
|
<div class="rounded-[5px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-3">
|
|
<div class="text-[10.5px] uppercase tracking-[0.6px] font-semibold text-[color:var(--color-ink-3)]">
|
|
{{ __('Pressemitteilungen') }}
|
|
</div>
|
|
<div class="text-[18px] font-bold text-[color:var(--color-ink)] mt-1">
|
|
{{ $company->press_releases_count }}
|
|
</div>
|
|
</div>
|
|
<div class="rounded-[5px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-3">
|
|
<div class="text-[10.5px] uppercase tracking-[0.6px] font-semibold text-[color:var(--color-ink-3)]">
|
|
{{ __('Pressekontakte') }}
|
|
</div>
|
|
<div class="text-[18px] font-bold text-[color:var(--color-ink)] mt-1">
|
|
{{ $company->contacts_count }}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="px-5 pb-4 pt-3 border-t border-[color:var(--color-bg-rule)] flex justify-end">
|
|
<flux:button size="sm" variant="ghost" icon="arrow-right" href="{{ route('me.press-kits.show', $company->id) }}" wire:navigate>
|
|
{{ __('Firma öffnen') }}
|
|
</flux:button>
|
|
</div>
|
|
</article>
|
|
@empty
|
|
<article class="panel md:col-span-2 xl:col-span-3">
|
|
<div class="p-10 flex flex-col items-center justify-center text-center">
|
|
<div class="w-14 h-14 rounded-[6px] flex items-center justify-center mb-3
|
|
bg-[color:var(--color-hub-soft)] border border-[color:var(--color-hub-soft-2)] text-[color:var(--color-hub)]">
|
|
<flux:icon.building-office class="size-6" />
|
|
</div>
|
|
<div class="text-[14px] font-semibold text-[color:var(--color-ink)] mb-1">
|
|
{{ __('Keine Firmen gefunden') }}
|
|
</div>
|
|
<p class="text-[12px] text-[color:var(--color-ink-3)] max-w-md m-0">
|
|
{{ __('Prüfen Sie die Suche oder wenden Sie sich an den Support, wenn eine Firma fehlen sollte.') }}
|
|
</p>
|
|
<flux:button class="mt-4" variant="primary" href="{{ route('me.profile') }}" wire:navigate>
|
|
{{ __('Profil prüfen') }}
|
|
</flux:button>
|
|
</div>
|
|
</article>
|
|
@endforelse
|
|
</section>
|
|
|
|
{{ $pressKits->links() }}
|
|
</div>
|