Update notifikasi send email
This commit is contained in:
@@ -22,6 +22,7 @@ use Modules\Internal\Transformers\ClaimHistoryCareResource;
|
||||
use Box\Spout\Reader\Common\Creator\ReaderEntityFactory;
|
||||
use Box\Spout\Writer\Common\Creator\WriterEntityFactory;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
use PDF;
|
||||
|
||||
@@ -928,16 +929,19 @@ class ClaimController extends Controller
|
||||
$note = $request->input('note');
|
||||
|
||||
$dataToInsert = [];
|
||||
$description = "";
|
||||
if ($condition) {
|
||||
$dataToInsert[] = [
|
||||
'claim_request_id' => $claim_id,
|
||||
'date' => date('Y-m-d H:i:s'),
|
||||
'type' => 'claim-kondisi',
|
||||
'description' => $note,
|
||||
'created_by' =>auth()->user()->id,
|
||||
'created_by' => auth()->user()->id,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$description = "Condition";
|
||||
$this->sendNotif($description);
|
||||
}
|
||||
if ($diagnosis) {
|
||||
$dataToInsert[] = [
|
||||
@@ -949,6 +953,8 @@ class ClaimController extends Controller
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$description = "Diagnosis";
|
||||
$this->sendNotif($description);
|
||||
}
|
||||
if ($result) {
|
||||
$dataToInsert[] = [
|
||||
@@ -960,12 +966,42 @@ class ClaimController extends Controller
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$description = "Result";
|
||||
$this->sendNotif($description);
|
||||
}
|
||||
DB::table('claim_request_files')->insert($dataToInsert);
|
||||
|
||||
return Helper::responseJson([]);
|
||||
}
|
||||
|
||||
public function sendNotif($description)
|
||||
{
|
||||
// Insert data notifications
|
||||
$dataNotif = [
|
||||
'hospital_id' => 1,
|
||||
'title' => 'Request Document',
|
||||
'description' => 'Please enter the document '.$description,
|
||||
'type' => 1,
|
||||
'isUnRead' => true,
|
||||
'created_by' => auth()->user()->id,
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
'updated_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
$sendNotif = Helper::insertNotification($dataNotif);
|
||||
// Send Email after insert notifications
|
||||
if($sendNotif)
|
||||
{
|
||||
//Beluma ada Data Users
|
||||
$dataEmail = [
|
||||
'email' => 'akun.kerja.ivan@gmail.com',
|
||||
'name' => 'Ivan Julian',
|
||||
'subject' => 'Enter Document '.$description,
|
||||
'body' => View::make('email/notif_email', ['name' => 'Ivan Julian', 'link' => 'https://linkmedis.com/chat'])->render(),
|
||||
];
|
||||
Helper::sendEmail($dataEmail);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////// History Care Hospital ///////////////////////////
|
||||
|
||||
public function storeHistoryCare(Request $request, $id){
|
||||
|
||||
@@ -6,6 +6,8 @@ use Carbon\Carbon;
|
||||
use Carbon\CarbonPeriod;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class Helper
|
||||
{
|
||||
@@ -244,14 +246,52 @@ class Helper
|
||||
return $convertedDate;
|
||||
}
|
||||
|
||||
public static function sendNotification()
|
||||
public static function insertNotification($data = array())
|
||||
{
|
||||
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
DB::table('notifications')->insert($data);
|
||||
DB::commit();
|
||||
return true;
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
DB::rollback();
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendEmail()
|
||||
public static function sendEmail($data = array())
|
||||
{
|
||||
// Buat instance PHPMailer
|
||||
$mail = new PHPMailer(true);
|
||||
|
||||
try {
|
||||
// Server settings
|
||||
$mail->isSMTP();
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = env('EMAIL');
|
||||
$mail->Password = env('PW_EMAIL');
|
||||
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
|
||||
$mail->Port = 465;
|
||||
$mail->SMTPSecure = "ssl";
|
||||
|
||||
// Penerima email
|
||||
$mail->setFrom(env('EMAIL'), env('NAME_EMAIL'));
|
||||
$mail->addAddress($data['email'], $data['name']);
|
||||
|
||||
// Konten email
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = $data['subject'];
|
||||
$mail->Body = $data['body'];
|
||||
|
||||
// Kirim email
|
||||
$mail->send();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
//var_dump($mail->ErrorInfo);die();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
ListSubheader,
|
||||
ListItemAvatar,
|
||||
ListItemButton,
|
||||
Stack
|
||||
} from '@mui/material';
|
||||
// utils
|
||||
import { fToNow } from '@/utils/formatTime';
|
||||
@@ -93,13 +94,13 @@ export default function NotificationsPopover() {
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
{totalUnRead > 0 && (
|
||||
{/* {totalUnRead > 0 && (
|
||||
<Tooltip title=" Mark all as read">
|
||||
<IconButtonAnimate color="primary" onClick={handleMarkAllAsRead}>
|
||||
<Iconify icon="eva:done-all-fill" width={20} height={20} />
|
||||
</IconButtonAnimate>
|
||||
</Tooltip>
|
||||
)}
|
||||
)} */}
|
||||
</Box>
|
||||
|
||||
<Divider sx={{ borderStyle: 'dashed' }} />
|
||||
@@ -116,7 +117,7 @@ export default function NotificationsPopover() {
|
||||
}
|
||||
>
|
||||
{notifications.slice(0, 2).map((notification) => (
|
||||
<NotificationItem key={notification.id} notification={notification} onClick={notification.id} getDataNotifications={getDataNotifications}/>
|
||||
<NotificationItem key={notification.id} notification={notification} getDataNotifications={getDataNotifications}/>
|
||||
))}
|
||||
</List>
|
||||
|
||||
@@ -129,7 +130,7 @@ export default function NotificationsPopover() {
|
||||
}
|
||||
>
|
||||
{notifications.slice(2, 5).map((notification) => (
|
||||
<NotificationItem key={notification.id} notification={notification} onClick={notification.id} getDataNotifications={getDataNotifications}/>
|
||||
<NotificationItem key={notification.id} notification={notification} getDataNotifications={getDataNotifications}/>
|
||||
))}
|
||||
</List>
|
||||
</>
|
||||
@@ -161,7 +162,7 @@ type NotificationItemProps = {
|
||||
isUnRead: boolean;
|
||||
};
|
||||
|
||||
function NotificationItem({ notification, onClick, getDataNotifications }: { notification: NotificationItemProps, onClick: (id: string) => void, getDataNotifications: () => void}) {
|
||||
function NotificationItem({ notification, getDataNotifications }: { notification: NotificationItemProps, getDataNotifications: () => void}) {
|
||||
const { avatar, title } = renderContent(notification);
|
||||
const {enqueueSnackbar} = useSnackbar();
|
||||
const handleClick = () => {
|
||||
@@ -223,12 +224,12 @@ function NotificationItem({ notification, onClick, getDataNotifications }: { not
|
||||
|
||||
function renderContent(notification: NotificationItemProps) {
|
||||
const title = (
|
||||
<Typography variant="subtitle2">
|
||||
{notification.title}
|
||||
<Typography component="span" variant="body2" sx={{ color: 'text.secondary' }}>
|
||||
{noCase(notification.description)}
|
||||
</Typography>
|
||||
</Typography>
|
||||
<Stack direction="column">
|
||||
<Typography variant="subtitle2">{notification.title}</Typography>
|
||||
<Typography component="span" variant="body2" sx={{ color: 'text.secondary' }}>
|
||||
{notification.description}
|
||||
</Typography>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
if (notification.type === 'order_placed') {
|
||||
|
||||
160
resources/views/email/notif_email.blade.php
Normal file
160
resources/views/email/notif_email.blade.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="x-apple-disable-message-reformatting">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no">
|
||||
<style>
|
||||
|
||||
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@100;400&display=swap');
|
||||
body {
|
||||
color: #777777
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'LucidaGrande';
|
||||
src: url('https://linksehat.com/assets/fonts/LucidaGrande.ttf');
|
||||
}
|
||||
|
||||
@media screen {
|
||||
.all-font-lato {
|
||||
font-family: Lato, -apple-system, "Segoe UI", sans-serif !important;
|
||||
}
|
||||
.all-font-avenir {
|
||||
font-family: Avenir, -apple-system, "Segoe UI", sans-serif !important;
|
||||
}
|
||||
}
|
||||
|
||||
.text-shade {
|
||||
color: #19bbbb;
|
||||
}
|
||||
.font-roboto {
|
||||
font-family: 'Roboto', sans-serif !important;
|
||||
}
|
||||
.login-button {
|
||||
background-color: #3498db; /* Warna biru muda */
|
||||
color: #fff; /* Warna teks putih */
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
a.login-button {
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="margin: 0; padding: 0; width: 100%; word-break: break-word; -webkit-font-smoothing: antialiased;">
|
||||
<div role="article" aria-roledescription="email" aria-label="" lang="en" style="mso-line-height-rule: exactly;">
|
||||
<table class="all-font-avenir" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly;">
|
||||
<table style="max-width: 42rem; width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; padding-top: 10px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; vertical-align: top;" valign="top"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; padding-left: 10px; padding-right: 10px;">
|
||||
<table style="max-width: 42rem; width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; background-color: #ffffff; border-top-left-radius: 0.25rem; border-top-right-radius: 0.25rem; padding-bottom: 0; padding-top: 40px; color: #111111; vertical-align: top;" valign="top">
|
||||
<img src="https://linksehat.com/assets/img/LinkSehat_logotype_1.png" alt="LinkSehat" style="border: 0; line-height: 100%; max-width: 100%; vertical-align: middle; font-size: 18px; color: #ffffff; width: 33.333333%;">
|
||||
<img src="https://linksehat.com/assets/img/divider.png" alt="Divider" style="border: 0; line-height: 100%; max-width: 100%; vertical-align: middle; font-size: 18px; color: #ffffff; width: 100%;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; background-color: #ffffff; padding-bottom: 0; padding-top: 40px; color: #111111; vertical-align: top;" valign="top">
|
||||
<img src="https://linksehat.com/assets/img/verify-female.png" alt="LinkSehat" style="border: 0; line-height: 100%; max-width: 100%; vertical-align: middle; font-size: 18px; color: #ffffff; width: 33.333333%;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; background-color: #f4f4f4; padding-left: 10px; padding-right: 10px;">
|
||||
<table style="max-width: 42rem; width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #ffffff; padding: 30px; padding-bottom: 0; padding-top: 10px; vertical-align: top;" valign="top">
|
||||
<h3 style="mso-line-height-rule: exactly; font-weight: 800; font-size: 18px; margin: 0;text-align: center;" class="text-shade">Halo, {{ strtoupper($name) }}</h3>
|
||||
<p style="text-align: center;">
|
||||
You have received a new notification. Please use the link below to check and login your account.
|
||||
</p>
|
||||
<p style="text-align: center;"><a href="{{ $link }}" class="login-button">LOGIN TO YOUR ACCOUNT</a></p>
|
||||
<p style="text-align: center;">Thank you for your attention</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; background-color: #f4f4f4; padding-left: 10px; padding-right: 10px;">
|
||||
<table style="max-width: 42rem; width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation" class="font-roboto">
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #e8f8f8; font-size: 16px; line-height: 25px; padding-left: 30px; padding-right: 30px; padding-bottom: 20px; padding-top: 40px; color: #555555;">
|
||||
<h2 style="mso-line-height-rule: exactly; font-weight: 800; font-size: 22px; margin: 0; text-align: center;">PT LINK MEDIS SEHAT</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #e8f8f8; font-size: 16px; line-height: 25px; padding-left: 30px; padding-right: 30px; padding-bottom: 20px; color: #777777;">
|
||||
<p style="mso-line-height-rule: exactly; margin: 0; text-align: center;">
|
||||
Graha Cempaka Mas Blok D/20</p>
|
||||
<p style="mso-line-height-rule: exactly; margin: 0; text-align: center;">Jl. Let. Jend. Suprapto
|
||||
<p style="mso-line-height-rule: exactly; margin: 0; text-align: center;">Jakarta Pusat 10640, Indonesia</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #e8f8f8; font-size: 16px; line-height: 25px; padding-left: 30px; padding-right: 30px; padding-bottom: 10px; padding-top: 20px; color: #555555;">
|
||||
<h2 style="mso-line-height-rule: exactly; font-weight: 800; font-size: 16px; margin: 0; text-align: center;">Customer Care</h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #e8f8f8; font-size: 16px; line-height: 25px; padding-left: 30px; padding-right: 30px; padding-bottom: 40px; text-align: center; color: #777777;">
|
||||
<p style="mso-line-height-rule: exactly; margin: 0;">0858 9000 8500</p>
|
||||
<p style="mso-line-height-rule: exactly; margin: 0;">
|
||||
<a href="mailto:helpdesk@linksehat.com" target="_blank" style="mso-line-height-rule: exactly; color: #459ecf">helpdesk@linksehat.com</a>
|
||||
</p>
|
||||
<p style="mso-line-height-rule: exactly; margin: 0; text-align: center;">
|
||||
<a href="https://www.facebook.com/linkmedissehat" target="_blank" style="mso-line-height-rule: exactly; color: #7c72dc; text-decoration: none;">
|
||||
<img alt="Facebook" height="32" src="https://linksehat.com/assets/img/facebook@2x.png" style="line-height: 100%; max-width: 100%; vertical-align: middle; text-decoration: none; height: auto; border: none; display: inline-block;" title="Facebook" width="32">
|
||||
</a>
|
||||
<a href="https://instagram.com/linkmedissehat" target="_blank" style="mso-line-height-rule: exactly; margin-left: 5px; color: #7c72dc; text-decoration: none;">
|
||||
<img alt="Instagram" height="32" src="https://linksehat.com/assets/img/instagram@2x.png" style="line-height: 100%; max-width: 100%; vertical-align: middle; text-decoration: none; height: auto; border: none; display: inline-block;" title="Instagram" width="32">
|
||||
</a>
|
||||
<a href="https://www.linkedin.com/company/link-medis-sehat" target="_blank" style="mso-line-height-rule: exactly; margin-left: 5px; color: #7c72dc; text-decoration: none;">
|
||||
<img alt="Linkedin" height="32" src="https://linksehat.com/assets/img/linkedin@2x.png" style="line-height: 100%; max-width: 100%; vertical-align: middle; text-decoration: none; height: auto; border: none; display: inline-block;" title="Linkedin" width="32">
|
||||
</a>
|
||||
<a href="https://linksehat.com" target="_blank" style="mso-line-height-rule: exactly; margin-left: 5px; color: #7c72dc; text-decoration: none;">
|
||||
<img alt="Facebook" height="32" src="https://linksehat.com/assets/img/website@2x.png" style="line-height: 100%; max-width: 100%; vertical-align: middle; text-decoration: none; height: auto; border: none; display: inline-block;" title="Facebook" width="32">
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" style="mso-line-height-rule: exactly; background-color: #f4f4f4; padding-left: 10px; padding-right: 10px; padding-bottom: 20px;">
|
||||
<table style="max-width: 42rem; width: 100%;" border="0" cellpadding="0" cellspacing="0" role="presentation">
|
||||
<tr>
|
||||
<td align="left" style="mso-line-height-rule: exactly; background-color: #ffffff; border-bottom-right-radius: 0.25rem; border-bottom-left-radius: 0.25rem; font-size: 14px; line-height: 18px; margin-bottom: 20px; padding-top: 20px; padding-bottom: 20px; text-align: center; color: #777777;">
|
||||
<p style="mso-line-height-rule: exactly; margin: 0;">
|
||||
©<?= date('Y') ?> PT Link Medis Sehat. All Rights Reserved
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user