PM-Vorschau: Firmen-Kachel im Stil der Firmenübersicht
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
284d029b29
commit
970b4909fa
2 changed files with 131 additions and 18 deletions
|
|
@ -99,8 +99,13 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
$cover = app(PressReleaseCoverImage::class);
|
||||
$user = auth()->user();
|
||||
|
||||
$company = $pr->company?->loadCount(['pressReleases', 'contacts']);
|
||||
|
||||
return [
|
||||
'pr' => $pr,
|
||||
'companyLogoUrl' => $company?->logoUrl(),
|
||||
'companyInitials' => $this->companyInitials($company?->name),
|
||||
'companyMetaLine' => $this->companyMetaLine($company),
|
||||
'categoryName' => $categoryName,
|
||||
'coverUrl' => $cover->coverUrl($pr, 'cover'),
|
||||
'coverIsPlaceholder' => $cover->coverIsPlaceholder($pr),
|
||||
|
|
@ -122,12 +127,59 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialen für die Logo-Kachel (analog zur Firmenübersicht).
|
||||
*/
|
||||
private function companyInitials(?string $name): string
|
||||
{
|
||||
$name = trim((string) $name);
|
||||
|
||||
if ($name === '') {
|
||||
return '–';
|
||||
}
|
||||
|
||||
$letters = collect(preg_split('/\s+/u', $name) ?: [])
|
||||
->map(fn (string $word): string => mb_substr($word, 0, 1))
|
||||
->filter()
|
||||
->take(2)
|
||||
->implode('');
|
||||
|
||||
return mb_strtoupper($letters ?: mb_substr($name, 0, 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Kompakte Meta-Zeile: Ort (letzte Adresszeile) · Firmentyp.
|
||||
*/
|
||||
private function companyMetaLine(?\App\Models\Company $company): string
|
||||
{
|
||||
if (! $company) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$parts = [];
|
||||
|
||||
$lastAddressLine = collect(preg_split('/\r?\n/', trim((string) $company->address)) ?: [])
|
||||
->map(fn ($line) => trim((string) $line))
|
||||
->filter()
|
||||
->last();
|
||||
|
||||
if (is_string($lastAddressLine) && $lastAddressLine !== '') {
|
||||
$parts[] = $lastAddressLine;
|
||||
}
|
||||
|
||||
if ($company->type?->label()) {
|
||||
$parts[] = $company->type->label();
|
||||
}
|
||||
|
||||
return implode(' · ', $parts);
|
||||
}
|
||||
|
||||
private function getMyPR(): PressRelease
|
||||
{
|
||||
return PressRelease::withoutGlobalScopes()
|
||||
->where('user_id', auth()->id())
|
||||
->with([
|
||||
'company:id,name,email,phone',
|
||||
'company:id,name,email,phone,address,portal,logo_path,legacy_portal,is_active,type',
|
||||
'category.translations',
|
||||
'contacts' => fn ($query) => $query
|
||||
->withoutGlobalScopes()
|
||||
|
|
@ -314,16 +366,30 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
<span class="section-eyebrow">{{ __('Firma & Pressekontakt') }}</span>
|
||||
</div>
|
||||
<div class="p-5 space-y-4">
|
||||
{{-- Firma der Pressemitteilung --}}
|
||||
{{-- Firma der Pressemitteilung — gleiche Kachel wie in der Firmenübersicht --}}
|
||||
@if ($pr->company)
|
||||
<div class="flex items-start gap-3 rounded-[5px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-3">
|
||||
<div class="flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-[5px]
|
||||
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-5" />
|
||||
<div class="firm-card">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="logo {{ $companyLogoUrl ? '' : 'lg-'.['brew', 'mv', 'soft', 'warm'][$pr->company->id % 4] }}">
|
||||
@if ($companyLogoUrl)
|
||||
<img src="{{ $companyLogoUrl }}" alt="{{ $pr->company->name }}" loading="lazy" />
|
||||
@else
|
||||
{{ $companyInitials }}
|
||||
@endif
|
||||
</div>
|
||||
@if ($pr->company->is_active)
|
||||
<span class="badge ok dot">{{ __('Aktiv') }}</span>
|
||||
@else
|
||||
<span class="badge err dot">{{ __('Inaktiv') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="text-[13px] font-semibold text-[color:var(--color-ink)]">{{ $pr->company->name }}</div>
|
||||
<div class="mt-0.5 flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-[color:var(--color-ink-3)]">
|
||||
|
||||
<div class="min-w-0">
|
||||
<h3 class="name">{{ $pr->company->name }}</h3>
|
||||
@if (filled($companyMetaLine))
|
||||
<div class="meta-line">{{ $companyMetaLine }}</div>
|
||||
@endif
|
||||
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11.5px] text-[color:var(--color-ink-3)]">
|
||||
@if ($pr->company->email)
|
||||
<span>{{ $pr->company->email }}</span>
|
||||
@endif
|
||||
|
|
@ -332,9 +398,35 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<flux:button size="xs" variant="filled" href="{{ route('me.press-kits.show', $pr->company->id) }}" wire:navigate>
|
||||
{{ __('Firma öffnen') }}
|
||||
</flux:button>
|
||||
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
@if ($pr->company->portal === \App\Enums\Portal::Both)
|
||||
<span class="portal-pill pe"><span class="pdot"></span>presseecho</span>
|
||||
<span class="portal-pill bp"><span class="pdot"></span>businessportal24</span>
|
||||
@elseif ($pr->company->portal === \App\Enums\Portal::Presseecho)
|
||||
<span class="portal-pill pe"><span class="pdot"></span>presseecho</span>
|
||||
@elseif ($pr->company->portal === \App\Enums\Portal::Businessportal24)
|
||||
<span class="portal-pill bp"><span class="pdot"></span>businessportal24</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="kpis">
|
||||
<div class="kpi">
|
||||
<span class="k">{{ number_format($pr->company->press_releases_count ?? 0, 0, ',', '.') }}</span>
|
||||
<span class="l">{{ __('PMs') }}</span>
|
||||
</div>
|
||||
<div class="kpi">
|
||||
<span class="k">{{ number_format($pr->company->contacts_count ?? 0, 0, ',', '.') }}</span>
|
||||
<span class="l">{{ __('Kontakte') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-2 pt-1">
|
||||
<a href="{{ route('me.press-kits.show', $pr->company->id) }}" wire:navigate class="card-action primary" style="flex:1;">
|
||||
<flux:icon.arrow-right class="size-3" />
|
||||
{{ __('Firma öffnen') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue