CHANGE_SI_ENHANCEMENT_HIDE_SHOW_IN_DROP_DOWN_DELETE_ADDITIONAL_RACK_RATE_DATE : RV
This commit is contained in:
parent
f8bb91240d
commit
a2ebc9bea7
@ -23,12 +23,6 @@ $routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmp
|
||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||
|
||||
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
|
||||
|
||||
|
||||
$routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("create", "UserController::create");
|
||||
$routes->get("create", "UserController::create");
|
||||
@ -42,6 +36,9 @@ $routes->group("/user", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
$routes->group("/dashboard", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("view", "DashboardController::dashboard");
|
||||
$routes->get('get-notification', 'DashboardController::getDashboardNotifications');
|
||||
$routes->get('acknowledge-notification/(:segment)', 'DashboardController::acknowledgeMessage/$1');
|
||||
$routes->get('get-pending-action', 'PendingActionsController::getPendingActions');
|
||||
});
|
||||
|
||||
|
||||
@ -236,6 +233,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("has_policy_config_completed/(:any)", "EmployeeController::hasPolicyConfigCompleted/$1");
|
||||
$routes->get("get-client-branch/(:any)", "ClientController::getClientBranch/$1");
|
||||
$routes->get("get-client-details/(:any)", "ClientController::getClientAllDetailsByUsingClientID/$1");
|
||||
$routes->get("delete-additional-rack-rate/(:any)", "ClientController::deleteAdditionalRackRate/$1");
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -40,8 +40,7 @@ class Session extends BaseConfig
|
||||
* The number of SECONDS you want the session to last.
|
||||
* Setting to 0 (zero) means expire when the browser is closed.
|
||||
*/
|
||||
// public int $expiration = 7200;
|
||||
public int $expiration = 86400; //24 Hours
|
||||
public int $expiration = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@ -169,8 +169,9 @@ class ClientController extends AdminController
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($data); die;
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$data['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
// dd($data['placeHolders']);
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $data);
|
||||
@ -283,7 +284,7 @@ class ClientController extends AdminController
|
||||
|
||||
|
||||
$editData['notification'] =$this->notificationModel->select('template_name,enabled')->where('client_id',$id)->findAll();
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'client_name'];
|
||||
$editData['placeHolders'] = ['member_name','nhance_logo','tpa_id','ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
@ -591,7 +592,7 @@ class ClientController extends AdminController
|
||||
$policyCount = $this->clientPolicyModel
|
||||
->where('policy_id', $policy_id)
|
||||
->where('client_branch_id', $client_branch_id)
|
||||
->countAllResult();
|
||||
->countAllResults();
|
||||
|
||||
if($policyCount > 0 ){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
@ -809,8 +810,8 @@ class ClientController extends AdminController
|
||||
$relation_data['spouse'] = $spouse;
|
||||
$relation_data['childrens'] = $childrens;
|
||||
$relation_data['parents'] = $parents;
|
||||
$relation_data['parents_in_law'] = $parents_in_law;
|
||||
$relation_data['either_parents_pil'] = $either_parents_pil;
|
||||
$relation_data['parents-in-law'] = $parents_in_law;
|
||||
$relation_data['either-parents-pil'] = $either_parents_pil;
|
||||
|
||||
|
||||
$jsonDataForRelation = json_encode($relation_data);
|
||||
@ -2094,5 +2095,31 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function deleteAdditionalRackRate($client_id, $client_policy_id, $rack_rate_type)
|
||||
{
|
||||
try {
|
||||
$result = $this->policyPremium2Model
|
||||
->where('client_id', $client_id)
|
||||
->where('client_policy_id', $client_policy_id)
|
||||
->where('rack_rate_type', $rack_rate_type)
|
||||
->set('is_active', 0)
|
||||
->update();
|
||||
|
||||
if (!$result) {
|
||||
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
log_message('error', $e->getMessage());
|
||||
return $this->respond(['status' => false,'code' => 200, 'message' => 'Failed to update the record.'], 200);
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true,'code' => 200, 'message' => 'Additionaly Rack Rate Data Remove Successfully'], 200);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -18,11 +18,14 @@ class DashboardController extends AdminController
|
||||
use ResponseTrait;
|
||||
protected $messageModel;
|
||||
protected $userMessageModel;
|
||||
protected $myLogger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
set_session_context('Dashboard');
|
||||
$this->messageModel = new MessageModel();
|
||||
$this->userMessageModel = new UserMessageModel();
|
||||
$this->myLogger = \Config\Services::mylogger();
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
@ -34,15 +37,20 @@ class DashboardController extends AdminController
|
||||
|
||||
public function getDashboardNotifications()
|
||||
{
|
||||
//pull notofications to dashboard especially for file upload cases
|
||||
// Pull notifications for the dashboard, especially for file upload cases.
|
||||
$userId = get_session_userid();
|
||||
$roleId = 5;
|
||||
$teamId = 1;
|
||||
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
|
||||
return $this->respond($messages);
|
||||
|
||||
if ($userId != null && $roleId != null && $teamId != null) {
|
||||
$messages = $this->messageModel->getMessagesForUser($userId, $roleId, $teamId);
|
||||
return $this->respond(['status' => true, 'code' => 200, 'message' => $messages], 200);
|
||||
} else {
|
||||
$this->myLogger->logme('error', 'The session is not set correctly. USER_ID : {user_id}, ROLE_ID : {role_id}, TEAM_ID : {team_id}', ['user_id' => $userId, 'role_id' => $roleId, 'team_id' => $teamId]);
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data found'], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function acknowledgeMessage($messageId)
|
||||
{
|
||||
|
||||
@ -1040,6 +1040,34 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
|
||||
$this->loadLayout('ecard_template/default_ecard');
|
||||
|
||||
// Load the session library if it's not autoloaded
|
||||
// $session = \Config\Services::session();
|
||||
|
||||
// Access session data
|
||||
$sessionData = session()->get();
|
||||
|
||||
// Check if session data exists and if expiration time is set
|
||||
if (!empty($sessionData) && isset($sessionData['isLoggedIn']) && isset($sessionData['session_expiration'])) {
|
||||
// Get the session expiration timestamp
|
||||
$expirationTimestamp = $sessionData['session_expiration'];
|
||||
|
||||
// Get the current timestamp
|
||||
$currentTimestamp = time();
|
||||
|
||||
// Check if the current time is greater than the expiration time
|
||||
if ($currentTimestamp > $expirationTimestamp) {
|
||||
// Session has expired
|
||||
echo "Session has expired";
|
||||
} else {
|
||||
// Session is active
|
||||
echo "Session is active";
|
||||
}
|
||||
} else {
|
||||
// Session data is not set or session is not started
|
||||
echo "Session is not started or data is not set";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1253,9 +1281,18 @@ class EmployeeController extends AdminController
|
||||
{
|
||||
$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;
|
||||
|
||||
$si_enhancement_true_or_false = 1;
|
||||
if($policy_terms){
|
||||
$policyTermsData = json_decode($policy_details['policy_terms']);
|
||||
|
||||
if (isset($policyTermsData->suminsuredenhancement) && $policyTermsData->suminsuredenhancement !== null) {
|
||||
$si_enhancement_true_or_false = $policyTermsData->suminsuredenhancement;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$slab_details = $this->policiesModel->getPolicySlabRatesForEmpOnboard($client_policy_id,$policy_details['client_id']);
|
||||
|
||||
$message = null;
|
||||
@ -1270,7 +1307,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
$message = isset($message) ? ($message . ' not defined for choosed policy') : null;
|
||||
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message], 200);
|
||||
return $this->respond(['dataStatus' => true, 'code' => 200, 'message' => $message, 'si_enhancement' => $si_enhancement_true_or_false], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,7 @@ class sendMailNotification
|
||||
$name = $get_emp_email_and_other_details['name'];
|
||||
$mail_content = $notification['mail_content'];
|
||||
$nhance_logo = $_ENV['NHANCE_LOGO'];
|
||||
$post_enrollment_app_link = $_ENV['POST_ENROLLMENT_APP_LINK'];
|
||||
|
||||
$client_logo = base_url() . "public/uploads/logo/" . $client_data['client_logo'];
|
||||
// $client_logo = $nhance_logo;
|
||||
@ -114,8 +115,9 @@ class sendMailNotification
|
||||
|
||||
$mail_content = str_replace("[[member_name]]", $name, $mail_content);
|
||||
$mail_content = str_replace("[[app_link]]", "<a href='$app_link'>Review Details</a>", $mail_content);
|
||||
$mail_content = str_replace("[[post_enrollment_app_link]]", "<a href='$post_enrollment_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);
|
||||
$mail_content = str_replace("[[ecard_download_link]]", "<a href='$link/1'>Download Insurance Card</a>", $mail_content);
|
||||
$mail_content = str_replace("[[client_name]]", $client_data['client_name'], $mail_content);
|
||||
|
||||
$wholeData = ['mail' => $mail, 'subject' => $subject,'message'=> $mail_content,'bcc'=> $client_data['common_mails']];
|
||||
|
||||
@ -10,6 +10,37 @@ if (!function_exists('check_session')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('set_last_visited_time')) {
|
||||
function set_last_visited_time()
|
||||
{
|
||||
$session = \Config\Services::session();
|
||||
$session->set('last_visited', date("Y-m-d H:i:s"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_last_visited_time')) {
|
||||
function get_last_visited_time()
|
||||
{
|
||||
// Get the session service
|
||||
$session = \Config\Services::session();
|
||||
|
||||
// Get the last visited time from session
|
||||
$lastVisitTime = $session->get('last_visited');
|
||||
|
||||
// Check if the last visited time is set
|
||||
if ($lastVisitTime) {
|
||||
// Calculate the time five minutes ago
|
||||
$fiveMinutesBefore = date("YmdHi", strtotime('-5 minutes'));
|
||||
|
||||
// Compare the last visited time with the time five minutes ago
|
||||
return date("YmdHi", strtotime($lastVisitTime)) > $fiveMinutesBefore ? 1 : 0;
|
||||
}
|
||||
|
||||
// If last visited time is not set, return 0
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get_session_userid')) {
|
||||
function get_session_userid()
|
||||
{
|
||||
|
||||
@ -42,7 +42,18 @@ class ClientModel extends Model
|
||||
|
||||
foreach ($clients as &$client) {
|
||||
$clientPolicyModel = new ClientPolicyModel();
|
||||
$clientPolicies = $clientPolicyModel->select(['client_branch.id as branch_id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id', 'client_policy.id as client_policy_id','p.name','pt.policy_type',])
|
||||
$clientPolicies = $clientPolicyModel
|
||||
->select(['
|
||||
|
||||
client_branch.id as branch_id',
|
||||
'client_branch.branch_name',
|
||||
'client_branch.branch_code',
|
||||
'client_branch.client_id',
|
||||
'client_policy.id as client_policy_id',
|
||||
'client_policy.policy_terms',
|
||||
'p.name',
|
||||
'pt.policy_type',
|
||||
])
|
||||
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||
->join('policies p', 'p.id = client_policy.policy_id')
|
||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||
|
||||
@ -234,7 +234,7 @@ $(document).ready(function () {
|
||||
$("#branch_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
|
||||
console.log('branch_PrimaryKey', branch_PrimaryKey)
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="client_branch" name="client_branch_id">
|
||||
<option value="" selected>Select Client Branch</option>
|
||||
<option selected >Select Client Branch</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -1468,6 +1468,13 @@
|
||||
|
||||
$('#client_branch').empty();
|
||||
|
||||
|
||||
$('#client_branch').append($('<option>', {
|
||||
value: '',
|
||||
text: 'Select Branch',
|
||||
selected: true
|
||||
}));
|
||||
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
|
||||
@ -64,7 +64,7 @@ option:disabled {
|
||||
{
|
||||
foreach($actions as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -351,9 +351,10 @@ function fetchClientPolicies() {
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
// console.log(response);
|
||||
console.log(response);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data)
|
||||
@ -910,7 +911,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
{
|
||||
// console.log(event.target.id);
|
||||
var policy_id = (event.target.value);
|
||||
// console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||
{
|
||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||
@ -930,11 +931,18 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||
success: function(response) {
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
console.log('check policy responce', response);
|
||||
|
||||
if (response.hasOwnProperty('si_enhancement') && response.si_enhancement == 0) {
|
||||
$('.si-enhancement-option').hide();
|
||||
} else {
|
||||
$('.si-enhancement-option').show();
|
||||
}
|
||||
|
||||
// console.log('check policy responce', response);
|
||||
|
||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||
toastr.error(response.message, 'Error');
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
<?php
|
||||
if (isset($events) && count($events)) {
|
||||
foreach ($events as $key => $action) {
|
||||
echo "<option value=" . $key . ">" . $action . "</option>";
|
||||
echo "<option value='$key'" . ($key == "si_enhancement" ? " class='si-enhancement-option'" : "") . ">$action</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -155,27 +155,28 @@
|
||||
function fetchMessages() {
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url('get-notification') ?>',
|
||||
url: '<?= base_url('dashboard/get-notification') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
// $(document).ready(function() {
|
||||
// $("#playMusic").get(0).play();
|
||||
// });
|
||||
console.log('responce', response)
|
||||
|
||||
|
||||
//console.log('responce', response)
|
||||
if(response.status == false){
|
||||
$('#notification_count').html('0')
|
||||
console.log('The session is not set correctly. ')
|
||||
return;
|
||||
}
|
||||
|
||||
let messagesList = $('#messages-list');
|
||||
messagesList.empty();
|
||||
|
||||
var html = "";
|
||||
|
||||
pullNotificationCount = response.length
|
||||
pullNotificationCount = response.message.length
|
||||
|
||||
localStorage.setItem('pullNotificationCount', pullNotificationCount)
|
||||
|
||||
response.forEach(message => {
|
||||
response.message.forEach(message => {
|
||||
|
||||
// if (!message.is_read) {
|
||||
// unreadCount++;
|
||||
@ -183,7 +184,6 @@
|
||||
|
||||
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';
|
||||
@ -247,7 +247,7 @@
|
||||
|
||||
function acknowledgeMessage(messageId) {
|
||||
$.ajax({
|
||||
url: '<?= base_url('acknowledge-notification/') ?>' + messageId,
|
||||
url: '<?= base_url('dashboard/acknowledge-notification/') ?>' + messageId,
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
fetchMessages();
|
||||
@ -300,7 +300,7 @@
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: '<?= base_url('get-pending-action') ?>',
|
||||
url: '<?= base_url('dashboard/get-pending-action') ?>',
|
||||
method: 'GET',
|
||||
success: function(response) {
|
||||
|
||||
|
||||
@ -370,7 +370,8 @@
|
||||
<select id="member_ecard_mail_modal_customButton" class="form-control" style="border:none;right: 6px;width: auto;position: absolute;z-index: 1;top: 17px;height: 32px;float: right;">
|
||||
<option value="">PlaceHolders</option>
|
||||
<?php foreach ($placeHolders as $value): ?>
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
|
||||
<?php if($value == 'member_name' || $value == 'nhance_logo' || $value == 'client_logo' || $value == 'app_link' || $value == 'post_enrollment_app_link' || $value == 'client_name' || $value == 'ecard_download_link'){ ?>
|
||||
<?php $valueChange = str_replace('_', ' ', $value); $valueChange = ucwords($valueChange); ?>
|
||||
<option value="[[<?php echo $value; ?>]]"><?php echo $valueChange; ?></option>
|
||||
<?php } ?>
|
||||
|
||||
@ -99,10 +99,10 @@
|
||||
<form role="form" class="parsley-examples" method="post" id="AdditionalGridForm"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="client_id" id="Client_id"
|
||||
<input type="hidden" name="client_id" id="Client_id_2"
|
||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||
<input type="hidden" name="client_policy_id" id="client_policy_id_2" />
|
||||
<input type="hidden" name="rack_rate_type" id="rack_rate_type" value="1" />
|
||||
<input type="hidden" name="rack_rate_type" id="rack_rate_type_2" value="1" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row" id="rac_rate_dropdown">
|
||||
@ -110,7 +110,7 @@
|
||||
<label for="emp_code">Policy Premium Type<span
|
||||
class="text-danger">*</span></label>
|
||||
<select data-secondary="1" class="form-control" id="additional_grid"
|
||||
name="policy_grid_id" onchange="addGridHTML(event)" required>
|
||||
name="policy_grid_id" onchange="addGridHTML(event)" required>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -130,9 +130,19 @@
|
||||
</div>
|
||||
|
||||
<div class="form-row" id="relationship">
|
||||
</div> <br>
|
||||
</div>
|
||||
|
||||
<a href="#" id='copyfromexcelforadditional'>Copy from excel</a>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="col-2">
|
||||
<a href="#" id='copyfromexcelforadditional'>Copy from excel</a>
|
||||
</div>
|
||||
|
||||
<div class="col-2" id="del_btn_col" style="display: none;">
|
||||
<a class="btn btn-bordered-danger waves-effect waves-light fa fa-trash" id="del_btn"> Delete</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
@ -861,7 +871,10 @@ $("#GridForm").submit(function(event) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' :'Policy Premium Added Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
// $('.close').click();
|
||||
|
||||
if($('#grid').val() == 1 || $('#grid').val() == 2){
|
||||
$('.close').click();
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
@ -887,6 +900,10 @@ $("#AdditionalGridForm").submit(function(event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkCheckboxes()) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
var isValid = $('#AdditionalGridForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
@ -987,10 +1004,14 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
if (res.self == "") {
|
||||
$('.close').click();
|
||||
toastr.warning('Unable to create rack rate due to the absence of policy terms.',
|
||||
'Warning');
|
||||
if(policy_type_string == 'GMC'){
|
||||
|
||||
if (res.self == "") {
|
||||
$('.close').click();
|
||||
toastr.warning('Unable to create rack rate due to the absence of policy terms.',
|
||||
'Warning');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$('#GridForm')[0].reset();
|
||||
@ -998,7 +1019,7 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
|
||||
if (policy_type_string == 'GMC') {
|
||||
$('#premium_type').show();
|
||||
$('#individual').prop('checked', true)
|
||||
$('#individual').prop('checked', true)
|
||||
} else {
|
||||
$('#premium_type').hide();
|
||||
$('#individual').prop('checked', true)
|
||||
@ -1047,10 +1068,10 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
$.each(res.premiumData, function(index, item) {
|
||||
|
||||
if (item.rack_rate_type == 0) {
|
||||
if (item.rack_rate_type == 0 || policy_type_string == 'GPA') {
|
||||
policy_grid_id_value = item.policy_grid_id;
|
||||
secondary = item.policy_grid_id;
|
||||
premium_type_for_sec_rr.push(item.premium_type);
|
||||
premium_type_for_primary_rr.push(item.premium_type);
|
||||
|
||||
} else if (item.rack_rate_type == 1) {
|
||||
|
||||
@ -1063,6 +1084,14 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
|
||||
}
|
||||
|
||||
console.log('premium_type_for_sec_rr', premium_type_for_sec_rr)
|
||||
|
||||
if(premium_type_for_sec_rr.length > 0){
|
||||
$('#del_btn_col').show();
|
||||
}else{
|
||||
$('#del_btn_col').hide();
|
||||
}
|
||||
|
||||
|
||||
if (premium_type_for_sec_rr.length > 0) {
|
||||
|
||||
@ -1081,6 +1110,10 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
$('#single_2').prop('checked', false)
|
||||
$('#individual_2').prop('checked', true)
|
||||
}
|
||||
}else{
|
||||
|
||||
$('#single_2').prop('checked', false)
|
||||
$('#individual_2').prop('checked', true)
|
||||
|
||||
}
|
||||
|
||||
@ -1129,6 +1162,9 @@ $('body').on('click', '.btnPolicyModel', function() {
|
||||
$('#single').prop('checked', false);
|
||||
$('#individual').prop('checked', true);
|
||||
}
|
||||
}else{
|
||||
$('#single').prop('checked', false);
|
||||
$('#individual').prop('checked', true);
|
||||
}
|
||||
|
||||
|
||||
@ -2616,7 +2652,7 @@ function createCheckboxes(obj, additional_relationship) {
|
||||
console.log('isChecked', isChecked);
|
||||
html += `
|
||||
<div class="col-2">
|
||||
<input type="checkbox" name="${key}" ${isChecked}>
|
||||
<input class="relation_checkbox" type="checkbox" name="${key}" ${isChecked}>
|
||||
<label style="position: relative;left: 18px;bottom: 30px;">${key}</label>
|
||||
</div>`;
|
||||
// console.log(html);
|
||||
@ -2627,8 +2663,101 @@ function createCheckboxes(obj, additional_relationship) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
function formatString(str) {
|
||||
return str.split('-').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ');
|
||||
}
|
||||
|
||||
|
||||
$('#del_btn').click(function() {
|
||||
console.log('delete btn clicked');
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to Delete this!",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
console.log('after then entered');
|
||||
|
||||
if (result.isConfirmed) {
|
||||
console.log('isConfirmed entered');
|
||||
|
||||
var client_policy_id = $('#client_policy_id_2').val();
|
||||
console.log('client_policy_id', client_policy_id)
|
||||
|
||||
var rack_rate_type = $('#rack_rate_type_2').val();
|
||||
console.log('rack_rate_type', rack_rate_type)
|
||||
|
||||
var client_id = $('#Client_id_2').val();
|
||||
console.log('client_id', client_id)
|
||||
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/delete-additional-rack-rate/'); ?>' + client_id + '/' + client_policy_id + '/' + rack_rate_type,
|
||||
type: 'GET',
|
||||
success: function(res) {
|
||||
|
||||
console.log('ajax success entered');
|
||||
console.log(res);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if (res.status === true) {
|
||||
|
||||
$('#additional_grid_content_input').empty();
|
||||
$('#additional_grid').val('');
|
||||
$('#individual_2').prop('checked', true)
|
||||
$('#single_2').prop('checked', false)
|
||||
$('input[type="checkbox"]').prop('checked', false);
|
||||
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
} else if (res.status === false) {
|
||||
toastr.warning(res.message, 'Warning');
|
||||
return;
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log('ajax error entered');
|
||||
console.error(xhr.responseText);
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
// Removed the duplicated loader hiding code here
|
||||
}
|
||||
|
||||
console.log('after then entered end or cancel');
|
||||
});
|
||||
|
||||
console.log('delete btn clicked end');
|
||||
});
|
||||
|
||||
|
||||
function checkCheckboxes() {
|
||||
var checkboxes = $('input.relation_checkbox');
|
||||
var checkedCount = checkboxes.filter(':checked').length;
|
||||
var uncheckedCount = checkboxes.not(':checked').length;
|
||||
|
||||
console.log('Checked count:', checkedCount); // Debugging
|
||||
console.log('unchecked Count', uncheckedCount);
|
||||
|
||||
if (checkedCount < 1) {
|
||||
toastr.warning('You must select at least one checkbox.', 'Warning');
|
||||
return false;
|
||||
} else if (checkedCount != uncheckedCount) {
|
||||
toastr.warning('You can not select all of the checkboxes', 'Waraning');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user