CHANGES_GMC_GPA_TERMS : RV
This commit is contained in:
parent
482ed4ef0f
commit
516bf18ac3
@ -649,6 +649,18 @@ class ClientController extends AdminController
|
||||
$policy_id = $this->request->getGet('policy_id');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
|
||||
$emp_count = $this->employeeModel ->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||
->join('employee_polices ep',"cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||
->where("employees.client_id",$client_id)
|
||||
->where("employees.emp_status",'active')
|
||||
->countAllResults();
|
||||
|
||||
if($emp_count = 0){
|
||||
$emp_count = true;
|
||||
}else{
|
||||
$emp_count = false;
|
||||
}
|
||||
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($policy_id);
|
||||
$pattern = '/gmc/i';
|
||||
@ -669,7 +681,7 @@ class ClientController extends AdminController
|
||||
// echo '<pre>';
|
||||
// print_r($results);
|
||||
// print_r($data[0]->policy_type); die;
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData], 200);
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $results, 'premiumData' => $premiumData, 'count' => $emp_count], 200);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -71,6 +71,8 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div id="policyGMCTerms" style="display:none">
|
||||
<span id="policyGMCTermsClose" style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
<h5><label for="gmcTerms" style="margin-bottom: 20px;">Policy GMC Terms</label></h5>
|
||||
@ -79,6 +81,8 @@
|
||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_policy_id" id="client_policy_id" />
|
||||
<input type="hidden" name="policy_id" id="policy_id"/>
|
||||
<input type="hidden" id="gmc_emp_count"/>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-column">
|
||||
@ -95,7 +99,7 @@
|
||||
</div>
|
||||
<div style="display:none; margin-top: 27px;margin-bottom: 7px; margin-left: 31px;">
|
||||
<div>
|
||||
<input type="checkbox" name="family_floaters[]" value="self" id="self"> Self
|
||||
<input type="checkbox" name="family_floaters[]" value="self" id="self" checked disabled> Self
|
||||
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse"> Spouse
|
||||
<input type="checkbox" name="family_floaters[]" value="child1" id="child1"> Child 1
|
||||
<input type="checkbox" name="family_floaters[]" value="child2" id="child2"> Child 2
|
||||
@ -401,13 +405,23 @@ var grid_html = '';
|
||||
|
||||
|
||||
$("#policyJsonForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
var isValid = $('#policyJsonForm').parsley().validate();
|
||||
|
||||
if($('#gmc_emp_count').val() == true){
|
||||
toastr.warning('Client has active employees', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var formData = new FormData($('#policyJsonForm')[0]);
|
||||
var policy_form_action = '<?= base_url("client/policy/policyGMCTerms") ?>';
|
||||
|
||||
@ -428,21 +442,24 @@ var grid_html = '';
|
||||
element.parentNode.remove();
|
||||
});
|
||||
|
||||
|
||||
console.log(res);
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Premium Added successfully' : 'Policy Premium Added Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
$('.close').click();
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
var message = 'Policy Terms Updated successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
@ -471,8 +488,21 @@ var grid_html = '';
|
||||
method: 'GET',
|
||||
data: { policy_id : policy_id , client_id: client_id},
|
||||
success: function(response) {
|
||||
|
||||
$('gmc_emp_count').val(response.count)
|
||||
if(response.count){
|
||||
|
||||
$('emp_count').val(response.count)
|
||||
if(response.count === false){
|
||||
$("#btnGPATermsSubmit").prop("disabled", true);
|
||||
}else{
|
||||
$("#btnGPATermsSubmit").prop("disabled", false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (response) {
|
||||
let jsonObject = JSON.parse(response);
|
||||
let jsonObject = JSON.parse(response.data);
|
||||
Object.keys(jsonObject).forEach(function(key) {
|
||||
if (key.includes("special_condition_label") || key.includes("special_condition_input")) {
|
||||
if (key.includes("special_condition_label")) {
|
||||
@ -552,7 +582,6 @@ var grid_html = '';
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$('.jodit-wysiwyg').each(function() {
|
||||
$(this).click();
|
||||
});
|
||||
@ -572,8 +601,6 @@ var grid_html = '';
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Jodit RTE -->
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
@ -590,10 +617,9 @@ var grid_html = '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Policy terms Add Special Condition -->
|
||||
<script>
|
||||
|
||||
document.getElementById('myButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
event.preventDefault();
|
||||
specialCondition();
|
||||
@ -603,7 +629,7 @@ var grid_html = '';
|
||||
function specialCondition(count =0) {
|
||||
if (count === 0) {
|
||||
var index =$('.modifyclassinput').length;
|
||||
var appendElement =`<div class="form-group col-md-6 form-group-client-policy-masters">
|
||||
var appendElement =`<div class="form-group col-md-6 form-group-client-policy-masters removeDom">
|
||||
<label for="specialconditionlabel" class="special_condition_label[]" style="width: 400px;"><input name="special_condition_label[]" id="special_condition_label[]"><span class="specialConditionClose" style="color: red;margin-left: 20px;">X</span></label>
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control form-control-client-policy-masters special_condition_input[]">
|
||||
</div>`;
|
||||
@ -622,9 +648,7 @@ var grid_html = '';
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Close the Policy terms
|
||||
|
||||
$(document).on('click', '#policyGMCTermsClose', function() {
|
||||
$('#policyGMCTerms').css('display', 'none');
|
||||
$('#police-tab').css('display', '');
|
||||
@ -632,4 +656,4 @@ var grid_html = '';
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
});
|
||||
|
||||
</script>
|
||||
</script>
|
||||
@ -405,6 +405,7 @@
|
||||
$('#police-tab').css('display', 'none');
|
||||
$('.nav.nav-pills.navtab-bg').css('display','none');
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','none');
|
||||
$('.removeDom').remove()
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getterms") ?>',
|
||||
@ -496,6 +497,7 @@
|
||||
$('.nav.nav-pills.navtab-bg').prev().css('display','');
|
||||
});
|
||||
|
||||
|
||||
$("#sumInsured2").on("keyup", function() {
|
||||
var inputNumber = parseInt($(this).val());
|
||||
if (!isNaN(inputNumber)) {
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="client_policy_id" id="client_policy_id" />
|
||||
<input type="hidden" id="grid_emp_count"/>
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
@ -427,6 +428,14 @@ $("#GridForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
console.log($('#grid_emp_count').val());
|
||||
|
||||
if($('#grid_emp_count').val() == false){
|
||||
console.log('test')
|
||||
toastr.warning('Client has active employees', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var isValid = $('#GridForm').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
@ -479,10 +488,13 @@ $('body').on('click', '.btnPolicyModel', function () {
|
||||
success: function (res) {
|
||||
console.log('responce :', res);
|
||||
|
||||
$('#grid_emp_count').val(res.count);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
|
||||
var policy_grid_id_value = '';
|
||||
if (res.premiumData && res.premiumData.length > 0 && res.premiumData[0].policy_grid_id) {
|
||||
policy_grid_id_value = res.premiumData[0].policy_grid_id;
|
||||
@ -497,7 +509,6 @@ $('body').on('click', '.btnPolicyModel', function () {
|
||||
$('#grid').html(policeGridOptionHTML);
|
||||
|
||||
|
||||
console.log('Length', res.premiumData.length)
|
||||
if (res.premiumData && res.premiumData.length > 0) {
|
||||
|
||||
addGridHTML(false, res.premiumData[0], res.premiumData[0].policy_grid_id);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user