FEAT_ADDON_POLICY_POLICY_LIST_FIX_DATE_FORMATE_CHANGE_SESSION_TIMEOUT_FEAT_INSURER_CATAGORY : RV
This commit is contained in:
parent
5c4ca76ac3
commit
5d69cc47df
@ -16,6 +16,7 @@ $routes->get('/login', 'LoginController::index');///auth/google
|
||||
$routes->get('/logout', 'LoginController::logout');
|
||||
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
||||
$routes->get('/update-policy', 'ClientController::checkPolicyEndDateUpdateClientPolicyStatusExpired');
|
||||
|
||||
|
||||
$routes->group("/user", ["filter" => "authMVC"], function($routes){
|
||||
@ -209,6 +210,8 @@ $routes->group("/util", ["filter" => "authMVC"], function($routes){
|
||||
$routes->get("download-excel/(:any)", "EmployeeController::downloadSampleExcelFile/$1");
|
||||
$routes->get("get-emp-endorsement/(:any)", "EmployeeController::getEmpEndoresmentEntry/$1");
|
||||
$routes->post("import-export", "EmployeeController::importExport");
|
||||
$routes->get("featch-client-policy-list/(:any)", "ClientController::getClientPolicyList/$1");
|
||||
|
||||
});
|
||||
|
||||
$routes->cli('cli/processjob', 'JobWorker::processJob');
|
||||
|
||||
@ -40,7 +40,8 @@ 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 = 7200;
|
||||
public int $expiration = 86400; //24 Hours
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
|
||||
@ -29,6 +29,8 @@ use App\Models\PolicyGridModel;
|
||||
use App\Models\PolicyPremium1Model;
|
||||
use App\Models\PolicyPremium2Model;
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -57,6 +59,7 @@ class ClientController extends AdminController
|
||||
protected $policyPremium2Model;
|
||||
protected $clientDepositModel;
|
||||
protected $employeeModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -83,6 +86,9 @@ class ClientController extends AdminController
|
||||
$this->policyPremium1Model = new PolicyPremium1Model();
|
||||
$this->policyPremium2Model = new PolicyPremium2Model();
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -103,6 +109,14 @@ class ClientController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function checkPolicyEndDateUpdateClientPolicyStatusExpired(){
|
||||
|
||||
$return = $this->clientPolicyModel->updateStatus();
|
||||
$this->myLogger->logme('error', 'Client Policy Status Update Count: {data}', ['data' => $return['client']]);
|
||||
$this->myLogger->logme('error', 'Employee Policy Status Update Count: {data}', ['data' => $return['emp']]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function removeClient($id = null)
|
||||
{
|
||||
@ -248,10 +262,21 @@ class ClientController extends AdminController
|
||||
$editData['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $id)->findAll();
|
||||
$editData['client_branch'] = $this->clientBranchModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['client_relation'] = $this->clientRMModel->where(['client_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['client_policy'] = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($id);
|
||||
|
||||
foreach ($clientPoliceData as $key => $value) {
|
||||
|
||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
|
||||
}
|
||||
|
||||
$editData['client_policy'] = $clientPoliceData;
|
||||
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
// print_r($editData); die;
|
||||
// print_r($clientPoliceData); die;
|
||||
|
||||
echo view('layout/header', $headerData);
|
||||
echo view('client_onboarding', $editData);
|
||||
@ -577,6 +602,7 @@ class ClientController extends AdminController
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
|
||||
if (!isset($data['is_addon'])) {
|
||||
$data['is_addon'] = 0;
|
||||
@ -594,6 +620,11 @@ class ClientController extends AdminController
|
||||
$insert = $this->clientPolicyModel->insert($data);
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($this->request->getPost('client_id'));
|
||||
foreach ($clientPoliceData as $key => $value) {
|
||||
|
||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
|
||||
}
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'CERATE'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -637,6 +668,8 @@ class ClientController extends AdminController
|
||||
$data['earned_premium_amount'] = $this->request->getPost('earned_premium_amount');
|
||||
$data['claims_incurred_amount'] = $this->request->getPost('claims_incurred_amount');
|
||||
$data['is_addon'] = $this->request->getPost('is_addon');
|
||||
$data['base_policy'] = $this->request->getPost('base_policy');
|
||||
|
||||
|
||||
|
||||
if (!isset($data['is_addon'])) {
|
||||
@ -654,6 +687,11 @@ class ClientController extends AdminController
|
||||
|
||||
if($insert){
|
||||
$clientPoliceData = $this->clientPolicyModel->getClientPolicyByClientId($client_id);
|
||||
foreach ($clientPoliceData as $key => $value) {
|
||||
|
||||
$clientPoliceData[$key]->policy_start_date = date('d-M-Y', strtotime($value->policy_start_date));
|
||||
$clientPoliceData[$key]->policy_end_date = date('d-M-Y', strtotime($value->policy_end_date));
|
||||
}
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $clientPoliceData, 'method' => 'EDIT'], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
@ -903,8 +941,13 @@ class ClientController extends AdminController
|
||||
if($id){
|
||||
$client_policy_data = $this->clientPolicyModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$insurer_id = $client_policy_data['insurer_id'];
|
||||
$client_id = $client_policy_data['client_id'];
|
||||
$polices = $this->policesModel->where(['insurer_id' => $insurer_id, 'is_active' => 1])->findAll();
|
||||
return $this->respond(['status' => true,'code' => 200,'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
|
||||
$client_policy_list = $this->clientPolicyModel->select('policies.*')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('client_id', $client_id)
|
||||
->findAll();
|
||||
return $this->respond(['status' => true,'code' => 200, 'client_policy_list' => $client_policy_list, 'data' => $client_policy_data, "insurer_id" => $client_policy_data['insurer_id'], 'policy' => $polices], 200);
|
||||
}else{
|
||||
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);
|
||||
}
|
||||
@ -1393,4 +1436,19 @@ class ClientController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getClientPolicyList($client_id = null){
|
||||
|
||||
$record = $this->clientPolicyModel->select('policies.*')
|
||||
->join('policies', 'policies.id = client_policy.policy_id')
|
||||
->where('client_id', $client_id)
|
||||
->findAll();
|
||||
|
||||
if ($record) {
|
||||
return $this->respond(['Status' => true,'code' => 200,'data' => $record], 200);
|
||||
} else {
|
||||
return $this->respond(['Status' => false,'code' => 200,'message' => 'Record not found.'], 200);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,7 @@ if (!function_exists('generate_excel')) {
|
||||
|
||||
if($totals == 1){
|
||||
// Call the helper function for Calculate GST, Pro Rata Premium, and Total sums for inception
|
||||
add_totals_row($spreadsheet, $data);
|
||||
add_totals_row($spreadsheet, $data, $headers);
|
||||
}else if($totals == 2){
|
||||
add_totals_for_deletion($spreadsheet, $data);
|
||||
}
|
||||
@ -268,25 +268,39 @@ if (! function_exists('transform_objects_to_array_for_deletion')) {
|
||||
|
||||
|
||||
if (!function_exists('add_totals_row')) {
|
||||
function add_totals_row(Spreadsheet $spreadsheet, array $data)
|
||||
function add_totals_row(Spreadsheet $spreadsheet, array $data, array $headers)
|
||||
{
|
||||
|
||||
//find the index value
|
||||
$rata = array_search('PRO RATA PREMIUM', $headers);
|
||||
$gst = array_search('GST', $headers);
|
||||
$total = array_search('TOTAL', $headers);
|
||||
|
||||
|
||||
// Calculate GST, Pro Rata Premium, and Total sums
|
||||
$gstSum = 0;
|
||||
$proRataPremiumSum = 0;
|
||||
$totalSum = 0;
|
||||
|
||||
foreach ($data as $row) {
|
||||
$gstSum += $row[18];
|
||||
$proRataPremiumSum += $row[19];
|
||||
$totalSum += $row[20];
|
||||
$gstSum += $row[$gst];
|
||||
$proRataPremiumSum += $row[$rata];
|
||||
$totalSum += $row[$total];
|
||||
}
|
||||
|
||||
$cellValue = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
|
||||
$prev_index = $rata - 1;
|
||||
$cellValueTotal = $cellValue[$prev_index];
|
||||
$cellValueRata = $cellValue[$rata];
|
||||
$cellValueGST = $cellValue[$gst];
|
||||
$cellValueTotalSum = $cellValue[$total];
|
||||
|
||||
// Add a new row with sums
|
||||
$lastRow = count($data) + 1; // To get the last row number
|
||||
$spreadsheet->getActiveSheet()->setCellValue('R' . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue('S' . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('T' . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue('U' . ($lastRow + 1), $totalSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotal . ($lastRow + 1), 'TOTALS');
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueRata . ($lastRow + 1), $proRataPremiumSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueGST . ($lastRow + 1), $gstSum);
|
||||
$spreadsheet->getActiveSheet()->setCellValue($cellValueTotalSum . ($lastRow + 1), $totalSum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ class ClientPolicyModel extends Model
|
||||
"policy_terms",
|
||||
"open_for_enrollment",
|
||||
"is_addon",
|
||||
"base_policy",
|
||||
"created_by",
|
||||
"updated_by",
|
||||
"Is_active",
|
||||
@ -249,4 +250,21 @@ public function getDepositlistsummary($id)
|
||||
->getResult();
|
||||
}
|
||||
|
||||
|
||||
public function updateStatus(){
|
||||
|
||||
// Update client_policy table
|
||||
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
|
||||
$client_count = $this->db->affectedRows();
|
||||
// Update employee_polices table
|
||||
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()");
|
||||
$emp_count = $this->db->affectedRows();
|
||||
|
||||
return ['client'=>$client_count, 'emp' => $emp_count];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ class InsurerModel extends Model
|
||||
protected $allowedFields = [
|
||||
"id",
|
||||
"type",
|
||||
"category",
|
||||
"name",
|
||||
"short_name",
|
||||
"created_by",
|
||||
|
||||
@ -75,12 +75,21 @@ $(document).ready(function() {
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Client_Deposit',
|
||||
title: 'Client Deposit Details - ' + ' <?php echo $clientName[0]['client_name'];?>',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}],
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'Client Deposit Details - ' + ' <?php echo $clientName[0]['client_name'];?>',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)'
|
||||
},
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
|
||||
@ -28,6 +28,10 @@ body {
|
||||
|
||||
}
|
||||
|
||||
.navtab-bg .nav-link {
|
||||
margin: 0 5px 10px!important;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="row" id="client_add">
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
|
||||
|
||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
<button type="button" id="BtnAdd" class="btn btn-primary waves-effect waves-light btnAdd btn-sm"><span
|
||||
class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy</button>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive" id="table_list">
|
||||
@ -28,45 +29,46 @@
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||
<button type="button" id="btnPolicyBack" class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list" aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
<button type="button" id="btnPolicyBack"
|
||||
class="btn btn-primary waves-effect waves-light btn-sm btnBack btn-sm"><span class="fa fa-list"
|
||||
aria-hidden="true" style="padding: 5px 10px;"></span>Back To List</button>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="policy_form"
|
||||
enctype="multipart/form-data">
|
||||
<form role="form" class="parsley-examples" method="post" id="policy_form" enctype="multipart/form-data">
|
||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey"/>
|
||||
<input type="hidden" id="policy_form_action"/>
|
||||
<input type="hidden" name="policy_type_id" id="policy_type_id"/>
|
||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
|
||||
<input type="hidden" name="PrimaryKey" id="policy_PrimaryKey" />
|
||||
<input type="hidden" id="policy_form_action" />
|
||||
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
||||
<input type="hidden" name="client_id" id="client_id_policy"
|
||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="email">Insurer<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="email">Insurer<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="insurer" name="insurer" required>
|
||||
<option value="">Select Insurer</option>
|
||||
<?php foreach($insurer as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id']?>"><?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id']?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy">Policies<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="policy">Policies<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy" name="policy_id" required>
|
||||
<option value="" selected>Select Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="mobile">TPA<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="mobile">TPA<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="tpa" name="tpa" required>
|
||||
<option value="">Select TPA</option>
|
||||
<?php foreach($tpa as $value) { ?>
|
||||
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>"><?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
||||
<option value="<?= $value['id']. '-' . $value['tpa_id'] ?>">
|
||||
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
@ -74,23 +76,38 @@
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
||||
<label for="policy_start_date">Policy Start Date<span
|
||||
class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter Start Date "
|
||||
name="policy_start_date" id="start_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter End Date " name="policy_end_date" id="end_date" required>
|
||||
<input value="" type="text" class="form-control" placeholder="Enter End Date "
|
||||
name="policy_end_date" id="end_date" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4" id="policy_status_field">
|
||||
<label for="policy_status">Policy Status</label>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status" id="policy_status" readonly>
|
||||
<input value="" type="text" class="form-control" placeholder="Policy Status"
|
||||
id="policy_status" readonly>
|
||||
</div>
|
||||
<div >
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4" style="margin-top: 49px;">
|
||||
<label class="switch">
|
||||
<input id="is_addon" type="checkbox" name="is_addon" <?= (isset($client['is_addon']) && $client['is_addon'] == 1) ? 'checked' : '' ?>>
|
||||
<input id="is_addon" type="checkbox" name="is_addon"
|
||||
<?= (isset($client['is_addon']) && $client['is_addon'] == 1) ? 'checked' : '' ?>>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
<label for="is_addon" style=" position: relative;bottom: 5px;">Is AddOn Policy</label>
|
||||
<label for="is_addon" style="position: absolute;left: 70px;bottom: 2px;">Is AddOn Policy</label>
|
||||
</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>
|
||||
<select class="form-control" id="base_policy" name="base_policy">
|
||||
<option value="" selected>Select Base Policy</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -116,11 +133,10 @@
|
||||
<?php include('policy_gpa_terms.php'); ?>
|
||||
|
||||
<script>
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||
var policy_client = $('#policy_PrimaryKey').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#policy_status_field').hide()
|
||||
|
||||
@ -156,7 +172,10 @@
|
||||
$('.btnBack').hide();
|
||||
|
||||
|
||||
$('.btnAdd').click(function(){
|
||||
$('.btnAdd').click(function() {
|
||||
|
||||
fetchClientPolicyList()
|
||||
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').show();
|
||||
$('#table_list').hide();
|
||||
@ -170,11 +189,13 @@
|
||||
$('#is_addon').prop('checked', false);
|
||||
$('#policy_form_action').val('<?= base_url("client/policy/create"); ?>');
|
||||
$('#policy_status_field').hide()
|
||||
$('#base_policy_id').hide();
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
$('.btnBack').click(function(){
|
||||
$('.btnBack').click(function() {
|
||||
$('#policy_form')[0].reset();
|
||||
$('#add_form').hide();
|
||||
$('#table_list').show();
|
||||
@ -185,6 +206,7 @@
|
||||
$('#start_date').val('');
|
||||
$('#end_date').val('');
|
||||
$('#policy').html('<option value="" selected>Select Policy</option>');
|
||||
$('#base_policy_id').hide();
|
||||
|
||||
})
|
||||
|
||||
@ -214,7 +236,7 @@
|
||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||
<td>
|
||||
<div class="btn-group dropdown">
|
||||
@ -225,9 +247,11 @@
|
||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rac Rate</a>
|
||||
`;
|
||||
if (item.open_for_enrollment == 0) {
|
||||
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||
}else{
|
||||
policyTable +=`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="pointer-events:none; background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||
policyTable +=
|
||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
||||
} else {
|
||||
policyTable +=
|
||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="pointer-events:none; background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
||||
}
|
||||
policyTable += ` </div>
|
||||
</div>
|
||||
@ -241,15 +265,14 @@
|
||||
|
||||
|
||||
$('#table-client-policy').DataTable({
|
||||
paging: true ,
|
||||
paging: true,
|
||||
searching: false
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
/******** for form submit using AJAX *******/
|
||||
$("#policy_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@ -267,7 +290,7 @@
|
||||
var isValid = $('#policy_form').parsley().validate();
|
||||
if (!isValid) {
|
||||
console.log('Form is Empty', 'Warning');
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
$('.loader').fadeIn();
|
||||
@ -292,7 +315,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if(res){
|
||||
if (res) {
|
||||
setTimeout(function() {
|
||||
|
||||
$('.loader').fadeOut();
|
||||
@ -301,7 +324,8 @@
|
||||
$('#table_list').show();
|
||||
$('.btnBack').hide();
|
||||
$('.btnAdd').show();
|
||||
var message = (policy_PrimaryKey === '') ? 'Policy Created successfully' : 'Policy Updated Successfully';
|
||||
var message = (policy_PrimaryKey === '') ?
|
||||
'Policy Created successfully' : 'Policy Updated Successfully';
|
||||
toastr.success(message, 'Success');
|
||||
}, 1000);
|
||||
}
|
||||
@ -320,7 +344,8 @@
|
||||
} else if (patternGPA.test(subject)) {
|
||||
search_term = 'GPA';
|
||||
} else {
|
||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
search_term =
|
||||
subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||
}
|
||||
|
||||
console.log('search_term :', search_term)
|
||||
@ -371,10 +396,10 @@
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/********* To get th POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
/********* To get th POLICY base on Insurer *******/
|
||||
$('#insurer').change(function() {
|
||||
var id = $(this).val();
|
||||
var parts = id.split('-');
|
||||
var secondPart = parts[1];
|
||||
@ -386,7 +411,8 @@
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '">' + item.name + '</option>';
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
'">' + item.name + '</option>';
|
||||
});
|
||||
|
||||
$('#policy').html(OptionsHTML);
|
||||
@ -394,25 +420,35 @@
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy').change(function(){
|
||||
/********* set the Policy_Type_id for Form Submit *******/
|
||||
$('#policy').change(function() {
|
||||
|
||||
var id = $(this).val();
|
||||
var dataId = $(this).children('option:selected').attr('data-id');
|
||||
// console.log('dataId', dataId)
|
||||
console.log('id', id)
|
||||
$('#policy_type_id').val(dataId);
|
||||
|
||||
$('#base_policy option').each(function() {
|
||||
var val = $(this).val();
|
||||
if (val == id) {
|
||||
$(this).hide(); // Hide the option if its value matches the selected value of #policy
|
||||
} else {
|
||||
$(this).show(); // Show all other options
|
||||
}
|
||||
});
|
||||
|
||||
// if(dataId == 1){
|
||||
// appendPolicyFormFields(1);
|
||||
// }else if (dataId >= 1){
|
||||
// appendPolicyFormFields(2);
|
||||
// }
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// get the client policy data for edit
|
||||
$('body').on('click', '.btnPolicyEdit', function () {
|
||||
// get the client policy data for edit
|
||||
$('body').on('click', '.btnPolicyEdit', function() {
|
||||
|
||||
var policy_form_action = '';
|
||||
// var policy_id = $(this).data('id');
|
||||
@ -426,7 +462,7 @@
|
||||
url: '<?= base_url("client/policy/list/") ?>' + policy_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
success: function(res) {
|
||||
console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
@ -458,8 +494,10 @@
|
||||
|
||||
if (res.data.is_addon == 1) {
|
||||
$('#is_addon').prop('checked', true);
|
||||
$('#base_policy_id').show();
|
||||
} else {
|
||||
$('#is_addon').prop('checked', false);
|
||||
$('#base_policy_id').hide();
|
||||
}
|
||||
|
||||
/** do not delete this comment condition
|
||||
@ -475,11 +513,24 @@
|
||||
var policeOptionHTML = '';
|
||||
$.each(res.policy, function(index, item) {
|
||||
// console.log(item)
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + '" ' + (res.data.policy_id === item.id ? 'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
policeOptionHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
|
||||
'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
});
|
||||
$('#policy').html(policeOptionHTML);
|
||||
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
|
||||
$.each(res.client_policy_list, function(index, item) {
|
||||
if (res.data.policy_id !== item.id) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id +
|
||||
'" value="' + item.id + '" ' + (res.data.base_policy === item.id ?
|
||||
'selected="selected"' : '') + '>' + item.name + '</option>';
|
||||
}
|
||||
});
|
||||
$('#base_policy').html(OptionsHTML);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
@ -489,9 +540,9 @@
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnOpenEnroll', function () {
|
||||
$('body').on('click', '.btnOpenEnroll', function() {
|
||||
|
||||
var client_policy_id = $(this).attr('data-id');
|
||||
var policy_id = $(this).attr('id');
|
||||
@ -500,7 +551,7 @@
|
||||
|
||||
// console.log('client_policy_id', client_policy_id);
|
||||
|
||||
if(client_policy_id){
|
||||
if (client_policy_id) {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
}
|
||||
@ -509,20 +560,23 @@
|
||||
url: '<?php echo base_url('util/update-policy-status');?>',
|
||||
type: 'GET',
|
||||
data: {
|
||||
client_policy_id : client_policy_id,
|
||||
client_policy_id: client_policy_id,
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
if(res) {
|
||||
if (res) {
|
||||
if (res.open_for_enrollment) {
|
||||
var json_decode=JSON.parse(res.open_for_enrollment);
|
||||
var open_for_enrollment=json_decode.open_for_enrollment;
|
||||
var client_policy_id=json_decode.client_policy_id;
|
||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||
var open_for_enrollment = json_decode.open_for_enrollment;
|
||||
var client_policy_id = json_decode.client_policy_id;
|
||||
if (open_for_enrollment == 1) {
|
||||
// console.log($('[data-id="' + client_policy_id + '"]');
|
||||
$('.btnOpenEnroll').each(function(index, element) {
|
||||
if ($(element).data('id') == client_policy_id) {
|
||||
$(element).css({'background-color': 'lightgrey', 'pointer-events': 'none'});
|
||||
$(element).css({
|
||||
'background-color': 'lightgrey',
|
||||
'pointer-events': 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -531,10 +585,10 @@
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
if(res.status === true){
|
||||
if (res.status === true) {
|
||||
toastr.success(res.message, 'Success');
|
||||
|
||||
}else if(res.status === false){
|
||||
} else if (res.status === false) {
|
||||
toastr.warning(res.message, 'Warning');
|
||||
}
|
||||
}, 1000);
|
||||
@ -556,14 +610,14 @@
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function appendPolicyFormFields(policy_type, data = false){
|
||||
function appendPolicyFormFields(policy_type, data = false) {
|
||||
|
||||
var html = '';
|
||||
var container = document.getElementById('policy_fields');
|
||||
|
||||
if(policy_type == 2){
|
||||
if (policy_type == 2) {
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
@ -622,7 +676,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
}else if(policy_type == 1){
|
||||
} else if (policy_type == 1) {
|
||||
|
||||
$('#GMC').remove();
|
||||
$('#GPA').remove();
|
||||
@ -646,7 +700,7 @@
|
||||
|
||||
container.insertAdjacentHTML('beforeend', html);
|
||||
|
||||
if(policy_type == 2){
|
||||
if (policy_type == 2) {
|
||||
//Configure Flatpicker for the earned_premium_date datepicker.
|
||||
flatpickr("#earned_premium_date", {
|
||||
dateFormat: "d-m-Y",
|
||||
@ -662,7 +716,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$('#earned_premium_amount').keyup(function(){
|
||||
$('#earned_premium_amount').keyup(function() {
|
||||
|
||||
var PA = parseFloat($(this).val());
|
||||
var CA = parseFloat($('#claims_incurred_amount').val());
|
||||
@ -679,7 +733,7 @@
|
||||
});
|
||||
|
||||
|
||||
$('#claims_incurred_amount').keyup(function(){
|
||||
$('#claims_incurred_amount').keyup(function() {
|
||||
|
||||
var CA = $(this).val()
|
||||
var PA = $('#earned_premium_amount').val()
|
||||
@ -696,33 +750,33 @@
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||
function rearrangeDateFormat(inputDate) {
|
||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||
function rearrangeDateFormat(inputDate) {
|
||||
|
||||
if(inputDate !== null){
|
||||
if (inputDate !== null) {
|
||||
var dateComponents = inputDate.split("-");
|
||||
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
|
||||
return rearrangedDate;
|
||||
}else{
|
||||
} else {
|
||||
return '00-00-0000';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkDateStatus(inputDate, bg = false) {
|
||||
function checkDateStatus(inputDate, bg = false) {
|
||||
|
||||
var givenDate = new Date(inputDate);
|
||||
var currentDate = new Date();
|
||||
|
||||
if(bg != false){
|
||||
if (bg != false) {
|
||||
if (givenDate < currentDate) {
|
||||
return `<span class="badge badge-danger">Expired</span>`;
|
||||
} else {
|
||||
return `<span class="badge badge-success">Active</span>`;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if (givenDate < currentDate) {
|
||||
return `Expired`;
|
||||
} else {
|
||||
@ -730,15 +784,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const numberWords = {
|
||||
0: "Zero", 1: "One", 2: "Two", 3: "Three", 4: "Four", 5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine",
|
||||
10: "Ten", 11: "Eleven", 12: "Twelve", 13: "Thirteen", 14: "Fourteen", 15: "Fifteen", 16: "Sixteen", 17: "Seventeen", 18: "Eighteen", 19: "Nineteen",
|
||||
20: "Twenty", 30: "Thirty", 40: "Forty", 50: "Fifty", 60: "Sixty", 70: "Seventy", 80: "Eighty", 90: "Ninety"
|
||||
};
|
||||
const numberWords = {
|
||||
0: "Zero",
|
||||
1: "One",
|
||||
2: "Two",
|
||||
3: "Three",
|
||||
4: "Four",
|
||||
5: "Five",
|
||||
6: "Six",
|
||||
7: "Seven",
|
||||
8: "Eight",
|
||||
9: "Nine",
|
||||
10: "Ten",
|
||||
11: "Eleven",
|
||||
12: "Twelve",
|
||||
13: "Thirteen",
|
||||
14: "Fourteen",
|
||||
15: "Fifteen",
|
||||
16: "Sixteen",
|
||||
17: "Seventeen",
|
||||
18: "Eighteen",
|
||||
19: "Nineteen",
|
||||
20: "Twenty",
|
||||
30: "Thirty",
|
||||
40: "Forty",
|
||||
50: "Fifty",
|
||||
60: "Sixty",
|
||||
70: "Seventy",
|
||||
80: "Eighty",
|
||||
90: "Ninety"
|
||||
};
|
||||
|
||||
function convertNumberToWords(number) {
|
||||
function convertNumberToWords(number) {
|
||||
if (number === 0) {
|
||||
return numberWords[number];
|
||||
}
|
||||
@ -776,9 +855,9 @@
|
||||
}
|
||||
}
|
||||
return word.trim();
|
||||
}
|
||||
}
|
||||
|
||||
function convertCommaNumberToWords(input) {
|
||||
function convertCommaNumberToWords(input) {
|
||||
let number;
|
||||
if (input instanceof HTMLElement) {
|
||||
const inputValue = input.value;
|
||||
@ -794,20 +873,20 @@
|
||||
var convert_word_value = convertNumberToWords(number);
|
||||
|
||||
return convert_word_value;
|
||||
}
|
||||
}
|
||||
|
||||
function onlyNumbers(event){
|
||||
function onlyNumbers(event) {
|
||||
var charcode;
|
||||
charcode = event.which || event.keyCode;
|
||||
if(charcode>= 48 && charcode <= 57)return true;
|
||||
if (charcode >= 48 && charcode <= 57) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function formatNumber(input, maxLength) {
|
||||
function formatNumber(input, maxLength) {
|
||||
|
||||
// console.log("input", input);
|
||||
maxLength=16;
|
||||
maxLength = 16;
|
||||
let value = input.value.replace(/\D/g, ''); // Remove non-numeric characters
|
||||
|
||||
// Limit the number of digits
|
||||
@ -869,14 +948,68 @@
|
||||
// }
|
||||
// }
|
||||
|
||||
return ;
|
||||
return;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
function removeClientPolicy(element) {
|
||||
function removeClientPolicy(element) {
|
||||
console.log(element);
|
||||
}
|
||||
|
||||
|
||||
$('#is_addon').change(function() {
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#base_policy_id').show();
|
||||
$('#base_policy').prop('required', true);
|
||||
}else{
|
||||
$('#base_policy_id').hide();
|
||||
$('#base_policy').prop('required', false);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function fetchClientPolicyList(){
|
||||
|
||||
var client_id = $('#client_id_policy').val()
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("util/featch-client-policy-list/") ?>' + client_id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
console.log(res)
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
|
||||
if (res.status === false) {
|
||||
toastr.error(res.status);
|
||||
return;
|
||||
}
|
||||
var OptionsHTML = '';
|
||||
OptionsHTML += '<option value="" selected>Select Base Policy</option>';
|
||||
$.each(res.data, function(index, item) {
|
||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
|
||||
'">' + item.name + '</option>';
|
||||
});
|
||||
$('#base_policy').html(OptionsHTML);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
@ -2,38 +2,56 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card-body">
|
||||
<form role="form" class="parsley-examples" method="post" id="insurer_general_form" enctype="multipart/form-data">
|
||||
<form role="form" class="parsley-examples" method="post" id="insurer_general_form"
|
||||
enctype="multipart/form-data">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey" value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>"/>
|
||||
<input type="hidden" name="PrimaryKey" id="insurer_General_PrimaryKey"
|
||||
value="<?= isset($insurer['id']) ? $insurer['id'] : '' ?>" />
|
||||
<input type="hidden" name="insurer_id" id="insurer_id" />
|
||||
<div class="form-group">
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="entity_type_id">Insurer Type <span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="type" name="type" required>
|
||||
<option value="">Select Type</option>
|
||||
<?php foreach ($types as $type): ?>
|
||||
<option value="<?= $type->id; ?>" <?= isset($insurer['type']) && $insurer['type'] == $type->id ? 'selected' : ''; ?>>
|
||||
<?= $type->name; ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="insurer_name">Insurer Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<label for="insurer_name">Insurer Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="insurer_name"
|
||||
placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="short_name">Insurer Short Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name"
|
||||
placeholder="Enter Short Name" value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>" name="short_name" required>
|
||||
placeholder="Enter Insurer Name"
|
||||
value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-2">
|
||||
<label for="short_name">Insurer Short Name<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="short_name" placeholder="Enter Short Name"
|
||||
value="<?= isset($insurer['short_name']) ? $insurer['short_name'] : '' ?>"
|
||||
name="short_name" required minlength="3" maxlength="8">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="html">Insurer Type</label><br>
|
||||
<div style="margin-top: 10px;">
|
||||
<input type="radio" id="html" name="type" value="pvt" <?= isset($insurer['type']) && $insurer['type'] == 'pvt' ? 'checked' : '' ?>>
|
||||
<label for="html">PVT</label>
|
||||
<input type="radio" id="css" name="type" value="psu" <?= isset($insurer['type']) && $insurer['type'] == 'psu' ? 'checked' : '' ?>>
|
||||
<label for="css">PSU</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4" style="position: relative;right: 0px;">
|
||||
<label for="html">Insurer Category</label><br>
|
||||
<div style="margin-top: 10px;">
|
||||
<input type="radio" id="html" name="category" value="life" <?= isset($insurer['category']) && $insurer['category'] == 'life' ? 'checked' : '' ?>>
|
||||
<label for="html">Life</label>
|
||||
<input type="radio" id="css" name="category" value="general" <?= isset($insurer['category']) && $insurer['category'] == 'general' ? 'checked' : '' ?>>
|
||||
<label for="css" style="position: absolute;left: 70px;">General(Non Life)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0">
|
||||
@ -50,8 +68,7 @@
|
||||
<!-- end -->
|
||||
|
||||
<script>
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#insurer_general_form").submit(function(events) {
|
||||
|
||||
@ -62,7 +79,7 @@ $(document).ready(function () {
|
||||
jQuery.each(events.target, function(index, event) {
|
||||
if (event.validity.valid) {
|
||||
|
||||
}else{
|
||||
} else {
|
||||
isValid = false;
|
||||
}
|
||||
});
|
||||
@ -71,9 +88,9 @@ $(document).ready(function () {
|
||||
var form_action = '';
|
||||
if (isValid) {
|
||||
|
||||
if(PrimaryKey === ''){
|
||||
if (PrimaryKey === '') {
|
||||
form_action = '<?= base_url("master/insurer/createpost"); ?>';
|
||||
}else{
|
||||
} else {
|
||||
form_action = '<?= base_url("master/insurer/edit"); ?>';
|
||||
}
|
||||
|
||||
@ -114,7 +131,7 @@ $(document).ready(function () {
|
||||
// });
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
|
||||
@ -128,7 +145,7 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
|
||||
function validateForm() {
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
// Perform validation for each field
|
||||
@ -154,9 +171,8 @@ function validateForm() {
|
||||
});
|
||||
|
||||
return isValid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -111,11 +111,10 @@
|
||||
<tbody>
|
||||
<?php foreach($depositdata as $row) { ?>
|
||||
<tr id="<?php echo $row->id;?>">
|
||||
<td class=""><?php echo date('d-m-y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo date('d-M-Y h:i A', strtotime($row->created_at)); ?></td>
|
||||
<td><?php echo $row->username; ?></td>
|
||||
<td><?php echo $row->description; ?></td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
|
||||
</td>
|
||||
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo ($row->transaction_type == 'Debit') ? $row->amount : ''; ?></td>
|
||||
<td><?php echo $row->balance; ?></td>
|
||||
@ -229,7 +228,16 @@ $(document).ready(function() {
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}],
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: 'PDF',
|
||||
title: 'TransactionDetails',
|
||||
exportOptions: {
|
||||
columns: ''
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
|
||||
language: {
|
||||
|
||||
40
tests/unit/CheckFormateDataTest.php
Normal file
40
tests/unit/CheckFormateDataTest.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Tests;
|
||||
|
||||
use CodeIgniter\Test\CIUnitTestCase;
|
||||
|
||||
use App\Controllers\EmpDataServiceController;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\ClientModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\FileModel;
|
||||
use App\Models\BatchListModel;
|
||||
use App\Models\BatchFileModel;
|
||||
use App\Models\EmpEndorsementModel;
|
||||
use App\Models\ClientDepositModel;
|
||||
|
||||
|
||||
|
||||
class CheckFormateDataTest extends CIUnitTestCase
|
||||
{
|
||||
public function testGenerateExcelForAdditionAndInception()
|
||||
{
|
||||
$batch_data = [
|
||||
'client_id' => 12,
|
||||
'client_policy_id' => 12,
|
||||
'insurer_or_tpa' => 'insurer',
|
||||
'event_type' => 'inception',
|
||||
'actions' => 'export',
|
||||
'file_name' => 'TCS_HealthFlex_Advantage_Policy_IEI_06-04-2024_17-42-31.xlsx',
|
||||
];
|
||||
|
||||
$empServiceController = new EmpDataServiceController();
|
||||
$result = $empServiceController->generateExcelForAdditionAndInception($batch_data);
|
||||
|
||||
// You can add assertions here to verify the result if needed
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user