-
backend/app/Mail/Organizer/OrderSummaryForOrganizer.php
Open in GitHubuse HiEvents\DomainObjects\EventDomainObject; use HiEvents\DomainObjects\OrderDomainObject; use HiEvents\Helper\Currency; use HiEvents\Helper\Url; use HiEvents\Mail\BaseMail; use Illuminate\Mail\Mailables\Content; use Illuminate\Mail\Mailables\Envelope; use Illuminate\Support\Str; class OrderSummaryForOrganizer extends BaseMail { private OrderDomainObject $order; private EventDomainObject $event; public function __construct(OrderDomainObject $order, EventDomainObject $event) { parent::__construct(); $this->order = $order; $this->event = $event; } public function envelope(): Envelope { $subject = $this->order->getTotalGross() > 0 ? __('New order for :amount for :event 🎉', [ 'amount' => Currency::format($this->order->getTotalGross(), $this->event->getCurrency()), 'event' => Str::limit($this->event->getTitle(), 75)] ) : __('New order for :event 🎉', ['event' => Str::limit($this->event->getTitle(), 75)]); return new Envelope( subject: $subject, ); } public function content(): Content { return new Content( markdown: 'emails.orders.organizer.summary-for-organizer', with: [ 'event' => $this->event, 'order' => $this->order, 'orderUrl' => sprintf( Url::getFrontEndUrlFromConfig(Url::ORGANIZER_ORDER_SUMMARY), $this->event->getId(), $this->order->getId(), ) ] ); } }
-
backend/resources/views/emails/orders/organizer/summary-for-organizer.blade.php
Open in GitHub@php use HiEvents\Helper\Currency @endphp @php /** @uses /backend/app/Mail/OrderSummary.php */ @endphp @php /** @var \HiEvents\DomainObjects\OrderDomainObject $order */ @endphp @php /** @var \HiEvents\DomainObjects\EventDomainObject $event */ @endphp <x-mail::message> # {{ __('You\'ve received a new order!') }} 🎉 <br> {{ __('Congratulations! You\'ve received a new order for ') }} <b>{{ $event->getTitle() }}</b>! {{ __('Please find the details below.') }} <br> <br> {{ __('Order Amount:') }} <b>{{ Currency::format($order->getTotalGross(), $event->getCurrency()) }}</b><br> {{ __('Order ID:') }} <b>{{ $order->getPublicId() }}</b> <br> <x-mail::button :url="$orderUrl"> {{ __('View Order') }} </x-mail::button> <div class="table"> <table> <thead> <tr> <td><b>{{ __('Ticket') }}</b></td> <td><b>{{ __('Price') }}</b></td> <td><b>{{ __('Total') }}</b></td> </tr> </thead> <tbody> @foreach ($order->getOrderItems() as $ticket) <tr> <td> <b>{{ $ticket->getItemName() }} </b> x {{ $ticket->getQuantity()}} </td> <td>{{ Currency::format($ticket->getPrice() * $ticket->getQuantity(), $event->getCurrency()) }} </td> </tr> @endforeach <tr> <td colspan="3"> <b>{{ __('Total') }}</b> </td> <td> {{ Currency::format($order->getTotalGross(), $event->getCurrency()) }} </td> </tr> </tbody> </table> </div> {{ __('Best regards') }}, <br> {{config('app.name')}} </x-mail::message>
-
backend/app/Services/Domain/Mail/SendOrderDetailsService.php
Open in GitHubuse HiEvents\DomainObjects\EventDomainObject; use HiEvents\DomainObjects\OrderDomainObject; use HiEvents\Mail\Order\OrderSummary; use HiEvents\Mail\Organizer\OrderSummaryForOrganizer; readonly class SendOrderDetailsService { // ... private function sendOrderSummaryEmails(OrderDomainObject $order, EventDomainObject $event): void { $this->mailer ->to($order->getEmail()) ->locale($order->getLocale()) ->send(new OrderSummary( order: $order, event: $event, organizer: $event->getOrganizer(), eventSettings: $event->getEventSettings(), )); if ($order->getIsManuallyCreated() || !$event->getEventSettings()->getNotifyOrganizerOfNewOrders()) { return; } $this->mailer ->to($event->getOrganizer()->getEmail()) ->send(new OrderSummaryForOrganizer($order, $event)); } }