CHANGES_REMINDER_MAIL_AND_POLICY_GRID_AND_OTHERS : RV

This commit is contained in:
VENKATESHWARAN 2024-12-09 09:27:38 +05:30
parent 4e450451f3
commit fbefc7468e
9 changed files with 307 additions and 189 deletions

View File

@ -26,6 +26,7 @@ $routes->get("updateRemainderDate", "ClientController::updateRemainderDate");
$routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
$routes->get("sendextraparam", "ClientController::sendextraparam");
// $routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
// $routes->get("sendCroneRemainderMail", "DashboardController::sendCroneRemainderMail");
$routes->post("add_advertise_image", "AppContentManagementController::add_advertise_image");
$routes->get("add_image_index", "AppContentManagementController::add_image_index");

View File

@ -2442,11 +2442,11 @@ class ClientController extends AdminController
$termsData = json_decode($termsData['policy_terms']);
if (isset($termsData->sum_insured) && empty($termsData->sum_insured)) {
if (isset($termsData->sum_insured) && $termsData->sum_insured == "" && $termsData->sum_insured == null) {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty', 'data' => $record], 200);
}
if (isset($termsData->SumInsured) && empty($termsData->sum_insured)) {
if (isset($termsData->sumInsured2) && $termsData->sumInsured2 == "" && $termsData->sumInsured2 == null) {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty'], 200);
}

View File

@ -365,41 +365,81 @@ class DashboardController extends AdminController
foreach ($client_policy_data as $client_policy) {
if (empty($send_mail_for_manual_or_crone)) {
// Fetch client data
$client_data = $this->clientModel->find($client_policy['client_id']);
// 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();
// Fetch notification settings
$notification_data = $this->notificationModel
->where('client_id', $client_policy['client_id'])
->where('template_name', 'member_reminder_mail')
->first();
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
// $this->myLogger->logme('error', 'Notification data fetched: ' . json_encode($notification_data));
//manaual
if (empty($send_mail_for_manual_or_crone)) {
// Check if notification should be sent
if ($notification_data && $notification_data['enabled'] == 1 && !empty($notification_data['mail_content'])) {
// Check if notification should be sent
$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.*, employee_polices.id as emp_policy_id')
->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();
$employees = [];
if (in_array($client_policy['policy_type_id'], [2, 4]) || ($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 1)) {
// dd($employees);
// Fetch all employees related to the client policy
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
// dd($employees, 'first');
} else if (($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 3) || $client_policy['policy_type_id'] == 5) {
$empDependentData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship !=', 'Self')
->findAll();
$empCodes = array_column($empDependentData, 'emp_code');
// dd($empDependentData, $empCodes,'second');
if (!empty($empCodes)) {
$empSelfData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employees.emp_code', $empCodes)
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
$employees = array_merge($employees, $empSelfData);
}
}
// dd($employees);
// Process each employee
foreach ($employees as $employee) {
if (!empty($employees) && count($employees) > 0) {
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
@ -407,8 +447,8 @@ class DashboardController extends AdminController
$params['client_data'] = $client_data;
$params['notification_data'] = $notification_data;
$params['common'] = [
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_policy_id' => $client_policy['id'],
'employee_policy_id' => $employee['emp_policy_id'],
'employee_id' => $employee['id'],
@ -421,50 +461,76 @@ class DashboardController extends AdminController
$reminder_whole_mail[] = $mail_result;
}
}
} else {
$this->myLogger->logme('error', 'Notification was not sent for Client Policy ID: ' . $client_policy['id']);
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
}
} else {
$currentDate = date('d');
$remainder_dates = explode(",", $client_policy['reminder_date']);
} else { // crone
foreach ($remainder_dates as $date) {
if (!empty($client_policy['reminder_date'])) {
if ($currentDate == $date) {
$currentDate = date('d');
$remainder_dates = explode(",", $client_policy['reminder_date']);
$client_data = $this->clientModel->find($client_policy['client_id']);
foreach ($remainder_dates as $date) {
// Fetch notification settings
$notification_data = $this->notificationModel
->where('client_id', $client_policy['client_id'])
->where('template_name', 'member_reminder_mail')
->first();
if ($currentDate == $date) {
// Check if notification should be sent
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']);
// echo '4';
// Fetch all employees related to the client policy
$employees = [];
if (in_array($client_policy['policy_type_id'], [2, 4]) || ($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 1)) {
$this->myLogger->logme('error', 'Notification should be sent for client policy ID: ' . $client_policy['id']);
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
// Fetch all employees related to the client policy
$employees = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->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();
// dd($employees, 'first');
// Process each employee
foreach ($employees as $employee) {
} else if (($client_policy['policy_type_id'] == 3 && $client_policy['is_addon'] == 3) || $client_policy['policy_type_id'] == 5) {
$empDependentData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->where('employee_polices.client_policy_id', $client_policy['id'])
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.emp_status', 'draft')
->where('employee_polices.status', 'draft')
->where('employees.relationship !=', 'Self')
->findAll();
$empCodes = array_column($empDependentData, 'emp_code');
// dd($empDependentData, $empCodes,'second');
if (!empty($empCodes)) {
$empSelfData = $this->employeePolicyModel
->select('employees.*, employee_polices.id as emp_policy_id')
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
->whereIn('employees.emp_code', $empCodes)
->where('employees.is_active', 1)
->where('employee_polices.is_active', 1)
->where('employees.relationship', 'Self')
->where("employees.email_corporate IS NOT NULL AND employees.email_corporate != ''")
->findAll();
$employees = array_merge($employees, $empSelfData);
}
}
// dd($employees);
// 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
@ -472,8 +538,8 @@ class DashboardController extends AdminController
$params['client_data'] = $client_data;
$params['notification_data'] = $notification_data;
$params['common'] = [
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_id' => $client_policy['client_id'],
'client_branch_id' => $client_policy['client_branch_id'],
'client_policy_id' => $client_policy['id'],
'employee_policy_id' => $employee['emp_policy_id'],
'employee_id' => $employee['id'],
@ -485,13 +551,19 @@ class DashboardController extends AdminController
// $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', "SEND REMAINDER CRONE --- Remainder date is empty()");
}
}
} else {
$this->myLogger->logme('error', 'Notification setup not found or not enabled');
$this->myLogger->logme('error', 'Notification was not sent for this Client ID: ' . $client_policy['client_id']);
}
}
@ -515,11 +587,11 @@ class DashboardController extends AdminController
}
}
public function sendManualReminder($client_id, $client_branch_id)
public function sendManualReminder($client_id, $client_branch_id, $client_policy_id = null)
{
$this->myLogger->logme('error', "sendManualRemainder called with client_id: {$client_id}, client_branch_id: {$client_branch_id}");
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id);
$client_policy_data = $this->clientPolicyModel->getPolicyDetailsForRemainder($client_id, $client_branch_id, $client_policy_id);
// print_r($client_policy_data); die;
// print_r($this->clientPolicyModel->getLastQuery()); die;
// $this->myLogger->logme('error', "Policy details fetched: " . json_encode($client_policy_data));

View File

@ -711,16 +711,25 @@ class EmployeeController extends AdminController
public function enrollmentClientList()
{
$data = [];
$client_list = $this->clientModel->findAll();
$branch_list = $this->clientBranchModel->findAll();
$client_list = $this->clientModel->where('clients.is_active', 1)->findAll();
$branch_list = $this->clientBranchModel->where('client_branch.is_active', 1)->findAll();
$policy_list = $this->clientPolicyModel
->select('client_policy.*, policy_type.policy_type')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
->where('client_policy.is_active', 1)
->findAll();
$data['client_list'] = $client_list;
$data['branch_list'] = $branch_list;
$data['policy_list'] = $policy_list;
// Get session data if available
$data['selected_client_id'] = session()->get('client_id');
$data['selected_branch_id'] = session()->get('branch_id');
$data['selected_type'] = session()->get('type');
// dd($data);
$this->myLogger->logme('error', 'list called');
return $this->loadLayout('enrollment_list', $data);

View File

@ -81,76 +81,18 @@ class sendMailNotification
$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 ($emp_data && (isset($notification_data) && $notification_data['enabled'] == 1)) {
if(isset($emp_data['relationship'])){
if ($emp_data['relationship'] == 'Self') {
if(count($emp_data) > 0){
$mail ='';
if ($emp_data['relationship'] == 'Self') {
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
}
}
}else{
$mail ='';
}
}else{
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
}
if (isset($mail) && !empty($mail)) {
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
}
}else{
foreach ($emp_data as $key => $value) {
if ($value['relationship'] != 'Self') {
$emp_data = $EmployeeModel->where('client_id', $client_data['id'])->where('emp_code', $value['emp_code'])->where('is_active',1)->findAll();
if(count($emp_data) > 1){
$mail ='';
foreach ($emp_data as $key => $values) {
if ($value['relationship'] == 'Self') {
$employee_name =$values['name'];
$employee_mobile_no =$values['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $values['email_corporate'];
}
}
}else{
$mail ='';
}
}else{
$employee_name =$value['name'];
$employee_mobile_no =$value['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $value['email_corporate'];
}
if (isset($mail) && !empty($mail)) {
$wholeData[] = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
}
}
}
$employee_name =$emp_data['name'];
$employee_mobile_no =$emp_data['mobile'];
$mail_content = str_replace("[[member_name]]", $employee_name, $mail_content);
$mail_content = str_replace("[[member_mobile]]", $employee_mobile_no, $mail_content);
$mail = $emp_data['email_corporate'];
if (count($wholeData) < 1) {
$wholeData = [];
}
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content, 'bcc'=> $client_data['common_mails'], 'reply_to' => $client_data['reply_to'], 'common' => $common];
return $wholeData;
// }else{
// return "false";
// }
} else if($action == 'member_ecard_mail'){
@ -269,6 +211,8 @@ class sendMailNotification
}
//end of getting policy premium data
// dd($policy_premium_data);
$policy_name = $inner_item['policy_name'];
if ($inner_item['relationship'] == 'Self') {
@ -282,11 +226,12 @@ class sendMailNotification
$premium = '';
$gst_forself = '';
if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
// if(checkFamilyFloaters($policy_premium_data, $client_policy_data, $inner_item)){
$si = '₹ ' .format_indian_number($inner_item['basic_cover_si']);
$premium = '₹ ' .format_indian_number(round($inner_item['premium']));
$gst_forself = '₹ ' .format_indian_number(round($inner_item['gst']));
}
// }
$temp_data .= '<tr>';
$temp_data .= '<td>' . $inner_item['name'] . ($inner_item['relationship'] == 'Self' ? ' (' . $inner_item['emp_code'] . ')' : '') . '</td>';

View File

@ -390,21 +390,26 @@ public function getCliendDataForExcelFileName($client_policy_id){
}
//for this using in CRONE JOB
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null)
public function getPolicyDetailsForRemainder($client_id = null, $branch_id = null, $policy_id = null)
{
$builder = $this->table('client_policy')
->where('client_policy.is_addon', 1)
->where('client_policy.open_for_enrollment', 1)
->where('client_policy.inception_type', 2)
->where('client_policy.is_active', 1)
->where('client_policy.policy_status', 1)
->whereIn('client_policy.policy_type_id', [2, 3]);
// ->where('client_policy.is_addon', 1)
// ->where('client_policy.inception_type', 2)
->where('client_policy.open_for_enrollment', 1);
if ($client_id && $branch_id) {
$builder->where('client_policy.client_id', $client_id)
->where('client_policy.client_branch_id', $branch_id);
}
if(empty($policy_id)){
$builder->whereIn('client_policy.policy_type_id', [2, 3, 4, 5]);
}else{
$builder->where('client_policy.id', $policy_id);
}
return $builder->get()->getResultArray();
}

View File

@ -175,14 +175,14 @@
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
</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;">
<input id="is_member_modify_allowed" type="checkbox" name="is_member_modify_allowed" checked>
<span class="slider round" style="height: 27px;"></span>
</label>
<label for="is_member_modify_allowed" style="position: relative;bottom: 5px;left: 85px;"> In Enrollment Member Data Modification Allowed</label>
</div>
</div> -->
</div>
<div id="policy_fields"></div>
@ -827,11 +827,11 @@
}
// Member Modify Data Enable or Disable
if (res.data.is_member_modify_allowed == 1) {
$('#is_member_modify_allowed').prop('checked', true);
} else {
$('#is_member_modify_allowed').prop('checked', false);
}
// if (res.data.is_member_modify_allowed == 1) {
// $('#is_member_modify_allowed').prop('checked', true);
// } else {
// $('#is_member_modify_allowed').prop('checked', false);
// }
// if (res.data.is_addon != '1' && res.data.is_addon != '0') {
@ -1199,7 +1199,9 @@
} else if (input) {
// console.log( 'input type step 2', typeof input);
// Handle the case where input is a string
number = parseFloat(input.replace(/,/g, ''), 10);
// number = parseFloat(input.replace(/,/g, ''), 10);
number = parseFloat(String(input).replace(/,/g, ''), 10);
} else {
// Handle the case where input is undefined or null
number = NaN; // or handle as needed

View File

@ -17,7 +17,7 @@
/* background-color: #eb7a76; */
background-color: darkgrey;
/* padding-bottom: 1px; */
padding-top: 10px;
/* padding-top: 10px; */
}
#tickets-table_filter {
@ -59,24 +59,31 @@
</div>
<div class="col-3">
<div id="categoryFilter_11">
<select name="branch_id" class="form-control" id="branch_id">
<select name="branch_id" class="form-control" id="branch_id" onchange="populatePolicies()">
<option value="0">Select Branch</option>
</select>
</div>
</div>
<div class="col-3">
<div id="categoryFilter_14">
<select name="client_policy_id" class="form-control" id="client_policy_id">
<option value="0">Select Policy</option>
</select>
</div>
</div>
<div class="col-1">
<div id="categoryFilter_11">
<a href="#" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);"><i class="fa fa-search" aria-hidden="true"></i></a>
<a class="btn btn-primary waves-effect waves-light" onclick="fetchEmpolyeeList(event);" data-toggle="tooltip" data-placement="top" title="Search" id="get-emp-list"><i class="fa fa-search" aria-hidden="true"></i></a>
</div>
</div>
<div class="col-2">
<div class="col-0" style="margin-right: 15px; ">
<div id="categoryFilter_12">
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)">Send Reminder</a>
<a class="btn btn-primary waves-effect waves-light" onclick="sendManualReminder(this)" data-toggle="tooltip" data-placement="top" title="Send Reminder"><i class="fa fa-bell" aria-hidden="true"></i></a>
</div>
</div>
<div class="col-1">
<div class="col-0">
<div id="categoryFilter_13">
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" ><i class="fas fa-file-upload" ></i></a>
<a class="btn btn-primary waves-effect waves-light" onclick="uploadEnrollmentFile(this)" data-toggle="tooltip" data-placement="top" title="Enrollment File Upload"><i class="fas fa-file-upload" ></i></a>
</div>
</div>
@ -84,7 +91,7 @@
<!-- <div class="row" style="margin-bottom: 44px;"> -->
<div class="col-1 text-right view-status-btn" style="position: relative;bottom: 7px;">
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;">
<button type="button" class="btn btn-link visa_status_button" onclick="toggleContent()" style="color: #000;" data-toggle="tooltip" data-placement="top" title="View Status Card">
Status <i id="toggleIcon" class="fas fa-minus"></i>
</button>
</div>
@ -234,6 +241,7 @@
</div><!-- /.modal -->
<script>
function populateBranches()
{
var clientId = document.getElementById('clients').value;
@ -257,6 +265,38 @@
});
}
function populatePolicies()
{
console.log('populatePolicies function called');
var clientId = document.getElementById('clients').value;
var branchId = document.getElementById('branch_id').value;
var policyDropdown = document.getElementById('client_policy_id');
console.log('clientId', clientId);
console.log('branchId', branchId);
console.log('policyDropdown', policyDropdown);
policyDropdown.innerHTML = '<option value="0">Select Policy</option>';
if (clientId == 0 && branchId == 0) {
return;
}
var policies = <?= json_encode($policy_list) ?>;
console.log('policies', policies);
policies.forEach(policy => {
if (policy.client_id == clientId && policy.client_branch_id == branchId) {
var option = document.createElement('option');
option.value = policy.id;
option.textContent = policy.policy_type + ' - ' + policy.policy_no;
policyDropdown.appendChild(option);
}
});
}
function filterTable(columnIndex, filterValue)
{
var table = $('#tickets-table').DataTable();
@ -408,6 +448,7 @@
$('#clients').select2();
$('#policy_id').select2();
$('#branch_id').select2();
$('#client_policy_id').select2();
var table = $('#tickets-table').DataTable({
dom: 'fBrtip',
buttons: [
@ -704,20 +745,38 @@
var client_id = $('#clients').val()
var client_branch_id = $('#branch_id').val()
var client_policy_id = $('#client_policy_id').val()
console.log('input', input);
console.log('client_id', client_id);
console.log('client_branch_id', client_branch_id);
console.log('client_policy_id', client_policy_id);
if(client_id == 0 && client_branch_id == 0)
{
if (client_id == 0) {
Swal.fire({
title: "warning!",
text: 'Please select the Client and Client Branch.',
title: "Warning!",
text: 'Please select the Client.',
icon: "warning"
});
return false;
}
return false
if (client_branch_id == 0) {
Swal.fire({
title: "Warning!",
text: 'Please select the Client Branch.',
icon: "warning"
});
return false;
}
if (client_policy_id == 0) {
Swal.fire({
title: "Warning!",
text: 'Please select the Client Policy.',
icon: "warning"
});
return false;
}
Swal.fire({
@ -731,7 +790,7 @@
if (result.isConfirmed) {
$.ajax({
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id,
url: '<?= base_url("util/send_manual_reminder/") ?>' + client_id + '/' + client_branch_id + '/' + client_policy_id,
type: "GET",
dataType: 'json',
success: function(res) {

View File

@ -101,7 +101,7 @@
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="emp_code">Policy Premium Type<span
class="text-danger">*</span></label>
<select class="form-control" id="grid" name="policy_grid_id"
@ -109,15 +109,16 @@
</select>
</div>
<div class="form-group col-md-4"
<div class="form-group col-md-6"
style="position: relative; left: 45px; display:none" id="premium_type">
<label for="css"> Premium Calculation </label>
<div style="display: flex; align-items: center;">
<input type="radio" id="individual" name="premium_type" value="2">
<label for="individual" style="position: relative;top: 5px;left: 5px;">
Individual </label>&nbsp;
<label for="individual" style="position: relative;top: 5px;left: 5px;">Individual </label>&nbsp;
<input type="radio" id="single" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
<input type="radio" id="single_and_individual" name="premium_type" value="3">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater cum Individual </label>
</div>
</div>
</div>
@ -1899,24 +1900,25 @@ function removebutton(index, type)
function checkDuplicate(unique_id = null)
{
console.log('checkDuplicate unique_id', unique_id)
console.log('checkDuplicate function called')
// console.log('checkDuplicate unique_id', unique_id)
var id = $('#grid')[0];
var container = $('#grid_content_input');
console.log('checkDuplicate id 1', id);
console.log('checkDuplicate container 1', container);
// console.log('checkDuplicate id 1', id);
// console.log('checkDuplicate container 1', container);
if (unique_id) {
id = $('#grid_'+unique_id)[0];
container = $('#grid_content_input_for_additional_'+unique_id);
console.log('checkDuplicate id 2', id);
console.log('checkDuplicate container 2', container);
// console.log('checkDuplicate id 2', id);
// console.log('checkDuplicate container 2', container);
}
console.log('checkDuplicate id 3', id);
console.log('checkDuplicate container 3', container);
// console.log('checkDuplicate id 3', id);
// console.log('checkDuplicate container 3', container);
// var highlightDuplicates = function(duplicateIndices) {
// duplicateIndices.forEach(index => {
@ -2328,7 +2330,7 @@ function checkDuplicate(unique_id = null)
} else if (id.value === '12'){
var siInputs = container.find('input[name="12_si[]"]');
var relationship = container.find('input[name="12_relationship[]"]');
var relationship = container.find('select[name="12_relationship[]"]');
var units = container.find('input[name="12_unit[]"]');
var siValues = [];
@ -2350,9 +2352,15 @@ function checkDuplicate(unique_id = null)
unitValues.push(value);
});
// console.log('siInputs array', siInputs)
// console.log('relationship array', relationship)
// console.log('units array', units)
for (var i = 0; i < siValues.length; i++) {
for (var j = i + 1; j < siValues.length; j++) {
if (unitValues[i] === unitValues[j] && siValues[i] === siValues[j] && relationshipValue[i] === relationshipValue[j]) {
console.log('depulicate si :', siValues[i])
console.log('depulicate relation :', relationshipValue[i])
duplicatesFound = true;
}
}
@ -2364,10 +2372,11 @@ function checkDuplicate(unique_id = null)
} else {
return false;
}
} else if (id.value === '13'){
var siInputs = container.find('input[name="13_si[]"]');
var relationship = container.find('input[name="13_relationship[]"]');
var relationship = container.find('select[name="13_relationship[]"]');
var units = container.find('input[name="13_unit[]"]');
var ageFrom = container.find('input[name="13_age_from[]"]');
var ageTo = container.find('input[name="13_age_to[]"]');
@ -2404,12 +2413,8 @@ function checkDuplicate(unique_id = null)
for (var i = 0; i < siValues.length; i++) {
for (var j = i + 1; j < siValues.length; j++) {
if (unitValues[i] === unitValues[j] &&
siValues[i] === siValues[j] &&
relationshipValue[i] === relationshipValue[j] &&
fromAgeValue[i] === fromAgeValue[j] &&
toAgeValue[i] === toAgeValue[j]
) {
if (unitValues[i] === unitValues[j] && siValues[i] === siValues[j] && relationshipValue[i] === relationshipValue[j] && fromAgeValue[i] === fromAgeValue[j] && toAgeValue[i] === toAgeValue[j])
{
duplicatesFound = true;
}
}
@ -3332,7 +3337,7 @@ function appendNewTab(tabNameData = null, data = null)
<div class="form-group">
<div class="form-row" id="rac_rate_dropdown_${tabId}">
<div class="form-group col-md-6">
<div class="form-group col-md-4">
<label for="emp_code">Policy Premium Type<span
class="text-danger">*</span></label>
<select class="form-control" id="grid_${tabId}" name="policy_grid_id"
@ -3340,7 +3345,7 @@ function appendNewTab(tabNameData = null, data = null)
</select>
</div>
<div class="form-group col-md-4"
<div class="form-group col-md-6"
style="position: relative; left: 45px; display:none" id="premium_type_${tabId}">
<label for="css"> Premium Calculation </label>
<div style="display: flex; align-items: center;">
@ -3349,6 +3354,8 @@ function appendNewTab(tabNameData = null, data = null)
Individual </label>&nbsp;
<input type="radio" id="single_${tabId}" name="premium_type" value="1">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater </label>
<input type="radio" id="single_and_individual_${tabId}" name="premium_type" value="3">
<label for="single" style="position: relative;top: 5px;left: 5px;"> Family Floater cum Individual </label>
</div>
</div>
</div>
@ -3727,18 +3734,27 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
// console.log('editPolicyPremiumCalculationSetValue step 1');
if (premium_type === '2') {
// console.log('editPolicyPremiumCalculationSetValue step 2');
$('#individual_'+unique_id).prop('checked', true);
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', true);
$('#single_and_individual_'+unique_id).prop('checked', false);
} else if (premium_type === '1') {
// console.log('editPolicyPremiumCalculationSetValue step 3');
$('#single_'+unique_id).prop('checked', true);
$('#individual_'+unique_id).prop('checked', false);
$('#single_and_individual_'+unique_id).prop('checked', false);
}else if (premium_type === '3') {
// console.log('editPolicyPremiumCalculationSetValue step 3');
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', false);
$('#single_and_individual_'+unique_id).prop('checked', true);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 4');
$('#single_'+unique_id).prop('checked', false);
$('#individual_'+unique_id).prop('checked', true);
$('#single_and_individual_'+unique_id).prop('checked', false);
}
}else{
@ -3746,18 +3762,27 @@ function editPolicyPremiumCalculationSetValue(premium_type, unique_id = null)
// console.log('editPolicyPremiumCalculationSetValue step 5');
if (premium_type === '2') {
// console.log('editPolicyPremiumCalculationSetValue step 6');
$('#individual').prop('checked', true);
$('#single').prop('checked', false);
$('#individual').prop('checked', true);
$('#single_and_individual').prop('checked', false);
} else if (premium_type === '1') {
// console.log('editPolicyPremiumCalculationSetValue step 7');
$('#single').prop('checked', true);
$('#individual').prop('checked', false);
$('#single_and_individual').prop('checked', false);
}else if (premium_type === '3') {
// console.log('editPolicyPremiumCalculationSetValue step 7');
$('#single').prop('checked', false);
$('#individual').prop('checked', false);
$('#single_and_individual').prop('checked', true);
} else {
// console.log('editPolicyPremiumCalculationSetValue step 8');
$('#single').prop('checked', false);
$('#individual').prop('checked', true);
$('#single_and_individual').prop('checked', false);
}