diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
index eed5b2f..bfff3e0 100644
--- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
+++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
@@ -3171,9 +3171,11 @@ class CreateInvoiceValidation extends CreateRecord
$mPlantName = $mailData['plant_name'];
$emails = $mailData['emails'];
+ $mUserName = Filament::auth()->user()->name;
+
if (! empty($emails)) {
Mail::to($emails)->send(
- new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotFoundInvoice')
+ new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode,$mUserName,'NotFoundInvoice')
);
} else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
@@ -3379,18 +3381,18 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playNotificationSound');
- $mInvoiceType = 'Serial';
- $mailData = $this->getMail();
- $mPlantName = $mailData['plant_name'];
- $emails = $mailData['emails'];
+ // $mInvoiceType = 'Serial';
+ // $mailData = $this->getMail();
+ // $mPlantName = $mailData['plant_name'];
+ // $emails = $mailData['emails'];
- if (! empty($emails)) {
- Mail::to($emails)->send(
- new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
+ // if (! empty($emails)) {
+ // Mail::to($emails)->send(
+ // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
+ // );
+ // } else {
+ // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
+ // }
$filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp';
@@ -3509,19 +3511,19 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound');
- $mInvoiceType = 'Serial';
- $mailData = $this->getMail();
- $mPlantName = $mailData['plant_name'];
- $emails = $mailData['emails'];
+ // $mInvoiceType = 'Serial';
+ // $mailData = $this->getMail();
+ // $mPlantName = $mailData['plant_name'];
+ // $emails = $mailData['emails'];
- if (! empty($emails)) {
- // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
- Mail::to($emails)->send(
- new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
+ // if (! empty($emails)) {
+ // // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
+ // Mail::to($emails)->send(
+ // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
+ // );
+ // } else {
+ // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
+ // }
$filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp';
@@ -3582,19 +3584,21 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $mInvoiceType = 'Serial';
- $mailData = $this->getMail();
- $mPlantName = $mailData['plant_name'];
- $emails = $mailData['emails'];
+ // $mInvoiceType = 'Serial';
+ // $mailData = $this->getMail();
+ // $mPlantName = $mailData['plant_name'];
+ // $emails = $mailData['emails'];
- if (! empty($emails)) {
- // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
- Mail::to($emails)->send(
- new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicateCapacitorQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
+ // $mUserName = Filament::auth()->user()->name;
+
+ // if (! empty($emails)) {
+ // // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
+ // Mail::to($emails)->send(
+ // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
+ // );
+ // } else {
+ // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
+ // }
$this->form->fill([
'plant_id' => $plantId,
@@ -3719,19 +3723,19 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound');
- $mInvoiceType = 'Serial';
- $mailData = $this->getMail();
- $mPlantName = $mailData['plant_name'];
- $emails = $mailData['emails'];
+ // $mInvoiceType = 'Serial';
+ // $mailData = $this->getMail();
+ // $mPlantName = $mailData['plant_name'];
+ // $emails = $mailData['emails'];
- if (! empty($emails)) {
- // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
- Mail::to($emails)->send(
- new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
+ // if (! empty($emails)) {
+ // // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
+ // Mail::to($emails)->send(
+ // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv')
+ // );
+ // } else {
+ // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
+ // }
$filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp';
diff --git a/app/Mail/InvalidSerialMail.php b/app/Mail/InvalidSerialMail.php
index 7c06d35..7f490ae 100644
--- a/app/Mail/InvalidSerialMail.php
+++ b/app/Mail/InvalidSerialMail.php
@@ -82,12 +82,14 @@ class InvalidSerialMail extends Mailable
public $greeting;
public $subjectLine;
+ public $mUserName;
+
public $itemCode;
/**
* Create a new message instance.
*/
- public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat')
+ public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mUserName, $mailType = 'InvalidFormat')
{
$this->serial = $serial;
$this->invoiceNumber = $invoiceNumber;
@@ -95,6 +97,7 @@ class InvalidSerialMail extends Mailable
$this->mInvoiceType = $mInvoiceType;
$this->mailType = $mailType;
$this->itemCode = $itemCode;
+ $this->mUserName = $mUserName;
}
/**
@@ -110,15 +113,18 @@ class InvalidSerialMail extends Mailable
case 'DuplicateCapacitorQR':
$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':
+ 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(
@@ -141,48 +147,20 @@ class InvalidSerialMail extends Mailable
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
Scanned QR Code: {$this->serial}
+ Employee Code: {$this->mUserName}
";
break;
- case 'DuplicateCapacitorQR':
- $this->greeting = "
- Dear Sir/Madam,
- The scanned Capacitor serial number has already completed the scanning process.
- 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}
- 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}
- 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 'DuplicateCapacitorQR':
+ // $this->greeting = "
+ // Dear Sir/Madam,
+ // The scanned Capacitor serial number has already completed the scanning process.
+ // Plant: {$this->mplantName}
+ // Invoice Type: {$this->mInvoiceType}
+ // Invoice Number: {$this->invoiceNumber}
+ // Scanned QR Code: {$this->serial}
+ // Employee Code: {$this->mUserName}
+ // ";
+ // break;
}
return new Content(