FEATURE_NOTIFICATION : AADHAVAN
This commit is contained in:
parent
8b1fd96cad
commit
abedaf5fd9
@ -63,6 +63,11 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list/(:any)", "ClientController::editClientOnboarding/$1");
|
||||
|
||||
|
||||
$routes->group("notification", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "NotificationController::createNotification");
|
||||
$routes->post("update_enable", "NotificationController::update_enable");
|
||||
$routes->get("getMailTemplateData/(:any)/(:any)", "NotificationController::getMailTemplateData/$1/$2");
|
||||
});
|
||||
|
||||
$routes->group("general", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "ClientController::createClientGeneralInfo");
|
||||
@ -245,6 +250,8 @@ $routes->post("/editEmployeeProfile", "EmployeeRestController::editEmployeeProfi
|
||||
$routes->post("/calculatePremium", "EmployeeRestController::calculatePremium");
|
||||
|
||||
|
||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
|
||||
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
|
||||
|
||||
@ -60,6 +61,7 @@ class ClientController extends AdminController
|
||||
protected $clientDepositModel;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -87,6 +89,7 @@ class ClientController extends AdminController
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
|
||||
|
||||
|
||||
@ -276,6 +279,9 @@ class ClientController extends AdminController
|
||||
$editData['client_policy'] = $clientPoliceData;
|
||||
|
||||
|
||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||
$editData['placeHolders'] = ['user_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'ecard_link', 'app_link', 'member_summary'];
|
||||
|
||||
// echo "<pre>";
|
||||
// dd($editData); die;
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
use App\Controllers\Jobs;
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
@ -42,6 +43,7 @@ class EmpDataServiceController extends BaseController
|
||||
protected $batchFileModel;
|
||||
protected $empEndorsementModel;
|
||||
protected $clientDepositModel;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -57,9 +59,10 @@ class EmpDataServiceController extends BaseController
|
||||
$this->batchFileModel = new BatchFileModel();
|
||||
$this->empEndorsementModel = new EmpEndorsementModel();
|
||||
$this->clientDepositModel = new ClientDepositModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The below function are Inserts batch files and corresponding batch list entries into the database.
|
||||
*
|
||||
@ -481,10 +484,13 @@ class EmpDataServiceController extends BaseController
|
||||
public function importExcelDataForInception($import_data)
|
||||
{
|
||||
|
||||
|
||||
$client_id = $import_data['client_id'];
|
||||
$client_policy_id = $import_data['client_policy_id'];
|
||||
$file = $import_data['file'];
|
||||
|
||||
$get_client_policy_type = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
$data = $this->readExcelToArray($file);
|
||||
|
||||
if (!$data) {
|
||||
@ -647,8 +653,11 @@ class EmpDataServiceController extends BaseController
|
||||
$this->cashDepositCalculationForInception($depositeData);
|
||||
|
||||
|
||||
$this->sendMailForDownloadingECard($empty_emp_tpa_uh_ids);
|
||||
if($get_client_policy_type['policy_type_id'] != 1){
|
||||
|
||||
$this->sendMailForDownloadingECard($empty_emp_tpa_uh_ids);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1595,10 +1604,12 @@ class EmpDataServiceController extends BaseController
|
||||
public function sendMailForDownloadingECard(array $ids)
|
||||
{
|
||||
try {
|
||||
$count = 0;
|
||||
|
||||
foreach ($ids as $key => $id) {
|
||||
|
||||
$get_emp_email_and_other_details = $this->employeePolicyModel
|
||||
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
||||
->select('employee_polices.client_policy_id, employees.emp_code, employees.email_corporate,employees.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
->where('employees.emp_status', 'active')
|
||||
->where('employees.is_active', '1')
|
||||
@ -1606,46 +1617,52 @@ class EmpDataServiceController extends BaseController
|
||||
->where('employee_polices.is_active', '1')
|
||||
->where('employee_polices.id', $id)->first();
|
||||
|
||||
if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "") {
|
||||
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$email = $get_emp_email_and_other_details['email_corporate'];
|
||||
// echo "<pre>";
|
||||
// print_r($notification);
|
||||
// die;
|
||||
$client_data = $this->clientModel->where('id',$get_emp_email_and_other_details['client_id'])->first();
|
||||
$notification = $this->notificationModel->where('client_id',$get_emp_email_and_other_details['client_id'])->where('template_name','member_ecard_mail')->first();
|
||||
if ($get_emp_email_and_other_details != null && $get_emp_email_and_other_details != "" && $notification['enabled'] == 1) {
|
||||
$rand_string = $get_emp_email_and_other_details['rand_string'];
|
||||
$tpa_id = $get_emp_email_and_other_details['tpa_id'];
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
|
||||
$mail = $get_emp_email_and_other_details['email_corporate'];
|
||||
|
||||
$subject = $notification['subject'];
|
||||
|
||||
$link = generate_download_link($rand_string);
|
||||
$subject = 'Download E-Card';
|
||||
|
||||
$html = '<body>
|
||||
<p>Dear ' .$name .',</p>
|
||||
<p>Your Policy( ' .$tpa_id .' ) has been successfully created. Please click the link below to download the insurance card:</p>
|
||||
<p><a href="'.$link.'">Download Insurance Card</a></p>
|
||||
<p>Thank you,</p>
|
||||
</body>';
|
||||
|
||||
|
||||
|
||||
if ($email != null && $email != "") {
|
||||
|
||||
$mail_data = [
|
||||
'mail' => $email,
|
||||
'subject' => $subject,
|
||||
'message' => $html
|
||||
];
|
||||
|
||||
// dd($mail_data);
|
||||
|
||||
$result = Mailhelper::send_email($mail_data);
|
||||
$decoded_result = (array) json_decode($result);
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
|
||||
$data = [
|
||||
'status' => $decoded_result['status'],
|
||||
'message'=>$decoded_result['message'] ?? 'Internal Server Error',
|
||||
'email' => $decoded_result['data']
|
||||
];
|
||||
|
||||
// dd($data);
|
||||
$this->myLogger->logme('error', 'status : {status}, message : {message}, email : {email}', $data);
|
||||
}
|
||||
$mail_content = $notification['mail_content'];
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
|
||||
$mail_content = str_replace("[[user_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[tpa_id]]", $tpa_id, $mail_content);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link'>Download Insurance Card</a>", $mail_content);
|
||||
|
||||
$message = $mail_content;
|
||||
$count++;
|
||||
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message,'cc'=> $client_data['common_mails']];
|
||||
|
||||
if($count == 20 || $count == count($ids)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true; // Email(s) sent successfully
|
||||
|
||||
@ -20,6 +20,7 @@ use App\Models\ClientPolicyModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\PolicyTypeModel;
|
||||
use App\Models\NotificationModel;
|
||||
|
||||
use App\Controllers\Jobs ;
|
||||
use App\Controllers\JobWorker ;
|
||||
@ -49,7 +50,8 @@ class EmployeeRestController extends AdminController
|
||||
protected $policyPremium1Model;
|
||||
protected $policyPremium2Model;
|
||||
protected $policyTypeModel;
|
||||
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// helper('utility');
|
||||
@ -65,9 +67,10 @@ class EmployeeRestController extends AdminController
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->policyTypeModel = new PolicyTypeModel();
|
||||
$this->notificationModel = new NotificationModel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getEmployeeProfile()
|
||||
{
|
||||
try {
|
||||
@ -594,14 +597,26 @@ class EmployeeRestController extends AdminController
|
||||
// Upload the Employee Detail in DB by Sheet Data
|
||||
public function employeeUpload()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// echo $this->request->getPost('client_id');
|
||||
// die;
|
||||
$file = $this->request->getFile('file');
|
||||
$client_id = $this->request->getPost('client_id');
|
||||
$policy_id = $this->request->getPost('policy_id');
|
||||
|
||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||
|
||||
$notification = $this->notificationModel->where('client_id',$client_id)->where('template_name','member_welcome_mail')->first();
|
||||
|
||||
$jwt = $this->request->getHeader('Authorization');
|
||||
$jwtParts = explode(' ', $jwt);
|
||||
// print_r($jwtParts);die;
|
||||
$token = $jwtParts[2];
|
||||
// return "hello";
|
||||
|
||||
|
||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||
@ -611,7 +626,6 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
|
||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||
|
||||
if ($client_policy) {
|
||||
$policy = $this->policesModel->where('id', $client_policy['policy_id'])->first();
|
||||
$policy_permium_1 = $this->policyPremium1Model->where(['client_id' => $client_id , 'client_policy_id' => $policy_id,'is_active' =>1])-> first();
|
||||
@ -787,105 +801,120 @@ class EmployeeRestController extends AdminController
|
||||
$count = 0;
|
||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||
{
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$data_after_gpa_or_gmc =[];
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
}else{
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_by'] = $employee_id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
}
|
||||
}else{
|
||||
if ($dataToInsert[$a]['emp_code'] != 0) {
|
||||
$result =false;
|
||||
if (count($data_after_gpa_or_gmc) != 0) {
|
||||
$data_after_gpa_or_gmc['created_by'] = $employee_id;
|
||||
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
|
||||
}
|
||||
$emp_id =$result;
|
||||
if ($result) {
|
||||
$emp = $this->employeeModel->where('id', $result)->get()->getResult();
|
||||
|
||||
$policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
|
||||
|
||||
|
||||
$log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
|
||||
$this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$emp_policy_data =[
|
||||
'employee_id'=>$emp_id,
|
||||
'client_policy_id'=>$policy_id,
|
||||
'status'=> 'draft',
|
||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
|
||||
//trigger
|
||||
$mail = $dataToInsert[$a]['email_corporate'];
|
||||
$subject = 'Welcome, Employee Benefit Program Enrolment';
|
||||
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
|
||||
$data['employee_name']=$dataToInsert[$a]['name'];
|
||||
$data['policy_name']=$policy['name'];
|
||||
$data['App_Url'] = $_ENV['App_Url'];
|
||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||
$emp_id =0;
|
||||
|
||||
$message = view('mail_welcome', $data);
|
||||
$data_after_gpa_or_gmc =[];
|
||||
if ($policy['policy_type_id'] == 1) {
|
||||
if (strtolower($dataToInsert[$a]['relationship']) == 'self') {
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
}else{
|
||||
$data_after_gpa_or_gmc = $dataToInsert[$a];
|
||||
}
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$current_timestamp = time();
|
||||
$formatted_date_time = date('Y-m-d H:i:s', $current_timestamp);
|
||||
|
||||
if ($dataToInsert[$a]['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
$count++;
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message];
|
||||
if ($employee) {
|
||||
|
||||
|
||||
$emp_id =$employee['id'];
|
||||
$id =$emp_id;
|
||||
$data_after_gpa_or_gmc['id'] = $id;
|
||||
$data_after_gpa_or_gmc['updated_by'] = $employee_id;
|
||||
$data_after_gpa_or_gmc['updated_at'] = $formatted_date_time;
|
||||
$result = $this->employeeModel->save($data_after_gpa_or_gmc);
|
||||
if ($result) {
|
||||
$log_message = 'Update Employee - '.$employee['name'].'('.$employee['emp_code'].') with PK '.$employee['id'];
|
||||
$this->myLogger->logme('error',('Update - ' . $employee['id'].' - '. $employee['emp_code'] .' - '.$employee['name']));
|
||||
}
|
||||
}else{
|
||||
if ($dataToInsert[$a]['emp_code'] != 0) {
|
||||
$result =false;
|
||||
if (count($data_after_gpa_or_gmc) != 0) {
|
||||
$data_after_gpa_or_gmc['created_by'] = $employee_id;
|
||||
$result = $this->employeeModel->insert($data_after_gpa_or_gmc);
|
||||
}
|
||||
$emp_id =$result;
|
||||
if ($result) {
|
||||
$emp = $this->employeeModel->where('id', $result)->get()->getResult();
|
||||
|
||||
$policy_name = $this->employeePolicyModel->where('employee_id', $result)->get()->getResult();;
|
||||
|
||||
|
||||
$log_message = 'Insert Employee- '.$dataToInsert[$a]['name'] .'('.$dataToInsert[$a]['emp_code'] .') with PK ';
|
||||
$this->myLogger->logme('error',('Insert - ' . $dataToInsert[$a]['emp_code'] .' - '. $dataToInsert[$a]['name']));
|
||||
}
|
||||
}
|
||||
}
|
||||
$emp_policy_data =[
|
||||
'employee_id'=>$emp_id,
|
||||
'client_policy_id'=>$policy_id,
|
||||
'status'=> 'draft',
|
||||
'basic_cover_si'=>isset($basic_cover_si[$a]) ? $basic_cover_si[$a] : null
|
||||
];
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->checkExistingEmpPolicy(['employee_id' => $emp_id,'client_policy_id' => $policy_id]);
|
||||
if ($employee_policy) {
|
||||
foreach ($employee_policy as $existing_policy) {
|
||||
$emp_policy_data['id']= $existing_policy['id'];
|
||||
$emp_policy_data['updated_at'] = $formatted_date_time;
|
||||
$this->employeePolicyModel->save($emp_policy_data);
|
||||
}
|
||||
} else {
|
||||
$emp_policy = $this->employeePolicyModel->insert($emp_policy_data);
|
||||
}
|
||||
|
||||
// print_r($wholeData);
|
||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||
if($count == 20 || $a == count($dataToInsert)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
// $wholeData[]= $r;
|
||||
|
||||
// Mailhelper::bulk_mail($wholeData);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
if ($notification['enabled'] == 1) {
|
||||
//trigger
|
||||
if ($dataToInsert[$a]['relationship'] == 'Self') {
|
||||
$mail = $dataToInsert[$a]['email_corporate'];
|
||||
|
||||
|
||||
$subject = $notification['subject'];
|
||||
// $subject = 'Welcome, Employee Benefit Program Enrolment';
|
||||
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
|
||||
// $data['employee_name']=$dataToInsert[$a]['name'];
|
||||
$data['policy_name']=$policy['name'];
|
||||
// $data['App_Url'] = $_ENV['App_Url'];
|
||||
|
||||
$app_link = $_ENV['App_Url'];
|
||||
$employee_name =$dataToInsert[$a]['name'];
|
||||
|
||||
|
||||
$mail_content = $notification['mail_content'];
|
||||
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
|
||||
|
||||
$mail_content = str_replace("[[nhance_logo]]", "<img src='$nhance_logo' alt='Nhance Logo' width='20'>", $mail_content);
|
||||
$mail_content = str_replace("[[user_name]]", $employee_name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
|
||||
$message = $mail_content;
|
||||
if ($dataToInsert[$a]['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||
$count++;
|
||||
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message,'cc'=> $client_data['common_mails']];
|
||||
}
|
||||
}
|
||||
|
||||
if($count == 20 || $a == count($dataToInsert)-1){
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||
// $wholeData[]= $r;
|
||||
|
||||
// Mailhelper::bulk_mail($wholeData);
|
||||
$wholeData = [];
|
||||
$count = 0;
|
||||
}
|
||||
|
||||
|
||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||
|
||||
}
|
||||
|
||||
// print_r($r);//die();
|
||||
// $jobWorker = new JobWorker();
|
||||
//JobWorker::processJob($r);
|
||||
// $return_log = MailHelper::send_email($mail,$subject, $message);
|
||||
// $return_log = json_decode($return_log);
|
||||
// $this->myLogger->logme('info', "Email Status : {mail_status}, Sender Email:{email}", ['mail_status' => $return_log->status, 'email'=> $return_log->data]);
|
||||
}
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'message' => "Success" ], 200);
|
||||
}else{
|
||||
|
||||
@ -66,6 +66,7 @@ class JobWorker extends AdminController
|
||||
*/
|
||||
public static function processJob(array $jobdata = [])
|
||||
{
|
||||
|
||||
// print_r($jobdata);
|
||||
// echo 'listen';
|
||||
// die();
|
||||
|
||||
129
app/Controllers/NotificationController.php
Normal file
129
app/Controllers/NotificationController.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
// declare(strict_types=1);
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
|
||||
|
||||
|
||||
use App\Models\NotificationModel;
|
||||
use App\Models\ClientModel;
|
||||
|
||||
|
||||
|
||||
class NotificationController extends AdminController
|
||||
{
|
||||
use ResponseTrait;
|
||||
|
||||
protected $myLogger;
|
||||
protected $notificationModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// set_session_context('Client');
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
|
||||
$this->notificationModel = new NotificationModel();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function camelCaseToSnakeCase($input) {
|
||||
$input = preg_replace('/(?<!^)([A-Z])/', '$1', $input);
|
||||
$input = str_replace(' ', '_', $input);
|
||||
return strtolower($input);
|
||||
}
|
||||
|
||||
|
||||
public function createNotification(){
|
||||
|
||||
// print_r($this->request->getPost());
|
||||
|
||||
$data['template_name'] = $this->camelCaseToSnakeCase($this->request->getPost('template_name'));
|
||||
$data['subject'] = $this->request->getPost('subject');
|
||||
$data['mail_content'] = $this->request->getPost('editorContent');
|
||||
$data['client_id'] = $this->request->getPost('client_id');
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$find = $notificationModel->where('client_id',$data['client_id'])->where('template_name',$data['template_name'])->first();
|
||||
if ($find) {
|
||||
// print_r($find['id']);
|
||||
$id = $find['id'];
|
||||
$notificationModel->update($id,$data);
|
||||
$complete = "Update";
|
||||
}else{
|
||||
$notificationModel->insert($data);
|
||||
$complete = "Inserted";
|
||||
}
|
||||
return json_encode($complete);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function update_enable(){
|
||||
|
||||
|
||||
// print_r();die;
|
||||
|
||||
$checkboxNames = [
|
||||
'member_welcome_mail_btn',
|
||||
'member_remider_mail_btn',
|
||||
'member_ecard_mail_btn',
|
||||
'member_review_and_summary_mail_btn',
|
||||
'account_maneger_summary_mail_btn',
|
||||
'client_hr_summary_mail_btn'
|
||||
];
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($checkboxNames as $checkboxName) {
|
||||
$data[str_replace('_btn', '', $checkboxName)] = ($this->request->getPost($checkboxName) === "true") ? 1 : 0;
|
||||
}
|
||||
|
||||
$notificationModel = new NotificationModel();
|
||||
$clientModel = new ClientModel();
|
||||
|
||||
$id =$this->request->getPost('client_id');
|
||||
|
||||
$clientData['common_mails'] = $this->request->getPost('recipient_mail_ids');
|
||||
$clientModel->update($id,$clientData);
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
$find = $notificationModel->where('client_id',$this->request->getPost('client_id'))->where('template_name', $key)->first();
|
||||
|
||||
if ($find) {
|
||||
$id = $find['id'];
|
||||
$changeData['enabled']= $value;
|
||||
$update = $notificationModel->update($id, $changeData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return json_encode("true");
|
||||
}
|
||||
|
||||
public function getMailTemplateData($template_name,$client_id){
|
||||
|
||||
$notificationModel = new NotificationModel();
|
||||
|
||||
$value = $notificationModel->where('client_id',$client_id)->where('template_name',$template_name)->first();
|
||||
|
||||
// print_r($value);die;
|
||||
return json_encode($value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -16,9 +16,11 @@ class MailHelper
|
||||
{
|
||||
public static function send_email($params)
|
||||
{
|
||||
|
||||
$emaill = $params['mail'];
|
||||
$subject = $params['subject'];
|
||||
$message = $params['message'];
|
||||
$cc = $params['cc'];
|
||||
try {
|
||||
|
||||
$email = \Config\Services::email();
|
||||
@ -27,7 +29,14 @@ class MailHelper
|
||||
|
||||
$email->setTo($emaill);
|
||||
|
||||
$ccList = explode(',', $cc);
|
||||
|
||||
// if (empty($cc)) {
|
||||
$email->setCC($cc);
|
||||
// }
|
||||
|
||||
$email->setSubject($subject);
|
||||
|
||||
$email->setMessage($message);
|
||||
|
||||
if ($email->send()) {
|
||||
@ -44,6 +53,7 @@ class MailHelper
|
||||
|
||||
public static function bulk_mail(array $mails = [])
|
||||
{
|
||||
// print_r();die;
|
||||
$model = new JobModel();
|
||||
$start = microtime(true);
|
||||
$runtime= 0;
|
||||
|
||||
@ -26,6 +26,7 @@ class ClientModel extends Model
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"is_active",
|
||||
"common_mails"
|
||||
];
|
||||
|
||||
|
||||
|
||||
12
app/Models/NotificationModel.php
Normal file
12
app/Models/NotificationModel.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class NotificationModel extends Model
|
||||
{
|
||||
protected $table = 'notifications';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = ["id","client_id","template_name","subject","mail_content","enabled","created_by","updated_by","is_active",];
|
||||
}
|
||||
@ -76,6 +76,12 @@ body {
|
||||
<span class="d-none d-sm-inline-block">Branch & Contacts</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#notification-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="notification_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-bell"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Notifications</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#police-tab" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2" id="policy_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-book-open-page-variant"></i></span>
|
||||
@ -84,6 +90,8 @@ body {
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<?php include('notification.php'); ?>
|
||||
|
||||
<?php include('client_basic_info.php'); ?>
|
||||
<?php include('client_kyc.php'); ?>
|
||||
<?php include('client_rm.php'); ?>
|
||||
@ -187,6 +195,24 @@ body {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function client_notification() {
|
||||
var check_client_id = $('#general_PrimaryKey');
|
||||
|
||||
|
||||
if(check_client_id[0].value == '' || check_client_id[0].value == null || check_client_id[0].value == 0){
|
||||
$('#btnBranchAdd').hide();
|
||||
toastr.warning('Please Add the Client!', 'warning',{timeOut: 2000});
|
||||
}else{
|
||||
if ($('#btnBranchBack')[0].style.display == 'none') {
|
||||
$('#btnBranchAdd').show();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.getElementById("kyc_tab").addEventListener("click", function(event) {
|
||||
event.preventDefault();
|
||||
client_kyc_docs();
|
||||
@ -209,6 +235,12 @@ body {
|
||||
event.preventDefault();
|
||||
client_branch_contact();
|
||||
});
|
||||
|
||||
// document.getElementById("notification_tab").addEventListener("click", function(event) {
|
||||
// event.preventDefault();
|
||||
// client_notification();
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@ -496,6 +496,10 @@
|
||||
<!-- Jodit Js -->
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/jodit.min.js"></script>
|
||||
|
||||
<script src="<?= base_url()."public"; ?>/assets/libs/quill/quill.min.js"></script>
|
||||
<script src="<?= base_url()."public"; ?>/assets/js/pages/form-quilljs.init.js"></script>
|
||||
|
||||
|
||||
<!-- select2 -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
|
||||
|
||||
@ -43,6 +43,10 @@
|
||||
<!-- Jodit Css -->
|
||||
<link href="<?= base_url()."public"; ?>/assets/css/jodit.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
<link href="<?= base_url()."public"; ?>/assets/libs/quill/quill.snow.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
|
||||
|
||||
<!-- JQuery CDN -->
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
@ -241,6 +245,7 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
1264
app/Views/notification.php
Normal file
1264
app/Views/notification.php
Normal file
File diff suppressed because it is too large
Load Diff
1
public/assets/images/image-solid.svg
Normal file
1
public/assets/images/image-solid.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path opacity="1" fill="#1E3050" d="M0 96C0 60.7 28.7 32 64 32H448c35.3 0 64 28.7 64 64V416c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96zM323.8 202.5c-4.5-6.6-11.9-10.5-19.8-10.5s-15.4 3.9-19.8 10.5l-87 127.6L170.7 297c-4.6-5.7-11.5-9-18.7-9s-14.2 3.3-18.7 9l-64 80c-5.8 7.2-6.9 17.1-2.9 25.4s12.4 13.6 21.6 13.6h96 32H424c8.9 0 17.1-4.9 21.2-12.8s3.6-17.4-1.4-24.7l-120-176zM112 192a48 48 0 1 0 0-96 48 48 0 1 0 0 96z"/></svg>
|
||||
|
After Width: | Height: | Size: 667 B |
5
public/logo.jpg
Normal file
5
public/logo.jpg
Normal file
@ -0,0 +1,5 @@
|
||||
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M428.357 3.03152C399.835 2.7241 385.421 4.56862 377.14 12.869C365.486 24.551 366.1 42.3814 366.713 50.0669C366.713 72.816 366.713 95.5652 366.713 118.314C366.713 157.972 366.713 197.629 366.713 237.286C366.713 237.901 366.713 243.127 366.713 243.742C366.713 244.049 366.713 244.049 366.713 244.357C366.713 244.664 366.713 244.972 366.713 244.972C366.713 245.587 367.02 245.894 367.02 246.509C368.553 252.042 371.927 256.039 374.993 258.806C412.716 294.466 442.771 321.827 459.638 337.198C465.159 342.117 473.132 348.572 479.879 346.113C487.24 343.346 489.08 331.049 489.693 327.053C489.693 270.488 489.693 213.922 489.693 157.357C489.693 118.007 489.693 83.5758 490 48.2224C490 34.6959 490 19.3248 479.573 9.48735C470.679 2.10925 456.571 3.33894 428.357 3.03152Z" fill="#E26828"/>
|
||||
<path d="M83.6435 509.968C112.165 510.276 126.579 508.431 134.86 500.438C146.514 489.064 145.9 471.848 145.287 464.163C145.287 442.028 145.287 419.894 145.287 397.76C145.287 359.332 145.287 320.597 145.287 281.862C145.287 281.247 145.287 276.329 145.287 275.406C145.287 275.099 145.287 275.099 145.287 274.791C145.287 274.484 145.287 274.177 145.287 274.177C145.287 273.869 144.98 273.254 144.98 272.947C143.447 267.721 140.073 263.724 137.007 260.958C58.1887 192.71 52.055 184.41 52.055 184.41C46.8414 179.184 38.5609 170.268 31.5072 172.42C26.2936 173.957 23.5334 180.721 22.3067 185.332C22.3067 243.435 22.3067 301.537 22.3067 359.64C22 390.074 22 424.813 22 466.007C22 479.841 22.3067 494.597 32.4273 503.513C41.0144 510.891 55.1219 509.661 83.6435 509.968Z" fill="#E26828"/>
|
||||
<path d="M274.401 203.47L100.818 14.4061C91.924 4.56862 81.19 3.64636 68.9227 3.64636C43.7746 3.95378 19.2398 -5.57626 22.3067 52.5263L24.4535 91.5687C24.7602 97.4097 27.2136 103.558 31.5072 108.169L294.642 387.922L398.301 501.668C401.675 505.972 406.582 508.431 412.102 508.431C424.983 508.739 442.157 508.431 451.664 508.431C476.813 508.124 489.693 507.509 489.693 477.997L487.24 438.339C486.933 432.498 484.48 426.35 480.186 422.046L274.401 203.47Z" fill="#00999E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue
Block a user