diff --git a/Modules/Invoice/Emails/SendPendingInvoiceMail.php b/Modules/Invoice/Emails/SendPendingInvoiceMail.php index 30feeaf0e3..2674ce9fec 100644 --- a/Modules/Invoice/Emails/SendPendingInvoiceMail.php +++ b/Modules/Invoice/Emails/SendPendingInvoiceMail.php @@ -8,6 +8,7 @@ use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Storage; use Modules\Invoice\Entities\Invoice; +use Modules\Invoice\Entities\InvoiceActivity; class SendPendingInvoiceMail extends Mailable { @@ -77,10 +78,23 @@ public function build() $mail->bcc($emailAddress); } + InvoiceActivity::create([ + 'invoice_id' => $this->invoice->id, + 'type' => 'mail', + 'subject' => $subject, + 'content' => $body, + 'to' => $this->email['to'], + 'from' => $this->email['from'], + 'cc' => isset($this->email['cc']) && is_array($this->email['cc']) ? implode(',', $this->email['cc']) : null, + 'bcc' => isset($this->email['bcc']) && is_array($this->email['bcc']) ? implode(',', $this->email['bcc']) : null, + 'receiver_name' => $this->email['to_name'], + ]); + return $mail->subject($subject) ->attach($invoiceFile, [ 'mime' => 'application/pdf', - ])->view('mail.plain')->with([ + ]) + ->view('mail.plain')->with([ 'body' => $body, ]); } diff --git a/Modules/Invoice/Entities/InvoiceActivity.php b/Modules/Invoice/Entities/InvoiceActivity.php new file mode 100644 index 0000000000..8f7aa6c089 --- /dev/null +++ b/Modules/Invoice/Entities/InvoiceActivity.php @@ -0,0 +1,17 @@ +belongsTo(Invoice::class); + } +} diff --git a/Modules/Invoice/Http/Controllers/InvoiceController.php b/Modules/Invoice/Http/Controllers/InvoiceController.php index 1831b38588..8077e871bd 100644 --- a/Modules/Invoice/Http/Controllers/InvoiceController.php +++ b/Modules/Invoice/Http/Controllers/InvoiceController.php @@ -175,6 +175,7 @@ public function taxReportExport(Request $request) public function sendReminderEmail(Request $request) { $invoice = Invoice::find($request->invoice_id); + $this->service->sendInvoiceReminder($invoice, $request->all()); return redirect()->back()->with('status', 'Invoice saved successfully.'); diff --git a/Modules/Invoice/Resources/views/index.blade.php b/Modules/Invoice/Resources/views/index.blade.php index 083b9ea82c..1c2dfe9be5 100644 --- a/Modules/Invoice/Resources/views/index.blade.php +++ b/Modules/Invoice/Resources/views/index.blade.php @@ -151,7 +151,7 @@ class="ml-2" @endif - +