Abo Einmalprodukte: Phasen 5-7, konfigurierbare Sperrfristen, Lokalisierung & Dashboard
Rechnung/Lieferschein: - PDF-Gruppierung Abo- vs. Einmal-Artikel (is_abo_addon), rueckwaertskompatibel - Vorschau-Command sales:preview-invoice (umgeht Test-System-Gate, ohne Rechnungsnummer) Reminder-Mail (vorbereitet, Cron inaktiv): - MailAboExecutionReminder + Template, abo:send-execution-reminder, Spalte onetime_reminder_sent_for - Berater -> Sales Center, Kunde -> Portal; Vorschau abo:preview-reminder - Datum-Fix: formatDateDB() statt formatDate() (ICU-Format) Sperrfristen konfigurierbar (Admin-Settings): - abo-lock-days-change (Liefertag + Abo-Produkte), abo-lock-days-pause-cancel - Meldungen mit :lock-Platzhalter; Pausieren/Kuendigen vom Change-Lock entkoppelt - Abo-Produkt-Aenderungen im Lock-Fenster server- + clientseitig eingefroren - Selbstbedienung: Add-only/Lock nach $view (kein Admin-Bypass), Stale-Cache-Fix beim Mengen-Update Dashboard: - Einmalprodukte-Card + Team-Abo-KPI-Card, News-Card responsiv (col-xl-6) Lokalisierung: - Sprachdateien en/es/fr vollstaendig mit de synchronisiert (inkl. marketingplan/portal) - LocalizationSyncTest sichert Key-Gleichheit ab Tests: AboOneTimeInvoiceGrouping, AboExecutionReminder, AboLockDaysSetting, AboOnetimeDashboardAndMail, PreviewInvoiceCommand, TeamAboOverview + erweiterte View-Tests Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
9f996a7f1b
commit
65b867f8ee
96 changed files with 4154 additions and 1189 deletions
67
app/Console/Commands/PreviewAboReminder.php
Normal file
67
app/Console/Commands/PreviewAboReminder.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Mail\MailAboExecutionReminder;
|
||||
use App\Models\UserAbo;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PreviewAboReminder extends Command
|
||||
{
|
||||
/**
|
||||
* Rendert die Abo-Ausführungs-Reminder-Mail für ein Abo als HTML-Vorschau
|
||||
* (und sendet sie optional via --send an eine Adresse, z. B. zum Test in Mailpit).
|
||||
* Verbraucht/ändert nichts am Abo.
|
||||
*/
|
||||
protected $signature = 'abo:preview-reminder {abo : UserAbo-ID} {--send= : Mail zusätzlich an diese Adresse senden (Mailpit-Test)}';
|
||||
|
||||
protected $description = 'Vorschau der Abo-Reminder-Mail erzeugen (HTML) und optional testweise versenden';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$abo = UserAbo::with(['user', 'shopping_user'])->find((int) $this->argument('abo'));
|
||||
|
||||
if (! $abo) {
|
||||
$this->error('UserAbo '.$this->argument('abo').' nicht gefunden.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$locale = $this->recipientLocale($abo);
|
||||
$originalLocale = App::getLocale();
|
||||
|
||||
App::setLocale($locale);
|
||||
try {
|
||||
$html = (new MailAboExecutionReminder($abo))->render();
|
||||
} finally {
|
||||
App::setLocale($originalLocale);
|
||||
}
|
||||
|
||||
$path = 'preview/abo-reminder-'.$abo->id.'.html';
|
||||
Storage::disk('public')->put($path, $html);
|
||||
|
||||
$url = preg_replace('#(?<!:)//+#', '/', Storage::disk('public')->url($path));
|
||||
$this->info("Reminder-Vorschau für Abo {$abo->id} (Locale {$locale}, ".($abo->is_for === 'me' ? 'Berater → Sales Center' : 'Endkunde → Portal').'):');
|
||||
$this->line(' HTML: '.$url);
|
||||
$this->line(' Datei: '.Storage::disk('public')->path($path));
|
||||
|
||||
if ($send = $this->option('send')) {
|
||||
Mail::to($send)->locale($locale)->send(new MailAboExecutionReminder($abo));
|
||||
$this->info(" Mail an {$send} versendet (siehe Mailpit).");
|
||||
}
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
private function recipientLocale(UserAbo $abo): string
|
||||
{
|
||||
$locale = $abo->is_for === 'me'
|
||||
? $abo->user?->getLocale()
|
||||
: $abo->shopping_user?->getLocale();
|
||||
|
||||
return $locale ?: 'de';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue