diff --git a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
index eaf6286..7777fc9 100644
--- a/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
+++ b/app/Filament/Resources/InvoiceValidationResource/Pages/CreateInvoiceValidation.php
@@ -3098,22 +3098,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- // ..Mail
-
- $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, 'InvalidFormat')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3155,23 +3139,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('play-warn-sound');
- // ..Mail
-
- $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, 'NotFound')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
- // ..
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3240,19 +3207,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'NotFoundItemS')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3305,19 +3259,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'NotValidPackage')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3356,18 +3297,6 @@ class CreateInvoiceValidation extends CreateRecord
->seconds(3)
->send();
$this->dispatch('playWarnSound');
- $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, 'NotMotorQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
$this->form->fill([
'plant_id' => $plantId,
@@ -3389,21 +3318,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- // ..Mail
-
- $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, 'DuplicateMotorQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3514,20 +3428,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'NotPumpQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3547,20 +3447,6 @@ class CreateInvoiceValidation extends CreateRecord
->send();
$this->dispatch('playWarnSound');
- $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, 'DuplicatePumpQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3675,20 +3561,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'MissingPanelBox')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3765,20 +3637,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'UnknownPumpsetQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
@@ -3799,20 +3657,6 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound');
- $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, 'DuplicatePumpsetQR')
- );
- } else {
- \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
- }
-
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
diff --git a/app/Mail/InvalidSerialMail.php b/app/Mail/InvalidSerialMail.php
index c6333d7..422aae3 100644
--- a/app/Mail/InvalidSerialMail.php
+++ b/app/Mail/InvalidSerialMail.php
@@ -104,58 +104,15 @@ class InvalidSerialMail extends Mailable
{
// 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})";
+ $this->subjectLine = "Invoice - Second Scanning({$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})";
+ $this->subjectLine = "Invoice - Second Scanning({$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(
@@ -170,117 +127,10 @@ class InvalidSerialMail extends Mailable
{
// 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!
+ The scanned serial number could not be found in the given invoice.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
@@ -288,29 +138,9 @@ class InvalidSerialMail extends Mailable
";
break;
case 'DuplicateCapacitorQR':
- $this->greeting = "
+ $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.
+ The scanned Capacitor serial number has already completed the scanning process.
Plant: {$this->mplantName}
Invoice Type: {$this->mInvoiceType}
Invoice Number: {$this->invoiceNumber}
@@ -327,67 +157,6 @@ class InvalidSerialMail extends Mailable
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(