Add email and notification improvements for bookings

Refactored notification methods to handle Slack, SMS, and email delivery logic more effectively. Introduced `sendBookingNotification` email functionality and a new template for booking notifications. Improved handling of booking data for emails and centralized logic for retrieving booking details.
This commit is contained in:
Jepp9350
2025-04-11 12:16:11 +02:00
parent b6f2629bed
commit 4248a585d9
5 changed files with 198 additions and 46 deletions
@@ -7,6 +7,7 @@ use forms\form_helper_c;
use objects\bookings_o;
use objects\departments_o;
use objects\users_o;
use Psr\Http\Client\ClientExceptionInterface;
use traits\form_t;
class book_wash_f extends form_helper_c
@@ -48,6 +49,7 @@ class book_wash_f extends form_helper_c
/**
* @inheritDoc
* @throws \Exception
* @throws ClientExceptionInterface
*/
public function afterSubmit(): void
{
@@ -97,19 +99,6 @@ class book_wash_f extends form_helper_c
// Send the booking confirmation email
$email->sendBookingConfirmationEmail(
$bookings->id,
$user->getCustomerName($user->customer_number->value()),
self::getCustomerNumber(),
self::getSanitizedData('contact_email'),
self::getSanitizedData('reference'),
strtoupper(self::getSanitizedData('registration_number_tractor')),
strtoupper(self::getSanitizedData('registration_number_trailer')),
self::getSanitizedData('wants_wash_certificate') ? 'Ja' : 'Nej',
($wants_wash_certificate ? self::getSanitizedData('wants_wash_certificate_email') : ''),
self::getSanitizedData('date'),
$department->name->value(),
$department->description->value(),
self::getSanitizedData('wants_pickup') ? 'Ja' : 'Nej',
self::getSanitizedData('notes')
);
// TODO: Implement afterSubmit() method.
}