Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
b20654a955
@ -308,6 +308,8 @@ class ClientController extends AdminController
|
|||||||
$data['is_download_btn'] = 1;
|
$data['is_download_btn'] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// print_r($data);die;
|
||||||
|
|
||||||
$update = $this->clientModel->update($id,$data);
|
$update = $this->clientModel->update($id,$data);
|
||||||
|
|
||||||
|
|
||||||
@ -1311,7 +1313,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
||||||
if(empty($termsData['policy_terms'])){
|
if(empty($termsData['policy_terms'])){
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'This Policy does not Create Terms'], 200);
|
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy terms '], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1338,11 +1340,21 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
if($racRate == 0){
|
if($racRate == 0){
|
||||||
|
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy has no Data for Rac Rate'], 200);
|
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy premium'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
||||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Policy Status Updated Successfully', 'data' => $termsData, 'racRate' => $racRate], 200);
|
$json_data ='';
|
||||||
|
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id )->set('open_for_enrollment', 1)->update();
|
||||||
|
if ($open_for_enrollment) {
|
||||||
|
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id )->find();
|
||||||
|
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
||||||
|
$client_policy_id_value = $client_policy_id;
|
||||||
|
|
||||||
|
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => true,'code' => 200, 'message' => 'Policy Status Updated Successfully', 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data], 200);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -519,12 +519,17 @@ class EmployeeRestController extends AdminController
|
|||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$policy_id = $this->request->getPost('policy_id');
|
$policy_id = $this->request->getPost('policy_id');
|
||||||
|
|
||||||
$token = $this->request->headers()['Auth']->getValue();
|
$jwt = $this->request->getHeader('Authorization');
|
||||||
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
$jwtParts = explode(' ', $jwt);
|
||||||
|
$token = $jwtParts[1];
|
||||||
|
|
||||||
|
|
||||||
|
$decodedPayload = json_decode(base64_decode(explode('.', $token)[1]), true);
|
||||||
// get the employee id from token
|
// get the employee id from token
|
||||||
$employee_id = $decodedPayload['id'];
|
$employee_id = $decodedPayload['id'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
$client_policy = $this->clientPolicyModel->where('id', $policy_id)->where('client_id', $client_id)->first();
|
||||||
|
|
||||||
if ($client_policy) {
|
if ($client_policy) {
|
||||||
@ -697,6 +702,7 @@ class EmployeeRestController extends AdminController
|
|||||||
$basic_cover_si[]= $basic_cover_si_value;
|
$basic_cover_si[]= $basic_cover_si_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$count = 0;
|
||||||
for ($a=0; $a <count($dataToInsert) ; $a++)
|
for ($a=0; $a <count($dataToInsert) ; $a++)
|
||||||
{
|
{
|
||||||
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
$employee = $this->employeeModel->checkExistingEmployee($dataToInsert[$a]);
|
||||||
@ -773,10 +779,23 @@ class EmployeeRestController extends AdminController
|
|||||||
$data['policy_name']=$policy['name'];
|
$data['policy_name']=$policy['name'];
|
||||||
|
|
||||||
$message = view('mail_welcome', $data);
|
$message = view('mail_welcome', $data);
|
||||||
|
|
||||||
|
if ($dataToInsert[$a]['relationship'] == 'Self' && $mail != null || $mail != '') {
|
||||||
|
$count++;
|
||||||
|
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $message];
|
||||||
|
}
|
||||||
|
|
||||||
|
// print_r($wholeData);
|
||||||
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
// if ($dataToInsert[$a]['email_corporate'] != null || $dataToInsert[$a]['email_corporate'] != '' && $dataToInsert[$a]['relationship'] == 'Self') {
|
||||||
// $job_details = new Jobs();
|
if($count == 20 || $a == count($dataToInsert)-1){
|
||||||
// $r = Jobs::addJob(['job_name' => 'send_email','payload' => ['mail' => $mail, 'subject' => $subject,'message'=> $message]]);
|
$job_details = new Jobs();
|
||||||
// }
|
$r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]);
|
||||||
|
// $wholeData[]= $r;
|
||||||
|
|
||||||
|
// Mailhelper::bulk_mail($wholeData);
|
||||||
|
$wholeData = [];
|
||||||
|
$count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// print_r($r);//die();
|
// print_r($r);//die();
|
||||||
// $jobWorker = new JobWorker();
|
// $jobWorker = new JobWorker();
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class JobWorker extends AdminController
|
|||||||
* Constructs the class
|
* Constructs the class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
private static $event_class_mapping = ['add' => ['type' => 'HC','handler' => 'App\\Helpers\\HttpRequestHelper'], 'sub' => ['type' => 'CC','handler' => 'App\\Controllers\\Jobs\SubJob'],'fancy_date_time_format' => [ 'type' => 'HF','handler' => 'fancy_date_time_format'],'addNumber' => ['type' => 'HC','handler' => 'App\\Model\\HttpRequestHelper'],'excelFileFormatValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'excelFileDataValidation' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'employeeOnboard' => ['type' => 'CC','handler' => 'App\\Controllers\\EmployeeServiceController'],'send_email' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper'],'bulk_mail' => ['type' => 'HC','handler' => 'App\\Helpers\\MailHelper']];
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// echo 'HiC';//die();
|
// echo 'HiC';//die();
|
||||||
@ -199,4 +199,7 @@ class JobWorker extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,8 @@ use PHPMailer\PHPMailer\PHPMailer;
|
|||||||
use PHPMailer\PHPMailer\SMTP;
|
use PHPMailer\PHPMailer\SMTP;
|
||||||
use PHPMailer\PHPMailer\Exception;
|
use PHPMailer\PHPMailer\Exception;
|
||||||
|
|
||||||
|
use App\Models\JobModel;
|
||||||
|
|
||||||
|
|
||||||
class MailHelper
|
class MailHelper
|
||||||
{
|
{
|
||||||
@ -18,6 +20,7 @@ class MailHelper
|
|||||||
$subject = $params['subject'];
|
$subject = $params['subject'];
|
||||||
$message = $params['message'];
|
$message = $params['message'];
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$email = \Config\Services::email();
|
$email = \Config\Services::email();
|
||||||
$email->setMailType('html');
|
$email->setMailType('html');
|
||||||
$email->setFrom('bbone@venbait.in', 'Nhance');
|
$email->setFrom('bbone@venbait.in', 'Nhance');
|
||||||
@ -37,5 +40,26 @@ class MailHelper
|
|||||||
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
return json_encode(['status' => 'failed','code' => 500,'data' => $emaill],500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function bulk_mail(array $mails = [])
|
||||||
|
{
|
||||||
|
$model = new JobModel();
|
||||||
|
$start = microtime(true);
|
||||||
|
$runtime= 0;
|
||||||
|
try {
|
||||||
|
foreach ( $mails as $index=>$mail) {
|
||||||
|
$runtime = microtime(true) - $start;
|
||||||
|
$send_mail = self::send_email($mail);
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode(['status' => 'success','code' => 200, 'message'=>'Email Sent Successfully...'],200);
|
||||||
|
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
return json_encode(['status' => 'failed','code' => 500],500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -86,16 +86,19 @@ if (!function_exists('compressImage')) {
|
|||||||
if (!function_exists('fancy_date_time_format'))
|
if (!function_exists('fancy_date_time_format'))
|
||||||
{
|
{
|
||||||
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
function fancy_date_time_format($datetime,$return_type = 'fancy') {
|
||||||
|
date_default_timezone_set('Asia/Kolkata');
|
||||||
|
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new DateTime();
|
||||||
$passedDateTime = new DateTime($datetime);
|
$passedDateTime = new DateTime($datetime);
|
||||||
|
|
||||||
|
|
||||||
// Calculate the interval between the current time and the passed datetime
|
// Calculate the interval between the current time and the passed datetime
|
||||||
$interval = $currentDateTime->diff($passedDateTime);
|
$interval = $currentDateTime->diff($passedDateTime);
|
||||||
// return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a');
|
|
||||||
// If the interval is more than 1 month, return the original datetime
|
// If the interval is more than 1 month or the year is different, return the original datetime
|
||||||
if ($interval->m > 1 || $interval->y > 0) {
|
if ($interval->m > 1 || $interval->y != 0) {
|
||||||
if($return_type = 'fancy'){ return change_date_format($datetime,'Y-m-d H:i:s','d M Y h:i a'); }
|
if ($return_type == 'fancy') {
|
||||||
|
return change_date_format($datetime, 'Y-m-d H:i:s', 'd M Y h:i a');
|
||||||
|
}
|
||||||
return $datetime;
|
return $datetime;
|
||||||
} elseif ($interval->m == 1 && $interval->y == 0) {
|
} elseif ($interval->m == 1 && $interval->y == 0) {
|
||||||
return "1 month ago";
|
return "1 month ago";
|
||||||
|
|||||||
@ -192,9 +192,9 @@
|
|||||||
if (policy_PrimaryKey !== '') {
|
if (policy_PrimaryKey !== '') {
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||||
console.log('client_policy_data',data)
|
// console.log('client_policy_data',data)
|
||||||
data.forEach(function(item) {
|
data.forEach(function(item) {
|
||||||
|
console.log(item.open_for_enrollment);
|
||||||
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
var patternGMC = /gmc/i; // Case insensitive pattern for 'gmc'
|
||||||
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
var patternGPA = /gpa/i; // Case insensitive pattern for 'gpa'
|
||||||
var subject = item.policy_type_name;
|
var subject = item.policy_type_name;
|
||||||
@ -223,8 +223,13 @@
|
|||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a>
|
`;
|
||||||
</div>
|
if (item.open_for_enrollment == 0) {
|
||||||
|
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||||
|
}else{
|
||||||
|
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="pointer-events:none; background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||||
|
}
|
||||||
|
policyTable += ` </div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -507,13 +512,28 @@
|
|||||||
client_policy_id : client_policy_id,
|
client_policy_id : client_policy_id,
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
// console.log(res);
|
console.log(res);
|
||||||
if(res) {
|
if(res) {
|
||||||
|
if (res.open_for_enrollment) {
|
||||||
|
var json_decode=JSON.parse(res.open_for_enrollment);
|
||||||
|
var open_for_enrollment=json_decode.open_for_enrollment;
|
||||||
|
var client_policy_id=json_decode.client_policy_id;
|
||||||
|
if (open_for_enrollment == 1) {
|
||||||
|
// console.log($('[data-id="' + client_policy_id + '"]');
|
||||||
|
$('.btnOpenEnroll').each(function(index, element) {
|
||||||
|
if ($(element).data('id') == client_policy_id) {
|
||||||
|
$(element).css({'background-color': 'lightgrey', 'pointer-events': 'none'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
if(res.status === true){
|
if(res.status === true){
|
||||||
toastr.success(res.message, 'Success');
|
toastr.success(res.message, 'Success');
|
||||||
|
|
||||||
}else if(res.status === false){
|
}else if(res.status === false){
|
||||||
toastr.warning(res.message, 'Warning');
|
toastr.warning(res.message, 'Warning');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,7 +157,7 @@ paths:
|
|||||||
summary: 'Add a new EmployeeUpload to the store'
|
summary: 'Add a new EmployeeUpload to the store'
|
||||||
operationId: EmployeeUpload
|
operationId: EmployeeUpload
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -317,7 +317,7 @@ paths:
|
|||||||
summary: 'RelationshipList'
|
summary: 'RelationshipList'
|
||||||
operationId: RelationshipList
|
operationId: RelationshipList
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -340,7 +340,7 @@ paths:
|
|||||||
summary: 'GetEmployeeAndDependence'
|
summary: 'GetEmployeeAndDependence'
|
||||||
operationId: GetEmployeeAndDependence
|
operationId: GetEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -368,7 +368,7 @@ paths:
|
|||||||
summary: 'EditEmployeeAndDependence'
|
summary: 'EditEmployeeAndDependence'
|
||||||
operationId: EditEmployeeAndDependence
|
operationId: EditEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -461,7 +461,7 @@ paths:
|
|||||||
summary: 'AddEmployeeAndDependence'
|
summary: 'AddEmployeeAndDependence'
|
||||||
operationId: AddEmployeeAndDependence
|
operationId: AddEmployeeAndDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -551,7 +551,7 @@ paths:
|
|||||||
summary: 'GetEmployeePolicy'
|
summary: 'GetEmployeePolicy'
|
||||||
operationId: GetEmployeePolicy
|
operationId: GetEmployeePolicy
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -584,7 +584,7 @@ paths:
|
|||||||
summary: 'CreateOrUpdateEmployeePolicySiAmount'
|
summary: 'CreateOrUpdateEmployeePolicySiAmount'
|
||||||
operationId: CreateOrUpdateEmployeePolicySiAmount
|
operationId: CreateOrUpdateEmployeePolicySiAmount
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -627,7 +627,7 @@ paths:
|
|||||||
summary: 'DeleteDependence'
|
summary: 'DeleteDependence'
|
||||||
operationId: DeleteDependence
|
operationId: DeleteDependence
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -655,7 +655,7 @@ paths:
|
|||||||
summary: 'GetEmployeeAndDependenceByClientId'
|
summary: 'GetEmployeeAndDependenceByClientId'
|
||||||
operationId: GetEmployeeAndDependenceByClientId
|
operationId: GetEmployeeAndDependenceByClientId
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
@ -688,7 +688,7 @@ paths:
|
|||||||
summary: 'GetClientPolicy'
|
summary: 'GetClientPolicy'
|
||||||
operationId: GetClientPolicy
|
operationId: GetClientPolicy
|
||||||
parameters:
|
parameters:
|
||||||
- name: auth
|
- name: Authorization
|
||||||
in: header
|
in: header
|
||||||
description: an authorization header
|
description: an authorization header
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user