Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
8f904b23e6
@ -32,6 +32,7 @@ $routes->get("sendextraparam", "ClientController::sendextraparam");
|
||||
$routes->get("updateRenewalData", "ClientController::updateRenewalData");
|
||||
$routes->get("updateRenewalDataNotExistingClient", "ClientController::updateRenewalDataNotExistingClient");
|
||||
$routes->get("updateRenewalInsurerData", "ClientController::updateRenewalInsurerData");
|
||||
$routes->get("sendMutipleToEmails", "MasterController::sendMutipleToEmails");
|
||||
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
|
||||
// $routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
|
||||
@ -1829,4 +1829,22 @@ class MasterController extends AdminController
|
||||
echo "################################################################\n\n";
|
||||
}
|
||||
|
||||
public function sendMutipleToEmails()
|
||||
{
|
||||
|
||||
$message = '<style>body{font-family:Arial,sans-serif;color:#333;line-height:1.6;margin:0;padding:0}.email-container{width:100%;max-width:600px;margin:0 auto;padding:20px;border:1px solid #e0e0e0;background-color:#f9f9f9}.header{background-color:#4a90e2;color:#fff;padding:15px;text-align:center}.header h1{margin:0;font-size:24px}.content{padding:20px;background-color:#fff}.content h2{color:#4a90e2;font-size:20px;margin-top:0}.content p{margin:10px 0}.details-table{width:100%;border-collapse:collapse;margin-top:20px}.details-table td,.details-table th{border:1px solid #ddd;padding:10px;text-align:left}.details-table th{background-color:#f2f2f2}.footer{margin-top:20px;font-size:12px;color:#777;text-align:center}.attachment-note{margin-top:20px;padding:10px;background-color:#f7f7f7;border-left:4px solid #4a90e2;font-style:italic}</style><div class=email-container><div class=header><h1>Request for Quotation (RFQ)</h1></div><div class=content><h2>Dear {{RECIPIENT_NAME}},</h2><p>We are reaching out to request a quotation for the following insurance coverage. Please review the details below and provide your quote at your earliest convenience.<h2>RFQ Details</h2><table class=details-table><tr><th>Client name<td>{{CLIENT_NAME}}<tr><th>Coverage Type<td>{{POLICY_LONG_NAME}}<tr><th>Policy Start Date<td>{{POLICY_START_DATE}}<tr><th>Policy Duration<td>{{DURATION}}</table><div class=attachment-note>Please note: Additional terms and details are included in the attachment for your reference.</div><p>Please feel free to reach out if you require any further information to prepare the quote. We look forward to receiving your proposal.<p>Best regards,<p><strong>Nhance India Pvt Ltd</strong><br></div><div class=footer><p>© Nhance India Pvt Ltd. All rights reserved.</div></div>';
|
||||
$attachments = [
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_addition.xls","fileName" => "sample_addition.xls"],
|
||||
["filePath" => ROOTPATH."public/sample_excel/sample_inception.xls","fileName" => "sample_inception.xls"],
|
||||
["filePath" => ROOTPATH."public/assets/images/login_bg.jpg","fileName" => "login_bg.jpg"]
|
||||
];
|
||||
$email_id = 'venkateshraman786@gmail.com';
|
||||
$params = ['mail'=>$email_id];
|
||||
$multi_mails = ['venkateshraman786@gmail.com', 'gowtham.manavalan.la@gmail.com', 'venkatesh.r@venbainfotech.com'];
|
||||
$common = ['mail_type'=>'test_mail_cli'];
|
||||
$bcc = "vitvelz@gmail.com,velmurugan.s@venbainfotech.com,srinivas.saravanan@venbainfotech.com";
|
||||
$result = MailHelper::send_email(['mail' => $multi_mails, 'bcc'=>$bcc, 'params'=>$params,'subject' => 'Send Multiple " To " emails','message' => $message,'attachments' => $attachments,'common'=>$common]);
|
||||
dd($result);
|
||||
}
|
||||
|
||||
}
|
||||
@ -125,6 +125,7 @@ class TicketController extends BaseController
|
||||
'((CLAIM_FEEDBACK_FORM))' => 'claim_feedback_form',
|
||||
'((SETTLED_LETTER))' => 'settle_letter',
|
||||
'((APPROVED_LETTER))' => 'approved_letter',
|
||||
'((APPROVED_DESCRIBTION))' => 'approved_description',
|
||||
];
|
||||
$this->extraFields = [
|
||||
1 => ['non_id_reason'],
|
||||
@ -134,13 +135,13 @@ class TicketController extends BaseController
|
||||
5 => ['claim_number', 'registration_date'],
|
||||
7 => ['query_received_date'],
|
||||
8 => ['denial_reason','denial_date'],
|
||||
9 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
9 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
11 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
40 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
40 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
44 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
30 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
30 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
34 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
20 => ['approved_amount','approved_date', 'approved_letter'],
|
||||
20 => ['approved_amount','approved_date', 'approved_letter', "approved_description"],
|
||||
24 => ['utr_details', 'settled_date', 'settle_letter'],
|
||||
14 => ['return_remark', 'awb_no_courier_name'],
|
||||
48 => ['return_remark', 'awb_no_courier_name'],
|
||||
@ -175,6 +176,9 @@ class TicketController extends BaseController
|
||||
public function ticketList()
|
||||
{
|
||||
$data['ticket_type'] = $this->ticketType;
|
||||
$data['modeOFIntimate'] = $this->modeOFIntimate;
|
||||
$data['priorityType'] = $this->priorityType;
|
||||
$data['claimType'] = $this->claimType;
|
||||
if ($this->request->is('get')) {
|
||||
$data['page_name'] = "Claims";
|
||||
$data['claim_status'] = $this->claimStatus->select('id,ticket_type,claim_status')->where('is_active', 1)->findAll();
|
||||
@ -201,13 +205,13 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
public function ticketSearch($action = null)
|
||||
{
|
||||
{
|
||||
$db = db_connect();
|
||||
|
||||
$subquery = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id AS ticket_id',
|
||||
"CASE
|
||||
->select([
|
||||
'tm.id AS ticket_id',
|
||||
"CASE
|
||||
WHEN DATEDIFF(
|
||||
CURDATE(),
|
||||
COALESCE(latest_history.created_at, tm.created_at)
|
||||
@ -222,17 +226,17 @@ class TicketController extends BaseController
|
||||
) BETWEEN 13 AND 20 THEN '13-20 Days'
|
||||
ELSE 'Above 20 Days'
|
||||
END AS tat"
|
||||
])
|
||||
->join(
|
||||
'(SELECT th.ticket_id, MAX(th.created_at) AS created_at
|
||||
])
|
||||
->join(
|
||||
'(SELECT th.ticket_id, MAX(th.created_at) AS created_at
|
||||
FROM ticket_history th
|
||||
WHERE th.field_name = "claim_status_id"
|
||||
GROUP BY th.ticket_id) AS latest_history',
|
||||
'latest_history.ticket_id = tm.id',
|
||||
'left'
|
||||
)
|
||||
->where('tm.is_active', 1)
|
||||
->groupBy('tm.id, tm.created_at, latest_history.created_at');
|
||||
'latest_history.ticket_id = tm.id',
|
||||
'left'
|
||||
)
|
||||
->where('tm.is_active', 1)
|
||||
->groupBy('tm.id, tm.created_at, latest_history.created_at');
|
||||
|
||||
|
||||
//action 1 get last 100 rows, action 2 filter and get all rows related to that and action 3 gets according to dashboard
|
||||
@ -250,12 +254,63 @@ class TicketController extends BaseController
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat',
|
||||
|
||||
'tm.claim_status_id',
|
||||
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.tpa_id',
|
||||
'tm.client_policy_id',
|
||||
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.relationship',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
@ -264,13 +319,12 @@ class TicketController extends BaseController
|
||||
->where('tm.is_active', 1)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
$data = $query->get()->getResultArray();
|
||||
|
||||
// dd(db_connect()->getLastQuery());
|
||||
|
||||
return $data;
|
||||
|
||||
}else if ($action == 3) {
|
||||
} else if ($action == 3) {
|
||||
$ids = $this->request->getPost('ids');
|
||||
$ids = array_filter(explode(',', $ids));
|
||||
|
||||
@ -292,41 +346,90 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
// print_rr($where);
|
||||
|
||||
|
||||
}
|
||||
$query = $db->table('ticket_master tm')
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat'
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||
->where('tm.is_active', 1)
|
||||
->where($where)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
->select([
|
||||
'tm.id',
|
||||
'tm.ticket_type_id',
|
||||
'tcs.claim_status AS status',
|
||||
'tm.claim_number AS claim_no',
|
||||
'tm.claim_status_id',
|
||||
'tm.is_head_approved',
|
||||
'tm.tpa_id',
|
||||
'tm.tpa_no',
|
||||
'tm.emp_name',
|
||||
'tm.emp_code',
|
||||
'tm.relationship',
|
||||
'i.name AS insurer_name',
|
||||
'c.client_name',
|
||||
'tm.insured_name',
|
||||
'c.short_name',
|
||||
'DATE_FORMAT(tm.created_at, "%d-%m-%Y") AS ticket_created_date',
|
||||
'COALESCE(tat_category.tat, "0-6 Days") AS tat',
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
'(SELECT first_name FROM user_profiles WHERE user_profiles.id = tm.acm_id) AS acm_name',
|
||||
'(SELECT name FROM insurers WHERE insurers.id = tm.insurer_id) AS insurer_name',
|
||||
'(SELECT name FROM tpa WHERE tpa.id = tm.tpa_id) AS tpa_name',
|
||||
|
||||
return $data;
|
||||
'tm.claim_status_id',
|
||||
'tm.acm_id',
|
||||
'tm.insurer_id',
|
||||
'tm.tpa_id',
|
||||
'tm.client_policy_id',
|
||||
'tm.policy_no',
|
||||
'tm.priority',
|
||||
'tm.relationship',
|
||||
'tm.emp_mobile',
|
||||
'tm.emp_mail',
|
||||
'tm.emp_personal_mail',
|
||||
'tm.mode_of_intimation',
|
||||
'tm.claim_type',
|
||||
'tm.hospital_name',
|
||||
'tm.doa',
|
||||
'tm.dod',
|
||||
'tm.claim_amount',
|
||||
'tm.pod_no',
|
||||
'tm.date_of_join',
|
||||
'tm.date_of_incep',
|
||||
'tm.dob',
|
||||
'tm.date_of_accident',
|
||||
'tm.date_of_death',
|
||||
'tm.date_of_intimat',
|
||||
'tm.si_amt',
|
||||
'tm.raised_date',
|
||||
'tm.registration_date',
|
||||
'tm.query_received_date',
|
||||
'tm.denial_date',
|
||||
'tm.approved_date',
|
||||
'tm.settled_date',
|
||||
'tm.denial_reason',
|
||||
'tm.approved_letter',
|
||||
'tm.approved_amount',
|
||||
'tm.utr_details',
|
||||
'tm.settle_letter',
|
||||
'tm.return_remark',
|
||||
'tm.cancel_remark',
|
||||
'tm.awb_no_courier_name',
|
||||
'tm.non_id_reason',
|
||||
'tm.pay_initiate_date',
|
||||
'tm.approved_description'
|
||||
|
||||
])
|
||||
->join('insurers i', 'i.id = tm.insurer_id AND i.is_active = 1', 'left')
|
||||
->join('clients c', 'c.id = tm.client_id AND c.is_active = 1', 'left')
|
||||
->join('ticket_claim_status tcs', 'tcs.id = tm.claim_status_id AND tcs.is_active = 1', 'left')
|
||||
->join("({$subquery->getCompiledSelect()}) tat_category", 'tm.id = tat_category.ticket_id', 'left')
|
||||
->where('tm.is_active', 1)
|
||||
->where($where)
|
||||
->orderBy('tm.id', 'DESC');
|
||||
|
||||
$data = $query->get()->getResultArray();
|
||||
// print_rr($data);
|
||||
// log_message('error',' Claims Master Data '.json_encode($data));die();
|
||||
// print_rr($data);die();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function ticket_form($ticket_type)
|
||||
@ -893,24 +996,24 @@ class TicketController extends BaseController
|
||||
}
|
||||
|
||||
// Construct Mail Data
|
||||
$mailData[] = [
|
||||
'mail' => $ticket_data['emp_mail'],
|
||||
$mailData = [
|
||||
'mail' => [$ticket_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'cc' => $ticket_data['common_mails'] ?? '',
|
||||
'attachments' => []
|
||||
];
|
||||
|
||||
// if the employee personal mail is not empty then send the mail to the employee personal mail
|
||||
if(!empty($ticket_data['emp_personal_mail'])){
|
||||
$mailData[] = [
|
||||
'mail' => $ticket_data['emp_personal_mail'],
|
||||
'subject' => $subject,
|
||||
'message' => $message,
|
||||
'cc' => $ticket_data['common_mails'] ?? '',
|
||||
'attachments' => []
|
||||
];
|
||||
}
|
||||
// // if the employee personal mail is not empty then send the mail to the employee personal mail
|
||||
// if(!empty($ticket_data['emp_personal_mail'])){
|
||||
// $mailData[] = [
|
||||
// 'mail' => [$ticket_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||
// 'subject' => $subject,
|
||||
// 'message' => $message,
|
||||
// 'cc' => $ticket_data['common_mails'] ?? '',
|
||||
// 'attachments' => []
|
||||
// ];
|
||||
// }
|
||||
|
||||
// print_r($mailData); die;
|
||||
|
||||
@ -1001,28 +1104,28 @@ class TicketController extends BaseController
|
||||
$this->myLogger->logme('error', "Fetched ACM emails");
|
||||
|
||||
|
||||
if(!empty($ticket_data['emp_personal_mail'])){
|
||||
// if(!empty($ticket_data['emp_personal_mail'])){
|
||||
|
||||
$this->myLogger->logme('error', "Send employee personal mail start");
|
||||
// $this->myLogger->logme('error', "Send employee personal mail start");
|
||||
|
||||
$emailPersonalData = [
|
||||
'mail' => $ticket_data['emp_personal_mail'],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
'message' => $mail_data['mail_content'],
|
||||
'common' => [],
|
||||
'cc' => $acm_mails['common_mails'],
|
||||
'attachments' => []
|
||||
];
|
||||
// $emailPersonalData = [
|
||||
// 'mail' => $ticket_data['emp_personal_mail'],
|
||||
// 'subject' => $mail_data['mail_subject'],
|
||||
// 'message' => $mail_data['mail_content'],
|
||||
// 'common' => [],
|
||||
// 'cc' => $acm_mails['common_mails'],
|
||||
// 'attachments' => []
|
||||
// ];
|
||||
|
||||
$this->sendTrigger($emailPersonalData);
|
||||
// $this->sendTrigger($emailPersonalData);
|
||||
|
||||
$this->myLogger->logme('error', "Send employee personal mail successfully");
|
||||
}else{
|
||||
$this->myLogger->logme('error', "Send employee personal mail is empty");
|
||||
}
|
||||
// $this->myLogger->logme('error', "Send employee personal mail successfully");
|
||||
// }else{
|
||||
// $this->myLogger->logme('error', "Send employee personal mail is empty");
|
||||
// }
|
||||
|
||||
$emailData = [
|
||||
'mail' => $mail_data['emp_mail'],
|
||||
'mail' => [$mail_data['emp_mail'], $ticket_data['emp_personal_mail'] ?? ""],
|
||||
'subject' => $mail_data['mail_subject'],
|
||||
'message' => $mail_data['mail_content'],
|
||||
'common' => [],
|
||||
@ -1044,10 +1147,11 @@ class TicketController extends BaseController
|
||||
if (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 1) {
|
||||
$mail_content = $this->constructMailContent($ticket_id);
|
||||
// print_r($mail_content); die;
|
||||
foreach ($mail_content as $key => $value) {
|
||||
$mail_responce = $this->sendTrigger($value);
|
||||
$this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
|
||||
}
|
||||
// foreach ($mail_content as $key => $value) {
|
||||
$mail_responce = $this->sendTrigger($mail_content);
|
||||
// $this->myLogger->logme('error', '{data} - Auto Mail Sent, Successfully', ['data' => $key + 1]);
|
||||
$this->myLogger->logme('error', 'Auto Mail Sent, Successfully');
|
||||
// }
|
||||
} elseif (!empty($auto_mail_enable) && $auto_mail_enable['is_auto_mail'] == 0) {
|
||||
$this->myLogger->logme('error', 'Auto Mail Not Sent, Reason: Automail Not Enabled');
|
||||
} else {
|
||||
@ -1558,7 +1662,7 @@ class TicketController extends BaseController
|
||||
|
||||
$sent_message_data['ticket_id'] = $ticket_id;
|
||||
$sent_message_data['sender'] = 'staff';
|
||||
$sent_message_data['emp_mail'] = $mail_sent_status->data->params->mail;
|
||||
$sent_message_data['emp_mail'] = isset($mail_sent_status->data->params->mail[0]) ? $mail_sent_status->data->params->mail[0] ?? null : $mail_sent_status->data->params->mail ?? null;
|
||||
$sent_message_data['mail_subject'] = $mail_sent_status->data->params->subject;
|
||||
$sent_message_data['mail_content'] = $mail_sent_status->data->params->message;
|
||||
|
||||
|
||||
@ -74,7 +74,11 @@ class GmailResponseHandler{
|
||||
if(in_array($key,$arr)){
|
||||
$data[$key] = isset($value)?json_encode($value):null;
|
||||
}else{
|
||||
$data[$key] = isset($value)?$value:null;
|
||||
if($key == "mail" && is_array($value)){
|
||||
$data[$key] = isset($value)?json_encode($value):null;
|
||||
}else{
|
||||
$data[$key] = isset($value)?$value:null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,154 +292,164 @@ class MailHelper
|
||||
}
|
||||
}
|
||||
|
||||
public static function send_email($params)
|
||||
{
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
||||
$common = isset($params['common']) ? $params['common'] : '';
|
||||
$bcc = isset($params['bcc']) ? $params['bcc'] : '';
|
||||
$cc = isset($params['cc']) ? $params['cc'] : '';
|
||||
|
||||
$from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail');
|
||||
// $from_address = "claims@nhanceindia.in";
|
||||
try {
|
||||
$curl = curl_init();
|
||||
|
||||
$postData = [
|
||||
'from' => [
|
||||
'address' => $from_address
|
||||
],
|
||||
'to' => [
|
||||
[
|
||||
public static function send_email($params)
|
||||
{
|
||||
$myLogger = \Config\Services::mylogger();
|
||||
if (is_array($params['mail'])) {
|
||||
$emails = [];
|
||||
|
||||
foreach ($params['mail'] as $key => $emaill) {
|
||||
$emails[] = [
|
||||
'email_address' => [
|
||||
'address' => $emaill
|
||||
]
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$emails[] = [
|
||||
'email_address' => [
|
||||
'address' => $params['mail']
|
||||
]
|
||||
],
|
||||
'subject' => $subject,
|
||||
'htmlbody' => $message
|
||||
];
|
||||
|
||||
// Add CC recipients if provided
|
||||
if (!empty($cc)) {
|
||||
$ccList = explode(',', $cc);
|
||||
$ccList = array_map('trim', $ccList);
|
||||
$postData['cc'] = array_map(function($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $ccList);
|
||||
}
|
||||
// Add BCC if present
|
||||
if (!empty($bcc)) {
|
||||
$bccList = explode(',', $bcc);
|
||||
$bccList = array_map('trim', $bccList);
|
||||
$postData['bcc'] = array_map(function($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $bccList);
|
||||
];
|
||||
}
|
||||
|
||||
// Add BCC recipients if provided
|
||||
// if (!empty($bcc)) {
|
||||
// $postData['bcc'] = [];
|
||||
// // Handle both string and array inputs for BCC
|
||||
// $bccEmails = is_array($bcc) ? $bcc : [$bcc];
|
||||
// foreach ($bccEmails as $bccEmail) {
|
||||
// $postData['bcc'][] = [
|
||||
// 'email_address' => [
|
||||
// 'address' => $bccEmail
|
||||
// ]
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
$attachments = isset($params['attachments']) ? $params['attachments'] : [];
|
||||
$common = isset($params['common']) ? $params['common'] : '';
|
||||
$bcc = isset($params['bcc']) ? $params['bcc'] : '';
|
||||
$cc = isset($params['cc']) ? $params['cc'] : '';
|
||||
|
||||
// Handle attachments
|
||||
if (!empty($attachments)) {
|
||||
$postData['attachments'] = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
|
||||
// Determine MIME type dynamically
|
||||
$fileMimeType = mime_content_type($attachment['filePath']);
|
||||
|
||||
$postData['attachments'][] = [
|
||||
'content' => base64_encode(file_get_contents($attachment['filePath'])),
|
||||
'name' => $attachment['fileName'],
|
||||
'mime_type' => $fileMimeType,
|
||||
$from_address = isset($params['from_mail']) && !empty($params['from_mail']) ? $params['from_mail'] : getenv('email.fromEmail');
|
||||
// $from_address = "claims@nhanceindia.in";
|
||||
try {
|
||||
$curl = curl_init();
|
||||
|
||||
$postData = [
|
||||
'from' => [
|
||||
'address' => $from_address
|
||||
],
|
||||
'to' => $emails,
|
||||
'subject' => $subject,
|
||||
'htmlbody' => $message
|
||||
];
|
||||
|
||||
// Add CC recipients if provided
|
||||
if (!empty($cc)) {
|
||||
$ccList = explode(',', $cc);
|
||||
$ccList = array_map('trim', $ccList);
|
||||
$postData['cc'] = array_map(function ($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $ccList);
|
||||
}
|
||||
// Add BCC if present
|
||||
if (!empty($bcc)) {
|
||||
$bccList = explode(',', $bcc);
|
||||
$bccList = array_map('trim', $bccList);
|
||||
$postData['bcc'] = array_map(function ($email) {
|
||||
return [
|
||||
'email_address' => [
|
||||
'address' => $email
|
||||
]
|
||||
];
|
||||
}, $bccList);
|
||||
}
|
||||
|
||||
// Add BCC recipients if provided
|
||||
// if (!empty($bcc)) {
|
||||
// $postData['bcc'] = [];
|
||||
// // Handle both string and array inputs for BCC
|
||||
// $bccEmails = is_array($bcc) ? $bcc : [$bcc];
|
||||
// foreach ($bccEmails as $bccEmail) {
|
||||
// $postData['bcc'][] = [
|
||||
// 'email_address' => [
|
||||
// 'address' => $bccEmail
|
||||
// ]
|
||||
// ];
|
||||
// }
|
||||
// }
|
||||
|
||||
// Handle attachments
|
||||
if (!empty($attachments)) {
|
||||
$postData['attachments'] = [];
|
||||
foreach ($attachments as $attachment) {
|
||||
if (isset($attachment['filePath']) && file_exists($attachment['filePath'])) {
|
||||
// Determine MIME type dynamically
|
||||
$fileMimeType = mime_content_type($attachment['filePath']);
|
||||
|
||||
$postData['attachments'][] = [
|
||||
'content' => base64_encode(file_get_contents($attachment['filePath'])),
|
||||
'name' => $attachment['fileName'],
|
||||
'mime_type' => $fileMimeType,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($postData),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"accept: application/json",
|
||||
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
|
||||
"cache-control: no-cache",
|
||||
"content-type: application/json",
|
||||
],
|
||||
]);
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => "https://api.zeptomail.in/v1.1/email",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($postData),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"accept: application/json",
|
||||
"authorization: Zoho-enczapikey " . getenv('ZEPTO_API_KEY'),
|
||||
"cache-control: no-cache",
|
||||
"content-type: application/json",
|
||||
],
|
||||
]);
|
||||
|
||||
$mail_result = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
$mail_result = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
curl_close($curl);
|
||||
|
||||
$res['params'] = $params;
|
||||
$MailDataHelper = new GmailResponseHandler();
|
||||
$apiResponse = json_decode($mail_result, true);
|
||||
$res['zepto_api'] = $apiResponse;
|
||||
|
||||
if (isset($apiResponse['error'])) {
|
||||
$res['params'] = $params;
|
||||
$MailDataHelper = new GmailResponseHandler();
|
||||
$apiResponse = json_decode($mail_result, true);
|
||||
$res['zepto_api'] = $apiResponse;
|
||||
|
||||
if (isset($apiResponse['error'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'message' => 'Email Sent Failed...' . json_encode($params['mail']),
|
||||
'data' => $res
|
||||
], 404);
|
||||
}
|
||||
|
||||
if (isset($apiResponse['data'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email Sent Successfully...' . json_encode($params['mail']),
|
||||
'data' => $res
|
||||
], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$msg['error'] = $e->getMessage();
|
||||
$msg['params'] = $params;
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 404,
|
||||
'message' => 'Email Sent Failed...' . $emaill,
|
||||
'data' => $res
|
||||
], 404);
|
||||
'code' => 500,
|
||||
'data' => $msg
|
||||
], 500);
|
||||
}
|
||||
|
||||
if (isset($apiResponse['data'])) {
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Email Sent Successfully...' . $emaill,
|
||||
'data' => $res
|
||||
], 200);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$msg['error'] = $e->getMessage();
|
||||
$msg['params'] = $params;
|
||||
$response = $res;
|
||||
$MailDataHelper->receive_and_distribute_param_to_functions($response);
|
||||
return json_encode([
|
||||
'status' => 'failed',
|
||||
'code' => 500,
|
||||
'data' => $msg
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public static function bulk_mail(array $mails = [])
|
||||
{
|
||||
$model = new JobModel();
|
||||
|
||||
@ -74,7 +74,9 @@ class TicketMasterModel extends Model
|
||||
'head_rejection_reason',
|
||||
'pay_initiate_date',
|
||||
'emp_personal_mail',
|
||||
'client_policy_id'
|
||||
'client_policy_id',
|
||||
|
||||
'approved_description'
|
||||
|
||||
];
|
||||
|
||||
|
||||
@ -348,6 +348,12 @@
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_description">Approved Description</label>
|
||||
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
|
||||
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
@ -720,6 +726,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$field = $('#approved_description')
|
||||
$field.prop('required', false);
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
||||
|
||||
});
|
||||
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
|
||||
@ -274,6 +274,12 @@
|
||||
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-6 approved" style="display: none;">
|
||||
<label for="approved_description">Approved Description</label>
|
||||
<input type="text" class="form-control" id="approved_description" placeholder="Enter Approved Description"
|
||||
value="<?= isset($ticket_data['approved_description']) ? $ticket_data['approved_description'] : '' ?>" name="approved_description">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3 settled" style="display: none;">
|
||||
<label for="utr_details">UTR Details</label>
|
||||
<input type="text" class="form-control" id="utr_details" placeholder="Enter UTR Details"
|
||||
@ -555,6 +561,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$field = $('#approved_description')
|
||||
$field.prop('required', false);
|
||||
var $parentDiv = $field.closest("div");
|
||||
$parentDiv.find("label[for='approved_description'] .text-danger").remove();
|
||||
|
||||
});
|
||||
// function addRequiredFieldSymbol(field_name) {
|
||||
// // Find the field with the given name
|
||||
|
||||
@ -65,6 +65,49 @@ table.dataTable tbody td {
|
||||
<th>Emp name</th>
|
||||
<th>Insured Name</th>
|
||||
<th>Corporate name</th>
|
||||
|
||||
<th style="display: none;">ACM</th>
|
||||
<th style="display: none;">Insurer</th>
|
||||
<th style="display: none;">TPA</th>
|
||||
<th style="display: none;">Policy No</th>
|
||||
<th style="display: none;">Priority</th>
|
||||
<th style="display: none;">Relationship</th>
|
||||
<th style="display: none;">Emp Mobile</th>
|
||||
<th style="display: none;">Emp Email</th>
|
||||
<th style="display: none;">Emp Personal Email</th>
|
||||
<th style="display: none;">Mode of Intimation</th>
|
||||
<th style="display: none;">Claim Type</th>
|
||||
<th style="display: none;">Hospital Name</th>
|
||||
<th style="display: none;">DOA</th>
|
||||
<th style="display: none;">DOD</th>
|
||||
<th style="display: none;">Claim Amount</th>
|
||||
<th style="display: none;">POD No.</th>
|
||||
<th style="display: none;">Date of Join</th>
|
||||
<th style="display: none;">Date of Inception</th>
|
||||
<th style="display: none;">DOB</th>
|
||||
<th style="display: none;">Date of Accident</th>
|
||||
<th style="display: none;">Date of Death</th>
|
||||
<th style="display: none;">Date of Intimate</th>
|
||||
<th style="display: none;">Sum Insured</th>
|
||||
<th style="display: none;">Raised Date</th>
|
||||
<th style="display: none;">Registration Date</th>
|
||||
<th style="display: none;">Query Received Date</th>
|
||||
<th style="display: none;">Denial Date</th>
|
||||
<th style="display: none;">Approved Date</th>
|
||||
<th style="display: none;">Settled Date</th>
|
||||
<th style="display: none;">Denial Reason</th>
|
||||
<th style="display: none;">Approved Letter</th>
|
||||
<th style="display: none;">Approved Amount</th>
|
||||
<th style="display: none;">UTR Details</th>
|
||||
<th style="display: none;">Settle Letter</th>
|
||||
<th style="display: none;">Return Remark</th>
|
||||
<th style="display: none;">Cancel Remark</th>
|
||||
<th style="display: none;">AWB No. and Courier Name</th>
|
||||
<th style="display: none;">Non ID Reason</th>
|
||||
<th style="display: none;">Payment Initiate Date</th>
|
||||
<th style="display: none;">Approved Description</th>
|
||||
|
||||
|
||||
<th>TAT</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -119,6 +162,59 @@ table.dataTable tbody td {
|
||||
<td><?php echo $row['emp_name']; ?></td>
|
||||
<td><?php echo $row['insured_name']; ?></td>
|
||||
<td><?php echo $row['short_name']; ?></td>
|
||||
|
||||
<td style="display: none;"><?php echo $row['acm_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['insurer_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['tpa_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['policy_no']; ?></td>
|
||||
<td style="display: none;"><?php echo isset($priorityType[$row['priority'] ?? 0]) ? $priorityType[$row['priority'] ?? 0] : ''; ?></td>
|
||||
<td style="display: none;"><?php echo $row['relationship']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_mobile']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_mail']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['emp_personal_mail']; ?></td>
|
||||
<td style="display: none;"><?php echo isset($modeOFIntimate[$row['mode_of_intimation'] ?? '']) ? $modeOFIntimate[$row['mode_of_intimation']] : ''; ?></td>
|
||||
<td style="display: none;">
|
||||
<?php
|
||||
$typeId = $row['ticket_type_id'] ?? 0;
|
||||
$claimKey = $row['claim_type'] ?? '';
|
||||
if ($typeId == 1) {
|
||||
echo isset($claimType[1][$claimKey]) ? $claimType[1][$claimKey] : '';
|
||||
} else {
|
||||
echo isset($claimType[2][$claimKey]) ? $claimType[2][$claimKey] : '';
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
<td style="display: none;"><?php echo $row['hospital_name']; ?></td>
|
||||
<td style="display: none;"><?php echo change_date_format($row['doa'], null, 'd-m-Y'); ?></td>
|
||||
<td style="display: none;"><?php echo $row['dod']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['claim_amount']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['pod_no']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_join']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_incep']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['dob']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_accident']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_death']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['date_of_intimat']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['si_amt']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['raised_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['registration_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['query_received_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['denial_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['settled_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['denial_reason']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_letter']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_amount']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['utr_details']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['settle_letter']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['return_remark']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['cancel_remark']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['awb_no_courier_name']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['non_id_reason']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['pay_initiate_date']; ?></td>
|
||||
<td style="display: none;"><?php echo $row['approved_description']; ?></td>
|
||||
|
||||
|
||||
<td><?php echo $row['tat']; ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user