FIX_PULL_NOTIFICATION_CSS_AND_CLIENT_POLICY_BASE_POLICY_MANDATORY_REMOVE : RV

This commit is contained in:
VENKATESHWARAN 2024-05-17 11:11:04 +05:30
parent affbd87822
commit a28cc81245
7 changed files with 140 additions and 68 deletions

View File

@ -22,7 +22,7 @@ class DashboardController extends AdminController
public function __construct()
{
$this->messageModel = new MessageModel();
$this->userMessageModel = new UserMessageModel();
$this->userMessageModel = new UserMessageModel();
}
public function dashboard()

View File

@ -644,7 +644,7 @@ class EmpDataServiceController extends BaseController
$this->batchFileModel->where('id', $file_id)->set($data)->update();
$this->myLogger->logme('error', 'importInceptionFileValidation TPAID already updated');
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'The list of employees provided has already been updated with the TPA ID, or this is not the correct file';
@ -658,7 +658,7 @@ class EmpDataServiceController extends BaseController
$this->batchFileModel->where('id', $file_id)->set($data)->update();
$this->myLogger->logme('error', 'importInceptionFileValidation UHID already updated');
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'The list of employees provided has already been updated with the UHID, or this is not the correct file';
@ -697,7 +697,7 @@ class EmpDataServiceController extends BaseController
$this->batchFileModel->where('id', $file_id)->set($data)->update();
$this->myLogger->logme('error', 'importInceptionFileValidation excel file count ( {excel} ) exceeds db count ( {db} )', ['db' => $emp_data_count, 'excel' => $excel_data_count]);
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'The Excel record count exceeds the DB record count. excel file count : ' . $excel_data_count . 'db count : ' . $emp_data_count;
@ -892,14 +892,14 @@ class EmpDataServiceController extends BaseController
if ($insurer_or_tpa == 'tpa') {
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'The TPA ID column is either partially or entirely empty.';
} else if ($insurer_or_tpa == 'insurer') {
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'The UHID column is either partially or entirely empty.';
@ -967,7 +967,7 @@ class EmpDataServiceController extends BaseController
$this->batchFileModel->where('id', $file_id)->set($data)->update();
$this->myLogger->logme('error', 'importInceptionUpdateTPAandUHID the Physical file not found - file id : {data}', ['data' => $file_id]);
$file_data = $this->getDataByFileId($file_id, 'Failure');
$file_data = $this->getDataByFileId($file_id, 'failure');
$this->setPullNotification($file_data);
return 'importInceptionUpdateTPAandUHID the Physical file not found'; // Return error code if file not found
@ -1114,7 +1114,7 @@ class EmpDataServiceController extends BaseController
}
$file_data = $this->getDataByFileId($file_id);
$file_data = $this->getDataByFileId($file_id, 'success');
$this->setPullNotification($file_data);
return 'Import Inception Updated '. $status_val . '- Updated Count : ' . $emp_count;
@ -2215,37 +2215,56 @@ class EmpDataServiceController extends BaseController
}
public function getDataByFileId($file_id, $status = 'Success'){
public function getDataByFileId($file_id, $status = 'success'){
$data = $this->batchFileModel
->select('batch_files.*, clients.client_name, policies.name as policy_name')
->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name')
->join('clients', 'clients.id = batch_files.client_id')
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
->join('policies', 'policies.id = client_policy.policy_id')
->where('batch_files.id', $file_id)
->first();
$msg_txt = 'Client : '. $data['client_name'] . ', Client policy : '. $data['policy_name'] . ', Event : ' . $data['event_type'] . ', Action : ' .$data['actions'] . ', Insure or TPA : ' . $data['insurer_or_tpa'] . ' Status : ' . $status;
if($status == 'success'){
$msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
$msg_title = 'File Upload Success';
}else if ($status == 'failure'){
$msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
$msg_title = 'File Upload Failure';
}
$user_id = $data['created_by'];
$url = 'employee/upload#KYC-DOC-tab';
return ['msg_txt' => $msg_txt, 'user_id' => $user_id, 'url' => $url];
return ['msg_txt' => $msg_txt, 'user_id' => $user_id, 'url' => $url, 'status' => $status, 'title' => $msg_title];
}
public function setPullNotification($data){
$array = ['message_text' => $data['msg_txt'], 'action_url' => $data['url'], 'msg_status' => $data['status'], 'msg_title' => $data['title']];
$jsonEncodeData = json_encode($array);
$msg_data = [
'message_text' => $data['msg_txt'],
'message_text' => $jsonEncodeData,
'user_id' => $data['user_id'],
'role_id' => NULL,
'team_id' => NULL,
'message_type' => '1to1',
'action_url' => $data['url'],
];
$this->messageModel->insert($msg_data);
}
}

