Ensure proper initialization of lane status via getter methods, refactor email template structure for better MSO compatibility, and add machine_available field to guest API response.
This commit is contained in:
@@ -56,100 +56,130 @@ class email_template_new_customer
|
||||
# Start of the html
|
||||
?>
|
||||
|
||||
<!-- New customer welcome template (styled per provided HTML) -->
|
||||
<div class="email-template" style="width:100%;max-width:600px;margin:0 auto;font-family:Arial, sans-serif;color:#000000;">
|
||||
<!-- Blue outer container -->
|
||||
<div class="container-blue" style="background-color:#001244;padding:48px 24px;">
|
||||
<!-- White inner card -->
|
||||
<div class="container-inner" style="background-color:#ffffff;border-radius:0;padding:32px 24px;">
|
||||
<!-- Title / Welcome -->
|
||||
<p class="container-text-lg" style="color:#000000;font-size:24px;line-height:1.5;margin:0 0 24px 0;mso-line-height-rule:exactly;"><strong>Velkommen!</strong></p>
|
||||
|
||||
<!-- Intro -->
|
||||
<p class="container-text-md" style="color:#000000;font-size:16px;line-height:1.5;margin:0 0 18px 0;mso-line-height-rule:exactly;">
|
||||
Tak for din registrering af <?=((new users_o())->getCustomerName((int)$this->customer_number))?><?=(((new users_o())->getCustomerEcocomicData((int)$this->customer_number)->economic_customer->corporateIdentificationNumber) ? ' (' . (new users_o())->getCustomerEcocomicData((int)$this->customer_number)->economic_customer->corporateIdentificationNumber . ')' : '')?> som kunde hos Truck Wash.
|
||||
</p>
|
||||
|
||||
<!-- You can now wash your trucks -->
|
||||
<p class="container-text-md" style="color:#000000;font-size:16px;line-height:1.5;margin:0 0 18px 0;mso-line-height-rule:exactly;">
|
||||
Du kan nu vaske i alle vores afdelinger, find din nærmeste på
|
||||
<a href="https://www.truckwash.dk" style="color:#001244; text-decoration:none;">truckwash.dk</a>
|
||||
</p>
|
||||
|
||||
<!-- As a new customer of Truck Wash, features -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Som ny kunde af Truck Wash får du adgang til en række unikke fordele:
|
||||
</p>
|
||||
<ul class="container-text-md" style="list-style-type: disc; padding-left: 20px; margin-top: 0; margin-bottom:18px;">
|
||||
<li>Et landsdækkende netværk af vaskehaller</li>
|
||||
<li>En kundeportal, hvor du kan håndtere alle aspekter af dine vaskebehov</li>
|
||||
<li>En samlet faktura for alle dine vaske på tværs af landet</li>
|
||||
<li>Et standardiseret vaskecertifikat for gennemførte vaske</li>
|
||||
<li>En bookingportal, hvor du nemt kan booke vaske på tværs af landet</li>
|
||||
<li>En mulighed for at vaske 24/7, idet vi har døgnåbent på de fleste lokationer</li>
|
||||
</ul>
|
||||
|
||||
<!-- Customer credentials -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Dit login til kundeportalen er:<br/>
|
||||
<strong>Brugernavn:</strong> <?= $this->customer_number ?><br/>
|
||||
<strong>Kode:</strong> Ikke opsat
|
||||
</p>
|
||||
|
||||
<!-- Button to create password (centered) with MSO fallback -->
|
||||
<div style="margin-top: 24px; margin-bottom: 32px; text-align: center;">
|
||||
<!--[if mso]>
|
||||
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
href="<?= htmlspecialchars($this->password_reset_link) ?>"
|
||||
style="height:48px;v-text-anchor:middle;width:360px;" arcsize="25%" stroke="f" fillcolor="#477fae">
|
||||
<w:anchorlock/>
|
||||
<center style="color:#ffffff;font-family:Arial,sans-serif;font-size:18px;">Færdiggør kontoopsætning</center>
|
||||
</v:roundrect>
|
||||
<![endif]-->
|
||||
<!--[if !mso]><!-- -->
|
||||
<a href="<?= htmlspecialchars($this->password_reset_link) ?>"
|
||||
class="container-button container-button-shadow"
|
||||
style="background-color:#477fae;color:#ffffff !important;padding:16px 24px;text-decoration:none;border-radius:15px;font-size:18px;display:inline-block;box-shadow:0 4px 8px rgba(0,0,0,0.2);">
|
||||
Færdiggør kontoopsætning
|
||||
</a>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
|
||||
<!-- Closing -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Vi ser frem til at modtage dine køretøjer ude i vaskebanerne.<br/>
|
||||
Har du spørgsmål, så kontakt os endelig.
|
||||
</p>
|
||||
|
||||
<!-- Kind regards -->
|
||||
<p class="container-text-md no-margin" style="margin-top: 16px;color:#000000;font-size:16px;line-height:1.5;mso-line-height-rule:exactly;">
|
||||
Med venlig hilsen,
|
||||
</p>
|
||||
|
||||
<!-- Signatures (images + contact) -->
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top:24px;">
|
||||
<!-- New customer welcome template (table-based for Outlook Classic fidelity) -->
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="background-color:#001244;margin:0;padding:0;width:100%;">
|
||||
<tr>
|
||||
<td align="center" style="padding:48px 24px;">
|
||||
<!--[if mso]>
|
||||
<table role="presentation" width="600" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td valign="top" width="50%" style="padding-right:8px;">
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
<img src="https://truckwash.io/img/jm-signature.png" alt="Signature Jimmy Mølgaard" width="100" style="width:100px;height:auto;display:block;margin:0 0 8px 0;"/>
|
||||
<a class="signature-name" href="tel:+4553855359" style="color:#001244;text-decoration:none;font-weight:bold;">Jimmy Mølgaard<br/></a>
|
||||
<a class="signature-role" href="tel:+4553855359" style="color:#001244;text-decoration:none;font-style:italic;">Kundechef<br/></a>
|
||||
<a class="signature-link" href="tel:+4553855359" style="color:#001244;text-decoration:none;">+45 53 85 53 59</a>
|
||||
<td>
|
||||
<![endif]-->
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="max-width:600px;background-color:#ffffff;border-radius:0;">
|
||||
<tr>
|
||||
<td style="padding:32px 24px;font-family:Arial, sans-serif;color:#000000;">
|
||||
<!-- Title / Welcome -->
|
||||
<p class="container-text-lg" style="color:#000000;font-size:24px;line-height:1.5;margin:0 0 24px 0;mso-line-height-rule:exactly;"><strong>Velkommen!</strong></p>
|
||||
|
||||
<!-- Intro -->
|
||||
<p class="container-text-md" style="color:#000000;font-size:16px;line-height:1.5;margin:0 0 18px 0;mso-line-height-rule:exactly;">
|
||||
Tak for din registrering af <?=((new users_o())->getCustomerName((int)$this->customer_number))?><?=(((new users_o())->getCustomerEcocomicData((int)$this->customer_number)->economic_customer->corporateIdentificationNumber) ? ' (' . (new users_o())->getCustomerEcocomicData((int)$this->customer_number)->economic_customer->corporateIdentificationNumber . ')' : '')?> som kunde hos Truck Wash.
|
||||
</p>
|
||||
</td>
|
||||
<td valign="top" width="50%" style="padding-left:8px;">
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
<img src="https://truckwash.io/img/my-signature.png" alt="Signature Mads Yde Jensen" width="100" style="width:100px;height:auto;display:block;margin:0 0 8px 0;"/>
|
||||
<a class="signature-name" href="tel:+4542460282" style="color:#001244;text-decoration:none;font-weight:bold;">Mads Yde Jensen<br/></a>
|
||||
<a class="signature-role" href="tel:+4542460282" style="color:#001244;text-decoration:none;font-style:italic;">Direktør<br/></a>
|
||||
<a class="signature-link" href="tel:+4542460282" style="color:#001244;text-decoration:none;">+45 42 46 02 82</a>
|
||||
|
||||
<!-- You can now wash your trucks -->
|
||||
<p class="container-text-md" style="color:#000000;font-size:16px;line-height:1.5;margin:0 0 18px 0;mso-line-height-rule:exactly;">
|
||||
Du kan nu vaske i alle vores afdelinger, find din nærmeste på
|
||||
<a href="https://www.truckwash.dk" style="color:#001244; text-decoration:none;">truckwash.dk</a>
|
||||
</p>
|
||||
|
||||
<!-- As a new customer of Truck Wash, features -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Som ny kunde af Truck Wash får du adgang til en række unikke fordele:
|
||||
</p>
|
||||
<ul class="container-text-md" style="list-style-type: disc; padding-left: 20px; margin-top: 0; margin-bottom:18px;">
|
||||
<li>Et landsdækkende netværk af vaskehaller</li>
|
||||
<li>En kundeportal, hvor du kan håndtere alle aspekter af dine vaskebehov</li>
|
||||
<li>En samlet faktura for alle dine vaske på tværs af landet</li>
|
||||
<li>Et standardiseret vaskecertifikat for gennemførte vaske</li>
|
||||
<li>En bookingportal, hvor du nemt kan booke vaske på tværs af landet</li>
|
||||
<li>En mulighed for at vaske 24/7, idet vi har døgnåbent på de fleste lokationer</li>
|
||||
</ul>
|
||||
|
||||
<!-- Customer credentials -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Dit login til kundeportalen er:<br/>
|
||||
<strong>Brugernavn:</strong> <?= $this->customer_number ?><br/>
|
||||
<strong>Kode:</strong> Ikke opsat
|
||||
</p>
|
||||
|
||||
<!-- Button to create password (centered) with MSO fallback -->
|
||||
<div style="margin-top: 24px; margin-bottom: 32px; text-align: center;">
|
||||
<!--[if mso]>
|
||||
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
href="<?= htmlspecialchars($this->password_reset_link) ?>"
|
||||
style="height:48px;v-text-anchor:middle;width:360px;" arcsize="25%" stroke="f" fillcolor="#477fae">
|
||||
<w:anchorlock/>
|
||||
<center style="color:#ffffff;font-family:Arial,sans-serif;font-size:18px;">Færdiggør kontoopsætning</center>
|
||||
</v:roundrect>
|
||||
<![endif]-->
|
||||
<!--[if !mso]><!-- -->
|
||||
<a href="<?= htmlspecialchars($this->password_reset_link) ?>"
|
||||
class="container-button container-button-shadow"
|
||||
style="background-color:#477fae;color:#ffffff !important;padding:16px 24px;text-decoration:none;border-radius:15px;font-size:18px;display:inline-block;box-shadow:0 4px 8px rgba(0,0,0,0.2);">
|
||||
Færdiggør kontoopsætning
|
||||
</a>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
|
||||
<!-- Closing -->
|
||||
<p class="container-text-md no-margin" style="color:#000000;font-size:16px;line-height:1.5;margin:0;mso-line-height-rule:exactly;">
|
||||
Vi ser frem til at modtage dine køretøjer ude i vaskebanerne.<br/>
|
||||
Har du spørgsmål, så kontakt os endelig.
|
||||
</p>
|
||||
|
||||
<!-- Kind regards -->
|
||||
<p class="container-text-md no-margin" style="margin-top: 16px;color:#000000;font-size:16px;line-height:1.5;mso-line-height-rule:exactly;">
|
||||
Med venlig hilsen,
|
||||
</p>
|
||||
|
||||
<!-- Signatures (images + contact) -->
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top:24px;table-layout:fixed;">
|
||||
<tr>
|
||||
<td align="left" valign="top" width="50%" style="width:50%;padding-right:8px;">
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td style="padding:0 0 8px 0;">
|
||||
<img src="https://truckwash.io/img/jm-signature.png" alt="Signature Jimmy Mølgaard" width="100" style="width:100px;height:auto;display:block;line-height:0;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family:Arial,sans-serif;color:#000000;font-size:16px;line-height:1.5;mso-line-height-rule:exactly;">
|
||||
<a class="signature-name" href="tel:+4553855359" style="color:#001244;text-decoration:none;font-weight:bold;">Jimmy Mølgaard</a><br/>
|
||||
<span class="signature-role" style="color:#001244;text-decoration:none;font-style:italic;">Kundechef</span><br/>
|
||||
<a class="signature-link" href="tel:+4553855359" style="color:#001244;text-decoration:none;">+45 53 85 53 59</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td align="left" valign="top" width="50%" style="width:50%;padding-left:8px;">
|
||||
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td style="padding:0 0 8px 0;">
|
||||
<img src="https://truckwash.io/img/my-signature.png" alt="Signature Mads Yde Jensen" width="100" style="width:100px;height:auto;display:block;line-height:0;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic;"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-family:Arial,sans-serif;color:#000000;font-size:16px;line-height:1.5;mso-line-height-rule:exactly;">
|
||||
<a class="signature-name" href="tel:+4542460282" style="color:#001244;text-decoration:none;font-weight:bold;">Mads Yde Jensen</a><br/>
|
||||
<span class="signature-role" style="color:#001244;text-decoration:none;font-style:italic;">Direktør</span><br/>
|
||||
<a class="signature-link" href="tel:+4542460282" style="color:#001244;text-decoration:none;">+45 42 46 02 82</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
# End of the html
|
||||
|
||||
@@ -24,10 +24,10 @@ trait selfserve_lane_port_controller_t
|
||||
{
|
||||
// Require department lane object
|
||||
if (empty($this->department_lane)) throw new \Exception("Department lane object not found for lane ID {$this->id}");
|
||||
// Check lane status
|
||||
if ($this->status->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot open port on CLOSED lane");
|
||||
if ($this->status->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot open port on MAINTENANCE lane");
|
||||
if ($this->status->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot open port on FAULT lane");
|
||||
// Check lane status (ensure initialization via getter)
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot open port on CLOSED lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot open port on MAINTENANCE lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot open port on FAULT lane");
|
||||
// Get the relay ID based on the port
|
||||
$relay_id = match ($port) {
|
||||
selfserve_lane_port::ENTRANCE => $this->department_lane->relay_out_id->value(),
|
||||
|
||||
@@ -26,10 +26,10 @@ trait selfserve_lane_relay_controller_t
|
||||
{
|
||||
// Require department lane object
|
||||
if (empty($this->department_lane)) throw new \Exception("Department lane object not found for lane ID {$this->id}");
|
||||
// Check lane status
|
||||
if ($this->status->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot turn on relay on CLOSED lane");
|
||||
if ($this->status->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot turn on relay on MAINTENANCE lane");
|
||||
if ($this->status->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot turn on relay on FAULT lane");
|
||||
// Check lane status (ensure initialization via getter)
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot turn on relay on CLOSED lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot turn on relay on MAINTENANCE lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot turn on relay on FAULT lane");
|
||||
// Enforce that MACHINE relay can only be enabled when allowed by current self-serve tasks (self-serve, manual trigger required)
|
||||
if ($relay === selfserve_lane_relay::MACHINE) {
|
||||
// Allowed services are stored as an array of names in lane cache
|
||||
@@ -78,10 +78,10 @@ trait selfserve_lane_relay_controller_t
|
||||
{
|
||||
// Require department lane object
|
||||
if (empty($this->department_lane)) throw new \Exception("Department lane object not found for lane ID {$this->id}");
|
||||
// Check lane status
|
||||
if ($this->status->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot turn off relay on CLOSED lane");
|
||||
if ($this->status->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot turn off relay on MAINTENANCE lane");
|
||||
if ($this->status->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot turn off relay on FAULT lane");
|
||||
// Check lane status (ensure initialization via getter)
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::CLOSED)) throw new \Exception("Cannot turn off relay on CLOSED lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::MAINTENANCE)) throw new \Exception("Cannot turn off relay on MAINTENANCE lane");
|
||||
if ($this->getLaneStatus()->equals(selfserve_lane_status::FAULT)) throw new \Exception("Cannot turn off relay on FAULT lane");
|
||||
// Get the relay ID based on the relay type
|
||||
$relay_id = match ($relay) {
|
||||
selfserve_lane_relay::MACHINE => $this->department_lane->relay_machine_id->value(),
|
||||
|
||||
@@ -74,6 +74,7 @@ class guestRoute
|
||||
'name' => (string)$lane->name->value(),
|
||||
'status' => (string)$lane->getLaneStatus()->name,
|
||||
'products' => $lane->getSelfServeLaneProducts(),
|
||||
'machine_available' => !empty($lane->relay_machine_id->value())
|
||||
];
|
||||
}, $department->getLanes());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user