Participant mangement
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail\ParticipantPaymentMails;
|
||||
|
||||
use App\Models\EventParticipant;
|
||||
use App\ValueObjects\Amount;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Attachment;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
|
||||
class ParticipantPaymentOverpaidMail extends Mailable
|
||||
{
|
||||
public function __construct(
|
||||
private EventParticipant $participant,
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
public function envelope(): Envelope
|
||||
{
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$subject = sprintf(
|
||||
'Überzahlung des Beitrags %1$s%2$s',
|
||||
'für die Veranstaltung',
|
||||
$this->participant->event()->first()->name
|
||||
);
|
||||
|
||||
|
||||
return new Envelope(
|
||||
subject: $subject,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$event = $this->participant->event()->first()->toResource()->toArray(new Request());
|
||||
$participant = $this->participant->toResource()->toArray(new Request());
|
||||
|
||||
$overpaidAmount = Amount::fromString($participant['amount_left_value'] * -1)->toString();
|
||||
|
||||
return new Content(
|
||||
view: 'emails.participantPayments.amount_overpaid',
|
||||
with: [
|
||||
'participationType' => $participant['participationType'],
|
||||
'name' => $participant['nicename'],
|
||||
'eventTitle' => $event['name'],
|
||||
'eventEmail' => $event['email'],
|
||||
'arrival' => $participant['arrival'],
|
||||
'departure' => $participant['departure'],
|
||||
'amount' => $participant['amountExpected']['readable'],
|
||||
'amount_paid' => $participant['amountPaid']['readable'],
|
||||
'overpaidAmount' => $overpaidAmount,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
* @return array<int, Attachment>
|
||||
*/
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user