View File

@ -22,6 +22,7 @@ class MessageModel extends Model
'message_type',
'created_at',
'action_url',
'msg_status',
];

View File

@ -54,7 +54,7 @@
</div>
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
<label for="addon_policy">Base Policy<span class="text-danger">*</span></label>
<label for="addon_policy">Base Policy<span id="base_danger" class="text-danger">*</span></label>
<select class="form-control" id="base_policy" name="base_policy">
<option value="" selected>Select Base Policy</option>
</select>
@ -92,7 +92,7 @@
</div>
<div class="form-row" id="second" style="display: none;">
<div class="form-group col-md-3">
<div class="form-group col-md-3">
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Policy Number " name="policy_no" id="policy_no" required>
</div>
@ -256,30 +256,30 @@
// console.log('search_term :', search_term)
var enrollmentStatus = '';
if(item.inception_type == 1){
if (item.inception_type == 1) {
enrollmentStatus = 'N/A'
enrollmentStatus = 'N/A'
}else if(item.inception_type == 2){
} else if (item.inception_type == 2) {
if(item.open_for_enrollment == 1){
if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
enrollmentStatus = '<a href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
}else if(item.open_for_enrollment == 0){
} else if (item.open_for_enrollment == 0) {
enrollmentStatus = '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
enrollmentStatus = '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
var tpaValue = 'TPA Unavailable';
}
if (item.tpa_short && item.tpa_branch_code) {
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
}
var tpaValue = 'TPA Unavailable';
if (item.tpa_short && item.tpa_branch_code) {
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
}
policyTable += `
@ -417,20 +417,20 @@
// console.log('search_term :', search_term)
var enrollmentStatus = '';
if(item.inception_type == 1){
if (item.inception_type == 1) {
enrollmentStatus = 'N/A'
}else if(item.inception_type == 2){
} else if (item.inception_type == 2) {
if(item.open_for_enrollment == 1){
if (item.open_for_enrollment == 1) {
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Open</a>'
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Open</a>'
}else if(item.open_for_enrollment == 0){
} else if (item.open_for_enrollment == 0) {
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + item.id + '" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
}
@ -602,9 +602,9 @@
// appendPolicyFormFields(2);
// }
if($('#policy_type').val() == 1){
if ($('#policy_type').val() == 1) {
console.log('step 1')
console.log('step 1')
if (dataId == 3) {
@ -612,7 +612,8 @@
var displayStatus = $('#base_policy_id').css('display');
$('#base_policy_id').show();
$('#base_policy').prop('required', true);
$('#base_danger').hide();
// $('#base_policy').prop('required', true);
if (displayStatus === 'none') {
console.log('step 2.1')
@ -628,7 +629,8 @@
var displayStatus = $('#base_policy_id').css('display');
$('#base_policy_id').hide();
$('#base_policy').prop('required', false);
$('#base_danger').show();
// $('#base_policy').prop('required', false);
if (displayStatus === 'none') {
console.log('step 3.1')
@ -655,7 +657,7 @@
dataType: 'json',
success: function(res) {
console.log(res)
console.log('client_policy_res', res)
setTimeout(function() {
$('.loader').fadeOut();
@ -722,7 +724,7 @@
}
if(res.data.is_addon == 1 && res.data.base_policy > 0){
if (res.data.is_addon == 1 && res.data.base_policy > 0) {
// $("#insurer").next(".select2-container").css({
// 'pointer-events': 'none',
@ -815,23 +817,23 @@
Swal.fire({
title: "Are you sure?",
text: "You need to approve this!",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
text: "You need to approve this!",
icon: "info",
showCancelButton: true,
confirmButtonColor: "#3085d6",
confirmButtonText: "Yes",
}).then((result) => {
if (result.isConfirmed) {
var client_policy_id = $(this).attr('data-id');
var policy_id = $(this).attr('id');
var client_id = $('#client_id_policy').val()
var client_policy_id = $(this).attr('data-id');
var policy_id = $(this).attr('id');
var client_id = $('#client_id_policy').val()
console.log('client_policy_id', client_policy_id)
console.log('policy_id', policy_id)
console.log('client_id', client_id)
console.log('client_policy_id', client_policy_id)
console.log('policy_id', policy_id)
console.log('client_id', client_id)
if (client_policy_id) {
$('.loader').fadeIn();
@ -1202,7 +1204,7 @@
}
if (input.id == 'gpa_sum_si2') {
gpaSumInsureMultiplier(input);
gpaSumInsureMultiplier(input);
}
// if(input.id == 'basic_pay'){
@ -1267,6 +1269,7 @@
$('#end_date').val('');
$('#base_policy').val('').change();
if ($(this).val() == 2 || $(this).val() == 3) {
$("#insurer").next(".select2-container").css({
@ -1282,6 +1285,12 @@
$('#select2-tpa-container').css({
'background-color': '#ebebe0',
});
var baseDanger = $('#base_danger');
if (baseDanger.css('display') === 'none') {
baseDanger.show();
}
} else {
$("#insurer").next(".select2-container").css({

View File

@ -41,7 +41,7 @@
$(document).ready(function() {
if (window.location.hash === '#KYC-DOC-tab') {
console.log(window.location.hash)
console.log('url hash :', window.location.hash)
$('#kyc_tab').click();
}

View File

@ -138,10 +138,6 @@
<script>
// setInterval(function(){
// count++;
// $('#notification_count').html(count);
// }, 1000); // 2000 milliseconds = 2 seconds
$(document).ready(function() {
@ -153,7 +149,7 @@
method: 'GET',
success: function(response) {
// console.log('responce', response.length)
console.log('responce', response)
let unreadCount = 0;
let messagesList = $('#messages-list');
@ -167,18 +163,45 @@
unreadCount++;
}
var html = ` <li data-id="${message.id}" data-url="${message.action_url}">
var jasonDecodeData = JSON.parse(message.message_text)
var toast_body_css = 'background : #bfd7eb !important;';
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
var toast_status_word = 'Success';
if(jasonDecodeData.msg_status == 'failure'){
toast_body_css = 'background : #fdcfcf !important;';
toast_head_css = 'background-color : rgb(235 105 105 / 85%) !important; color :#000; border-bottom: 0;';
toast_icon = 'mdi mdi-information mr-auto'
toast_status_word = 'Failure';
}else if(jasonDecodeData.msg_status == 'success'){
toast_body_css = 'background : #bfd7eb !important;';
toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto'
toast_status_word = 'Success';
}
var html = ` <li data-id="${message.id}" data-url="${jasonDecodeData.action_url != undefined && jasonDecodeData.action_url != "" ? jasonDecodeData.action_url : 'dashboard/view'}">
<div class="p-3">
<div class="toast fade show" role="alert" aria-live="assertive" aria-atomic="true" data-toggle="toast">
<div class="toast-header">
<strong class="mr-auto"></strong>
<small>${formatDate(message.created_at)}</small>
<div class="toast-header " style="${toast_head_css}" >
<strong class="${toast_icon}"> ${toast_status_word}</strong>
<button type="button" class="ml-2 mb-1 close rm_msg" data-dismiss="toast" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</button>
</div>
<div class="toast-body">
${message.message_text}
<div class="toast-body" style="${toast_body_css}">
<strong>${jasonDecodeData.msg_title ? jasonDecodeData.msg_title : ''}</strong> <br><br>
<small style="position: relative;bottom: 8px;">${jasonDecodeData.message_text}</small>
<div class="toast-footer">
<a href="#" class="redirect_page" data-toggle="tooltip" data-placement="bottom" title="Click Go to the Page"><small style="margin-right: 25px;position: relative;top: 2px;">${jasonDecodeData.action_url != undefined && jasonDecodeData.action_url != "" ? 'see more' : ''}</small></a>
<small style="position: relative;top: 2px;left: 5px;font-size: 10px;">${formatDate(message.created_at)}</small>
</div>
</div>
</div>
</div>
@ -186,6 +209,9 @@
messagesList.append(html);
$(function() {
$('[data-toggle="tooltip"]').tooltip();
});
});
$('#notification_count').html(unreadCount);
@ -205,20 +231,27 @@
$('#messages-list').on('click', 'li', function(event) {
console.log('messages-list click li')
if ($(event.target).closest('.rm_msg').length > 0) {
console.log('.rm_msg')
let messageId = $(this).data('id');
let url = $(this).data('url');
acknowledgeMessage(messageId);
$(this).delay(300).fadeOut('slow', function() {
$(this).remove();
});
} else{
} else if ($(event.target).closest('.redirect_page').length > 0){
console.log('url')
console.log('redirect_page')
let messageId = $(this).data('id');
let url = $(this).data('url');
console.log('url : ', url)
acknowledgeMessage(messageId);
window.location.href = '<?= base_url() ?>' + url;
@ -231,6 +264,7 @@
setInterval(fetchMessages, 5000); // Fetch messages every minute
});
</script>

View File

@ -243,6 +243,15 @@
margin-bottom: -25px; /* Adjust this value to reduce the space */
}
.toast-footer {
text-align: right;
color: #000;
border-top: 1px solid aliceblue;
margin-top: 11px;
margin-bottom: -6px;
}
</style>
<script>