MERGE_UAT_LIVE_CHGREQ
This commit is contained in:
commit
2831a27dd5
@ -202,59 +202,71 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
public function updatePolicyEnrollmentStatus()
|
public function updatePolicyEnrollmentStatus()
|
||||||
{
|
{
|
||||||
$clientModel = new ClientModel();
|
|
||||||
$clientPolicyModel = new ClientPolicyModel();
|
$clientPolicyModel = new ClientPolicyModel();
|
||||||
$notificationModel = new NotificationModel();
|
|
||||||
$employeePolicyModel = new EmployeePolicyModel();
|
|
||||||
$myLogger = \Config\Services::mylogger();
|
$myLogger = \Config\Services::mylogger();
|
||||||
|
|
||||||
// $myLogger->logme('error', 'enrollment_status function called');
|
$client_policy_data = $clientPolicyModel->getPolicyDetailsForEnrollment();
|
||||||
|
$myLogger->logme('error', 'Fetched client policy data for Enrollment Status update');
|
||||||
$client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder();
|
|
||||||
$myLogger->logme('error', 'Fetched client policy data');
|
|
||||||
|
|
||||||
// dd($client_policy_data);
|
// dd($client_policy_data);
|
||||||
|
|
||||||
$currentDate = date('d');
|
$currentDate = date('d-m-Y');
|
||||||
// $myLogger->logme('error', 'Current date: ' . $currentDate);
|
$openEnrollment = [];
|
||||||
|
$closeEnrollment = [];
|
||||||
|
|
||||||
// Update policy status based on start and end dates
|
// Update policy status based on start and end dates
|
||||||
foreach ($client_policy_data as $client_policy) {
|
foreach ($client_policy_data as $client_policy) {
|
||||||
|
|
||||||
$id = $client_policy['id'];
|
$id = $client_policy['id'];
|
||||||
$openDate = date('d', strtotime($client_policy['open_date']));
|
$openDate = date('d-m-Y', strtotime($client_policy['open_date']));
|
||||||
$closeDate = date('d', strtotime($client_policy['close_date']));
|
$closeDate = date('d-m-Y', strtotime($client_policy['close_date']));
|
||||||
|
|
||||||
// $myLogger->logme('error', 'Processing client policy ID: ' . $id);
|
|
||||||
// $myLogger->logme('error', 'Open date: ' . $openDate . ', Close date: ' . $closeDate);
|
|
||||||
|
|
||||||
if ($currentDate == $openDate) {
|
if ($currentDate == $openDate) {
|
||||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 1]);
|
||||||
|
$openEnrollment[] = $id;
|
||||||
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.');
|
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to open for enrollment.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($closeDate < $currentDate) {
|
if ($closeDate < $currentDate) {
|
||||||
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
$clientPolicyModel->update($id, ['open_for_enrollment' => 0]);
|
||||||
|
$closeEnrollment[] = $id;
|
||||||
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to close for enrollment.');
|
$myLogger->logme('error', 'Updated policy ID ' . $id . ' to close for enrollment.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$myLogger->logme('error', 'enrollment_status function completed');
|
||||||
|
return $this->respond([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'updated Policy Enrollment Status',
|
||||||
|
'open_policy_count' => count($openEnrollment),
|
||||||
|
'close_policy_count' => count($closeEnrollment),
|
||||||
|
'open_policy_ids' => $openEnrollment,
|
||||||
|
'close_policy_ids' => $closeEnrollment,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sendCroneRemainderMail()
|
||||||
|
{
|
||||||
|
$clientPolicyModel = new ClientPolicyModel();
|
||||||
|
$myLogger = \Config\Services::mylogger();
|
||||||
|
|
||||||
|
|
||||||
|
$client_policy_data = $clientPolicyModel->getPolicyDetailsForRemainder();
|
||||||
|
$myLogger->logme('error', 'Fetched client policy data');
|
||||||
|
// dd($client_policy_data);
|
||||||
|
|
||||||
// Mail send function
|
// Mail send function
|
||||||
// $myLogger->logme('error', 'Calling sendRemainderMail function');
|
$result = $this->sendRemainderMail($client_policy_data, 'crone');
|
||||||
if( $currentDate == date('d', strtotime($client_policy['reminder_date']))){
|
|
||||||
$result = $this->sendRemainderMail($client_policy_data);
|
$myLogger->logme('error', 'sendCroneRemainderMail function completed');
|
||||||
}else{
|
|
||||||
$result = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// $myLogger->logme('error', 'enrollment_status function completed');
|
|
||||||
if($result){
|
if($result){
|
||||||
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
return json_encode(['status' => true, 'message' => 'Mail send successfully']);
|
||||||
}else{
|
}else{
|
||||||
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
return json_encode(['status' => false, 'message' => 'There is no data to send']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function featch_dashboard_data($type)
|
public function featch_dashboard_data($type)
|
||||||
{
|
{
|
||||||
@ -292,65 +304,133 @@ class DashboardController extends AdminController
|
|||||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sendRemainderMail($client_policy_data, $send_mail_for_manual_or_crone = null)
|
||||||
public function sendRemainderMail($client_policy_data)
|
|
||||||
{
|
{
|
||||||
// $this->myLogger->logme('error', 'sendRemainderMail function called');
|
// $this->myLogger->logme('error', 'sendRemainderMail function called');
|
||||||
|
|
||||||
|
// dd($client_policy_data, $send_mail_for_manual_or_crone);
|
||||||
|
|
||||||
$reminder_whole_mail = [];
|
$reminder_whole_mail = [];
|
||||||
|
|
||||||
foreach ($client_policy_data as $client_policy) {
|
foreach ($client_policy_data as $client_policy) {
|
||||||
|
|
||||||
// Fetch client data
|
|
||||||
$client_data = $this->clientModel->find($client_policy['client_id']);
|
|
||||||
|
|
||||||
// Fetch notification settings
|
|
||||||
$notification_data = $this->notificationModel
|
|
||||||
->where('client_id', $client_policy['client_id'])
|
|
||||||
->where('template_name', 'member_reminder_mail')
|
|
||||||
->first();
|
|
||||||
|
|
||||||
// $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data));
|
if(empty($send_mail_for_manual_or_crone)){
|
||||||
|
|
||||||
// Check if notification should be sent
|
// echo '1';
|
||||||
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
|
|
||||||
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
|
// Fetch client data
|
||||||
|
$client_data = $this->clientModel->find($client_policy['client_id']);
|
||||||
// Fetch all employees related to the client policy
|
|
||||||
$employees = $this->employeePolicyModel
|
// Fetch notification settings
|
||||||
->select('employees.*')
|
$notification_data = $this->notificationModel
|
||||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
->where('client_id', $client_policy['client_id'])
|
||||||
->where('employee_polices.client_policy_id', $client_policy['id'])
|
->where('template_name', 'member_reminder_mail')
|
||||||
->where('employees.emp_status', 'draft')
|
->first();
|
||||||
->where('employees.is_active', 1)
|
|
||||||
->where('employee_polices.status', 'draft')
|
// $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data));
|
||||||
->where('employee_polices.is_active', 1)
|
|
||||||
->where('employees.relationship', 'Self')
|
// Check if notification should be sent
|
||||||
->findAll();
|
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
|
||||||
|
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
|
||||||
// Process each employee
|
|
||||||
foreach ($employees as $employee) {
|
// Fetch all employees related to the client policy
|
||||||
|
$employees = $this->employeePolicyModel
|
||||||
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
|
->select('employees.*')
|
||||||
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||||
// Mail params
|
->where('employees.emp_status', 'draft')
|
||||||
$params['emp_data'] = $employee;
|
->where('employees.is_active', 1)
|
||||||
$params['client_data'] = $client_data;
|
->where('employee_polices.status', 'draft')
|
||||||
$params['notification_data'] = $notification_data;
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employees.relationship', 'Self')
|
||||||
// Send the mail notification
|
->findAll();
|
||||||
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
|
||||||
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
// Process each employee
|
||||||
$reminder_whole_mail[] = $mail_result;
|
foreach ($employees as $employee) {
|
||||||
|
|
||||||
|
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
|
||||||
|
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
|
||||||
|
|
||||||
|
// Mail params
|
||||||
|
$params['emp_data'] = $employee;
|
||||||
|
$params['client_data'] = $client_data;
|
||||||
|
$params['notification_data'] = $notification_data;
|
||||||
|
|
||||||
|
// Send the mail notification
|
||||||
|
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||||
|
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||||
|
$reminder_whole_mail[] = $mail_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// echo '2';
|
||||||
|
|
||||||
|
$currentDate = date('d-m-Y');
|
||||||
|
|
||||||
|
if($currentDate == date('d-m-Y', strtotime($client_policy['reminder_date']))){
|
||||||
|
|
||||||
|
// echo '3';
|
||||||
|
|
||||||
|
$client_data = $this->clientModel->find($client_policy['client_id']);
|
||||||
|
|
||||||
|
// Fetch notification settings
|
||||||
|
$notification_data = $this->notificationModel
|
||||||
|
->where('client_id', $client_policy['client_id'])
|
||||||
|
->where('template_name', 'member_reminder_mail')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
// Check if notification should be sent
|
||||||
|
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
|
||||||
|
|
||||||
|
// echo '4';
|
||||||
|
|
||||||
|
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
|
||||||
|
|
||||||
|
// Fetch all employees related to the client policy
|
||||||
|
$employees = $this->employeePolicyModel
|
||||||
|
->select('employees.*')
|
||||||
|
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||||
|
->where('employee_polices.client_policy_id', $client_policy['id'])
|
||||||
|
->where('employees.emp_status', 'draft')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employee_polices.status', 'draft')
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
|
->where('employees.relationship', 'Self')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
// Process each employee
|
||||||
|
foreach ($employees as $employee) {
|
||||||
|
|
||||||
|
if ($employee['emp_status'] == 'draft' && $employee['relationship'] == 'Self') {
|
||||||
|
$this->myLogger->logme('error', 'Employee status and relationship check passed for employee ID: ' . $employee['id']);
|
||||||
|
|
||||||
|
// Mail params
|
||||||
|
$params['emp_data'] = $employee;
|
||||||
|
$params['client_data'] = $client_data;
|
||||||
|
$params['notification_data'] = $notification_data;
|
||||||
|
|
||||||
|
// Send the mail notification
|
||||||
|
$mail_result = sendMailNotification::sendMailNotification('member_reminder_mail', $params);
|
||||||
|
// $this->myLogger->logme('error', 'Mail sent result: ' . json_encode($mail_result));
|
||||||
|
$reminder_whole_mail[] = $mail_result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// echo '5';
|
||||||
|
$this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$this->myLogger->logme('error', 'Notification not sent for client policy ID: ' . $client_policy['id']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'Whole email, count: ' . $reminder_whole_mail);
|
// dd($reminder_whole_mail);
|
||||||
|
|
||||||
|
// $this->myLogger->logme('error', 'Whole email, count: ' . $reminder_whole_mail);
|
||||||
|
|
||||||
// Process and queue bulk emails
|
// Process and queue bulk emails
|
||||||
$temp_whole_data = [];
|
$temp_whole_data = [];
|
||||||
@ -387,7 +467,6 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function sendManualRemainder($client_id, $client_branch_id)
|
public function sendManualRemainder($client_id, $client_branch_id)
|
||||||
{
|
{
|
||||||
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
|
||||||
@ -414,7 +493,6 @@ class DashboardController extends AdminController
|
|||||||
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'There is no data to send', 'message2' => 'No policy data found to send'], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -439,6 +439,29 @@ class EmployeeRestController extends AdminController
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$requestData = $this->request->getJSON();
|
$requestData = $this->request->getJSON();
|
||||||
|
foreach ($requestData as $key => $value)
|
||||||
|
{
|
||||||
|
|
||||||
|
$checkIfExist = $this->employeePolicyModel->where('employee_id', $value->employee_id)
|
||||||
|
->where('client_policy_id', $value->client_policy_id)
|
||||||
|
->where('is_active', 1 )
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
|
||||||
|
if ($checkIfExist) {
|
||||||
|
|
||||||
|
$empPolicy = $this->employeePolicyModel->updateSiAndPremium($value->client_policy_id, $value->employee_id, $value->basic_cover_si);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$data['employee_id']= $value->employee_id;
|
||||||
|
$data['client_policy_id']= $value->client_policy_id;
|
||||||
|
$data['basic_cover_si']= $value->basic_cover_si;
|
||||||
|
$data['status'] = 'draft';
|
||||||
|
|
||||||
|
$this->employeePolicyModel->insert($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(count($requestData))
|
if(count($requestData))
|
||||||
{
|
{
|
||||||
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code , $requestData[0]->client_branch_id);
|
$this->updatePremiumAmount($requestData[0]->client_policy_id , $requestData[0]->emp_code , $requestData[0]->client_branch_id);
|
||||||
@ -999,7 +1022,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
||||||
$self['data']['mobile'] = $selfData[0]['mobile'];
|
$self['data']['mobile'] = $selfData[0]['mobile'];
|
||||||
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
$self['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||||
|
|
||||||
$array->mapped_family_floaters = $self;
|
$array->mapped_family_floaters = $self;
|
||||||
$array->type = 'GPA';
|
$array->type = 'GPA';
|
||||||
@ -1056,6 +1079,7 @@ class EmployeeRestController extends AdminController
|
|||||||
foreach ($empData as $key => $value) {
|
foreach ($empData as $key => $value) {
|
||||||
if ($value['family_floater_key'] === $dependent) {
|
if ($value['family_floater_key'] === $dependent) {
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->ClientPolicyId)->where('is_active', 1 )->get()->getRow();
|
||||||
|
|
||||||
$temp['is_value_exist'] = true;
|
$temp['is_value_exist'] = true;
|
||||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||||
$temp['data']['employee_id'] = $value['id'];
|
$temp['data']['employee_id'] = $value['id'];
|
||||||
@ -1064,7 +1088,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
$temp['data']['form_type'] = $dependent;
|
$temp['data']['form_type'] = $dependent;
|
||||||
$temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||||
|
|
||||||
|
|
||||||
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||||
@ -1164,7 +1188,7 @@ class EmployeeRestController extends AdminController
|
|||||||
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
return $this->respond(['status' => 'failed','code' => 404,'data' => []], 200);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getLine()], 500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1260,7 +1284,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||||
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
$temp['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
$temp['data']['form_type'] = $dependent;
|
$temp['data']['form_type'] = $dependent;
|
||||||
$temp['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||||
$temp['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
|
$temp['data']['age_validation'] = $this->getAgeRange($array->Policy_Terms,$familyFloatesValue);
|
||||||
|
|
||||||
|
|
||||||
@ -1367,7 +1391,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
$self['data']['dob'] = $this->convertDateFormatDMY($selfData[0]['dob']);
|
||||||
$self['data']['mobile'] = $selfData[0]['mobile'];
|
$self['data']['mobile'] = $selfData[0]['mobile'];
|
||||||
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
$self['data']['client_policy_id'] = $array->ClientPolicyId;
|
||||||
$self['data']['basic_cover_si'] = $employee_policy->basic_cover_si;
|
$self['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||||
$array->mapped_family_floaters = $self;
|
$array->mapped_family_floaters = $self;
|
||||||
|
|
||||||
if($array->enrolment_visibility == 1)
|
if($array->enrolment_visibility == 1)
|
||||||
@ -1500,9 +1524,7 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
if(count($clientPolicy))
|
if(count($clientPolicy))
|
||||||
{
|
{
|
||||||
$self = $this->employeeModel
|
$self = $this->employeeModel->where('employees.is_active', 1)
|
||||||
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
|
||||||
->where('employees.is_active', 1)
|
|
||||||
->where('employees.emp_code', $this->request->getGet('emp_code'))
|
->where('employees.emp_code', $this->request->getGet('emp_code'))
|
||||||
->where('employees.client_id', $this->request->getGet('client_id'))
|
->where('employees.client_id', $this->request->getGet('client_id'))
|
||||||
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
|
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||||
@ -1553,6 +1575,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
|
$responce['OpenForEnrollment'] = $array['open_for_enrollment'];
|
||||||
$responce['policy_terms'] = $decodedArray;
|
$responce['policy_terms'] = $decodedArray;
|
||||||
$responce['policy_type_id'] = $array['policy_type_id'];
|
$responce['policy_type_id'] = $array['policy_type_id'];
|
||||||
|
$responce['disclaimer'] = $array['disclaimer'];
|
||||||
|
|
||||||
$tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string')
|
$tpaArray = $this->employeeModel->select('employees.name as name , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string')
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
@ -1586,8 +1609,18 @@ class EmployeeRestController extends AdminController
|
|||||||
|
|
||||||
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
if($array['is_addon'] == 3 && $array['policy_type_id'] == 3)//dependent add on policy
|
||||||
{
|
{
|
||||||
|
$selfGMC = $this->employeeModel->select('employees.name , employee_polices.basic_cover_si')
|
||||||
$selfSi = $self->basic_cover_si;
|
->join('employee_polices', 'employees.id = employee_polices.employee_id')
|
||||||
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id AND client_policy.policy_type_id = 2')
|
||||||
|
->where('employees.is_active', 1)
|
||||||
|
->where('employees.emp_code', $this->request->getGet('emp_code'))
|
||||||
|
->where('employees.client_id', $this->request->getGet('client_id'))
|
||||||
|
->where('employees.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||||
|
->where('employees.family_floater_key', 'self')
|
||||||
|
->get()
|
||||||
|
->getRow();
|
||||||
|
|
||||||
|
$selfSi = $selfGMC->basic_cover_si;
|
||||||
$filteredSlabRates = array_filter($responce['SlabRates'], function ($rate) use ($selfSi) {
|
$filteredSlabRates = array_filter($responce['SlabRates'], function ($rate) use ($selfSi) {
|
||||||
return $rate['si'] === $selfSi;
|
return $rate['si'] === $selfSi;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -18,18 +18,20 @@ use App\Models\EmployeeModel;
|
|||||||
use App\Models\UserModel;
|
use App\Models\UserModel;
|
||||||
|
|
||||||
use App\Helpers\sendMailNotification;
|
use App\Helpers\sendMailNotification;
|
||||||
|
use App\Helpers\MailHelper;
|
||||||
|
|
||||||
class NotificationController extends AdminController
|
class NotificationController extends AdminController
|
||||||
{
|
{
|
||||||
use ResponseTrait;
|
use ResponseTrait;
|
||||||
protected $myLogger;
|
protected $myLogger;
|
||||||
protected $notificationModel;
|
protected $notificationModel;
|
||||||
|
protected $clientModel;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->myLogger = \Config\Services::mylogger();
|
$this->myLogger = \Config\Services::mylogger();
|
||||||
$this->notificationModel = new NotificationModel();
|
$this->notificationModel = new NotificationModel();
|
||||||
|
$this->clientModel = new ClientModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is for Template Name Camel Case to Snake Case for store in DB
|
// This is for Template Name Camel Case to Snake Case for store in DB
|
||||||
@ -88,6 +90,8 @@ class NotificationController extends AdminController
|
|||||||
$id =$this->request->getPost('client_id');
|
$id =$this->request->getPost('client_id');
|
||||||
$clientData['common_mails'] = $this->request->getPost('nhance_team_mail_ids');
|
$clientData['common_mails'] = $this->request->getPost('nhance_team_mail_ids');
|
||||||
$clientData['hr_mails'] = $this->request->getPost('hr_mail_id');
|
$clientData['hr_mails'] = $this->request->getPost('hr_mail_id');
|
||||||
|
$clientData['reply_to'] = $this->request->getPost('reply_to');
|
||||||
|
$clientData['mail_domain'] = $this->request->getPost('mail_domain');
|
||||||
$clientModel->update($id,$clientData);
|
$clientModel->update($id,$clientData);
|
||||||
|
|
||||||
foreach ($data as $key => $value)
|
foreach ($data as $key => $value)
|
||||||
@ -159,4 +163,39 @@ class NotificationController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function for sent a mail for testing
|
||||||
|
public function sentTestMail($template_id, $test_mail)
|
||||||
|
{
|
||||||
|
$notification_data = $this->notificationModel->where('id', $template_id)->where('enabled', 1)->first();
|
||||||
|
$client_data = $this->clientModel->where('id', $notification_data['client_id'])->where('is_active', 1)->first();
|
||||||
|
|
||||||
|
if(!empty($notification_data)){
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'client_data' => $client_data,
|
||||||
|
'notification_data' => $notification_data,
|
||||||
|
'test_mail' => $test_mail
|
||||||
|
];
|
||||||
|
|
||||||
|
$testMailData = sendMailNotification::sendMailNotificationForTesting($notification_data['template_name'], $params);
|
||||||
|
// print_r($testMailData); die;
|
||||||
|
if (!empty($testMailData)) {
|
||||||
|
|
||||||
|
$mail_send_return1 = MailHelper::send_email($testMailData);
|
||||||
|
$this->myLogger->logme("info", $mail_send_return1);
|
||||||
|
$this->myLogger->logme("info", $mail_send_return1);
|
||||||
|
|
||||||
|
return $this->respond(['status' => true,'code' => 200, 'respond' => json_decode($mail_send_return1)]);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return $this->respond(['status' => false,'code' => 200, 'message' => 'Test Mail Data Does Not Exist']);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
|
||||||
|
return $this->respond(['status' => false,'code' => 200, 'message' => 'Notification Template not enabled']);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ class CloseDbConnection implements FilterInterface
|
|||||||
// Get all database configurations
|
// Get all database configurations
|
||||||
$db = \Config\Database::connect();
|
$db = \Config\Database::connect();
|
||||||
$log = \Config\Services::mylogger();
|
$log = \Config\Services::mylogger();
|
||||||
$log->logme('error','CloseDbConnections....!');
|
// $log->logme('error','CloseDbConnections....!');
|
||||||
$db->close();
|
$db->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,6 +93,8 @@ class MailHelper
|
|||||||
$emaill = $params['mail'];
|
$emaill = $params['mail'];
|
||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
|
|
||||||
|
//check BCC mail
|
||||||
if (isset($params['bcc'])) {
|
if (isset($params['bcc'])) {
|
||||||
$bcc = $params['bcc'];
|
$bcc = $params['bcc'];
|
||||||
$bcc = explode(',', $bcc);
|
$bcc = explode(',', $bcc);
|
||||||
@ -100,16 +102,23 @@ class MailHelper
|
|||||||
$bcc = [];
|
$bcc = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check CC mail
|
||||||
if (isset($params['cc'])) {
|
if (isset($params['cc'])) {
|
||||||
$cc = $params['cc'];
|
$cc = $params['cc'];
|
||||||
$cc = explode(',', $cc);
|
$cc = explode(',', $cc);
|
||||||
}else{
|
}else{
|
||||||
$cc = [];
|
$cc = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check REPLY TO mail
|
||||||
|
$reply_to = "";
|
||||||
|
if(isset($params['reply_to']) && !empty($params['reply_to'])){
|
||||||
|
$reply_to = $params['reply_to'];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'no-reply@nhanceindia.in', $reply_to, $cc, $bcc);
|
||||||
$res = $gmailapi->sendMessage($emaill, $subject, $message, 'info@nhanceindia.in', 'info@nhanceindia.in', $cc, $bcc);
|
|
||||||
|
|
||||||
if($res['status'])
|
if($res['status'])
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class sendMailNotification
|
|||||||
{
|
{
|
||||||
$wholeData =[];
|
$wholeData =[];
|
||||||
if ($action == 'member_welcome_mail') {
|
if ($action == 'member_welcome_mail') {
|
||||||
|
|
||||||
$dataToInsert = $params['dataToInsert'];
|
$dataToInsert = $params['dataToInsert'];
|
||||||
$notification = $params['notification'];
|
$notification = $params['notification'];
|
||||||
$client_data = $params['client_data'];
|
$client_data = $params['client_data'];
|
||||||
@ -33,10 +34,13 @@ class sendMailNotification
|
|||||||
|
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
if ($dataToInsert['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
} else if($action == 'member_reminder_mail'){
|
} else if($action == 'member_reminder_mail'){
|
||||||
|
|
||||||
$EmployeeModel = new EmployeeModel();
|
$EmployeeModel = new EmployeeModel();
|
||||||
$emp_data = $params['emp_data'];
|
$emp_data = $params['emp_data'];
|
||||||
$notification_data = $params['notification_data'];
|
$notification_data = $params['notification_data'];
|
||||||
@ -46,9 +50,12 @@ class sendMailNotification
|
|||||||
$app_link = $_ENV['App_Url'];
|
$app_link = $_ENV['App_Url'];
|
||||||
$mail_content = $notification_data['mail_content'];
|
$mail_content = $notification_data['mail_content'];
|
||||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
|
if ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||||
if(isset($emp_data['relationship'])){
|
if(isset($emp_data['relationship'])){
|
||||||
@ -72,9 +79,11 @@ class sendMailNotification
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($mail) && !empty($mail)) {
|
if (isset($mail) && !empty($mail)) {
|
||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
foreach ($emp_data as $key => $value) {
|
foreach ($emp_data as $key => $value) {
|
||||||
if ($value['relationship'] != 'Self') {
|
if ($value['relationship'] != 'Self') {
|
||||||
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
|
||||||
@ -96,7 +105,7 @@ class sendMailNotification
|
|||||||
$mail = $value['email_corporate'];
|
$mail = $value['email_corporate'];
|
||||||
}
|
}
|
||||||
if (isset($mail) && !empty($mail)) {
|
if (isset($mail) && !empty($mail)) {
|
||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,10 +113,13 @@ class sendMailNotification
|
|||||||
if (count($wholeData) < 1) {
|
if (count($wholeData) < 1) {
|
||||||
$wholeData = [];
|
$wholeData = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
// }else{
|
// }else{
|
||||||
// return "false";
|
// return "false";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
} else if($action == 'member_ecard_mail'){
|
} else if($action == 'member_ecard_mail'){
|
||||||
|
|
||||||
$notification = $params['notification'];
|
$notification = $params['notification'];
|
||||||
@ -144,9 +156,10 @@ class sendMailNotification
|
|||||||
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
// $mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
|
|
||||||
} else if($action == 'member_review_and_summary_mail'){
|
} else if($action == 'member_review_and_summary_mail'){
|
||||||
|
|
||||||
$array_list = $params['array_list'];//employeee lst
|
$array_list = $params['array_list'];//employeee lst
|
||||||
@ -189,64 +202,66 @@ class sendMailNotification
|
|||||||
|
|
||||||
foreach ($array_list as $item) {
|
foreach ($array_list as $item) {
|
||||||
if (count($item) != 0) {
|
if (count($item) != 0) {
|
||||||
$table_content .= '<div style="text-align: left; font-size: 12px; ">';
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
$table_content .= '<div style="text-align:left;"><h4 style="font-size: 12px; ">Policy Name : ';
|
|
||||||
$temp_data = '';
|
$temp_data = '';
|
||||||
$policy_name = '';
|
$policy_name = '';
|
||||||
$is_addon = '';
|
$is_addon = '';
|
||||||
|
|
||||||
foreach ($item as $inner_item) {
|
foreach ($item as $inner_item) {
|
||||||
$policy_name = $inner_item['policy_name'];
|
$policy_name = $inner_item['policy_name'];
|
||||||
$temp_data .= '<tr style="font-size: 12px; ">';
|
|
||||||
$temp_data .= '<td>' . $inner_item['name'] . '</td>';
|
if ($inner_item['relationship'] == 'Self') {
|
||||||
|
$emp_code = ' (' . $inner_item['emp_code'] . ')';
|
||||||
|
} else {
|
||||||
|
$emp_code = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$temp_data .= '<tr>';
|
||||||
|
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
||||||
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
||||||
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data .= '</tr>';
|
$temp_data .= '</tr>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($inner_item['relationship'] == 'Self' || $inner_item['relationship'] == 'self') {
|
|
||||||
$mail = $inner_item['email_corporate'];
|
|
||||||
$name = $inner_item['name'];
|
|
||||||
$emp_code = $inner_item['emp_code'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_addon = $inner_item['is_addon'];
|
$is_addon = $inner_item['is_addon'];
|
||||||
|
|
||||||
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
||||||
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
|
$addtional_premium = $inner_item['rata_premimum'] + $addtional_premium;
|
||||||
$gst = $inner_item['gst'] + $gst;
|
$gst = $inner_item['gst'] + $gst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_content .= $policy_name . '</h4></div>';
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
|
||||||
|
// Add text-align: center to the table head
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '<th>Name</th>';
|
$table_content .= '<th>Name</th>';
|
||||||
$table_content .= '<th>Relation</th>';
|
$table_content .= '<th>Relation</th>';
|
||||||
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
$table_content .= '<th>Sum Insured</th>';
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
$table_content .= '<th>Premium</th>';
|
$table_content .= '<th>Premium</th>';
|
||||||
$table_content .= '<th>GST</th>';
|
$table_content .= '<th>GST</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_content .= '</tr>';
|
$table_content .= '</tr>';
|
||||||
$table_content .= '</thead>';
|
$table_content .= '</thead>';
|
||||||
$table_content .= '<tbody>' . $temp_data . '</tbody>';
|
|
||||||
|
// Add text-align: center to the table body
|
||||||
|
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
|
||||||
$table_content .= '</table></div>';
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
$addon_list_array = [
|
$addon_list_array = [
|
||||||
'policy_name' => $policy_name,
|
'policy_name' => $policy_name,
|
||||||
@ -255,36 +270,52 @@ class sendMailNotification
|
|||||||
];
|
];
|
||||||
$Addon_list[] = $addon_list_array;
|
$Addon_list[] = $addon_list_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data = '';
|
$temp_data = '';
|
||||||
$addtional_premium = 0;
|
$addtional_premium = 0;
|
||||||
$gst = 0;
|
$gst = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($Addon_list) != 0 && count($Addon_list) > 0) {
|
if (count($Addon_list) > 0) {
|
||||||
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
$table_content .= '<br><div style="text-align: left; font-size: 12px; ">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<div style="text-align:left;">';
|
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
// Center align for table header and body
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr style="font-size: 12px;" ><th>Policy Name</th><th>Additional Premium</th><th>GST</th><th>Total</th></tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '</thead><tbody>';
|
$table_content .= '<th>Policy Name</th>';
|
||||||
$sum_tolal = 0;
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
$table_content .= '<th>Total</th>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
|
$sum_total = 0;
|
||||||
foreach ($Addon_list as $key => $value) {
|
foreach ($Addon_list as $key => $value) {
|
||||||
$sum_tolal = $value['gst'] + $value['addtional_premium'] + $sum_tolal;
|
$total_addon = $value['gst'] + $value['addtional_premium'];
|
||||||
$table_content .= '<tr style="font-size: 12px; "><td>' . $value['policy_name'] . '</td>';
|
$sum_total += $total_addon;
|
||||||
|
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $value['policy_name'] . '</td>';
|
||||||
$table_content .= '<td>₹' . format_indian_number($value['addtional_premium']) . '</td>';
|
$table_content .= '<td>₹' . format_indian_number($value['addtional_premium']) . '</td>';
|
||||||
$table_content .= '<td>₹' . format_indian_number($value['gst']) . '</td>';
|
$table_content .= '<td>₹' . format_indian_number($value['gst']) . '</td>';
|
||||||
$table_content .= '<td>₹' . format_indian_number(($value['gst'] + $value['addtional_premium'])) . '</td></tr>';
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sum_total_words = numberToWords($sum_tolal);
|
$sum_total_words = numberToWords($sum_total);
|
||||||
$table_content .= '<tr style="font-size: 12px;"><td></td><td></td><td><b>Total</b></td><td>₹' . format_indian_number($sum_tolal) . '</td></tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '</tbody></table></div></div>';
|
$table_content .= '<td></td><td></td><td><b>Total</b></td>';
|
||||||
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px; ">' . $sum_total_words . '</div>';
|
$table_content .= '<td>₹' . format_indian_number($sum_total) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div></div>';
|
||||||
|
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// print_r($table_content); die;
|
// print_r($table_content); die;
|
||||||
@ -296,7 +327,7 @@ class sendMailNotification
|
|||||||
|
|
||||||
// $mail = "aadhavanvalli@gmail.com";
|
// $mail = "aadhavanvalli@gmail.com";
|
||||||
// if (isset($mail) && !empty($mail)) {
|
// if (isset($mail) && !empty($mail)) {
|
||||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
@ -349,7 +380,6 @@ class sendMailNotification
|
|||||||
$Addon_list = [];
|
$Addon_list = [];
|
||||||
|
|
||||||
foreach ($array_list as $item) {
|
foreach ($array_list as $item) {
|
||||||
|
|
||||||
if (count($item) != 0) {
|
if (count($item) != 0) {
|
||||||
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
$temp_data = '';
|
$temp_data = '';
|
||||||
@ -364,19 +394,19 @@ class sendMailNotification
|
|||||||
} else {
|
} else {
|
||||||
$emp_code = '';
|
$emp_code = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data .= '<tr>';
|
$temp_data .= '<tr>';
|
||||||
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
||||||
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
||||||
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data .= '</tr>';
|
$temp_data .= '</tr>';
|
||||||
|
|
||||||
$is_addon = $inner_item['is_addon'];
|
$is_addon = $inner_item['is_addon'];
|
||||||
@ -389,22 +419,26 @@ class sendMailNotification
|
|||||||
|
|
||||||
$table_content .= $policy_name . '</h4></div>';
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
|
||||||
|
// Add text-align: center to the table head
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '<th>Name</th>';
|
$table_content .= '<th>Name</th>';
|
||||||
$table_content .= '<th>Relation</th>';
|
$table_content .= '<th>Relation</th>';
|
||||||
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
$table_content .= '<th>Sum Insured</th>';
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
$table_content .= '<th>Premium</th>';
|
$table_content .= '<th>Premium</th>';
|
||||||
$table_content .= '<th>GST</th>';
|
$table_content .= '<th>GST</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_content .= '</tr>';
|
$table_content .= '</tr>';
|
||||||
$table_content .= '</thead>';
|
$table_content .= '</thead>';
|
||||||
$table_content .= '<tbody>' . $temp_data . '</tbody>';
|
|
||||||
|
// Add text-align: center to the table body
|
||||||
|
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
|
||||||
$table_content .= '</table></div>';
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
@ -425,7 +459,9 @@ class sendMailNotification
|
|||||||
if (count($Addon_list) > 0) {
|
if (count($Addon_list) > 0) {
|
||||||
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
|
||||||
|
// Center align for table header and body
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '<th>Policy Name</th>';
|
$table_content .= '<th>Policy Name</th>';
|
||||||
$table_content .= '<th>Additional Premium</th>';
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
@ -433,8 +469,9 @@ class sendMailNotification
|
|||||||
$table_content .= '<th>Total</th>';
|
$table_content .= '<th>Total</th>';
|
||||||
$table_content .= '</tr>';
|
$table_content .= '</tr>';
|
||||||
$table_content .= '</thead>';
|
$table_content .= '</thead>';
|
||||||
$table_content .= '<tbody>';
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
$sum_total = 0;
|
$sum_total = 0;
|
||||||
foreach ($Addon_list as $key => $value) {
|
foreach ($Addon_list as $key => $value) {
|
||||||
$total_addon = $value['gst'] + $value['addtional_premium'];
|
$total_addon = $value['gst'] + $value['addtional_premium'];
|
||||||
@ -457,6 +494,7 @@ class sendMailNotification
|
|||||||
$table_content .= '</table></div></div>';
|
$table_content .= '</table></div></div>';
|
||||||
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
|
|
||||||
@ -466,7 +504,7 @@ class sendMailNotification
|
|||||||
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
$full_name = $value['first_name'] .' ' .$value['last_name'];
|
||||||
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
|
$mail_content = str_replace("[[member_name]]", $full_name , $mail_content);
|
||||||
|
|
||||||
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content];
|
$wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
// $wholeData[] = ['mail' => $value['email'], 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
}
|
}
|
||||||
return $wholeData;
|
return $wholeData;
|
||||||
@ -519,7 +557,6 @@ class sendMailNotification
|
|||||||
$Addon_list = [];
|
$Addon_list = [];
|
||||||
|
|
||||||
foreach ($array_list as $item) {
|
foreach ($array_list as $item) {
|
||||||
|
|
||||||
if (count($item) != 0) {
|
if (count($item) != 0) {
|
||||||
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
$temp_data = '';
|
$temp_data = '';
|
||||||
@ -534,19 +571,19 @@ class sendMailNotification
|
|||||||
} else {
|
} else {
|
||||||
$emp_code = '';
|
$emp_code = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data .= '<tr>';
|
$temp_data .= '<tr>';
|
||||||
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
$temp_data .= '<td>' . $inner_item['name'] . $emp_code . '</td>';
|
||||||
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
$temp_data .= '<td>' . $inner_item['relationship'] . '</td>';
|
||||||
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
$temp_data .= '<td>' . \DateTime::createFromFormat('Y-m-d', $inner_item['dob'])->format('d-m-Y') . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number($inner_item['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
if ($inner_item['is_addon'] == 2 || $inner_item['is_addon'] == 3) {
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['premium'])) . '</td>';
|
||||||
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
$temp_data .= '<td>₹' . format_indian_number(round($inner_item['gst'])) . '</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp_data .= '</tr>';
|
$temp_data .= '</tr>';
|
||||||
|
|
||||||
$is_addon = $inner_item['is_addon'];
|
$is_addon = $inner_item['is_addon'];
|
||||||
@ -559,22 +596,26 @@ class sendMailNotification
|
|||||||
|
|
||||||
$table_content .= $policy_name . '</h4></div>';
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
|
||||||
|
// Add text-align: center to the table head
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '<th>Name</th>';
|
$table_content .= '<th>Name</th>';
|
||||||
$table_content .= '<th>Relation</th>';
|
$table_content .= '<th>Relation</th>';
|
||||||
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
$table_content .= '<th>Sum Insured</th>';
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
//Only Display SI Topup and Dependent Addon
|
// Only Display SI Topup and Dependent Addon
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
$table_content .= '<th>Premium</th>';
|
$table_content .= '<th>Premium</th>';
|
||||||
$table_content .= '<th>GST</th>';
|
$table_content .= '<th>GST</th>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$table_content .= '</tr>';
|
$table_content .= '</tr>';
|
||||||
$table_content .= '</thead>';
|
$table_content .= '</thead>';
|
||||||
$table_content .= '<tbody>' . $temp_data . '</tbody>';
|
|
||||||
|
// Add text-align: center to the table body
|
||||||
|
$table_content .= '<tbody style="text-align: center;">' . $temp_data . '</tbody>';
|
||||||
$table_content .= '</table></div>';
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
if ($is_addon == 2 || $is_addon == 3) {
|
if ($is_addon == 2 || $is_addon == 3) {
|
||||||
@ -595,7 +636,9 @@ class sendMailNotification
|
|||||||
if (count($Addon_list) > 0) {
|
if (count($Addon_list) > 0) {
|
||||||
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff;">';
|
|
||||||
|
// Center align for table header and body
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
$table_content .= '<tr>';
|
$table_content .= '<tr>';
|
||||||
$table_content .= '<th>Policy Name</th>';
|
$table_content .= '<th>Policy Name</th>';
|
||||||
$table_content .= '<th>Additional Premium</th>';
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
@ -603,8 +646,9 @@ class sendMailNotification
|
|||||||
$table_content .= '<th>Total</th>';
|
$table_content .= '<th>Total</th>';
|
||||||
$table_content .= '</tr>';
|
$table_content .= '</tr>';
|
||||||
$table_content .= '</thead>';
|
$table_content .= '</thead>';
|
||||||
$table_content .= '<tbody>';
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
$sum_total = 0;
|
$sum_total = 0;
|
||||||
foreach ($Addon_list as $key => $value) {
|
foreach ($Addon_list as $key => $value) {
|
||||||
$total_addon = $value['gst'] + $value['addtional_premium'];
|
$total_addon = $value['gst'] + $value['addtional_premium'];
|
||||||
@ -627,7 +671,7 @@ class sendMailNotification
|
|||||||
$table_content .= '</table></div></div>';
|
$table_content .= '</table></div></div>';
|
||||||
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
// $table_content .= '<div style="width:100%; text-align:right; font-size: 12px;">' . $sum_total_words . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
|
|
||||||
|
|
||||||
@ -636,7 +680,7 @@ class sendMailNotification
|
|||||||
$mail_array = array_map('trim', $mail_array);
|
$mail_array = array_map('trim', $mail_array);
|
||||||
$wholeData = [];
|
$wholeData = [];
|
||||||
foreach ($mail_array as $key => $value) {
|
foreach ($mail_array as $key => $value) {
|
||||||
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content];
|
$wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
// $wholeData[] = ['mail' => $value, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,4 +689,555 @@ class sendMailNotification
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sendMailNotificationForTesting($action, $params)
|
||||||
|
{
|
||||||
|
$wholeData =[];
|
||||||
|
|
||||||
|
if ($action == 'member_welcome_mail') {
|
||||||
|
|
||||||
|
$clientModel = new ClientModel();
|
||||||
|
|
||||||
|
$notification = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
$mail_content = $notification['mail_content'];
|
||||||
|
$subject = $notification['subject'];
|
||||||
|
|
||||||
|
$employee_name = 'John Doe';
|
||||||
|
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
if ($mail != null || $mail != '') {
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
|
||||||
|
} else if($action == 'member_reminder_mail'){
|
||||||
|
|
||||||
|
$notification_data = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
$mail_content = $notification_data['mail_content'];
|
||||||
|
$subject = $notification_data['subject'];
|
||||||
|
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
|
||||||
|
$employee_name = 'John Doe';
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
if ((isset($notification_data) && $notification_data['enabled'] == 1)) {
|
||||||
|
|
||||||
|
if (isset($mail) && !empty($mail)) {
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
|
||||||
|
|
||||||
|
} else if($action == 'member_ecard_mail'){
|
||||||
|
|
||||||
|
$notification = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
$mail_content = $notification['mail_content'];
|
||||||
|
$subject = $notification['subject'];
|
||||||
|
|
||||||
|
$rand_string = 'HX3kUh';
|
||||||
|
$link = generate_download_link($rand_string);
|
||||||
|
|
||||||
|
$name = 'John Doe';
|
||||||
|
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_app_link'>Review Details</a>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
|
||||||
|
} else if($action == 'member_review_and_summary_mail'){
|
||||||
|
|
||||||
|
$array_list = [
|
||||||
|
'policy_name' => 'Health Insurance Plan',
|
||||||
|
'emp_code' => 'E12345',
|
||||||
|
'name' => 'John Doe',
|
||||||
|
'relationship' => 'Self',
|
||||||
|
'dob' => '1985-05-15',
|
||||||
|
'basic_cover_si' => 500000,
|
||||||
|
'premium' => 12000,
|
||||||
|
'gst' => 2160,
|
||||||
|
'rata_premimum' => 12000,
|
||||||
|
'is_addon' => 2
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
$notification_data = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
if (isset($notification_data) && $notification_data['enabled'] == 1) {
|
||||||
|
|
||||||
|
$mail_content = $notification_data['mail_content'];
|
||||||
|
$subject = $notification_data['subject'];
|
||||||
|
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
|
$table_content = '';
|
||||||
|
$addtional_premium = 0;
|
||||||
|
$gst = 0;
|
||||||
|
$Addon_list = [];
|
||||||
|
$name = $array_list['name'];
|
||||||
|
$emp_code = '';
|
||||||
|
|
||||||
|
if (!empty($array_list)) {
|
||||||
|
|
||||||
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
|
|
||||||
|
$policy_name = $array_list['policy_name'];
|
||||||
|
|
||||||
|
if ($array_list['relationship'] == 'Self') {
|
||||||
|
$emp_code = ' (' . $array_list['emp_code'] . ')';
|
||||||
|
} else {
|
||||||
|
$emp_code = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start table row
|
||||||
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Name</th>';
|
||||||
|
$table_content .= '<th>Relation</th>';
|
||||||
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
|
// Only Display SI Topup and Dependent Addon
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<th>Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
// Table body with details
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $array_list['name'] . $emp_code . '</td>';
|
||||||
|
$table_content .= '<td>' . $array_list['relationship'] . '</td>';
|
||||||
|
$table_content .= '<td>' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($array_list['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['premium'])) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['gst'])) . '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
|
// Calculate additional premium and GST if applicable
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$addtional_premium = $array_list['rata_premimum'];
|
||||||
|
$gst = $array_list['gst'];
|
||||||
|
|
||||||
|
// Prepare addon summary
|
||||||
|
$addon_list_array = [
|
||||||
|
'policy_name' => $policy_name,
|
||||||
|
'addtional_premium' => round($addtional_premium),
|
||||||
|
'gst' => round($gst)
|
||||||
|
];
|
||||||
|
|
||||||
|
$Addon_list[] = $addon_list_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate summary table for addon if applicable
|
||||||
|
if (count($Addon_list) > 0) {
|
||||||
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Policy Name</th>';
|
||||||
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
$table_content .= '<th>Total</th>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
|
$total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $Addon_list[0]['policy_name'] . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['gst']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
|
||||||
|
$sum_total_words = numberToWords($total_addon);
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td></td><td></td><td><b>Total</b></td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
|
|
||||||
|
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if($action == 'account_maneger_summary_mail'){
|
||||||
|
|
||||||
|
$array_list = [
|
||||||
|
'policy_name' => 'Health Insurance Plan',
|
||||||
|
'emp_code' => 'E12345',
|
||||||
|
'name' => 'John Doe',
|
||||||
|
'relationship' => 'Self',
|
||||||
|
'dob' => '1985-05-15',
|
||||||
|
'basic_cover_si' => 500000,
|
||||||
|
'premium' => 12000,
|
||||||
|
'gst' => 2160,
|
||||||
|
'rata_premimum' => 12000,
|
||||||
|
'is_addon' => 2
|
||||||
|
];
|
||||||
|
|
||||||
|
$notification_data = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
if (isset($notification_data) && $notification_data['enabled'] == 1) {
|
||||||
|
|
||||||
|
$mail_content = $notification_data['mail_content'];
|
||||||
|
$subject = $notification_data['subject'];
|
||||||
|
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
|
$table_content = '';
|
||||||
|
$addtional_premium = 0;
|
||||||
|
$gst = 0;
|
||||||
|
$Addon_list = [];
|
||||||
|
$name = $array_list['name'];
|
||||||
|
$emp_code = '';
|
||||||
|
|
||||||
|
if (!empty($array_list)) {
|
||||||
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
|
|
||||||
|
$policy_name = $array_list['policy_name'];
|
||||||
|
|
||||||
|
if ($array_list['relationship'] == 'Self') {
|
||||||
|
$emp_code = ' (' . $array_list['emp_code'] . ')';
|
||||||
|
} else {
|
||||||
|
$emp_code = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start table row
|
||||||
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Name</th>';
|
||||||
|
$table_content .= '<th>Relation</th>';
|
||||||
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
|
// Only Display SI Topup and Dependent Addon
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<th>Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
// Table body with details
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $array_list['name'] . $emp_code . '</td>';
|
||||||
|
$table_content .= '<td>' . $array_list['relationship'] . '</td>';
|
||||||
|
$table_content .= '<td>' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($array_list['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['premium'])) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['gst'])) . '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
|
// Calculate additional premium and GST if applicable
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$addtional_premium = $array_list['rata_premimum'];
|
||||||
|
$gst = $array_list['gst'];
|
||||||
|
|
||||||
|
// Prepare addon summary
|
||||||
|
$addon_list_array = [
|
||||||
|
'policy_name' => $policy_name,
|
||||||
|
'addtional_premium' => round($addtional_premium),
|
||||||
|
'gst' => round($gst)
|
||||||
|
];
|
||||||
|
|
||||||
|
$Addon_list[] = $addon_list_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate summary table for addon if applicable
|
||||||
|
if (count($Addon_list) > 0) {
|
||||||
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Policy Name</th>';
|
||||||
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
$table_content .= '<th>Total</th>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
|
$total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $Addon_list[0]['policy_name'] . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['gst']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
|
||||||
|
$sum_total_words = numberToWords($total_addon);
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td></td><td></td><td><b>Total</b></td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
|
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if($action == 'client_hr_summary_mail'){
|
||||||
|
|
||||||
|
$array_list = [
|
||||||
|
'policy_name' => 'Health Insurance Plan',
|
||||||
|
'emp_code' => 'E12345',
|
||||||
|
'name' => 'John Doe',
|
||||||
|
'relationship' => 'Self',
|
||||||
|
'dob' => '1985-05-15',
|
||||||
|
'basic_cover_si' => 500000,
|
||||||
|
'premium' => 12000,
|
||||||
|
'gst' => 2160,
|
||||||
|
'rata_premimum' => 12000,
|
||||||
|
'is_addon' => 2
|
||||||
|
];
|
||||||
|
|
||||||
|
$notification_data = $params['notification_data'];
|
||||||
|
$client_data = $params['client_data'];
|
||||||
|
$mail = $params['test_mail'];
|
||||||
|
|
||||||
|
if (isset($notification_data['enabled']) && $notification_data['enabled'] == 1) {
|
||||||
|
|
||||||
|
$mail_content = $notification_data['mail_content'];
|
||||||
|
$subject = $notification_data['subject'];
|
||||||
|
|
||||||
|
$app_link = $_ENV['App_Url'];
|
||||||
|
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||||
|
|
||||||
|
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_logo]]", "<img src='$client_logo' alt='Client Logo' width='20'>", $mail_content);
|
||||||
|
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||||
|
|
||||||
|
// Step 1: Replace the placeholder with an HTML table structure
|
||||||
|
$table_content = '';
|
||||||
|
$addtional_premium = 0;
|
||||||
|
$gst = 0;
|
||||||
|
$Addon_list = [];
|
||||||
|
$name = $array_list['name'];
|
||||||
|
$emp_code = '';
|
||||||
|
|
||||||
|
if (!empty($array_list)) {
|
||||||
|
|
||||||
|
$table_content .= '<div style="text-align: left; font-size: 12px;"><div style="text-align:left;"><h4>Policy Name : ';
|
||||||
|
|
||||||
|
$policy_name = $array_list['policy_name'];
|
||||||
|
|
||||||
|
if ($array_list['relationship'] == 'Self') {
|
||||||
|
$emp_code = ' (' . $array_list['emp_code'] . ')';
|
||||||
|
} else {
|
||||||
|
$emp_code = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start table row
|
||||||
|
$table_content .= $policy_name . '</h4></div>';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Name</th>';
|
||||||
|
$table_content .= '<th>Relation</th>';
|
||||||
|
$table_content .= '<th style="width:15%">Date Of Birth</th>';
|
||||||
|
$table_content .= '<th>Sum Insured</th>';
|
||||||
|
|
||||||
|
// Only Display SI Topup and Dependent Addon
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<th>Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
// Table body with details
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $array_list['name'] . $emp_code . '</td>';
|
||||||
|
$table_content .= '<td>' . $array_list['relationship'] . '</td>';
|
||||||
|
$table_content .= '<td>' . \DateTime::createFromFormat('Y-m-d', $array_list['dob'])->format('d-m-Y') . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($array_list['basic_cover_si']) . '</td>';
|
||||||
|
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['premium'])) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number(round($array_list['gst'])) . '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div>';
|
||||||
|
|
||||||
|
// Calculate additional premium and GST if applicable
|
||||||
|
if ($array_list['is_addon'] == 2 || $array_list['is_addon'] == 3) {
|
||||||
|
$addtional_premium = $array_list['rata_premimum'];
|
||||||
|
$gst = $array_list['gst'];
|
||||||
|
|
||||||
|
// Prepare addon summary
|
||||||
|
$addon_list_array = [
|
||||||
|
'policy_name' => $policy_name,
|
||||||
|
'addtional_premium' => round($addtional_premium),
|
||||||
|
'gst' => round($gst)
|
||||||
|
];
|
||||||
|
|
||||||
|
$Addon_list[] = $addon_list_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate summary table for addon if applicable
|
||||||
|
if (count($Addon_list) > 0) {
|
||||||
|
|
||||||
|
$table_content .= '<br><div style="text-align: left; font-size: 12px;"><div style="text-align:left;">';
|
||||||
|
$table_content .= '<table border="1" cellpadding="5" cellspacing="0" style="width:100%; border-collapse: collapse; font-size: 12px;">';
|
||||||
|
|
||||||
|
$table_content .= '<thead style="background-color: #02a8b5; color: #ffffff; text-align: center;">';
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<th>Policy Name</th>';
|
||||||
|
$table_content .= '<th>Additional Premium</th>';
|
||||||
|
$table_content .= '<th>GST</th>';
|
||||||
|
$table_content .= '<th>Total</th>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</thead>';
|
||||||
|
|
||||||
|
$table_content .= '<tbody style="text-align: center;">';
|
||||||
|
|
||||||
|
$total_addon = $Addon_list[0]['gst'] + $Addon_list[0]['addtional_premium'];
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td>' . $Addon_list[0]['policy_name'] . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['addtional_premium']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($Addon_list[0]['gst']) . '</td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
|
||||||
|
$sum_total_words = numberToWords($total_addon);
|
||||||
|
$table_content .= '<tr>';
|
||||||
|
$table_content .= '<td></td><td></td><td><b>Total</b></td>';
|
||||||
|
$table_content .= '<td>₹' . format_indian_number($total_addon) . '</td>';
|
||||||
|
$table_content .= '</tr>';
|
||||||
|
$table_content .= '</tbody>';
|
||||||
|
$table_content .= '</table></div></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$mail_content = str_replace("[[member_name]]", $name . ' (' . $emp_code . ')' , $mail_content);
|
||||||
|
$mail_content = str_replace("[[member_summary]]", $table_content , $mail_content);
|
||||||
|
|
||||||
|
|
||||||
|
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'reply_to' => $client_data['reply_to']];
|
||||||
|
|
||||||
|
return $wholeData;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -37,6 +37,8 @@ class ClientModel extends Model
|
|||||||
"reference",
|
"reference",
|
||||||
"phone",
|
"phone",
|
||||||
"email",
|
"email",
|
||||||
|
"reply_to",
|
||||||
|
"mail_domain",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,6 +49,7 @@ class ClientPolicyModel extends Model
|
|||||||
"cd_ac_no",
|
"cd_ac_no",
|
||||||
"gst",
|
"gst",
|
||||||
"enrolment_visibility",
|
"enrolment_visibility",
|
||||||
|
"disclaimer",
|
||||||
"is_active",
|
"is_active",
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -404,9 +405,24 @@ public function getPolicyDetailsForRemainder($client_id = null, $branch_id = nul
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $builder->get()->getResultArray();
|
return $builder->get()->getResultArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
//for this using in CRONE JOB
|
||||||
|
public function getPolicyDetailsForEnrollment($client_id = null, $branch_id = null)
|
||||||
|
{
|
||||||
|
$builder = $this->table('client_policy')
|
||||||
|
->where('client_policy.is_active', 1)
|
||||||
|
->where('client_policy.policy_status', 1)
|
||||||
|
->where('client_policy.open_date IS NOT NULL')
|
||||||
|
->where('client_policy.close_date IS NOT NULL');
|
||||||
|
|
||||||
|
if ($client_id && $branch_id) {
|
||||||
|
$builder->where('client_policy.client_id', $client_id)
|
||||||
|
->where('client_policy.client_branch_id', $branch_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $builder->get()->getResultArray();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -161,7 +161,7 @@ class EmployeeModel extends Model
|
|||||||
// for EMP rest API process do not change
|
// for EMP rest API process do not change
|
||||||
public function checkExistingEmployee($arr,$client_branch_id)
|
public function checkExistingEmployee($arr,$client_branch_id)
|
||||||
{
|
{
|
||||||
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->where('client_branch_id', $client_branch_id)->first();
|
return $this->where('emp_code',$arr['emp_code'])->where('name',$arr['name'])->where('client_id', $arr['client_id'])->where('client_branch_id', $client_branch_id)->where('emp_status !=', 'truncated')->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,6 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="mobile">GST ( % )<span id="tpa_danger" class="text-danger">*</span></label>
|
<label for="mobile">GST ( % )<span id="tpa_danger" class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
||||||
@ -143,18 +142,27 @@
|
|||||||
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
<label for="inception_type" style="position: relative;bottom: 5px;left: 85px;">Enable
|
||||||
Employee Enrolment Process</label>
|
Employee Enrolment Process</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Open Date " name="open_date" id="open_date" >
|
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Open Date " name="open_date" id="open_date" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" >
|
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Reminder Date " name="reminder_date" id="reminder_date" >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
||||||
|
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
<label class="switch" style="position: relative;top: 43px;left: 20px;">
|
||||||
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
|
<input id="policy_visibility" type="checkbox" name="enrolment_visibility" checked>
|
||||||
@ -743,6 +751,7 @@
|
|||||||
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
$('#end_date').val(rearrangeDateFormat(res.data.policy_end_date));
|
||||||
$('#close_date').val(rearrangeDateFormat(res.data.close_date));
|
$('#close_date').val(rearrangeDateFormat(res.data.close_date));
|
||||||
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
$('#reminder_date').val(rearrangeDateFormat(res.data.reminder_date));
|
||||||
|
$('#disclaimer').val(res.data.disclaimer);
|
||||||
$('#gst_no').val(gst);
|
$('#gst_no').val(gst);
|
||||||
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
$('#policy_status').val(checkDateStatus(res.data.policy_end_date));
|
||||||
$('#policy_status_field').show();
|
$('#policy_status_field').show();
|
||||||
|
|||||||
@ -5,6 +5,10 @@
|
|||||||
.preview_button{
|
.preview_button{
|
||||||
display:none;
|
display:none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scrollb {
|
||||||
|
overflow-y: auto !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<div class="tab-pane fade" id="notification-tab">
|
<div class="tab-pane fade" id="notification-tab">
|
||||||
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/>
|
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($notification['id']) ? $notification['id'] : '' ?>"/>
|
||||||
@ -56,16 +60,29 @@
|
|||||||
?></p>
|
?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_name">Team mail ID<span class="text-danger">*</span></label>
|
<label for="branch_name">Team mail ID<span class="text-danger"></span></label>
|
||||||
<textarea name="" id="nhance_team_mail_ids" class="form-control" placeholder="Example: jhon@gmail.com, dave@gmail.com"><?php echo isset($client['common_mails']) ? $client['common_mails'] : ''; ?></textarea>
|
<textarea name="" id="nhance_team_mail_ids" class="form-control" placeholder="Example: jhon@gmail.com, dave@gmail.com"><?php echo isset($client['common_mails']) ? $client['common_mails'] : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_name">HR mail ID<span class="text-danger">*</span></label>
|
<label for="branch_name">HR mail ID<span class="text-danger"></span></label>
|
||||||
<textarea name="" id="hr_mail_id" class="form-control" placeholder="Example: jhon@gmail.com, dave@gmail.com"><?php echo isset($client['hr_mails']) ? $client['hr_mails'] : ''; ?></textarea>
|
<textarea name="" id="hr_mail_id" class="form-control" placeholder="Example: jhon@gmail.com, dave@gmail.com"><?php echo isset($client['hr_mails']) ? $client['hr_mails'] : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="mail_domain">Mail Domain<span class="text-danger"></span></label>
|
||||||
|
<input type="text" name="" id="mail_domain" class="form-control" placeholder="Only one Domain Name. Example: nhance.com" value="<?php echo isset($client['mail_domain']) ? $client['mail_domain'] : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-6">
|
||||||
|
<label for="reply_to">Reply To Mail<span class="text-danger"></span></label>
|
||||||
|
<input type="text" name="" id="reply_to" class="form-control" placeholder="Only one Reply-to mail. Example: jhon@gmail.com" value="<?php echo isset($client['reply_to']) ? $client['reply_to'] : ''; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
<label for="branch_name">Member welcome mail</label>
|
<label for="branch_name">Member welcome mail</label>
|
||||||
@ -156,6 +173,7 @@
|
|||||||
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
|
<textarea style="display:none;" name="" id="" class="form-control "></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
</div>
|
</div>
|
||||||
@ -176,7 +194,7 @@
|
|||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="member_welcome_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="member_welcome_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
<div class="modal-dialog modal-full-width">
|
<div class="modal-dialog modal-full-width scrollb" >
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="myLargeModalLabel">Member welcome mail <span id="nameOfThePolicy"></span></h4>
|
<h4 class="modal-title" id="myLargeModalLabel">Member welcome mail <span id="nameOfThePolicy"></span></h4>
|
||||||
@ -206,6 +224,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
@ -226,15 +247,11 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<input type="file" id="Question_title_fileInput" style="display: none;">
|
<input type="file" id="Question_title_fileInput" style="display: none;">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<a class="btn btn-primary waves-effect waves-light mr-1 preview_button"
|
|
||||||
data-toggle="modal" data-target="#preview_modal" >Preview</a>
|
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
id="btnGridSubmit_2">Submit</button>
|
id="btnGridSubmit_2">Submit</button>
|
||||||
</div>
|
</div>
|
||||||
@ -244,10 +261,8 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="member_reminder_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="member_reminder_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="false" aria-modal="true">
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
|
||||||
<div class="modal-dialog modal-full-width">
|
<div class="modal-dialog modal-full-width">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -278,6 +293,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-row" id="rac_rate_dropdown">
|
<!-- <div class="form-row" id="rac_rate_dropdown">
|
||||||
@ -329,8 +347,6 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="member_ecard_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="member_ecard_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
@ -364,6 +380,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row" id="rac_rate_dropdown">
|
<div class="form-row" id="rac_rate_dropdown">
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
@ -404,7 +423,6 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="member_review_and_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="member_review_and_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
@ -438,6 +456,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-row" id="rac_rate_dropdown">
|
<!-- <div class="form-row" id="rac_rate_dropdown">
|
||||||
@ -489,7 +510,6 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="account_maneger_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
@ -523,6 +543,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-row" id="rac_rate_dropdown">
|
<!-- <div class="form-row" id="rac_rate_dropdown">
|
||||||
@ -574,7 +597,6 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Modal content for the Large example -->
|
<!-- Modal content for the Large example -->
|
||||||
<div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="client_hr_summary_mail_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
@ -608,6 +630,9 @@
|
|||||||
<div class="form-group col-md-5">
|
<div class="form-group col-md-5">
|
||||||
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
<input type="text" id="subject" name="subject" class="form-control" placeholder="Subject">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group col-md-2 testmail" style="display: none;">
|
||||||
|
<a class="btn btn-primary waves-effect waves-light mr-1 setid" onclick="testMailSend(this)">Test Mail</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-row" id="rac_rate_dropdown">
|
<!-- <div class="form-row" id="rac_rate_dropdown">
|
||||||
@ -661,18 +686,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="modal fade" id="preview_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
<div class="modal fade" id="preview_modal" tabindex="-1" role="dialog" aria-hidden="false" aria-modal="true" data-backdrop="static">
|
||||||
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-dialog modal-full-width">
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="myLargeModalLabel">Member Review and summary mail <span id="nameOfThePolicy"></span></h4>
|
<h4 class="modal-title" id="myLargeModalLabel">Testing Mail Data<span id="nameOfThePolicy"></span></h4>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<div class="text-center" id="no_data"></div>
|
<div class="text-center" id="no_data"></div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal-content -->
|
</div><!-- /.modal-content -->
|
||||||
@ -681,12 +704,51 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
// document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
|
||||||
|
// console.log('DOMContentLoaded start');
|
||||||
|
|
||||||
|
// var memberWelcomeMailModal = new bootstrap.Modal(document.getElementById('member_welcome_mail_modal'));
|
||||||
|
// var previewModal = new bootstrap.Modal(document.getElementById('preview_modal'));
|
||||||
|
|
||||||
|
|
||||||
|
// document.getElementById('preview_modal').addEventListener('hidden.bs.modal', function () {
|
||||||
|
// console.log('testing modal');
|
||||||
|
// memberWelcomeMailModal.show();
|
||||||
|
// console.log('testing modal end');
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log('DOMContentLoaded end');
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
$(document).on('hide.bs.modal', '.modal', function () {
|
||||||
|
console.log("Modal is hidden");
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('show.bs.modal', '.modal', function () {
|
||||||
|
console.log("Modal is hidden");
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
console.log('document ready start');
|
||||||
|
|
||||||
|
var memberWelcomeMailModal = new bootstrap.Modal(document.getElementById('member_welcome_mail_modal'));
|
||||||
|
var previewModal = new bootstrap.Modal(document.getElementById('preview_modal'));
|
||||||
|
|
||||||
|
|
||||||
|
document.getElementById('preview_modal').addEventListener('hidden.bs.modal', function () {
|
||||||
|
console.log('testing modal');
|
||||||
|
memberWelcomeMailModal.show();
|
||||||
|
console.log('testing modal end');
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('document ready end');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
var toolbar = "bold,italic,strikethrough,|,superscript,subscript,|,align,";
|
||||||
const editorConfig = {
|
const editorConfig = {
|
||||||
buttons: toolbar,
|
buttons: toolbar,
|
||||||
@ -770,6 +832,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
const fileInput = document.getElementById("Question_title_fileInput");
|
const fileInput = document.getElementById("Question_title_fileInput");
|
||||||
|
|
||||||
fileInput.addEventListener("change", () => {
|
fileInput.addEventListener("change", () => {
|
||||||
const file = fileInput.files[0];
|
const file = fileInput.files[0];
|
||||||
if (file)
|
if (file)
|
||||||
@ -958,7 +1021,6 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('#account_maneger_summary_mail_form').submit(function (event)
|
$('#account_maneger_summary_mail_form').submit(function (event)
|
||||||
{
|
{
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
@ -1055,6 +1117,8 @@
|
|||||||
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
|
formData.push({name:'client_id', value: $('#general_PrimaryKey').val()})
|
||||||
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() });
|
formData.push({ name: 'nhance_team_mail_ids', value: $('#nhance_team_mail_ids').val() });
|
||||||
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() });
|
formData.push({ name: 'hr_mail_id', value: $('#hr_mail_id').val() });
|
||||||
|
formData.push({ name: 'mail_domain', value: $('#mail_domain').val() });
|
||||||
|
formData.push({ name: 'reply_to', value: $('#reply_to').val() });
|
||||||
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
|
formData.push({ name: 'member_welcome_mail_btn', value: $('#member_welcome_mail_btn').prop('checked') });
|
||||||
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') });
|
formData.push({ name: 'member_reminder_mail_btn', value: $('#member_reminder_mail_btn').prop('checked') });
|
||||||
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
|
formData.push({ name: 'member_ecard_mail_btn', value: $('#member_ecard_mail_btn').prop('checked') });
|
||||||
@ -1095,7 +1159,6 @@
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if ($('#myDropdown')[0]) {
|
if ($('#myDropdown')[0]) {
|
||||||
document.getElementById("myDropdown").addEventListener("click", function(event)
|
document.getElementById("myDropdown").addEventListener("click", function(event)
|
||||||
{
|
{
|
||||||
@ -1120,23 +1183,41 @@
|
|||||||
function getMailTemplateData(element)
|
function getMailTemplateData(element)
|
||||||
{
|
{
|
||||||
var template_name = $(element).attr('id');
|
var template_name = $(element).attr('id');
|
||||||
|
|
||||||
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "account_maneger_summary_mail" || template_name == "client_hr_summary_mail")
|
if (template_name == "member_welcome_mail" || template_name == "member_reminder_mail" || template_name == "member_ecard_mail" || template_name == "member_review_and_summary_mail" || template_name == "account_maneger_summary_mail" || template_name == "client_hr_summary_mail")
|
||||||
{
|
{
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
var form_action = '<?= base_url("client/notification/getMailTemplateData/") ?>'+template_name+ '/' + $('#general_PrimaryKey').val();
|
var form_action = '<?= base_url("client/notification/getMailTemplateData/") ?>'+template_name+ '/' + $('#general_PrimaryKey').val();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: form_action,
|
url: form_action,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(res);
|
console.log('get Mail Template Data', res);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
$(`#${template_name}_form`).find('#template_name').val(snakeCaseToCamelCase(res.template_name));
|
$(`#${template_name}_form`).find('#template_name').val(snakeCaseToCamelCase(res.template_name));
|
||||||
$(`#${template_name}_form`).find('#subject').val(res.subject);
|
$(`#${template_name}_form`).find('#subject').val(res.subject);
|
||||||
$(`#${template_name}_form`).find('.jodit-wysiwyg').html(res.mail_content);
|
$(`#${template_name}_form`).find('.jodit-wysiwyg').html(res.mail_content);
|
||||||
|
|
||||||
|
console.log(res.id)
|
||||||
|
|
||||||
|
if(res.id){
|
||||||
|
$('.testmail').show();
|
||||||
|
$('.setid').attr('data-id', res.id);
|
||||||
|
}else{
|
||||||
|
$('.testmail').hide();
|
||||||
|
$('.setid').attr('data-id', '');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
$('.testmail').hide();
|
||||||
|
$('.setid').attr('data-id', '');
|
||||||
|
|
||||||
}
|
}
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -1154,5 +1235,109 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testMailSend(input){
|
||||||
|
|
||||||
|
// var memberWelcomeMailModal = new bootstrap.Modal(document.getElementById('member_welcome_mail_modal'));
|
||||||
|
// var previewModal = new bootstrap.Modal(document.getElementById('preview_modal'));
|
||||||
|
// previewModal.show();
|
||||||
|
// $('.close').click();
|
||||||
|
|
||||||
|
// Swal.fire({
|
||||||
|
// title: "Enter Testing mail",
|
||||||
|
// input: "text",
|
||||||
|
// inputPlaceholder: "Enter your email",
|
||||||
|
// showCancelButton: true,
|
||||||
|
// confirmButtonText: "Submit",
|
||||||
|
// backdrop: 'static', // Prevent focus issue by disallowing clicking outside
|
||||||
|
// preConfirm: (inputValue) => {
|
||||||
|
// if (!inputValue) {
|
||||||
|
// Swal.showValidationMessage('Please enter a valid email');
|
||||||
|
// }
|
||||||
|
// return inputValue;
|
||||||
|
// }
|
||||||
|
// }).then((result) => {
|
||||||
|
// if (result.isConfirmed) {
|
||||||
|
// Swal.fire({
|
||||||
|
// title: `Entered Email: ${result.value}`,
|
||||||
|
// text: 'This is the email you entered.',
|
||||||
|
// icon: 'success'
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
let test_mail = prompt("Please enter test mail:");
|
||||||
|
console.log('mail address:', test_mail);
|
||||||
|
|
||||||
|
if (test_mail !== null || test_mail !== "") {
|
||||||
|
|
||||||
|
if(isValidEmail(test_mail)){
|
||||||
|
|
||||||
|
var template_id = $(input).data('id');
|
||||||
|
console.log('templte id', template_id);
|
||||||
|
|
||||||
|
if(template_id){
|
||||||
|
let url = '<?= base_url('util/sentTestMail/') ?>' + template_id + '/' + test_mail;
|
||||||
|
console.log('testing mail url:', url);
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (res) {
|
||||||
|
|
||||||
|
console.log('Test mail send function response', res)
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if(res.status == true){
|
||||||
|
|
||||||
|
let respond = res.respond;
|
||||||
|
console.log('Parsed respond', respond)
|
||||||
|
|
||||||
|
if(respond.status == 'success'){
|
||||||
|
toastr.success(respond.message, 'SUCCESS')
|
||||||
|
}else{
|
||||||
|
toastr.warning(respond.message, 'WARNING')
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
toastr.warning('Failed to sent mail', 'WARNING')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
console.error(status, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}else{
|
||||||
|
let alert_msg = 'Template ID not exist'
|
||||||
|
toastr.warning(alert_msg, 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
toastr.warning('Please enter the valid mail', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
toastr.warning('Please enter the valid mail', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function isValidEmail(email) {
|
||||||
|
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
||||||
|
return emailPattern.test(email);
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user