Added laser idle hour mail page
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
This commit is contained in:
89
app/Mail/LaserIdleMail.php
Normal file
89
app/Mail/LaserIdleMail.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 LaserIdleMail 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: 'Laser Idle Report',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message content definition.
|
||||
*/
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached Laser Idle Report status details ,";
|
||||
|
||||
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.laser_idle_hour_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 [];
|
||||
}
|
||||
}
|
||||
88
resources/views/mail/laser_idle_hour_report.blade.php
Normal file
88
resources/views/mail/laser_idle_hour_report.blade.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Invoice 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 style="width: 100%; border-collapse: collapse; table-layout: auto;">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">No</th>
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Plant</th>
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Machine Name</th>
|
||||
|
||||
<th colspan="3" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">
|
||||
Auto Laser Mark Count
|
||||
</th>
|
||||
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Manual Mark Count</th>
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Total Laser On Hours</th>
|
||||
<th rowspan="2" style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Total Laser Off Hours</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Motor</th>
|
||||
<th style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">Pump</th>
|
||||
<th style="border:1px solid #444; padding:8px; background:#f2f2f2; text-align:center;">NamePlate</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['machine'] }}</td>
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['motorCount'] }}
|
||||
</td>
|
||||
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['pumpCount'] }}
|
||||
</td>
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['namePlateCount'] }}
|
||||
</td>
|
||||
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['manualCount'] }}
|
||||
</td>
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['totalLaserOnHours'] }}
|
||||
</td>
|
||||
<td style="text-align:center; border:1px solid #444; padding:8px;">
|
||||
{{ $row['totalLaserOffHours'] }}
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
<p>{!! $wishes !!}</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user