Creating Participation refunds
This commit is contained in:
@@ -2,8 +2,7 @@
|
||||
|
||||
namespace App\Domains\Admin\Controllers;
|
||||
|
||||
use App\Domains\ParticipantInvoice\ParticipantInvoiceTokens;
|
||||
use App\Models\DocumentTemplate;
|
||||
use App\Models\DocumentTypeCatalog;
|
||||
use App\Providers\DocumentTemplateRenderProvider;
|
||||
use App\Providers\PdfGenerateAndDownloadProvider;
|
||||
use App\Scopes\CommonController;
|
||||
@@ -17,10 +16,16 @@ class DocumentTemplatesPreviewController extends CommonController
|
||||
{
|
||||
public function __invoke(Request $request): Response
|
||||
{
|
||||
$documentType = (string) $request->input('type', DocumentTypeCatalog::default());
|
||||
|
||||
if (!DocumentTypeCatalog::has($documentType)) {
|
||||
abort(422, 'Unbekannte Dokumentart.');
|
||||
}
|
||||
|
||||
$html = new DocumentTemplateRenderProvider(
|
||||
DocumentTemplate::TYPE_PARTICIPANT_INVOICE,
|
||||
$documentType,
|
||||
(array) $request->input('blocks', []),
|
||||
)->render(ParticipantInvoiceTokens::sample());
|
||||
)->render(DocumentTypeCatalog::sampleTokens($documentType));
|
||||
|
||||
return response(PdfGenerateAndDownloadProvider::fromHtml($html, 'portrait'), 200, [
|
||||
'Content-Type' => 'application/pdf',
|
||||
|
||||
Reference in New Issue
Block a user