Updated alignments and validation logics
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
This commit is contained in:
@@ -4,28 +4,42 @@ namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
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 App\Exports\ProductionExport;
|
||||
// use Illuminate\Mail\Mailables\Attachment;
|
||||
// use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ProductionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $scheduleType;
|
||||
// public $excelData;
|
||||
// public $dates;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
public function __construct($scheduleType, $tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
}
|
||||
|
||||
// public function __construct($scheduleType,$tableData = [],$excelData = [],$dates = [])
|
||||
// {
|
||||
// $this->scheduleType = $scheduleType;
|
||||
// $this->tableData = $tableData;
|
||||
// $this->excelData = $excelData;
|
||||
// $this->dates = $dates;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and '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';
|
||||
$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;
|
||||
}
|
||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
||||
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');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.production_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
// return [
|
||||
// Attachment::fromData(
|
||||
// fn () => Excel::raw(
|
||||
// new ProductionExport(
|
||||
// $this->excelData,
|
||||
// $this->dates
|
||||
// ),
|
||||
// \Maatwebsite\Excel\Excel::XLSX
|
||||
// ),
|
||||
// 'production_plan_data.xlsx'
|
||||
// )->withMime(
|
||||
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
// ),
|
||||
// ];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user