Add feature notify admin when download pdf
This commit is contained in:
@@ -313,3 +313,5 @@ WABOT_TOKEN_KEYS_SECOND=cbee7e95cf3ffbfa0531d5fddfd44f87
|
||||
|
||||
# for config STORAGE_DIRECTORY, set value without slash at the end
|
||||
# STORAGE_DIRECTORY=/Users/UTM/Sites/lelong/storage
|
||||
|
||||
ADMIN_EMAIL="admin_1@example.com,admin_2@example.com"
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Jobs\NotifyJanaNotis;
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
@@ -40,8 +41,6 @@ use App\Models\WtdDraft;
|
||||
use App\Jobs\WhatsappNotisLelongFasa1;
|
||||
use App\Jobs\WhatsappNotisLelongFasa2;
|
||||
|
||||
|
||||
|
||||
class NotisController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -280,6 +279,11 @@ class NotisController extends Controller
|
||||
$currentdate = Carbon::now();
|
||||
$tarikh_cetak = $currentdate->toDateString();
|
||||
|
||||
$current_date_time = $currentdate->toDateTimeString();
|
||||
|
||||
Log::info("Jana notis fasa 1: " . $user->kodcaw . ", " . $user->name);
|
||||
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 1', $current_date_time);
|
||||
|
||||
$lelongid = Lelong::find($lelong_id);
|
||||
|
||||
$arraynorujukan = LelongBid::where('lelong_id', $lelong_id)->where('kodcaw', $caw->caw_code)->pluck('norujukan');
|
||||
@@ -591,6 +595,10 @@ class NotisController extends Controller
|
||||
// dd($marhuns);
|
||||
$arraysag = [];
|
||||
|
||||
$current_date_time = $current->toDateTimeString();
|
||||
|
||||
Log::info("Jana notis fasa 2: " . $user->kodcaw . ", " . $user->name);
|
||||
NotifyJanaNotis::dispatch($user->id, $user->kodcaw, $user->name, 'Jana Notis Fasa 2', $current_date_time);
|
||||
|
||||
foreach($marhuns as $index1=>$cal){
|
||||
$customer = Customer::where('kpbaru','=',$cal['nokp'])
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Mail\NotifyAdmin;
|
||||
use App\Mail\NotifyJanaNotis as MailNotifyJanaNotis;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class NotifyJanaNotis implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $user_id;
|
||||
public $user_kodcaw;
|
||||
private $user_name;
|
||||
private $description;
|
||||
private $date_time;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($user_id, $user_kodcaw, $user_name, $description, $date_time)
|
||||
{
|
||||
$this->user_id = $user_id;
|
||||
$this->user_kodcaw = $user_kodcaw;
|
||||
$this->user_name = $user_name;
|
||||
$this->description = $description;
|
||||
$this->date_time = $date_time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$content_collection = collect();
|
||||
$content_collection['user_id'] = $this->user_id;
|
||||
$content_collection['user_kodcaw'] = $this->user_kodcaw;
|
||||
$content_collection['user_name'] = $this->user_name;
|
||||
$content_collection['description'] = $this->description;
|
||||
$content_collection['download_time'] = $this->date_time;
|
||||
|
||||
$admin_emails = explode(',', config('app.admin_email'));
|
||||
|
||||
foreach($admin_emails as $email) {
|
||||
Mail::to($email)->send(new NotifyAdmin($content_collection));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mail;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class NotifyAdmin extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $content_collection;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($content_collection)
|
||||
{
|
||||
$this->content_collection = $content_collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->from("masterlelongpkb@gmail.com", "Admin ArrahnBid")
|
||||
->subject('ArrahnBid - ' . $this->content_collection['description'])
|
||||
->view('template.notifyadmin', ['content_collection' => $this->content_collection]);
|
||||
}
|
||||
}
|
||||
@@ -254,4 +254,6 @@ return [
|
||||
'storage_directory' => env('STORAGE_DIRECTORY', storage_path()),
|
||||
|
||||
'taxation' => env('TAX_AROS',true),
|
||||
|
||||
'admin_email' => env('ADMIN_EMAIL', 'admin@example.com')
|
||||
];
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<title></title>
|
||||
<style>
|
||||
table,
|
||||
td,
|
||||
div,
|
||||
h1,
|
||||
p {
|
||||
font-weight: 500;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.btn {
|
||||
margin: 10px 0px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
color: #fff !important;
|
||||
height: 46px;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
background-image: linear-gradient(to right top, #021d68, #052579, #072d8b, #09369d, #093fb0) !important;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
text-decoration: none;
|
||||
opacity: .8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="margin:0;padding:0;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;background:#ffffff;">
|
||||
<tr>
|
||||
<td align="center" style="padding:0;">
|
||||
<table role="presentation" style="width:600px;border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;text-align:left;">
|
||||
<tr style="border-collapse:collapse;border:1px solid #cccccc;border-spacing:0;">
|
||||
<td align="left" style="padding:10px 25px;background:#fff; display: flex; align-items: center;">
|
||||
<span style="font-weight: bold; padding-top: 10px;"> ArrahnBid </span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:36px 30px 42px 30px;">
|
||||
<table role="presentation" style="width:100%;border-collapse:collapse;border:0;border-spacing:0;">
|
||||
<tr>
|
||||
<td style="padding:0 0 36px 0;color:#153643;">
|
||||
<p style="font-weight:bold;margin:0 0 20px 0;font-family:Arial,sans-serif;">
|
||||
Greetings,</h1>
|
||||
<p style="margin:0 0 12px 0;font-size:14px;line-height:24px;font-family:Arial,sans-serif;">
|
||||
@foreach($content_collection as $index => $value)
|
||||
<span style="width: 140px !important;">{{ $index }}</span>
|
||||
<span>:</span>
|
||||
<span>{{ $value }}</span>
|
||||
<br>
|
||||
@endforeach
|
||||
</p>
|
||||
|
||||
<p style="margin:100px 0 12px 0;font-size:14px;font-family:Arial,sans-serif;">
|
||||
Thank you, </p>
|
||||
<p style="margin:0 0 12px 0;font-size:14px;font-family:Arial,sans-serif;">
|
||||
ArrahnBid </p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user