Addded quality mail page for quality validation

This commit is contained in:
dhanabalan
2025-11-24 09:25:23 +05:30
parent 921f70c8eb
commit 6638569367

View File

@@ -0,0 +1,135 @@
<?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 InvalidQualityMail extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*/
public $serial;
public $invoiceNumber;
public $mplantName;
public $mProdOrder;
public $mPartNo;
public $mailType;
public $greeting;
public $subjectLine;
public $itemCode;
public function __construct($parNo, $mProdOrder, $mplantName, $mailType = 'InvalidPartNumber')
{
$this->mPartNo = $parNo;
$this->mProdOrder = $mProdOrder;
$this->mplantName = $mplantName;
$this->mailType = $mailType;
}
public function envelope(): Envelope
{
// dynamic subject based on mail type
switch ($this->mailType) {
case 'InvalidPartNumber2':
$this->subjectLine = "Invalid Part Number 2 Scanned ({$this->mplantName})";
break;
case 'InvalidPartNumber3':
$this->subjectLine = "Invalid Part Number 3 Scanned ({$this->mplantName})";
break;
case 'InvalidPartNumber4':
$this->subjectLine = "Invalid Part Number 4 Scanned ({$this->mplantName})";
break;
case 'InvalidPartNumber5':
$this->subjectLine = "Invalid Part Number 5 Scanned ({$this->mplantName})";
break;
case 'InvalidPartNumber':
default:
$this->subjectLine = "Invalid Part Number 1 Scanned ({$this->mplantName})";
break;
}
return new Envelope(
subject: $this->subjectLine,
);
}
public function content(): Content
{
// dynamic greeting/message body
switch ($this->mailType) {
case 'InvalidPartNumber2':
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 2:</b> {$this->mPartNo}<br>
";
break;
case 'InvalidPartNumber3':
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 3:</b> {$this->mPartNo}<br>
";
break;
case 'InvalidPartNumber4':
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 4:</b> {$this->mPartNo}<br>
";
break;
case 'InvalidPartNumber5':
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 5:</b> {$this->mPartNo}<br>
";
break;
case 'InvalidPartNumber':
default:
$this->greeting = "
Dear Sir/Madam,<br><br>
Please note that the scanned part number appears to be incorrect.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Production Order:</b> {$this->mProdOrder}<br>
<b>Scanned Part Number 1:</b> {$this->mPartNo}<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",
],
);
}
/**
* Get the attachments for the message.
*
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
*/
public function attachments(): array
{
return [];
}
}