CHANGE_ALERT_IF_TERMS&RACK_NOT_DEFINED
This commit is contained in:
parent
96167760c0
commit
802e993b8e
@ -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');
|
||||
|
||||
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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'];
|
||||
}
|
||||
|
||||
|
||||
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ option:disabled {
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||
<option value="0">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -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 = '<?php echo base_url();?>' + '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;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user