From 75f029cf74650cd257345930eb93b7bd68ea64ce Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Tue, 13 Oct 2026 14:33:44 +0530 Subject: [PATCH] Added non plan production mail pages --- app/Mail/NonPlanProductionMail.php | 89 +++++++++++++++++++ .../mail/non_plan_production_report.blade.php | 63 +++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 app/Mail/NonPlanProductionMail.php create mode 100644 resources/views/mail/non_plan_production_report.blade.php diff --git a/app/Mail/NonPlanProductionMail.php b/app/Mail/NonPlanProductionMail.php new file mode 100644 index 00000000..1dd351ad --- /dev/null +++ b/app/Mail/NonPlanProductionMail.php @@ -0,0 +1,89 @@ +scheduleType = $scheduleType; + $this->tableData = $tableData ?? []; + } + + /** + * Get the message envelope. + */ + public function envelope(): Envelope + { + return new Envelope( + subject: 'Non Planned Production Report', + ); + } + + /** + * Get the message content definition. + */ + public function content(): Content + { + $greeting = "Dear Sir/Madam,

Kindly find the attached non planned production report status details 'Production Quantity' count,"; + + if ($this->scheduleType == 'Daily') { + $fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i').':000'; + $toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i').':999'; + $reportPeriod = "The following report presents results from: $fromDate to $toDate."; + $greeting .= $reportPeriod; + } + + if ($this->scheduleType == 'Hourly') { + $now = now(); + $fromHour = $now->copy()->subHour()->format('H:i:s'); + $toHour = $now->format('H:i:s'); + $reportDate = $now->format('d/m/Y'); + $greeting .= "The following report presents results from: $reportDate, $fromHour to $toHour."; + } + + if ($this->scheduleType == 'Live') { + $now = now(); + $fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s'); + $toMinute = $now->format('d/m/Y H:i:s'); + $greeting .= "The following report presents results from: $fromMinute to $toMinute."; + } + + return new Content( + view: 'mail.non_plan_production_report', + with: [ + 'company' => 'CRI Digital Manufacturing Solutions', + 'greeting' => $greeting, + 'tableData' => $this->tableData, + 'wishes' => 'Thanks & Regards,
CRI Digital Manufacturing Solutions', + ], + ); + } + + /** + * Get the attachments for the message. + * + * @return array + */ + public function attachments(): array + { + return []; + } +} diff --git a/resources/views/mail/non_plan_production_report.blade.php b/resources/views/mail/non_plan_production_report.blade.php new file mode 100644 index 00000000..df34d0ea --- /dev/null +++ b/resources/views/mail/non_plan_production_report.blade.php @@ -0,0 +1,63 @@ + + + + Non Plan Production Table + + + +
+ {{ $company }} +
+
+

{!! $greeting !!}

+ + + + + + + + + + {{-- --}} + + + + + + @foreach($tableData as $row) + + + + + + + + {{-- --}} + + + + @endforeach + +
NoPlantLineLine TypeDay Shift Non Plan ProductionNight Shift Non Plan ProductionActual ProductionActual Non Plan Production + Non Plan Production % +
{{ $row['no'] }}{{ $row['plant'] }}{{ $row['line'] }}{{ $row['type'] }}{{ $row['dayShiftActualQuantity'] }}{{ $row['nightShiftActualQuantity'] }}{{ $row['totalActualQuantity'] }}{{ $row['nonPlannedQuantity'] }} + {{ $row['nonPlannedPercentage'] }}% +
+ +

{!! $wishes !!}

+ +