Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 34s
Laravel Pint / pint (pull_request) Successful in 2m21s
Laravel Larastan / larastan (pull_request) Failing after 3m22s
176 lines
5.4 KiB
PHP
176 lines
5.4 KiB
PHP
<?php
|
|
|
|
namespace App\Mail;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Mail\Mailable;
|
|
use Illuminate\Mail\Mailables\Content;
|
|
use Illuminate\Mail\Mailables\Envelope;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
// class InvalidSerialMail extends Mailable
|
|
// {
|
|
// use Queueable, SerializesModels;
|
|
|
|
// /**
|
|
// * Create a new message instance.
|
|
// */
|
|
// public $serial;
|
|
// public $invoiceNumber;
|
|
// public $plantName;
|
|
// public $invoiceType;
|
|
|
|
// public $greetings;
|
|
|
|
|
|
// public function __construct($serial, $invoiceNumber, $plantName, $invoiceType)
|
|
// {
|
|
// $this->serial = $serial;
|
|
// $this->invoiceNumber = $invoiceNumber;
|
|
// $this->plantName = $plantName;
|
|
// $this->invoiceType = $invoiceType;
|
|
// }
|
|
|
|
// /**
|
|
// * Get the message envelope.
|
|
// */
|
|
// public function envelope(): Envelope
|
|
// {
|
|
// return new Envelope(
|
|
// subject: 'Invalid Serial Mail',
|
|
// );
|
|
// }
|
|
|
|
// /**
|
|
// * Get the message content definition.
|
|
// */
|
|
// public function content(): Content
|
|
// {
|
|
// $greeting = "Dear Sir/Madam,<br><br>Please note that the scanned serial number format appears to be incorrect.";
|
|
|
|
// return new Content(
|
|
// view: 'mail.invalid-serial',
|
|
// with: [
|
|
// 'company' => "CRI Digital Manufacturing Solutions",
|
|
// 'greeting' => $greeting,
|
|
// 'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
|
// ],
|
|
// );
|
|
// }
|
|
|
|
// /**
|
|
// * Get the attachments for the message.
|
|
// *
|
|
// * @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
|
// */
|
|
// public function attachments(): array
|
|
// {
|
|
// return [];
|
|
// }
|
|
// }
|
|
|
|
class InvalidSerialMail extends Mailable
|
|
{
|
|
use Queueable, SerializesModels;
|
|
|
|
public $serial;
|
|
public $invoiceNumber;
|
|
public $mplantName;
|
|
public $mInvoiceType;
|
|
public $mailType; // new
|
|
public $greeting;
|
|
public $subjectLine;
|
|
|
|
public $mUserName;
|
|
|
|
public $itemCode;
|
|
|
|
/**
|
|
* Create a new message instance.
|
|
*/
|
|
public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mUserName, $mailType = 'InvalidFormat')
|
|
{
|
|
$this->serial = $serial;
|
|
$this->invoiceNumber = $invoiceNumber;
|
|
$this->mplantName = $mplantName;
|
|
$this->mInvoiceType = $mInvoiceType;
|
|
$this->mailType = $mailType;
|
|
$this->itemCode = $itemCode;
|
|
$this->mUserName = $mUserName;
|
|
}
|
|
|
|
/**
|
|
* Get the message envelope.
|
|
*/
|
|
public function envelope(): Envelope
|
|
{
|
|
// dynamic subject based on mail type
|
|
switch ($this->mailType) {
|
|
case 'NotFoundInvoice':
|
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
break;
|
|
case 'DuplicateCapacitorQR':
|
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
break;
|
|
case 'InvalidPanelBox':
|
|
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
break;
|
|
// case 'CompletedSerialInvoice':
|
|
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
// break;
|
|
// case 'CSerialInvoice':
|
|
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
// break;
|
|
// case 'ComSerInv':
|
|
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
|
// break;
|
|
}
|
|
|
|
return new Envelope(
|
|
subject: $this->subjectLine,
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the message content definition.
|
|
*/
|
|
public function content(): Content
|
|
{
|
|
// dynamic greeting/message body
|
|
switch ($this->mailType) {
|
|
case 'NotFoundInvoice':
|
|
$this->greeting = "
|
|
Dear Sir/Madam,<br><br>
|
|
The scanned serial number could not be found in the given invoice.<br><br>
|
|
<b>Plant:</b> {$this->mplantName}<br>
|
|
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
|
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
|
<b>Scanned QR Code:</b> {$this->serial}<br>
|
|
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
";
|
|
break;
|
|
// case 'DuplicateCapacitorQR':
|
|
// $this->greeting = "
|
|
// Dear Sir/Madam,<br><br>
|
|
// The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br>
|
|
// <b>Plant:</b> {$this->mplantName}<br>
|
|
// <b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
|
// <b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
|
// <b>Scanned QR Code:</b> {$this->serial}<br>
|
|
// <b>Employee Code:</b> {$this->mUserName}<br>
|
|
// ";
|
|
// break;
|
|
}
|
|
|
|
return new Content(
|
|
view: 'mail.invalid-serial',
|
|
with: [
|
|
'company' => "CRI Digital Manufacturing Solutions",
|
|
'greeting' => $this->greeting,
|
|
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions",
|
|
],
|
|
);
|
|
}
|
|
}
|