From 835f32ea2a28cf48ebe536658fdcb147a6817829 Mon Sep 17 00:00:00 2001 From: smarcet Date: Tue, 17 Dec 2019 12:25:35 -0300 Subject: [PATCH] Updated bookable rooms emails Change-Id: I799ea6c130d54e0172b93c88282a1ee3541319b4 --- .../AbstractBookableRoomReservationEmail.php | 76 +++++++++++++++++-- .../BookableRoomReservationCanceledEmail.php | 15 ++-- .../BookableRoomReservationCreatedEmail.php | 14 ++-- ...leRoomReservationPaymentConfirmedEmail.php | 13 ++-- ...ableRoomReservationRefundAcceptedEmail.php | 13 ++-- ...omReservationRefundRequestedAdminEmail.php | 11 +-- ...omReservationRefundRequestedOwnerEmail.php | 11 ++- .../reservation_canceled.blade.php | 23 +++--- .../reservation_created.blade.php | 6 +- .../reservation_payment_confirmed.blade.php | 16 ++-- .../reservation_refund_accepted.blade.php | 20 ++--- ...servation_refund_requested_admin.blade.php | 22 +++--- ...servation_refund_requested_owner.blade.php | 21 ++--- 13 files changed, 175 insertions(+), 86 deletions(-) diff --git a/app/Mail/AbstractBookableRoomReservationEmail.php b/app/Mail/AbstractBookableRoomReservationEmail.php index 2e2222db..61734a6c 100644 --- a/app/Mail/AbstractBookableRoomReservationEmail.php +++ b/app/Mail/AbstractBookableRoomReservationEmail.php @@ -14,7 +14,6 @@ use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; -use Illuminate\Contracts\Queue\ShouldQueue; use models\summit\SummitRoomReservation; /** * Class AbstractBookableRoomReservationEmailextends @@ -25,18 +24,83 @@ abstract class AbstractBookableRoomReservationEmail extends Mailable use Queueable, SerializesModels; /** - * @var SummitRoomReservation + * @var string */ - public $reservation; + public $owner_fullname; /** - * AbstractBookableRoomReservationEmailextends constructor. + * @var string + */ + public $owner_email; + + /** + * @var string + */ + public $room_complete_name; + + /** + * @var int + */ + public $room_capacity; + + /** + * @var string + */ + public $reservation_start_datetime; + + /** + * @var string + */ + public $reservation_end_datetime; + + /** + * @var string + */ + public $reservation_created_datetime; + + /** + * @var int + */ + public $reservation_amount; + + /** + * @var int + */ + public $reservation_id; + + /** + * @var int + */ + public $reservation_refunded_amount; + + /** + * @var string + */ + public $reservation_currency; + + /** + * @var string + */ + public $summit_name; + + /** + * AbstractBookableRoomReservationEmail constructor. * @param SummitRoomReservation $reservation */ public function __construct(SummitRoomReservation $reservation) { - $this->reservation = $reservation; + $this->owner_fullname = $reservation->getOwner()->getFullName(); + $this->owner_email = $reservation->getOwner()->getEmail(); + $this->room_complete_name = $reservation->getRoom()->getCompleteName(); + $this->reservation_start_datetime = $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s"); + $this->reservation_end_datetime = $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s"); + $this->reservation_created_datetime = $reservation->getCreated()->format("Y-m-d H:i:s"); + $this->reservation_amount = $reservation->getAmount(); + $this->reservation_currency = $reservation->getCurrency(); + $this->reservation_id = $reservation->getId(); + $this->room_capacity = $reservation->getRoom()->getCapacity(); + $this->summit_name = $reservation->getRoom()->getSummit()->getName(); + $this->reservation_refunded_amount = $reservation->getRefundedAmount(); } - } diff --git a/app/Mail/BookableRoomReservationCanceledEmail.php b/app/Mail/BookableRoomReservationCanceledEmail.php index 884ef0f1..08feb35e 100644 --- a/app/Mail/BookableRoomReservationCanceledEmail.php +++ b/app/Mail/BookableRoomReservationCanceledEmail.php @@ -18,6 +18,8 @@ use Illuminate\Support\Facades\Config; */ final class BookableRoomReservationCanceledEmail extends AbstractBookableRoomReservationEmail { + + /** * Build the message. * @@ -25,12 +27,13 @@ final class BookableRoomReservationCanceledEmail extends AbstractBookableRoomRes */ public function build() { - $subject = Config::get("mail.bookable_room_reservation_canceled_email_subject"); - if(empty($subject)) - $subject = sprintf("[%s] Your Room Reservation had been canceled", Config::get('app.app_name')); - - return $this->from(Config::get("mail.from")) - ->to($this->reservation->getOwner()->getEmail()) + $subject = sprintf("[%s] Your Room Reservation had been canceled", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) + ->to($this->owner_email) ->subject($subject) ->view('emails.bookable_rooms.reservation_canceled'); } diff --git a/app/Mail/BookableRoomReservationCreatedEmail.php b/app/Mail/BookableRoomReservationCreatedEmail.php index 57d2edf9..aa204fed 100644 --- a/app/Mail/BookableRoomReservationCreatedEmail.php +++ b/app/Mail/BookableRoomReservationCreatedEmail.php @@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Config; */ final class BookableRoomReservationCreatedEmail extends AbstractBookableRoomReservationEmail { + /** * Build the message. * @@ -25,12 +26,13 @@ final class BookableRoomReservationCreatedEmail extends AbstractBookableRoomRese */ public function build() { - $subject = Config::get("mail.bookable_room_reservation_created_email_subject"); - if(empty($subject)) - $subject = sprintf("[%s] Room Reservation Created", Config::get('app.app_name')); - - return $this->from(Config::get("mail.from")) - ->to($this->reservation->getOwner()->getEmail()) + $subject = sprintf("[%s] Room Reservation Created", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) + ->to($this->owner_email) ->subject($subject) ->view('emails.bookable_rooms.reservation_created'); } diff --git a/app/Mail/BookableRoomReservationPaymentConfirmedEmail.php b/app/Mail/BookableRoomReservationPaymentConfirmedEmail.php index b57a4997..1aeb2837 100644 --- a/app/Mail/BookableRoomReservationPaymentConfirmedEmail.php +++ b/app/Mail/BookableRoomReservationPaymentConfirmedEmail.php @@ -26,12 +26,13 @@ final class BookableRoomReservationPaymentConfirmedEmail extends AbstractBookabl */ public function build() { - $subject = Config::get("mail.bookable_room_reservation_payment_confirmed_email_subject"); - if(empty($subject)) - $subject = sprintf("[%s] Your Room Reservation is confirmed!", Config::get('app.app_name')); - - return $this->from(Config::get("mail.from")) - ->to($this->reservation->getOwner()->getEmail()) + $subject = sprintf("[%s] Your Room Reservation is confirmed!", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) + ->to($this->owner_email) ->subject($subject) ->view('emails.bookable_rooms.reservation_payment_confirmed'); } diff --git a/app/Mail/BookableRoomReservationRefundAcceptedEmail.php b/app/Mail/BookableRoomReservationRefundAcceptedEmail.php index 81c02fe3..a8e02a44 100644 --- a/app/Mail/BookableRoomReservationRefundAcceptedEmail.php +++ b/app/Mail/BookableRoomReservationRefundAcceptedEmail.php @@ -26,12 +26,13 @@ final class BookableRoomReservationRefundAcceptedEmail extends AbstractBookableR */ public function build() { - $subject = Config::get("mail.bookable_room_reservation_refund_accepted_email_subject"); - if(empty($subject)) - $subject = sprintf("[%s] Your Room Reservation Refund is Accepted!", Config::get('app.app_name')); - - return $this->from(Config::get("mail.from")) - ->to($this->reservation->getOwner()->getEmail()) + $subject = sprintf("[%s] Your Room Reservation Refund is Accepted!", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) + ->to($this->owner_email) ->subject($subject) ->view('emails.bookable_rooms.reservation_refund_accepted'); } diff --git a/app/Mail/BookableRoomReservationRefundRequestedAdminEmail.php b/app/Mail/BookableRoomReservationRefundRequestedAdminEmail.php index 9cdc13ca..08b375a1 100644 --- a/app/Mail/BookableRoomReservationRefundRequestedAdminEmail.php +++ b/app/Mail/BookableRoomReservationRefundRequestedAdminEmail.php @@ -26,11 +26,12 @@ final class BookableRoomReservationRefundRequestedAdminEmail extends AbstractBoo */ public function build() { - $subject = Config::get("mail.bookable_room_reservation_refund_requeted_admin_email_subject"); - if(empty($subject)) - $subject = sprintf("[%s] There is a new reservation refund request available!", Config::get('app.app_name')); - - return $this->from(Config::get("mail.from")) + $subject = sprintf("[%s] There is a new reservation refund request available!", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) ->to(Config::get("bookable_rooms.admin_email")) ->subject($subject) ->view('emails.bookable_rooms.reservation_refund_requested_admin'); diff --git a/app/Mail/BookableRoomReservationRefundRequestedOwnerEmail.php b/app/Mail/BookableRoomReservationRefundRequestedOwnerEmail.php index cb2d276d..e0e4fc52 100644 --- a/app/Mail/BookableRoomReservationRefundRequestedOwnerEmail.php +++ b/app/Mail/BookableRoomReservationRefundRequestedOwnerEmail.php @@ -25,6 +25,15 @@ final class BookableRoomReservationRefundRequestedOwnerEmail extends AbstractBoo */ public function build() { - return $this->view('view.name'); + + $subject = sprintf("[%s] Your Room Reservation Refund is requested!", $this->summit_name); + $from = Config::get("mail.from"); + if(empty($from)){ + throw new \InvalidArgumentException("mail.from is not set"); + } + return $this->from($from) + ->to($this->owner_email) + ->subject($subject) + ->view('emails.bookable_rooms.reservation_refund_requested_owner'); } } diff --git a/resources/views/emails/bookable_rooms/reservation_canceled.blade.php b/resources/views/emails/bookable_rooms/reservation_canceled.blade.php index 77de8858..4f68f994 100644 --- a/resources/views/emails/bookable_rooms/reservation_canceled.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_canceled.blade.php @@ -5,21 +5,22 @@

- Dear {!! $reservation->getOwner()->getFullName() !!}, + Dear {!! $owner_fullname !!}

- Your Reservation for room {!! $reservation->getRoom()->getCompleteName() !!} got canceled because you did not take any action to pay it. + Your Reservation for room {!! $room_complete_name !!} got canceled because you did not take any action to pay it.

- Id {!! $reservation->getId()!!} - Owner {!! $reservation->getOwner()->getFullName()!!} - Email {!! $reservation->getOwner()->getEmail()!!} - From {!! $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s") !!} - To {!! $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s") !!} - Created {!! $reservation->getCreated()->format("Y-m-d H:i:s") !!} - Amount {!! $reservation->getAmount() !!} - Currency {!! $reservation->getCurrency() !!} +

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team

- \ No newline at end of file + diff --git a/resources/views/emails/bookable_rooms/reservation_created.blade.php b/resources/views/emails/bookable_rooms/reservation_created.blade.php index 91370829..d4246869 100644 --- a/resources/views/emails/bookable_rooms/reservation_created.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_created.blade.php @@ -5,11 +5,11 @@

- Dear {!! $reservation->getOwner()->getFullName() !!}, + Dear {!! $owner_fullname !!}

- Your Reservation for room {!! $reservation->getRoom()->getCompleteName() !!} has been created successfully. + Your Reservation for room {!! $room_complete_name !!} has been created successfully.

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team

- \ No newline at end of file + diff --git a/resources/views/emails/bookable_rooms/reservation_payment_confirmed.blade.php b/resources/views/emails/bookable_rooms/reservation_payment_confirmed.blade.php index 35ac4f8a..533ddc56 100644 --- a/resources/views/emails/bookable_rooms/reservation_payment_confirmed.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_payment_confirmed.blade.php @@ -5,20 +5,22 @@

- Dear {!! $reservation->getOwner()->getFullName() !!}, + Dear {!! $owner_fullname !!}

- Your Reservation for room {!! $reservation->getRoom()->getCompleteName() !!} has been confirmed. + Your Reservation for room {!! $room_complete_name !!} has been confirmed.

Please take note of the reservation info bellow:

- From {!! $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s") !!} - To {!! $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s") !!} - Room Capacity {!! $reservation->getRoom()->getCapacity() !!} - Amount {!! $reservation->getAmount() !!} - Currency {!! $reservation->getCurrency() !!} +

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team

