Email quick sale receipts and send them again from the sales list

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
2026-11-26 16:00:15 +02:00
co-authored by Claude Sonnet 5.5
parent 3faa4cfbc6
commit d160854b79
29 changed files with 679 additions and 34 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Modules\Sales\Infrastructure\Receipts;
use App\Modules\Sales\Application\DTOs\QuickSaleSummary;
use App\Modules\Shared\Application\UseCases\CompanyDetailsStore;
use Barryvdh\DomPDF\Facade\Pdf;
use Barryvdh\DomPDF\PDF as DomPdf;
/**
* Renders a quick sale's A5 PDF receipt, both for the browser and as an
* email attachment.
*/
class ReceiptPdf
{
public function __construct(private CompanyDetailsStore $company) {}
public function render(QuickSaleSummary $sale): DomPdf
{
return Pdf::loadView('sales-views::receipt', [
'sale' => $sale,
'company' => $this->company->get(),
])
->setPaper('a5')
->setOption('isFontSubsettingEnabled', true);
}
public function fileName(QuickSaleSummary $sale): string
{
return __('sales.receipt.file', ['number' => $sale->id]);
}
}