diff --git a/app/Mail/InvalidQualityMail.php b/app/Mail/InvalidQualityMail.php new file mode 100644 index 0000000..3a03d59 --- /dev/null +++ b/app/Mail/InvalidQualityMail.php @@ -0,0 +1,135 @@ +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,

+ Please note that the scanned part number appears to be incorrect.
+ Plant: {$this->mplantName}
+ Production Order: {$this->mProdOrder}
+ Scanned Part Number 2: {$this->mPartNo}
+ "; + break; + case 'InvalidPartNumber3': + $this->greeting = " + Dear Sir/Madam,

+ Please note that the scanned part number appears to be incorrect.
+ Plant: {$this->mplantName}
+ Production Order: {$this->mProdOrder}
+ Scanned Part Number 3: {$this->mPartNo}
+ "; + break; + case 'InvalidPartNumber4': + $this->greeting = " + Dear Sir/Madam,

+ Please note that the scanned part number appears to be incorrect.
+ Plant: {$this->mplantName}
+ Production Order: {$this->mProdOrder}
+ Scanned Part Number 4: {$this->mPartNo}
+ "; + break; + case 'InvalidPartNumber5': + $this->greeting = " + Dear Sir/Madam,

+ Please note that the scanned part number appears to be incorrect.
+ Plant: {$this->mplantName}
+ Production Order: {$this->mProdOrder}
+ Scanned Part Number 5: {$this->mPartNo}
+ "; + break; + case 'InvalidPartNumber': + default: + $this->greeting = " + Dear Sir/Madam,

+ Please note that the scanned part number appears to be incorrect.
+ Plant: {$this->mplantName}
+ Production Order: {$this->mProdOrder}
+ Scanned Part Number 1: {$this->mPartNo}
+ "; + break; + } + + return new Content( + view: 'mail.invalid-serial', + with: [ + 'company' => "CRI Digital Manufacturing Solutions", + 'greeting' => $this->greeting, + 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions", + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +}