Phase 9 Block 1: Gelb-Routing Direkt-Live, Slot-Verbrauch bei Veroeffentlichung, Submit-Gate
9A — Gelb geht direkt live (Entscheidung 12.06.2026): - routeByClassification(): Gelb durchlaeuft denselben Auto-Publish-Pfad wie Gruen (autoPublishApproved); nur Rot wird abgelehnt - Scheduler publiziert faellige gelbe + gruene PMs; unklassifizierte bleiben als Fallback in der manuellen Queue 9B — Slot-Verbrauch bei Veroeffentlichung (Decision-Update 3.2): - Increment aus submitForReview() entfernt; publish() und changeStatusFromAdmin() zaehlen idempotent beim ersten published-Uebergang (Pruefung ueber Status-Logs); Rot kostet nichts - Submit-Guard: Einreichen erfordert freien Slot (QuotaExceededException, API 422) 9C — Submit-Gate vorbereitet (Decision-Update 5.1): - User::hasActiveBooking()-Stub hinter config/billing.php (enforce_booking, Default aus); Tarif-Modul ersetzt nur den Rumpf - Einreichungs-Modal zeigt ohne Buchung einen Buchungs-Hinweis; Server-Guard (BookingRequiredException), API antwortet 402 - Fix: Customer-Create legte PMs bei "Zur Pruefung senden" direkt mit Status review an (vorbei an Blacklist/Quota/KI/Status-Log) — laeuft jetzt immer ueber submitForReview() Suite: 451 passed, 4 skipped (9 neue Tests). Pint clean. Plan: docs/PHASE-9-FLOW-UND-TARIFE-PLAN.md (Block 2 nach Review-Stopp). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
8d8d957884
commit
4419d9ff43
21 changed files with 551 additions and 114 deletions
|
|
@ -12,66 +12,99 @@
|
|||
`action`-Prop bestimmt die Livewire-Methode der Eltern-Komponente, die beim
|
||||
Bestätigen ausgeführt wird (z. B. `submitForReview`, `saveAndSubmit`,
|
||||
`save('review')`). Quota-Block wird nur angezeigt, wenn Werte übergeben sind.
|
||||
|
||||
Submit-Gate (Decision-Update §5.1): Ohne aktive Buchung zeigt das Modal
|
||||
statt des Prüf-Flows einen Buchungs-Hinweis — der Button konvertiert,
|
||||
er verschwindet nicht. Serverseitig sichert submitForReview() das Gate ab.
|
||||
--}}
|
||||
@php($bookingRequired = ! (auth()->user()?->hasActiveBooking() ?? true))
|
||||
|
||||
<flux:modal :name="$name" class="w-full max-w-xl">
|
||||
<div class="space-y-5" x-data="{ agb: false, images: false, contact: false }">
|
||||
<div>
|
||||
<flux:text class="eyebrow muted">{{ __('Veröffentlichung') }}</flux:text>
|
||||
<flux:heading size="lg">{{ __('Pressemitteilung zur Prüfung einreichen') }}</flux:heading>
|
||||
</div>
|
||||
|
||||
{{-- Rechtliche Hinweise (Platzhalter — vor Go-Live anwaltlich prüfen) --}}
|
||||
<div class="rounded-[6px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-4 text-[12.5px] leading-[1.6] text-[color:var(--color-ink-2)]">
|
||||
<p class="m-0 mb-2 font-semibold text-[color:var(--color-ink)]">{{ __('Mit dem Einreichen versichern Sie:') }}</p>
|
||||
<ul class="m-0 list-disc space-y-1 ps-5">
|
||||
<li>{{ __('Sie sind befugt, den Inhalt zu veröffentlichen.') }}</li>
|
||||
<li>{{ __('Alle verwendeten Bilder, Logos und Zitate liegen in Ihrer Nutzungsbefugnis.') }}</li>
|
||||
<li>{{ __('Personenbezogene Daten sind nur im zwingend erforderlichen Umfang enthalten.') }}</li>
|
||||
<li>{{ __('Aussagen entsprechen Ihrem Wissensstand und sind sachlich richtig.') }}</li>
|
||||
</ul>
|
||||
<p class="m-0 mt-2 text-[11.5px] text-[color:var(--color-ink-3)]">
|
||||
{{ __('Sie stellen die Plattform von Ansprüchen Dritter frei, die aus einer unberechtigten Nutzung von Inhalten resultieren. Die endgültige Veröffentlichung erfolgt nach redaktioneller Prüfung.') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{-- Kontingent (optional) --}}
|
||||
@if (! is_null($quotaRemaining) && ! is_null($quotaTotal))
|
||||
<div class="flex items-center justify-between rounded-[6px] border border-[color:var(--color-bg-rule)] px-4 py-3">
|
||||
<div class="text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<div class="font-semibold text-[color:var(--color-ink)]">{{ __('PM-Kontingent diesen Monat') }}</div>
|
||||
<div class="text-[color:var(--color-ink-3)]">{{ __('Verbleibend nach diesem Versand wird angerechnet.') }}</div>
|
||||
</div>
|
||||
<span @class(['badge', $quotaRemaining > 0 ? 'ok' : 'warn'])>
|
||||
{{ $quotaRemaining }} / {{ $quotaTotal }}
|
||||
</span>
|
||||
@if ($bookingRequired)
|
||||
<div class="space-y-5">
|
||||
<div>
|
||||
<flux:text class="eyebrow muted">{{ __('Veröffentlichung') }}</flux:text>
|
||||
<flux:heading size="lg">{{ __('Buchung erforderlich') }}</flux:heading>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Bestätigungen --}}
|
||||
<div class="space-y-2">
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="agb" class="mt-0.5" />
|
||||
<span>{{ __('Der Inhalt entspricht den AGB und gesetzlichen Vorgaben.') }}</span>
|
||||
</label>
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="images" class="mt-0.5" />
|
||||
<span>{{ __('Alle Bildrechte sind geklärt.') }}</span>
|
||||
</label>
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="contact" class="mt-0.5" />
|
||||
<span>{{ __('Die Angaben zum Pressekontakt sind korrekt.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="rounded-[6px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-4 text-[12.5px] leading-[1.6] text-[color:var(--color-ink-2)]">
|
||||
<p class="m-0 mb-2">
|
||||
{{ __('Zum Einreichen einer Pressemitteilung wird eine aktive Buchung benötigt. Ihre Entwürfe bleiben gespeichert und können jederzeit weiter bearbeitet werden.') }}
|
||||
</p>
|
||||
<p class="m-0 text-[11.5px] text-[color:var(--color-ink-3)]">
|
||||
{{ __('Nach der Buchung reichen Sie die Pressemitteilung mit einem Klick zur Prüfung ein.') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2">
|
||||
<flux:modal.close>
|
||||
<flux:button variant="filled">{{ __('Abbrechen') }}</flux:button>
|
||||
</flux:modal.close>
|
||||
<flux:button variant="primary" wire:click="{{ $action }}"
|
||||
wire:loading.attr="disabled"
|
||||
x-bind:disabled="! (agb && images && contact)">
|
||||
{{ $confirmLabel ?? __('Veröffentlichung anfordern') }}
|
||||
</flux:button>
|
||||
<div class="flex justify-end gap-2">
|
||||
<flux:modal.close>
|
||||
<flux:button variant="filled">{{ __('Später') }}</flux:button>
|
||||
</flux:modal.close>
|
||||
<flux:button variant="primary" :href="route('me.bookings.index')" wire:navigate>
|
||||
{{ __('Buchung auswählen') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="space-y-5" x-data="{ agb: false, images: false, contact: false }">
|
||||
<div>
|
||||
<flux:text class="eyebrow muted">{{ __('Veröffentlichung') }}</flux:text>
|
||||
<flux:heading size="lg">{{ __('Pressemitteilung zur Prüfung einreichen') }}</flux:heading>
|
||||
</div>
|
||||
|
||||
{{-- Rechtliche Hinweise (Platzhalter — vor Go-Live anwaltlich prüfen) --}}
|
||||
<div class="rounded-[6px] border border-[color:var(--color-bg-rule)] bg-[color:var(--color-bg-elev)] p-4 text-[12.5px] leading-[1.6] text-[color:var(--color-ink-2)]">
|
||||
<p class="m-0 mb-2 font-semibold text-[color:var(--color-ink)]">{{ __('Mit dem Einreichen versichern Sie:') }}</p>
|
||||
<ul class="m-0 list-disc space-y-1 ps-5">
|
||||
<li>{{ __('Sie sind befugt, den Inhalt zu veröffentlichen.') }}</li>
|
||||
<li>{{ __('Alle verwendeten Bilder, Logos und Zitate liegen in Ihrer Nutzungsbefugnis.') }}</li>
|
||||
<li>{{ __('Personenbezogene Daten sind nur im zwingend erforderlichen Umfang enthalten.') }}</li>
|
||||
<li>{{ __('Aussagen entsprechen Ihrem Wissensstand und sind sachlich richtig.') }}</li>
|
||||
</ul>
|
||||
<p class="m-0 mt-2 text-[11.5px] text-[color:var(--color-ink-3)]">
|
||||
{{ __('Sie stellen die Plattform von Ansprüchen Dritter frei, die aus einer unberechtigten Nutzung von Inhalten resultieren. Die endgültige Veröffentlichung erfolgt nach redaktioneller Prüfung.') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{{-- Kontingent (optional) --}}
|
||||
@if (! is_null($quotaRemaining) && ! is_null($quotaTotal))
|
||||
<div class="flex items-center justify-between rounded-[6px] border border-[color:var(--color-bg-rule)] px-4 py-3">
|
||||
<div class="text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<div class="font-semibold text-[color:var(--color-ink)]">{{ __('PM-Kontingent diesen Monat') }}</div>
|
||||
<div class="text-[color:var(--color-ink-3)]">{{ __('Wird erst bei Veröffentlichung verbraucht — abgelehnte Pressemitteilungen kosten keinen Slot.') }}</div>
|
||||
</div>
|
||||
<span @class(['badge', $quotaRemaining > 0 ? 'ok' : 'warn'])>
|
||||
{{ $quotaRemaining }} / {{ $quotaTotal }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{-- Bestätigungen --}}
|
||||
<div class="space-y-2">
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="agb" class="mt-0.5" />
|
||||
<span>{{ __('Der Inhalt entspricht den AGB und gesetzlichen Vorgaben.') }}</span>
|
||||
</label>
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="images" class="mt-0.5" />
|
||||
<span>{{ __('Alle Bildrechte sind geklärt.') }}</span>
|
||||
</label>
|
||||
<label class="flex items-start gap-2 text-[12.5px] text-[color:var(--color-ink-2)]">
|
||||
<input type="checkbox" x-model="contact" class="mt-0.5" />
|
||||
<span>{{ __('Die Angaben zum Pressekontakt sind korrekt.') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2">
|
||||
<flux:modal.close>
|
||||
<flux:button variant="filled">{{ __('Abbrechen') }}</flux:button>
|
||||
</flux:modal.close>
|
||||
<flux:button variant="primary" wire:click="{{ $action }}"
|
||||
wire:loading.attr="disabled"
|
||||
x-bind:disabled="! (agb && images && contact)">
|
||||
{{ $confirmLabel ?? __('Veröffentlichung anfordern') }}
|
||||
</flux:button>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</flux:modal>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ use App\Models\Company;
|
|||
use App\Models\Contact;
|
||||
use App\Models\PressRelease;
|
||||
use App\Services\Customer\CustomerCompanyContext;
|
||||
use App\Services\PressRelease\BlacklistViolationException;
|
||||
use App\Services\PressRelease\BookingRequiredException;
|
||||
use App\Services\PressRelease\PressReleaseHtmlSanitizer;
|
||||
use App\Services\PressRelease\PressReleaseService;
|
||||
use App\Services\PressRelease\QuotaExceededException;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Support\Str;
|
||||
|
|
@ -423,17 +427,17 @@ new #[Layout('components.layouts.app'), Title('Neue Pressemitteilung')] class ex
|
|||
|
||||
$this->portal = $company->portal?->value ?? Portal::Presseecho->value;
|
||||
|
||||
$status = $submitStatus === 'review' ? PressReleaseStatus::Review : PressReleaseStatus::Draft;
|
||||
|
||||
$slug = (new PressRelease)->generateUniqueSlug($this->title, [
|
||||
'portal' => $this->portal,
|
||||
'language' => $this->language,
|
||||
]);
|
||||
|
||||
// Immer als Entwurf anlegen — der Weg nach "review" führt ausschließlich
|
||||
// über submitForReview() (Blacklist, Gate, Quota, Status-Log, KI).
|
||||
$pr = PressRelease::query()->create([
|
||||
'uuid' => (string) Str::uuid(),
|
||||
'user_id' => $user->id,
|
||||
'status' => $status->value,
|
||||
'status' => PressReleaseStatus::Draft->value,
|
||||
...$this->pressReleaseAttributes($slug),
|
||||
]);
|
||||
|
||||
|
|
@ -441,15 +445,47 @@ new #[Layout('components.layouts.app'), Title('Neue Pressemitteilung')] class ex
|
|||
$pr->contacts()->sync([$contact->id]);
|
||||
}
|
||||
|
||||
Flux::toast(
|
||||
heading: $status === PressReleaseStatus::Review
|
||||
? __('Eingereicht')
|
||||
: __('Entwurf gespeichert'),
|
||||
text: $status === PressReleaseStatus::Review
|
||||
? __('Die Redaktion prüft die Pressemitteilung typischerweise innerhalb von 24 h.')
|
||||
: __('Deine Änderungen sind gesichert. Du kannst die PM jederzeit weiter bearbeiten.'),
|
||||
variant: 'success',
|
||||
);
|
||||
if ($submitStatus === 'review') {
|
||||
$this->authorize('submitForReview', $pr);
|
||||
|
||||
try {
|
||||
app(PressReleaseService::class)->submitForReview($pr);
|
||||
} catch (BlacklistViolationException $e) {
|
||||
Flux::toast(
|
||||
heading: __('Automatisch abgelehnt'),
|
||||
text: __('Unzulässiges Wort gefunden: ":word". Bitte überarbeiten.', ['word' => $e->word]),
|
||||
variant: 'danger',
|
||||
duration: 8000,
|
||||
);
|
||||
|
||||
$this->redirect(route('me.press-releases.show', $pr->id), navigate: true);
|
||||
|
||||
return;
|
||||
} catch (BookingRequiredException|QuotaExceededException $e) {
|
||||
Flux::toast(
|
||||
heading: __('Als Entwurf gespeichert'),
|
||||
text: $e->getMessage(),
|
||||
variant: 'warning',
|
||||
duration: 8000,
|
||||
);
|
||||
|
||||
$this->redirect(route('me.press-releases.show', $pr->id), navigate: true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Flux::toast(
|
||||
heading: __('Eingereicht'),
|
||||
text: __('Die Redaktion prüft die Pressemitteilung typischerweise innerhalb von 24 h.'),
|
||||
variant: 'success',
|
||||
);
|
||||
} else {
|
||||
Flux::toast(
|
||||
heading: __('Entwurf gespeichert'),
|
||||
text: __('Deine Änderungen sind gesichert. Du kannst die PM jederzeit weiter bearbeiten.'),
|
||||
variant: 'success',
|
||||
);
|
||||
}
|
||||
|
||||
$this->redirect(route('me.press-releases.show', $pr->id), navigate: true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,11 @@ use App\Models\Contact;
|
|||
use App\Models\PressRelease;
|
||||
use App\Services\Customer\CustomerCompanyContext;
|
||||
use App\Services\PressRelease\BlacklistViolationException;
|
||||
use App\Services\PressRelease\BookingRequiredException;
|
||||
use App\Services\PressRelease\PressReleaseCoverImage;
|
||||
use App\Services\PressRelease\PressReleaseHtmlSanitizer;
|
||||
use App\Services\PressRelease\PressReleaseService;
|
||||
use App\Services\PressRelease\QuotaExceededException;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
|
@ -448,6 +450,15 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung bearbeiten')] cl
|
|||
|
||||
$this->redirect(route('me.press-releases.show', $pr->id), navigate: true);
|
||||
|
||||
return;
|
||||
} catch (BookingRequiredException|QuotaExceededException $e) {
|
||||
Flux::toast(
|
||||
heading: __('Gespeichert, aber nicht eingereicht'),
|
||||
text: $e->getMessage(),
|
||||
variant: 'warning',
|
||||
duration: 8000,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ use App\Enums\PressReleaseStatus;
|
|||
use App\Models\PressRelease;
|
||||
use App\Services\Customer\CustomerCompanyContext;
|
||||
use App\Services\PressRelease\BlacklistViolationException;
|
||||
use App\Services\PressRelease\BookingRequiredException;
|
||||
use App\Services\PressRelease\PressReleaseService;
|
||||
use App\Services\PressRelease\QuotaExceededException;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Livewire\Attributes\Layout;
|
||||
|
|
@ -99,6 +101,8 @@ new #[Layout('components.layouts.app'), Title('Meine Pressemitteilungen')] class
|
|||
variant: 'danger',
|
||||
duration: 8000,
|
||||
);
|
||||
} catch (BookingRequiredException|QuotaExceededException $e) {
|
||||
Flux::toast(text: $e->getMessage(), variant: 'warning', duration: 8000);
|
||||
} catch (\LogicException $e) {
|
||||
Flux::toast(text: $e->getMessage(), variant: 'danger');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ use App\Enums\PressReleaseStatus;
|
|||
use App\Models\PressRelease;
|
||||
use App\Services\Auth\MagicLinkGenerator;
|
||||
use App\Services\PressRelease\BlacklistViolationException;
|
||||
use App\Services\PressRelease\BookingRequiredException;
|
||||
use App\Services\PressRelease\PressReleaseCoverImage;
|
||||
use App\Services\PressRelease\PressReleaseService;
|
||||
use App\Services\PressRelease\QuotaExceededException;
|
||||
use Flux\Flux;
|
||||
use Livewire\Attributes\Layout;
|
||||
use Livewire\Attributes\Locked;
|
||||
|
|
@ -45,6 +47,17 @@ new #[Layout('components.layouts.app'), Title('Pressemitteilung')] class extends
|
|||
duration: 8000,
|
||||
);
|
||||
|
||||
return;
|
||||
} catch (BookingRequiredException|QuotaExceededException $e) {
|
||||
Flux::modal('confirm-submit-review')->close();
|
||||
|
||||
Flux::toast(
|
||||
heading: __('Nicht eingereicht'),
|
||||
text: $e->getMessage(),
|
||||
variant: 'warning',
|
||||
duration: 8000,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue