participant->event()->first()->name ), ); } public function content(): Content { $event = $this->participant->event()->first(); $invoice = $this->refund->invoice()->first(); return new Content( view: 'emails.events.refund_accepted', with: [ 'name' => $this->participant->getNicename(), 'eventTitle' => $event->name, 'eventEmail' => $event->email, 'amount' => $this->refund->amount?->toString() ?? '0,00 Euro', 'reason' => $this->refund->reasonLabel(), 'accountOwner' => $this->refund->account_owner, 'accountIban' => Iban::format((string) $this->refund->account_iban), 'hasDocument' => $this->pdfContent !== null, 'invoiceNumber' => $invoice?->invoice_number, // Wird nur ein Teil erstattet, soll der Teili nicht rätseln, wo der Rest geblieben ist. 'hasRetention' => $this->refund->hasRetention(), 'retainedAmount' => $this->refund->retained_amount?->toString() ?? '0,00 Euro', 'retentionReason' => $this->refund->retentionReasonLabel(), 'retentionReasonNote' => $this->refund->retention_reason_note, // Hat die Aktionsleitung die Bankverbindung aufgenommen, hat der Teili selbst nichts // eingetragen -- dann darf die Mail sich nicht für seine Angaben bedanken. 'capturedByManagement' => $this->refund->wasCapturedByManagement(), // Der Hinweis auf "Meine Abrechnungen" nur, wenn die Anmeldung an einem Konto hängt -- // die Seite filtert über die Nutzer-Verknüpfung und bliebe sonst leer. 'myInvoicesUrl' => $invoice?->user_id !== null ? url('/invoice/my-invoices/new') : null, ], ); } /** * @return array */ public function attachments(): array { if ($this->pdfContent === null) { return []; } return [ Attachment::fromData(fn (): string => $this->pdfContent, $this->pdfFilename ?? 'Rueckerstattung.pdf') ->withMime('application/pdf'), ]; } }