Added non plan production mail pages
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 3m21s
Laravel Larastan / larastan (pull_request) Failing after 5m5s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 16s
Laravel Pint / pint (pull_request) Successful in 3m21s
Laravel Larastan / larastan (pull_request) Failing after 5m5s
This commit is contained in:
89
app/Mail/NonPlanProductionMail.php
Normal file
89
app/Mail/NonPlanProductionMail.php
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use DateTime;
|
||||||
|
|
||||||
|
class NonPlanProductionMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $tableData;
|
||||||
|
|
||||||
|
public $scheduleType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct($scheduleType, $tableData = [])
|
||||||
|
{
|
||||||
|
$this->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,<br><br>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,<br>CRI Digital Manufacturing Solutions',
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
63
resources/views/mail/non_plan_production_report.blade.php
Normal file
63
resources/views/mail/non_plan_production_report.blade.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Non Plan Production Table</title>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 60%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #444;
|
||||||
|
padding: 8px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background: #f2f2f2;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="text-align: center; font-weight: bold;">
|
||||||
|
{{ $company }}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<p>{!! $greeting !!}</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">No</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Plant</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Line</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Line Type</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Day Shift Non Plan Production</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Night Shift Non Plan Production</th>
|
||||||
|
{{-- <th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Actual Production</th> --}}
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">Actual Non Plan Production</th>
|
||||||
|
<th style="text-align: center; border: 1px solid #444; padding: 8px; background: #f2f2f2;">
|
||||||
|
Non Plan Production %
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach($tableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['no'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['plant'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['line'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center; white-space: nowrap;">{{ $row['type'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['dayShiftActualQuantity'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['nightShiftActualQuantity'] }}</td>
|
||||||
|
{{-- <td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['totalActualQuantity'] }}</td> --}}
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">{{ $row['nonPlannedQuantity'] }}</td>
|
||||||
|
<td style="border: 1px solid #444; padding: 8px; text-align: center;">
|
||||||
|
{{ $row['nonPlannedPercentage'] }}%
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>{!! $wishes !!}</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user