diff --git a/resources/views/emails/bookable_rooms/reservation_refund_accepted.blade.php b/resources/views/emails/bookable_rooms/reservation_refund_accepted.blade.php index dbbfd910..6f59a3f9 100644 --- a/resources/views/emails/bookable_rooms/reservation_refund_accepted.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_refund_accepted.blade.php @@ -5,21 +5,23 @@

- Dear {!! $reservation->getOwner()->getFullName() !!}, + Dear {!! $owner_fullname!!}

- Your Refund Request Reservation for room {!! $reservation->getRoom()->getCompleteName() !!} has been confirmed. + Your Refund Request Reservation for room {!! $room_complete_name !!} is confirmed.

- Please take note of the reservation info bellow: + Please take note of the reservation info below:

- From {!! $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s") !!} - To {!! $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s") !!} - Room Capacity {!! $reservation->getRoom()->getCapacity() !!} - Amount {!! $reservation->getRefundedAmount() !!} - Currency {!! $reservation->getCurrency() !!} +

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team

- \ No newline at end of file + diff --git a/resources/views/emails/bookable_rooms/reservation_refund_requested_admin.blade.php b/resources/views/emails/bookable_rooms/reservation_refund_requested_admin.blade.php index b9c8de1e..2475c30c 100644 --- a/resources/views/emails/bookable_rooms/reservation_refund_requested_admin.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_refund_requested_admin.blade.php @@ -8,18 +8,20 @@ There is a new reservation refund request available to process

- Please take note of the reservation info bellow: + Please take note of the reservation info below:

- Id {!! $reservation->getId()!!} - Owner {!! $reservation->getOwner()->getFullName()!!} - Email {!! $reservation->getOwner()->getEmail()!!} - From {!! $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s") !!} - To {!! $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s") !!} - Created {!! $reservation->getCreated()->format("Y-m-d H:i:s") !!} - Amount {!! $reservation->getAmount() !!} - Currency {!! $reservation->getCurrency() !!} +

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team

- \ No newline at end of file + diff --git a/resources/views/emails/bookable_rooms/reservation_refund_requested_owner.blade.php b/resources/views/emails/bookable_rooms/reservation_refund_requested_owner.blade.php index d4256280..2a216443 100644 --- a/resources/views/emails/bookable_rooms/reservation_refund_requested_owner.blade.php +++ b/resources/views/emails/bookable_rooms/reservation_refund_requested_owner.blade.php @@ -5,23 +5,24 @@

- Dear {!! $reservation->getOwner()->getFullName() !!}, + Dear {!! $owner_fullname !!}

You had requested a refund for your reservation.

- Please take note of the reservation info bellow: + Please take note of the reservation info below:

- Id {!! $reservation->getId()!!} - Owner {!! $reservation->getOwner()->getFullName()!!} - Email {!! $reservation->getOwner()->getEmail()!!} - From {!! $reservation->getLocalStartDatetime()->format("Y-m-d H:i:s") !!} - To {!! $reservation->getLocalEndDatetime()->format("Y-m-d H:i:s") !!} - Created {!! $reservation->getCreated()->format("Y-m-d H:i:s") !!} - Amount {!! $reservation->getAmount() !!} - Currency {!! $reservation->getCurrency() !!} +

Cheers,
{!! Config::get('app.tenant_name') !!} Support Team