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,

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,
CRI Digital Manufacturing Solutions" // ], // ); // } // /** // * Get the attachments for the message. // * // * @return array // */ // 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 $itemCode; /** * Create a new message instance. */ public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat') { $this->serial = $serial; $this->invoiceNumber = $invoiceNumber; $this->mplantName = $mplantName; $this->mInvoiceType = $mInvoiceType; $this->mailType = $mailType; $this->itemCode = $itemCode; } /** * Get the message envelope. */ public function envelope(): Envelope { // dynamic subject based on mail type switch ($this->mailType) { case 'NotFound': $this->subjectLine = "Serial Number Not Found ({$this->mplantName})"; break; case 'NotFoundInvoice': $this->subjectLine = "Serial Number Not Found in Invoice ({$this->mplantName})"; break; case 'NotFoundItemS': $this->subjectLine = "Item Code Not Found ({$this->mplantName})"; break; case 'NotValidPackage': $this->subjectLine = "Not Valid Package ({$this->mplantName})"; break; case 'InvalidMaterialFormat': $this->subjectLine = "Invalid Qr code format Found material ({$this->mplantName})"; break; case 'DuplicateMotorQR': $this->subjectLine = "Duplicate Serial Number ({$this->mplantName})"; break; case 'NotMotorQR': $this->subjectLine = "Item Code doesn't have Motor QR ({$this->mplantName})"; break; case 'CompletedSerialInvoice': $this->subjectLine = "Completed Serial Invoice ({$this->mplantName})"; break; case 'NotPumpQR': $this->subjectLine = "Item Code doesn't have Pump QR ({$this->mplantName})"; break; case 'DuplicatePumpQR': $this->subjectLine = "Duplicate Serial Number ({$this->mplantName})"; break; case 'CSerialInvoice': $this->subjectLine = "Completed Serial Invoice ({$this->mplantName})"; break; case 'MissingPanelBox': $this->subjectLine = "Missing Panel Box ({$this->mplantName})"; break; case 'DuplicateCapacitorQR': $this->subjectLine = "Duplicate Capacitor QR ({$this->mplantName})"; break; case 'UnknownPumpsetQR': $this->subjectLine = "Unknown PumpSet QR ({$this->mplantName})"; break; case 'DuplicatePumpsetQR': $this->subjectLine = "Duplicate PumpSet QR ({$this->mplantName})"; break; case 'ComSerInv': $this->subjectLine = "Completed Serial Invoice ({$this->mplantName})"; break; case 'InvalidFormat': default: $this->subjectLine = "Invalid Serial Format Found ({$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 'NotFound': $this->greeting = " Dear Sir/Madam,

The scanned Serial Number {$this->serial} was not found in the database for the plant {$this->mplantName}.

Invoice Number: {$this->invoiceNumber}
Invoice Type: {$this->mInvoiceType}

Please verify the serial number. "; break; case 'NotFoundInvoice': $this->greeting = " Dear Sir/Madam,

The scanned Serial Number '{$this->serial}' was not found in the Invoice Number '{$this->invoiceNumber}' for the plant {$this->mplantName}.

Invoice Type: {$this->mInvoiceType}

Please verify the serial number. "; break; case 'NotFoundItemS': $this->greeting = " Dear Sir/Madam,

Item Code '{$this->itemCode}' with Serial Number'{$this->serial}' not found in sticker master for the plant {$this->mplantName}.

Invoice Number: {$this->invoiceNumber}

Invoice Type: {$this->mInvoiceType}

Please verify the Item Code. "; break; case 'NotValidPackage': $this->greeting = " Dear Sir/Madam,

Scanned Item Code'{$this->itemCode}' doesn't have valid package type to proceed! for the plant {$this->mplantName}.

Invoice Number: {$this->invoiceNumber}

Invoice Type: {$this->mInvoiceType}

Please verify the Item Code. "; break; case 'InvalidMaterialFormat': $this->greeting = " Dear Sir/Madam,

Please note that the scanned serial number format appears to be incorrect.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'DuplicateMotorQR': $this->greeting = " Dear Sir/Madam,

Scanned 'Motor' serial number {$this->serial} already completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType} Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'NotMotorQR': $this->greeting = " Dear Sir/Madam,

Scanned Item Code {$this->itemCode} doesn't have 'Motor' QR to proceed!
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'CompletedSerialInvoice': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Scanned QR Code: {$this->serial}
"; break; case 'NotPumpQR': $this->greeting = " Dear Sir/Madam,

Scanned Item Code '{$this->itemCode}' doesn't have 'Pump' QR to proceed!
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'DuplicatePumpQR': $this->greeting = " Dear Sir/Madam,

Scanned 'Pump' serial number already completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'CSerialInvoice': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Scanned QR Code: {$this->serial}
"; break; case 'MissingPanelBox': $this->greeting = " Dear Sir/Madam,

Scanned Item Code '{$this->itemCode}' doesn't have 'Panel Box Code' to proceed!
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'DuplicateCapacitorQR': $this->greeting = " Dear Sir/Madam,

Scanned 'Capacitor' serial number already completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'UnknownPumpsetQR': $this->greeting = " Dear Sir/Madam,

Scanned Item Code '{$this->itemCode}' doesn't have 'Pump Set' QR to proceed!
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'DuplicatePumpsetQR': $this->greeting = " Dear Sir/Madam,

Scanned 'Pump Set' serial number already completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ComSerInv': $this->greeting = " Dear Sir/Madam,

Serial invoice '{$this->invoiceNumber}' completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ItemNotFound': $this->greeting = " Dear Sir/Madam,

Item code '{$this->itemCode}' not found in database.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ItemNotFoundDB': $this->greeting = " Dear Sir/Madam,

Item code '{$this->itemCode}' not found in database for choosed plant.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ItemNotValidMaterialType': $this->greeting = " Dear Sir/Madam,

Item code '{$this->itemCode}' doesn't have a valid material type.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ItemNotInvoice': $this->greeting = " Dear Sir/Madam,

Item code '{$this->itemCode}' doesn't exist in invoice.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'ItemNotInvoice': $this->greeting = " Dear Sir/Madam,

Item code '{$this->itemCode}' doesn't exist in invoice.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; case 'InvalidFormat': default: $this->greeting = " Dear Sir/Madam,

Please note that the scanned serial number format appears to be incorrect.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType} Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
"; break; } return new Content( view: 'mail.invalid-serial', with: [ 'company' => "CRI Digital Manufacturing Solutions", 'greeting' => $this->greeting, 'wishes' => "Thanks & Regards,
CRI Digital Manufacturing Solutions", ], ); } }