From b8863cc564f3fc79f6e660fe690830ba2aea2ef3 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Wed, 15 May 2024 17:05:31 +0530 Subject: [PATCH 01/13] CHANGE_GMC_POLCIY_TERMS_AGE_STORE_NULL_CHANEGE_THE_ISSUE : AADHAVAN --- app/Views/policy_gmc_terms.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/app/Views/policy_gmc_terms.php b/app/Views/policy_gmc_terms.php index 2d100a51..f6c9fa46 100644 --- a/app/Views/policy_gmc_terms.php +++ b/app/Views/policy_gmc_terms.php @@ -142,7 +142,7 @@ Spouse: -
Min Age:
+
Min Age:
Max Age:
@@ -1040,8 +1040,8 @@ if ($('#spouse').prop('checked')) { $('.spouse-age').css('display',''); - $('#spouse_min_age').val(18); - $('#spouse_max_age').val(60); + // $('#spouse_min_age').val(18); + // $('#spouse_max_age').val(60); } else { $('.spouse-age').css('display','none'); @@ -1256,10 +1256,10 @@ $('#spouse').change(function () { if ($(this).prop('checked')) { $('.spouse-age').css('display',''); - if($('#spouse_min_age').val() < 0 || $('#spouse_min_age').val() == '' ){ + if($('#spouse_min_age').val() < 17 || $('#spouse_min_age').val() == '' ){ $('#spouse_min_age').val(18); } - if($('#spouse_max_age').val() < 0 || $('#spouse_max_age').val() == '' ){ + if($('#spouse_max_age').val() < 17 || $('#spouse_max_age').val() == '' ){ $('#spouse_max_age').val(60); } }else{ @@ -1275,7 +1275,7 @@ if($('#child_min_age').val() < 0 || $('#child_min_age').val() == '' ){ $('#child_min_age').val(0); } - if($('#child_max_age').val() < 0 || $('#child_max_age').val() == '' ){ + if($('#child_max_age').val() < 24 || $('#child_max_age').val() == '' ){ $('#child_max_age').val(25); } }else{ @@ -1289,6 +1289,13 @@ var family_floaters = $(this).val(); if($('#family_floaters').val() != 0){ $('.other-member-age').css('display',''); + if($('#other_member_min_age').val() < 17 || $('#other_member_min_age').val() == '' ){ + $('#other_member_min_age').val(18); + } + if($('#other_member_max_age').val() < 79 || $('#other_member_max_age').val() == '' ){ + $('#other_member_max_age').val(60); + } + }else{ $('.other-member-age').css('display','none'); } From 802e993b8e3bf78cec850c420fbb5e4e4759ddfa Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 15 May 2024 17:33:33 +0530 Subject: [PATCH 02/13] CHANGE_ALERT_IF_TERMS&RACK_NOT_DEFINED --- app/Config/Routes.php | 1 + app/Controllers/EmployeeController.php | 28 ++++++++++++ app/Controllers/Jobs/SubJob.php | 2 + app/Models/PolicesModel.php | 13 ++++-- app/Views/employee_upload.php | 62 +++++++++++++++++++++++++- 5 files changed, 101 insertions(+), 5 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index c757962c..a82a9776 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -228,6 +228,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) { $routes->get("id-card", "EmployeeController::viewECard/$1"); $routes->get("preview-card/(:any)", "EmployeeController::previewTemplate/$1"); $routes->get("export-import-error-list/(:any)", "EmployeeController::errorListExportImport/$1"); + $routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1"); }); $routes->cli('cli/processjob', 'JobWorker::processJob'); diff --git a/app/Controllers/EmployeeController.php b/app/Controllers/EmployeeController.php index 2409f694..0e9b4a3f 100644 --- a/app/Controllers/EmployeeController.php +++ b/app/Controllers/EmployeeController.php @@ -11,6 +11,7 @@ use Psr\Log\LoggerInterface; use App\Models\EmployeeModel; use App\Models\EmployeePolicyModel; use App\Models\ClientModel; +use App\Models\PolicesModel; use App\Models\FileModel; use App\Models\BatchListModel; use App\Models\BatchFileModel; @@ -49,6 +50,7 @@ class EmployeeController extends AdminController protected $empEndorsementModel; protected $clientPolicyModel; protected $TPAModel; + protected $policiesModel; public function __construct() { @@ -64,6 +66,7 @@ class EmployeeController extends AdminController $this->empEndorsementModel = new EmpEndorsementModel(); $this->clientPolicyModel = new ClientPolicyModel(); $this->TPAModel = new TPAModel(); + $this->policiesModel = new PolicesModel(); } public function list() @@ -1141,4 +1144,29 @@ class EmployeeController extends AdminController echo view('export_import_error_list', $excelErrorData); } + public function hasPolicyConfigCompleted() + { + $client_policy_id = $this->request->uri->getSegment(3); + $policy_details = $this->clientPolicyModel->find($client_policy_id); + // print_r($policy_details);die(); + $policy_terms = isset($policy_details['policy_terms']) ? true : false; + + $slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']); + + $message = null; + + if (!isset($policy_terms)) { + $message .= 'Policy terms'; + } + + if($slab_details['slab_rates'] == null && $slab_details['grid_master'] == null) + { + $message = isset($message) ? ($message . ' and rack rates ') : ($message . ' Rack rates'); + } + $message = isset($message) ? ($message . ' not defined for choosed policy') : null; + + return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200); + + } + } diff --git a/app/Controllers/Jobs/SubJob.php b/app/Controllers/Jobs/SubJob.php index be74f0b8..35d9f8fd 100644 --- a/app/Controllers/Jobs/SubJob.php +++ b/app/Controllers/Jobs/SubJob.php @@ -8,6 +8,8 @@ class SubJob extends PublicController { public function handle($payload) { + $log = \Config\Services::mylogger(); + $log->logme('error', 'handle called'); return $payload['a'] - $payload['b']; } diff --git a/app/Models/PolicesModel.php b/app/Models/PolicesModel.php index d6a8182e..a56af6bc 100644 --- a/app/Models/PolicesModel.php +++ b/app/Models/PolicesModel.php @@ -39,6 +39,7 @@ class PolicesModel extends Model { $premium_slab_data = null; + $grid_type = null; $policyPremium1Model = new PolicyPremium1Model(); $premium_slab_data = $policyPremium1Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); @@ -50,9 +51,13 @@ class PolicesModel extends Model $premium_slab_data = $policyPremium2Model->where(['client_id' => $client_id, 'client_policy_id' => $policy_id, 'is_active' => 1])->findAll(); } - $grid_id = $premium_slab_data[0]['policy_grid_id']; - $policyGridModel = new PolicyGridModel(); - $results = $policyGridModel->find($grid_id); - return ['slab_rates' => $premium_slab_data,'grid_master' => $results]; + if(isset($premium_slab_data[0]['policy_grid_id'])) + { + $grid_id = $premium_slab_data[0]['policy_grid_id']; + $policyGridModel = new PolicyGridModel(); + $grid_type = $policyGridModel->find($grid_id); + } + + return ['slab_rates' => $premium_slab_data,'grid_master' => $grid_type]; } } diff --git a/app/Views/employee_upload.php b/app/Views/employee_upload.php index d729ab25..64cbca65 100644 --- a/app/Views/employee_upload.php +++ b/app/Views/employee_upload.php @@ -38,7 +38,7 @@ option:disabled {

-
@@ -727,10 +727,70 @@ $(document).ready(function() { } } }); + }) }) +function checkPolicyTermsAndRackRatesHasDefiend(event) +{ + console.log(event.target.id); + var policy_id = (event.target.value); + console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id); + var apiURL = '' + 'util/has_policy_config_completed/' + policy_id; + console.log(apiURL); + + $('.loader').fadeIn(); + $('.loader-mask').fadeIn(); + + + $.ajax({ + url: apiURL, + method: 'GET', + headers: { + "Content-Type": "application/json", + "X-Requested-With": "XMLHttpRequest" + }, + success: function(response) { + + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); + + console.log('check policy responce', response); + + if (response.code === 200 && response.dataStatus === true && response.message !== null) { + toastr.error(response.message, 'Error'); + $('#emp_form_submit_button').prop('disabled', true); + return false; + } + else if(response.code === 200 && response.dataStatus === true && response.message == null) + { + // toastr.error('Policy Terms or rack rate not defined!', 'Error'); + $('#emp_form_submit_button').prop('disabled', false); + return true; + } + else + { + toastr.error('Policy Terms or rack rate not defined!', 'Error'); + return false; + } + }, + error: function(xhr, status, error) { + setTimeout(function() { + $('.loader').fadeOut(); + $('.loader-mask').delay(350).fadeOut('slow'); + }, 1000); + toastr.error('Something went wrong! Try Later', 'Error'); + console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error); + return false; + } + }); + +} + + //--------------------------------------------------------------------------------------------------------- \ No newline at end of file From 5d20b696e99a10f2747141f920c2cdb159c41f94 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 16 May 2024 12:25:33 +0530 Subject: [PATCH 03/13] CHANGE_NOTIFICATION_MAIL_ALLOW_NULL_ISSUE : AADHAVAN --- app/Controllers/EmpDataServiceController.php | 29 ++++++++++++++------ app/Controllers/EmployeeRestController.php | 15 +++++----- app/Controllers/NotificationController.php | 11 +++++--- app/Helpers/sendMailNotification.php | 28 +++++++++++++------ 4 files changed, 54 insertions(+), 29 deletions(-) diff --git a/app/Controllers/EmpDataServiceController.php b/app/Controllers/EmpDataServiceController.php index 826c8a6b..fdaae901 100644 --- a/app/Controllers/EmpDataServiceController.php +++ b/app/Controllers/EmpDataServiceController.php @@ -2063,10 +2063,12 @@ class EmpDataServiceController extends BaseController $this->myLogger->logme('error', 'sendMailForDownloadingECard - inside try'); $count = 0; + $counts = 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.client_id as client_id, employees.name, employee_polices.rand_string, employee_polices.tpa_id') + ->select('employee_polices.client_policy_id, employees.relationship, 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') @@ -2091,19 +2093,28 @@ class EmpDataServiceController extends BaseController $params['notification'] = $notification; $params['notification'] = $notification; $params['get_emp_email_and_other_details'] = $get_emp_email_and_other_details; - $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params); + // $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',); - $count++; + if (isset($get_emp_email_and_other_details['email_corporate']) && !empty($get_emp_email_and_other_details['email_corporate']) && $get_emp_email_and_other_details['relationship'] === 'Self') { + $wholeData[] = sendMailNotification::sendMailNotification('member_ecard_mail', $params); + $count++; + } + $counts++; + - if ($count == 20 || $count == count($ids) - 1) { + if ($count == 20 || $counts == count($ids) - 1) { + if(count($wholeData) > 0){ - $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',); + $this->myLogger->logme('error', 'sendMailForDownloadingECard - create a job to bulk mail',); + + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]); + $wholeData = []; + $count = 0; + + } - $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'bulk_mail', 'payload' => $wholeData]); - $wholeData = []; - $count = 0; } $this->myLogger->logme('error', 'sendMailForDownloadingECard - Send Bulk Mail function end ',); diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php index 79069da8..91c4b6b6 100644 --- a/app/Controllers/EmployeeRestController.php +++ b/app/Controllers/EmployeeRestController.php @@ -877,7 +877,7 @@ class EmployeeRestController extends AdminController if (isset($notification) && $notification['enabled'] == 1) { //trigger - if ($dataToInsert[$a]['relationship'] == 'Self') { + if ($dataToInsert[$a]['relationship'] == 'Self' && isset($dataToInsert[$a]['email_corporate']) && !empty($dataToInsert[$a]['email_corporate'])) { $params['dataToInsert'] = $dataToInsert[$a]; $params['notification'] = $notification; @@ -887,13 +887,12 @@ class EmployeeRestController extends AdminController $count++; } 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 (count($wholeData) > 0) { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $wholeData]); + $wholeData = []; + $count = 0; + } } diff --git a/app/Controllers/NotificationController.php b/app/Controllers/NotificationController.php index e0a6280c..2c050523 100644 --- a/app/Controllers/NotificationController.php +++ b/app/Controllers/NotificationController.php @@ -147,11 +147,14 @@ class NotificationController extends AdminController $count++; $temp_whole_data[] = $value; if($count == 20 || $whole_index == count($wholeData)-1 && $index == count($values)-1){ - $job_details = new Jobs(); - $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]); + if (count($temp_whole_data) > 0) { + $job_details = new Jobs(); + $r = Jobs::addJob(['job_name' => 'bulk_mail','payload' => $temp_whole_data]); - $temp_whole_data = []; - $count = 0; + $temp_whole_data = []; + $count = 0; + } + } } } diff --git a/app/Helpers/sendMailNotification.php b/app/Helpers/sendMailNotification.php index f93e79f6..cfc96b17 100644 --- a/app/Helpers/sendMailNotification.php +++ b/app/Helpers/sendMailNotification.php @@ -57,21 +57,32 @@ class sendMailNotification if ($value['relationship'] != 'Self') { $emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll(); - - foreach ($emp_data as $key => $value) { - if ($value['relationship'] == 'Self') { - $employee_name =$value['name']; - $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); - $mail = $value['email_corporate']; + if(count($emp_data) > 1){ + $mail =''; + foreach ($emp_data as $key => $values) { + if ($value['relationship'] == 'Self') { + $employee_name =$values['name']; + $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); + + $mail = $values['email_corporate']; + } } + }else{ + $mail =''; } + }else{ $employee_name =$value['name']; $mail_content = str_replace("[[member_name]]", $employee_name, $mail_content); $mail = $value['email_corporate']; } + if (isset($mail) && !empty($mail)) { $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + } + } + if (count($wholeData) < 1) { + $wholeData = []; } return $wholeData; }else{ @@ -194,8 +205,9 @@ class sendMailNotification $mail_content = str_replace("[[member_summary]]", $table_content , $mail_content); // $mail = "aadhavanvalli@gmail.com"; - - $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + // if (isset($mail) && !empty($mail)) { + $wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails']]; + // } return $wholeData; From 90eaba5b85e174387f6576983ee591b176e5fcd1 Mon Sep 17 00:00:00 2001 From: aadhavan valli Date: Thu, 16 May 2024 14:33:56 +0530 Subject: [PATCH 04/13] CHANGE_CLIENT_POLICY_POLICY_NO_TPA_NETWORK_HOSPITAL : AADHAVAN --- app/Controllers/ClientController.php | 3 +++ app/Controllers/MasterController.php | 2 ++ app/Models/ClientPolicyModel.php | 3 ++- app/Models/TPAModel.php | 1 + app/Views/client_policy.php | 16 +++++++++++++--- app/Views/tpa_basic_info.php | 21 +++++++++++++-------- writable/e_card_template/md_tpa.html | 0 writable/e_card_template/ttpanh.html | 0 8 files changed, 34 insertions(+), 12 deletions(-) create mode 100644 writable/e_card_template/md_tpa.html create mode 100644 writable/e_card_template/ttpanh.html diff --git a/app/Controllers/ClientController.php b/app/Controllers/ClientController.php index 8b0c17ee..1984e5dc 100644 --- a/app/Controllers/ClientController.php +++ b/app/Controllers/ClientController.php @@ -653,6 +653,7 @@ class ClientController extends AdminController } + $data['policy_no'] = $this->request->getPost('policy_no'); $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); $data['created_by'] = get_session_userid(); @@ -696,6 +697,7 @@ class ClientController extends AdminController $data['tpa_id'] = $tpaId; $data['policy_id'] = $this->request->getPost('policy_id'); $data['policy_type_id'] = $this->request->getPost('policy_type_id'); + $data['policy_no'] = $this->request->getPost('policy_no'); $data['policy_start_date'] = change_date_format($this->request->getPost('policy_start_date'), 'd-m-Y', 'Y-m-d'); $data['policy_end_date'] = change_date_format($this->request->getPost('policy_end_date'), 'd-m-Y', 'Y-m-d'); @@ -741,6 +743,7 @@ class ClientController extends AdminController // dd($data); $data['updated_by'] = get_session_userid(); + // print_r($data);die; $insert = $this->clientPolicyModel->update($id,$data); $lastQuery = $this->clientPolicyModel->getLastQuery(); diff --git a/app/Controllers/MasterController.php b/app/Controllers/MasterController.php index a2c011a2..b652d3eb 100644 --- a/app/Controllers/MasterController.php +++ b/app/Controllers/MasterController.php @@ -427,6 +427,7 @@ class MasterController extends AdminController $data['tpa_logo'] = $file_name; $data['front_card'] = $front_card_file_name; $data['back_card'] = $back_card_file_name; + $data['network_hospitals'] = $this->request->getPost('network_hospitals'); $insert = $this->tpaModel->insert($data); @@ -566,6 +567,7 @@ class MasterController extends AdminController $data['back_card'] = $back_card_file_name; } + $data['network_hospitals'] = $this->request->getPost('network_hospitals'); $update = $this->tpaModel->update($id,$data); diff --git a/app/Models/ClientPolicyModel.php b/app/Models/ClientPolicyModel.php index 291b13f9..4cdd36b5 100644 --- a/app/Models/ClientPolicyModel.php +++ b/app/Models/ClientPolicyModel.php @@ -40,7 +40,8 @@ class ClientPolicyModel extends Model "updated_by", "Is_active", "date_of_exit", - "reason_for_exit" + "reason_for_exit", + "policy_no" ]; public function getClientPolicyById($id){ diff --git a/app/Models/TPAModel.php b/app/Models/TPAModel.php index 215c734d..fe3f30cd 100644 --- a/app/Models/TPAModel.php +++ b/app/Models/TPAModel.php @@ -15,6 +15,7 @@ class TPAModel extends Model "front_card", "back_card", "tpa_logo", + "network_hospitals", "created_by", "updated_by", "is_active", diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 8ee76ec5..d26b3f20 100644 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -92,15 +92,19 @@