PM-Liste: Hinweis auf laufende Boost-Platzierung unter dem Status
Badge "Boost bis TT.MM.JJJJ" in der Status-Spalte; Boost-Enden der Seite in einer Query aggregiert statt isBoosted() je Zeile. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
df6b24518c
commit
47c1cac5f5
2 changed files with 51 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Boost;
|
||||
use App\Models\PressRelease;
|
||||
use App\Services\Customer\CustomerCompanyContext;
|
||||
use App\Services\PressRelease\AiDeclarationRequiredException;
|
||||
|
|
@ -150,8 +151,19 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class
|
|||
|
||||
$prs = PressRelease::accessiblePageFor($user, $applyListFilters, $this->sortBy, $this->sortDir);
|
||||
|
||||
// Laufende Boosts der Seite in einer Query (statt isBoosted() je
|
||||
// Zeile): [press_release_id => spätestes ends_at].
|
||||
$boostEndsById = Boost::query()
|
||||
->active()
|
||||
->whereIn('press_release_id', collect($prs->items())->pluck('id'))
|
||||
->selectRaw('press_release_id, max(ends_at) as ends_at')
|
||||
->groupBy('press_release_id')
|
||||
->pluck('ends_at', 'press_release_id')
|
||||
->map(fn ($endsAt) => \Illuminate\Support\Carbon::parse($endsAt));
|
||||
|
||||
return [
|
||||
'pressReleases' => $prs,
|
||||
'boostEndsById' => $boostEndsById,
|
||||
'statusOptions' => PressReleaseStatus::cases(),
|
||||
'portalOptions' => Portal::cases(),
|
||||
'selectedCompany' => $context->selectedCompany(auth()->user()),
|
||||
|
|
@ -472,6 +484,14 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class
|
|||
:has-title-image="$pr->images_count > 0" />
|
||||
@endif
|
||||
</div>
|
||||
@if ($boostEndsAt = $boostEndsById->get($pr->id))
|
||||
{{-- Laufende Boost-Platzierung (Add-on) direkt unter dem Status. --}}
|
||||
<div class="mt-1">
|
||||
<span class="badge hub dot" title="{{ __('Boost — Platzierung auf Start- und Branchenseite') }}">
|
||||
{{ __('Boost bis :date', ['date' => $boostEndsAt->format('d.m.Y')]) }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
</flux:table.cell>
|
||||
|
||||
<flux:table.cell>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue