Add booking confirmation email functionality
Implemented a new booking confirmation email template and its integration with email sending functionality. Updated form handling to trigger confirmation email after submission and enhanced error handling on department validation.
This commit is contained in:
@@ -7,8 +7,10 @@ require_once WD . '/modules/email/templates/email_template_header.php';
|
||||
require_once WD . '/modules/email/templates/email_template_footer.php';
|
||||
require_once WD . '/modules/email/templates/email_template_head.php';
|
||||
require_once WD . '/modules/email/templates/email_template_stripe_invoice.php';
|
||||
require_once WD . '/modules/email/templates/email_template_booking_confirmation.php';
|
||||
|
||||
use email\email_c;
|
||||
use email\templates\email_template_booking_confirmation;
|
||||
use email\templates\email_template_footer;
|
||||
use email\templates\email_template_head;
|
||||
use email\templates\email_template_header;
|
||||
@@ -169,4 +171,59 @@ class email implements email_i
|
||||
$html .= self::generateHtmlFooter();
|
||||
$this->sendEmailMailerSend($to, $recipient_name, 'Betalingslink for bestilling #' . $order_id, '', $html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a booking confirmation email
|
||||
* @throws MailerSendException
|
||||
* @throws ClientExceptionInterface
|
||||
* @throws JsonException
|
||||
* @throws MailerSendAssertException
|
||||
*/
|
||||
public function sendBookingConfirmationEmail(
|
||||
int $booking_id,
|
||||
string $company_name,
|
||||
int $customer_id,
|
||||
string $contact_email,
|
||||
string $reference_number,
|
||||
string $vehicle_registration_truck,
|
||||
string $vehicle_registration_trailer,
|
||||
string $wants_wash_certificate,
|
||||
string $wash_certificate_email,
|
||||
string $date,
|
||||
string $department,
|
||||
string $address,
|
||||
string $pickup,
|
||||
string $notes
|
||||
): void
|
||||
{
|
||||
// Generate HTML email
|
||||
$html = self::generateHtmlHeader();
|
||||
// Add email content
|
||||
$html .= (new email_template_booking_confirmation(
|
||||
$booking_id,
|
||||
$company_name,
|
||||
$customer_id,
|
||||
$contact_email,
|
||||
$reference_number,
|
||||
$vehicle_registration_truck,
|
||||
$vehicle_registration_trailer,
|
||||
$wants_wash_certificate,
|
||||
$wash_certificate_email,
|
||||
$date,
|
||||
$department,
|
||||
$address,
|
||||
$pickup,
|
||||
$notes
|
||||
))->generate_html();
|
||||
// Add email footer
|
||||
$html .= self::generateHtmlFooter();
|
||||
// Send email
|
||||
$this->sendEmailMailerSend(
|
||||
$contact_email,
|
||||
$company_name,
|
||||
'Truck Wash Booking ( ID: ' . $booking_id . ', REF: ' . $reference_number . ' )',
|
||||
'',
|
||||
$html
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user