diff --git a/app/Mail/LaserStopMail.php b/app/Mail/LaserStopMail.php
index 2916470..e249d4b 100644
--- a/app/Mail/LaserStopMail.php
+++ b/app/Mail/LaserStopMail.php
@@ -8,28 +8,40 @@ use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
+use Illuminate\Support\Facades\URL;
class LaserStopMail extends Mailable
{
use Queueable, SerializesModels;
- public $records;
- public $plantId;
- public $machineId;
- public $plantName;
+ public $request;
+ public $approverName;
+ public $level;
+ public $tableData;
- public $machineName;
+ public $pendingApprovers;
+
+ public $approverNameFromMaster;
+
+ public $subjectLine;
+
+ public $characteristics;
+
+ public $stopDetails;
/**
* Create a new message instance.
*/
- public function __construct($records,$plantId,$machineId, $plantName, $machineName)
+ public function __construct($request, $approverName, $level, $pendingApprovers, $approverNameFromMaster, $subjectLine, $characteristics = [], $stopDetails=[])
{
- $this->records = $records;
- $this->plantId = $plantId;
- $this->machineId = $machineId;
- $this->plantName = $plantName;
- $this->machineName = $machineName;
+ $this->request = $request;
+ $this->approverName = $approverName;
+ $this->level = $level;
+ $this->pendingApprovers = $pendingApprovers;
+ $this->approverNameFromMaster = $approverNameFromMaster;
+ $this->subjectLine = $subjectLine;
+ $this->tableData = $characteristics;
+ $this->stopDetails = $stopDetails;
}
/**
@@ -38,7 +50,7 @@ class LaserStopMail extends Mailable
public function envelope(): Envelope
{
return new Envelope(
- subject: 'Laser Marking - Consolidated Stoppage Report',
+ subject: $this->subjectLine,
);
}
@@ -47,17 +59,33 @@ class LaserStopMail extends Mailable
*/
public function content(): Content
{
- $greeting = 'Dear Sir';
return new Content(
- view: 'mail.laser-stop-final-report',
+ view: 'mail.laser-stop-report',
with: [
- 'company' => 'CRI Digital Manufacturing Solutions',
- 'greeting' => $greeting,
- 'wishes' => 'Thanks & Regards,
CRI Digital Manufacturing Solutions',
- ],
+ 'company' => 'CRI Digital Manufacturing Solutions',
+ 'greeting' => 'Dear ' . $this->approverName . ',',
+ 'request' => $this->request,
+ 'level' => $this->level,
+ 'tableData' => $this->tableData,
+ 'tempstop' => $this->stopDetails,
+ 'pendingApprovers' => $this->pendingApprovers,
+ 'approverNameFromMaster' => $this->approverNameFromMaster,
+ 'approveUrl' => $this->approveUrl(),
+ // 'holdUrl' => $this->holdUrl(),
+ // 'rejectUrl' => $this->rejectUrl(),
+ 'wishes' => 'Thanks & Regards,
CRI Digital Manufacturing Solutions',
+ ]
);
}
+ protected function approveUrl()
+ {
+ return URL::signedRoute('laser.approve', [
+ 'id' => $this->request->id,
+ 'level' => $this->level
+ ]);
+ }
+
/**
* Get the attachments for the message.
*