FEAT_AUTO_SI : RV
This commit is contained in:
parent
4f5f117aa6
commit
f76c356729
@ -335,6 +335,8 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post('get_data_for_mapping', 'EmployeeController::getDataForMapping');
|
$routes->post('get_data_for_mapping', 'EmployeeController::getDataForMapping');
|
||||||
$routes->post('unmap_employees/(:num)', 'EmployeeController::unmapEmployees/$1');
|
$routes->post('unmap_employees/(:num)', 'EmployeeController::unmapEmployees/$1');
|
||||||
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
$routes->get('transformMailContent', 'LeadsController::transformMailContent');
|
||||||
|
$routes->get('getRackRateSIAmountAndAutoSiDataForAutoSI', 'ClientController::getRackRateSIAmountAndAutoSiDataForAutoSI');
|
||||||
|
$routes->post('createAutoSI', 'ClientController::createAutoSI');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|||||||
@ -39,6 +39,7 @@ use App\Models\PolicyTransactionModel;
|
|||||||
use App\Models\PolicyTransactionStatusModel;
|
use App\Models\PolicyTransactionStatusModel;
|
||||||
use App\Models\VehicleModel;
|
use App\Models\VehicleModel;
|
||||||
use App\Models\LeadsModel;
|
use App\Models\LeadsModel;
|
||||||
|
use App\Models\AutoSIModel;
|
||||||
|
|
||||||
use App\Controllers\EmpDataServiceController;
|
use App\Controllers\EmpDataServiceController;
|
||||||
use App\Controllers\GoogleDriveController;
|
use App\Controllers\GoogleDriveController;
|
||||||
@ -80,6 +81,7 @@ class ClientController extends AdminController
|
|||||||
protected $policyTransactionStatusModel;
|
protected $policyTransactionStatusModel;
|
||||||
protected $vehicleModel;
|
protected $vehicleModel;
|
||||||
protected $leadsModel;
|
protected $leadsModel;
|
||||||
|
protected $AutoSIModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -116,6 +118,7 @@ class ClientController extends AdminController
|
|||||||
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
$this->policyTransactionStatusModel = new PolicyTransactionStatusModel();
|
||||||
$this->vehicleModel = new VehicleModel();
|
$this->vehicleModel = new VehicleModel();
|
||||||
$this->leadsModel = new LeadsModel();
|
$this->leadsModel = new LeadsModel();
|
||||||
|
$this->AutoSIModel = new AutoSIModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
@ -3876,28 +3879,29 @@ class ClientController extends AdminController
|
|||||||
// $EmpDataServiceController = new EmpDataServiceController();
|
// $EmpDataServiceController = new EmpDataServiceController();
|
||||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 160]);
|
||||||
|
|
||||||
$EmpDataServiceController = new EmpDataServiceController();
|
// $EmpDataServiceController = new EmpDataServiceController();
|
||||||
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
// $EmpDataServiceController->importInceptionUpdateTPAandUHID(['file_id' => 162]);
|
||||||
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
// $EmpDataServiceController->importInceptionFileValidation(['file_id' => 162]);
|
||||||
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
// $EmpDataServiceController->importDeletionValidation(['file_id' => 171]);
|
||||||
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
// $EmpDataServiceController->importDeletionUpdateEndorsementID(['file_id' => 171]);
|
||||||
$array = [
|
|
||||||
"employeeIds" => ["12800", "12798", "12797", "12799"],
|
|
||||||
"client_id" => "159",
|
|
||||||
"client_policy_id" => "336",
|
|
||||||
"client_branch_id" => "126",
|
|
||||||
"cd_ac_no" => "Apple_123",
|
|
||||||
"endorsement_no" => "ENDORSEMENT_ID",
|
|
||||||
"count" => 4,
|
|
||||||
"event_name" => "deletion",
|
|
||||||
"policy_name" => "GMC",
|
|
||||||
"user_id" => "1"
|
|
||||||
];
|
|
||||||
|
|
||||||
$EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
// $array = [
|
||||||
|
// "employeeIds" => ["12800", "12798", "12797", "12799"],
|
||||||
|
// "client_id" => "159",
|
||||||
|
// "client_policy_id" => "336",
|
||||||
|
// "client_branch_id" => "126",
|
||||||
|
// "cd_ac_no" => "Apple_123",
|
||||||
|
// "endorsement_no" => "ENDORSEMENT_ID",
|
||||||
|
// "count" => 4,
|
||||||
|
// "event_name" => "deletion",
|
||||||
|
// "policy_name" => "GMC",
|
||||||
|
// "user_id" => "1"
|
||||||
|
// ];
|
||||||
|
|
||||||
// $employeeRestController = new EmployeeServiceController();
|
// $EmpDataServiceController->cashDepositCalculationForDeletion($array);
|
||||||
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 757]);
|
|
||||||
|
$employeeRestController = new EmployeeServiceController();
|
||||||
|
$employeeRestController->employeesOnboardPreprocess(['file_id' => 756]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3943,4 +3947,95 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ---------AUTO SI ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Function to insert and update the auto si data and update the client policy table for auto si enableor disable
|
||||||
|
public function createAutoSI()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$postData = $this->request->getPost();
|
||||||
|
if (empty($postData)) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'code' => 400,
|
||||||
|
'message' => 'No data provided.',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = $postData['id'] ?? null;
|
||||||
|
$auto_si_enable = isset($postData['is_auto_si']) ? 1 : 0;
|
||||||
|
$affectedRows = 0;
|
||||||
|
$message = '';
|
||||||
|
|
||||||
|
$this->clientPolicyModel->where('id', $postData['client_policy_id'])->set('is_auto_si', $auto_si_enable)->update();
|
||||||
|
|
||||||
|
if ($id) {
|
||||||
|
$affectedRows = $this->AutoSIModel->where('id', $id)->set($postData)->update();
|
||||||
|
$message = "Auto SI data updated successfully.";
|
||||||
|
} else {
|
||||||
|
$affectedRows = $this->AutoSIModel->insert($postData);
|
||||||
|
$message = "Auto SI data submitted successfully.";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($affectedRows) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => true,
|
||||||
|
'code' => 200,
|
||||||
|
'message' => $message,
|
||||||
|
'data' => $affectedRows,
|
||||||
|
], 200);
|
||||||
|
} else {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'code' => 500,
|
||||||
|
'message' => 'Failed to save data.',
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => false,
|
||||||
|
'code' => 500,
|
||||||
|
'message' => 'An error occurred.',
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Function to get the data from Policy Premium 2 table data for the SI Dropdown, and Auto SI table data for edit auto_si
|
||||||
|
public function getRackRateSIAmountAndAutoSiDataForAutoSI()
|
||||||
|
{
|
||||||
|
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||||
|
|
||||||
|
if(!empty($client_policy_id)){
|
||||||
|
|
||||||
|
$rack_rate_count = $this->policyPremium2Model
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->groupBy('rack_rate_name')
|
||||||
|
->countAllResults();
|
||||||
|
|
||||||
|
$si_amounts = $this->policyPremium2Model
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$auto_si = $this->AutoSIModel
|
||||||
|
->select('auto_si.*, client_policy.is_auto_si')
|
||||||
|
->join('client_policy', 'auto_si.client_policy_id = client_policy.id')
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('auto_si.is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if($rack_rate_count <= 1){
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'si_amount' => $si_amounts, "auto_si_amount" => $auto_si], 200);
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The policy has more than one rack rates. Auto SI create only one rack rate.', 'si_amount' => $si_amounts, "auto_si_amount" => $auto_si], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'No data to found. Client Policy Not found'], 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use App\Models\EmployeeModel;
|
use App\Models\EmployeeModel;
|
||||||
use App\Models\InsurerModel;
|
use App\Models\InsurerModel;
|
||||||
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\AutoSIModel;
|
||||||
use Kint\Kint;
|
use Kint\Kint;
|
||||||
|
|
||||||
|
|
||||||
@ -900,7 +902,7 @@ if (!function_exists('calculate_premium_new'))
|
|||||||
// dd($slab);
|
// dd($slab);
|
||||||
$res = compare_incoming_family_slab_with_configured_slab($slab,$incoming_familiy_composition);
|
$res = compare_incoming_family_slab_with_configured_slab($slab,$incoming_familiy_composition);
|
||||||
// kint::dump($key);
|
// kint::dump($key);
|
||||||
// kint::dump($res);
|
kint::dump($res);
|
||||||
|
|
||||||
if($res['is_applicable'])
|
if($res['is_applicable'])
|
||||||
{
|
{
|
||||||
@ -940,7 +942,7 @@ if (!function_exists('calculate_premium_new'))
|
|||||||
$temp_slab_rates[$key]['is_applicable'] = false;
|
$temp_slab_rates[$key]['is_applicable'] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dd();
|
dd($family_data);
|
||||||
|
|
||||||
//4. if macthed then the current rack rate is applicable and find common variables link max age,max count,grade, basic pay,SI, self/acting self for current rack rate
|
//4. if macthed then the current rack rate is applicable and find common variables link max age,max count,grade, basic pay,SI, self/acting self for current rack rate
|
||||||
|
|
||||||
@ -983,7 +985,7 @@ if (!function_exists('calculate_premium_new'))
|
|||||||
|
|
||||||
// // Final combined condition
|
// // Final combined condition
|
||||||
if ($conditions['isEmployeeSourceEnrollment'] || $conditions['isEmployeeSourceExcelFile'] || $primaryGridTypeCondition ) {
|
if ($conditions['isEmployeeSourceEnrollment'] || $conditions['isEmployeeSourceExcelFile'] || $primaryGridTypeCondition ) {
|
||||||
// dd($transformed_familiy_member_data);
|
dd($transformed_familiy_member_data);
|
||||||
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$temp_slab_rates,$default_si);
|
$transformed_familiy_member_data = premium_calculation_manager($transformed_familiy_member_data,$policy_terms,$temp_slab_rates,$default_si);
|
||||||
// dd($transformed_familiy_member_data);
|
// dd($transformed_familiy_member_data);
|
||||||
$result[] = $transformed_familiy_member_data;
|
$result[] = $transformed_familiy_member_data;
|
||||||
@ -2174,3 +2176,40 @@ if(!function_exists('generate_family_floater_key'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!function_exists('update_si_with_auto_si'))
|
||||||
|
{
|
||||||
|
function update_si_with_auto_si($client_id, $client_policy_id, $client_branch_id, $emp_code)
|
||||||
|
{
|
||||||
|
|
||||||
|
$clientPolicy = new ClientPolicyModel();
|
||||||
|
$policy_data = $clientPolicy->getPolicyDetails($client_id, $client_policy_id);
|
||||||
|
|
||||||
|
if(empty($policy_data) || $policy_data['is_auto_si']){
|
||||||
|
return null;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$autoSiModel = new AutoSIModel();
|
||||||
|
$auto_si_amounts = $autoSiModel
|
||||||
|
->where('client_policy_id', $client_policy_id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$params = [
|
||||||
|
'auto_si' => $auto_si_amounts,
|
||||||
|
];
|
||||||
|
|
||||||
|
$modified_si = modify_si_for_the_family($params);
|
||||||
|
return $modified_si;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('modify_si_for_the_family'))
|
||||||
|
{
|
||||||
|
function modify_si_for_the_family($params)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
53
app/Models/AutoSIModel.php
Normal file
53
app/Models/AutoSIModel.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use CodeIgniter\Model;
|
||||||
|
|
||||||
|
class AutoSIModel extends Model
|
||||||
|
{
|
||||||
|
protected $table = 'auto_si';
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
protected $allowedFields = [
|
||||||
|
'id',
|
||||||
|
'client_policy_id',
|
||||||
|
'family_composition',
|
||||||
|
'created_by',
|
||||||
|
'created_at',
|
||||||
|
'updated_by',
|
||||||
|
'updated_at',
|
||||||
|
'is_active'
|
||||||
|
];
|
||||||
|
// Callbacks
|
||||||
|
protected $allowCallbacks = true;
|
||||||
|
protected $beforeInsert = ["checkAndADDCreatedByValue"];
|
||||||
|
protected $afterInsert = [];
|
||||||
|
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
|
||||||
|
protected $afterUpdate = [];
|
||||||
|
protected $beforeFind = [];
|
||||||
|
protected $afterFind = [];
|
||||||
|
protected $beforeDelete = [];
|
||||||
|
protected $afterDelete = [];
|
||||||
|
|
||||||
|
protected function checkAndADDCreatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['created_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['created_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAndUpdateUpdatedByValue(array $data)
|
||||||
|
{
|
||||||
|
// Check if 'updated_by' value is null or empty
|
||||||
|
if (empty($data['data']['updated_by'])) {
|
||||||
|
// Set 'updated_by' value to the current session user ID
|
||||||
|
$data['data']['updated_by'] = get_session_userid();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -52,7 +52,8 @@ class ClientPolicyModel extends Model
|
|||||||
"disclaimer",
|
"disclaimer",
|
||||||
"is_active",
|
"is_active",
|
||||||
"is_member_modify_allowed",
|
"is_member_modify_allowed",
|
||||||
"cd_ac_pk"
|
"cd_ac_pk",
|
||||||
|
"is_auto_si",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
<div class="tab-pane fade" id="police-tab">
|
<div class="tab-pane fade" id="police-tab">
|
||||||
|
|
||||||
|
|
||||||
<div class="row float-right" style="padding-bottom: 10px; position: relative;right: 13px;">
|
<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" style="position: relative;right: 10px;"><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"
|
||||||
<button type="button" id="BtnAddSuccess" class="btn btn-success waves-effect waves-light BtnAddSuccess btn-sm" onclick="showModal()"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Policy From Lead</button>
|
style="position: relative;right: 10px;"><span class="fa fa-plus-square" aria-hidden="true"
|
||||||
|
style="padding: 5px 10px;"></span>Add Policy</button>
|
||||||
|
<button type="button" id="BtnAddSuccess" class="btn btn-success waves-effect waves-light BtnAddSuccess btn-sm"
|
||||||
|
onclick="showModal('lead_modal')"><span class="fa fa-plus-square" aria-hidden="true"
|
||||||
|
style="padding: 5px 10px;"></span>Add Policy From Lead</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive" id="table_list">
|
<div class="table-responsive" id="table_list">
|
||||||
@ -31,7 +34,9 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
<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>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
@ -43,7 +48,8 @@
|
|||||||
<input type="hidden" id="policy_form_action" />
|
<input type="hidden" id="policy_form_action" />
|
||||||
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
<input type="hidden" name="policy_type_id" id="policy_type_id" />
|
||||||
<input type="hidden" id="insurer_policy_id" />
|
<input type="hidden" id="insurer_policy_id" />
|
||||||
<input type="hidden" name="client_id" id="client_id_policy" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
<input type="hidden" name="client_id" id="client_id_policy"
|
||||||
|
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
||||||
@ -52,7 +58,7 @@
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
|
<label for="client_branch">Client Branch<span class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="client_branch" name="client_branch_id">
|
<select class="form-control" id="client_branch" name="client_branch_id">
|
||||||
<option selected >Select Client Branch</option>
|
<option selected>Select Client Branch</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -68,7 +74,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
|
<div class="form-group col-md-4" id="base_policy_id" style="display: none;">
|
||||||
<label for="base_policy">Base Policy<span id="base_danger" class="text-danger">*</span></label>
|
<label for="base_policy">Base Policy<span id="base_danger"
|
||||||
|
class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="base_policy" name="base_policy">
|
<select class="form-control" id="base_policy" name="base_policy">
|
||||||
<option value="" selected>Select Base Policy</option>
|
<option value="" selected>Select Base Policy</option>
|
||||||
</select>
|
</select>
|
||||||
@ -102,30 +109,36 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
|
<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>
|
<input value="" type="text" class="form-control" placeholder="Enter Policy Number "
|
||||||
|
name="policy_no" id="policy_no" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-row" id="second" style="display: none;">
|
<div class="form-row" id="second" style="display: none;">
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_start_date">Policy Start Date<span class="text-danger">*</span></label>
|
<label for="policy_start_date">Policy Start Date<span
|
||||||
<input value="" type="text" class="form-control" placeholder="Enter Start Date " name="policy_start_date" id="start_date" required>
|
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>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="policy_end_date">Policy End Date<span class="text-danger">*</span></label>
|
<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>
|
||||||
|
|
||||||
<div class="form-group col-md-4" id="policy_status_field">
|
<div class="form-group col-md-4" id="policy_status_field">
|
||||||
<label for="policy_status">Policy Status</label>
|
<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>
|
||||||
|
|
||||||
<div class="form-row" id="third" style="display: none; position: relative;top: 22px;">
|
<div class="form-row" id="third" style="display: none; position: relative;top: 22px;">
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="cd_ac_no">CD Account Number<span id="tpa_danger" class="text-danger">*</span></label>
|
<label for="cd_ac_no">CD Account Number<span id="tpa_danger"
|
||||||
|
class="text-danger">*</span></label>
|
||||||
<select class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
<select class="form-control" id="cd_ac_no" name="cd_ac_no" required>
|
||||||
<option value="">Select CD Account Number</option>
|
<option value="">Select CD Account Number</option>
|
||||||
</select>
|
</select>
|
||||||
@ -133,7 +146,8 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="gst_no">GST ( % )<span id="tpa_danger" class="text-danger">*</span></label>
|
<label for="gst_no">GST ( % )<span id="tpa_danger" class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst" required>
|
<input type="text" class="form-control" placeholder="GST (%)" id="gst_no" name="gst"
|
||||||
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
@ -148,22 +162,27 @@
|
|||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
<label for="open_date">Open Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Open Date " name="open_date" id="open_date" >
|
<input value="" type="text" class="form-control dateofdata"
|
||||||
|
placeholder="Enter Open Date " name="open_date" id="open_date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
<label for="close_date">Close Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Close Date " name="close_date" id="close_date" >
|
<input value="" type="text" class="form-control dateofdata"
|
||||||
|
placeholder="Enter Close Date " name="close_date" id="close_date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
<label for="reminder_date">Reminder Date<span class="text-danger">*</span></label>
|
||||||
<input value="" type="text" class="form-control dateofdata" placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date" id="reminder_date" >
|
<input value="" type="text" class="form-control dateofdata"
|
||||||
|
placeholder="Enter Remainder Dates( eg, 28,29,30 )" name="reminder_date"
|
||||||
|
id="reminder_date">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-12">
|
<div class="form-group col-md-12">
|
||||||
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
<label for="disclaimer">Disclaimer<span class="text-danger">*</span></label>
|
||||||
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer" id="disclaimer" ></textarea>
|
<textarea class="form-control" placeholder="Enter Disclaimer" name="disclaimer"
|
||||||
|
id="disclaimer"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
@ -172,7 +191,8 @@
|
|||||||
<span class="slider round" style="height: 27px;"></span>
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy Visibilty in Enrollment App</label>
|
<label for="policy_visibility" style="position: relative;bottom: 5px;left: 85px;">Policy
|
||||||
|
Visibilty in Enrollment App</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- <div class="form-group col-md-4">
|
<!-- <div class="form-group col-md-4">
|
||||||
@ -190,8 +210,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group text-right m-b-0">
|
<div class="form-group text-right m-b-0">
|
||||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1" id="btnSubmit">Submit</button>
|
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1"
|
||||||
<button type="button" class="btn btn-secondary waves-effect btnBack" id="btnBack">Cancel</button>
|
id="btnSubmit">Submit</button>
|
||||||
|
<button type="button" class="btn btn-secondary waves-effect btnBack"
|
||||||
|
id="btnBack">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@ -206,9 +228,11 @@
|
|||||||
<?php include('policy_gmc_terms.php'); ?>
|
<?php include('policy_gmc_terms.php'); ?>
|
||||||
<?php include('policy_gpa_terms.php'); ?>
|
<?php include('policy_gpa_terms.php'); ?>
|
||||||
<?php include('other_policy_terms.php'); ?>
|
<?php include('other_policy_terms.php'); ?>
|
||||||
|
<?php include('rack_rate_auto_si.php'); ?>
|
||||||
|
|
||||||
<!-- Center modal content -->
|
<!-- Center modal content -->
|
||||||
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="false">
|
<div class="modal fade" id="lead_modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||||
|
aria-hidden="false">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -223,7 +247,9 @@
|
|||||||
<option value="">Select Lead</option>
|
<option value="">Select Lead</option>
|
||||||
<?php if(isset($lead_data)) { ?>
|
<?php if(isset($lead_data)) { ?>
|
||||||
<?php foreach ($lead_data as $value) { ?>
|
<?php foreach ($lead_data as $value) { ?>
|
||||||
<option value="<?= $value['id']?>" data-clientid="<?= $value['client_id']?>", data-branchid="<?= $value['client_branch_id']?>"><?= $value['client_name'] ?> - <?= $value['branch_name'] ?> - <?= $value['user_name'] ?></option>
|
<option value="<?= $value['id']?>" data-clientid="<?= $value['client_id']?>" ,
|
||||||
|
data-branchid="<?= $value['client_branch_id']?>"><?= $value['client_name'] ?> -
|
||||||
|
<?= $value['branch_name'] ?> - <?= $value['user_name'] ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
@ -237,39 +263,39 @@
|
|||||||
</div>
|
</div>
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
|
||||||
|
|
||||||
$('#inception_type').change(function () {
|
<script>
|
||||||
|
$('#inception_type').change(function() {
|
||||||
var open_data = $('#open_date').parent();
|
var open_data = $('#open_date').parent();
|
||||||
var close_data = $('#close_date').parent();
|
var close_data = $('#close_date').parent();
|
||||||
var reminder_data = $('#reminder_date').parent();
|
var reminder_data = $('#reminder_date').parent();
|
||||||
if($(this).prop('checked')){
|
if ($(this).prop('checked')) {
|
||||||
$(open_data).show();
|
$(open_data).show();
|
||||||
$(close_data).show();
|
$(close_data).show();
|
||||||
$(reminder_data).show();
|
$(reminder_data).show();
|
||||||
$('.dateofdata').attr('required', true);
|
$('.dateofdata').attr('required', true);
|
||||||
}else{
|
} else {
|
||||||
$(open_data).hide();
|
$(open_data).hide();
|
||||||
$(close_data).hide();
|
$(close_data).hide();
|
||||||
$(reminder_data).hide();
|
$(reminder_data).hide();
|
||||||
$('.dateofdata').attr('required', false);
|
$('.dateofdata').attr('required', false);
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var policy_PrimaryKey = $('#client_id_policy').val();
|
var policy_PrimaryKey = $('#client_id_policy').val();
|
||||||
var policy_client = $('#policy_PrimaryKey').val();
|
var policy_client = $('#policy_PrimaryKey').val();
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Initialize select2
|
// Initialize select2
|
||||||
$("#insurer").select2();
|
$("#insurer").select2();
|
||||||
$("#policy").select2();
|
$("#policy").select2();
|
||||||
$("#tpa").select2();
|
$("#tpa").select2();
|
||||||
$("#base_policy").select2();
|
$("#base_policy").select2();
|
||||||
$("#client_branch").select2();
|
$("#client_branch").select2();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#policy_status_field').hide()
|
$('#policy_status_field').hide()
|
||||||
|
|
||||||
@ -327,7 +353,7 @@
|
|||||||
if (policy_PrimaryKey !== '') {
|
if (policy_PrimaryKey !== '') {
|
||||||
var policyTable = '';
|
var policyTable = '';
|
||||||
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
var data = <?= isset($client_policy) ? json_encode($client_policy) : '[]' ?>;
|
||||||
console.log('client_policy_data',data)
|
console.log('client_policy_data', data)
|
||||||
var role = data.role
|
var role = data.role
|
||||||
delete data.role;
|
delete data.role;
|
||||||
|
|
||||||
@ -379,9 +405,14 @@
|
|||||||
|
|
||||||
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
||||||
|
|
||||||
|
let auto_si_menu = '';
|
||||||
|
if(item.policy_type_id == 2){
|
||||||
|
auto_si_menu = `<a href="#" data-id="${item.id}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="showModal('rack_rate_auto_si_modal'); checkCDAmountForBasePremium('${item.id}')"><i class="mdi mdi-autorenew mr-2 text-muted font-18 vertical-middle"></i>Auto SI</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
policyTable += `
|
policyTable +=
|
||||||
|
`
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${policy_name_data}</td>
|
<td>${policy_name_data}</td>
|
||||||
@ -396,11 +427,12 @@
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" 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>Rack Rate</a>`;
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" 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>Rack Rate</a>
|
||||||
|
${auto_si_menu}`;
|
||||||
// Conditionally render the delete option based on the role
|
// Conditionally render the delete option based on the role
|
||||||
if (role !== 3 && role !== 4) {
|
if (role !== 3 && role !== 4) {
|
||||||
policyTable += `
|
policyTable +=
|
||||||
|
`
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,9 +458,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.btnAdd').click(function() {
|
$('.btnAdd').click(function() {
|
||||||
|
|
||||||
fetchClientBranch()
|
fetchClientBranch()
|
||||||
|
|
||||||
@ -461,9 +493,9 @@
|
|||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.btnBack').click(function() {
|
$('.btnBack').click(function() {
|
||||||
|
|
||||||
$('#policy_form')[0].reset();
|
$('#policy_form')[0].reset();
|
||||||
$('#add_form').hide();
|
$('#add_form').hide();
|
||||||
@ -482,10 +514,10 @@
|
|||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#client_branch').val('').change();
|
$('#client_branch').val('').change();
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/******** for form submit using AJAX *******/
|
/******** for form submit using AJAX *******/
|
||||||
$("#policy_form").submit(function(event) {
|
$("#policy_form").submit(function(event) {
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
@ -533,7 +565,7 @@
|
|||||||
|
|
||||||
var formData = new FormData($('#policy_form')[0]);
|
var formData = new FormData($('#policy_form')[0]);
|
||||||
var policy_form_action = $('#policy_form_action').val();
|
var policy_form_action = $('#policy_form_action').val();
|
||||||
console.log(formData+'form data');
|
console.log(formData + 'form data');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: formData,
|
data: formData,
|
||||||
url: policy_form_action,
|
url: policy_form_action,
|
||||||
@ -622,9 +654,16 @@
|
|||||||
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
tpaValue = item.tpa_short + '-' + item.tpa_branch_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' + `${item.policy_no ?? ''}`;
|
var policy_name_data = `${item.policy_type_name ?? ''}` + ' - ' +
|
||||||
|
`${item.policy_no ?? ''}`;
|
||||||
|
|
||||||
policyTable += `
|
let auto_si_menu = '';
|
||||||
|
if(item.policy_type_id == 2){
|
||||||
|
auto_si_menu = `<a href="#" data-id="${item.id}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="showModal('rack_rate_auto_si_modal'); checkCDAmountForBasePremium('${item.id}')"><i class="mdi mdi-autorenew mr-2 text-muted font-18 vertical-middle"></i>Auto SI</a>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
policyTable +=
|
||||||
|
`
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
<td>${item.insurer_short} - ${item.insurer_branch_name}</td>
|
||||||
<td>${policy_name_data}</td>
|
<td>${policy_name_data}</td>
|
||||||
@ -640,11 +679,14 @@
|
|||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" 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>Rack Rate</a>`;
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" 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>Rack Rate</a>
|
||||||
|
<a href="#" data-id="${item.id}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="showModal('rack_rate_auto_si_modal'); checkCDAmountForBasePremium('${item.id}')"><i class="mdi mdi-autorenew mr-2 text-muted font-18 vertical-middle"></i>Auto SI</a>
|
||||||
|
${auto_si_menu}`;
|
||||||
|
|
||||||
// Conditionally render the delete option based on the role
|
// Conditionally render the delete option based on the role
|
||||||
if (role !== 3 && role !== 4) {
|
if (role !== 3 && role !== 4) {
|
||||||
policyTable += `
|
policyTable +=
|
||||||
|
`
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="fa fa-trash mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,9 +725,9 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/********* To get the POLICY base on Insurer *******/
|
/********* To get the POLICY base on Insurer *******/
|
||||||
$('#insurer').change(function() {
|
$('#insurer').change(function() {
|
||||||
|
|
||||||
@ -700,12 +742,12 @@
|
|||||||
var base_policy_data_id = selectedOption.data('id');
|
var base_policy_data_id = selectedOption.data('id');
|
||||||
|
|
||||||
|
|
||||||
$.get(url_for_cd, function(response){
|
$.get(url_for_cd, function(response) {
|
||||||
|
|
||||||
// console.log(response)
|
// console.log(response)
|
||||||
// console.log(response.data)
|
// console.log(response.data)
|
||||||
|
|
||||||
if(response.status == false && response.insurer_id != 'undefined'){
|
if (response.status == false && response.insurer_id != 'undefined') {
|
||||||
toastr.warning('The CD Account Number not found.', 'Warning');
|
toastr.warning('The CD Account Number not found.', 'Warning');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -720,9 +762,9 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
/********* set the Policy_Type_id for Form Submit *******/
|
/********* set the Policy_Type_id for Form Submit *******/
|
||||||
$('#policy_type').change(function() {
|
$('#policy_type').change(function() {
|
||||||
|
|
||||||
@ -736,10 +778,10 @@
|
|||||||
$('#tpa_danger').show()
|
$('#tpa_danger').show()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// get the client policy data for edit
|
// get the client policy data for edit
|
||||||
$('body').on('click', '.btnPolicyEdit', function() {
|
$('body').on('click', '.btnPolicyEdit', function() {
|
||||||
|
|
||||||
var policy_form_action = '';
|
var policy_form_action = '';
|
||||||
var policy_id = $(this).attr('data-id');
|
var policy_id = $(this).attr('data-id');
|
||||||
@ -871,7 +913,8 @@
|
|||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
} else if (res.data.policy_type_id == '1' || res.data.policy_type_id == '2' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
} else if (res.data.policy_type_id == '1' || res.data.policy_type_id == '2' || res.data
|
||||||
|
.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
@ -879,7 +922,7 @@
|
|||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
}else if(res.data.policy_type_id == '3'){
|
} else if (res.data.policy_type_id == '3') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
@ -924,7 +967,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data
|
||||||
|
.policy_type_id == '7') {
|
||||||
$('#tpa').prop('required', false);
|
$('#tpa').prop('required', false);
|
||||||
$('#tpa_danger').hide()
|
$('#tpa_danger').hide()
|
||||||
} else {
|
} else {
|
||||||
@ -936,9 +980,11 @@
|
|||||||
$('#client_branch').val(res.data.client_branch_id).select2();
|
$('#client_branch').val(res.data.client_branch_id).select2();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
appendCDACNO(res.cd_data, res.data
|
||||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
.cd_ac_no) // append and select the current CD Account Number
|
||||||
|
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data
|
||||||
|
.client_branch_id); // append and select the Base palicy
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
|
|
||||||
@ -953,9 +999,9 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.btnOpenEnroll', function() {
|
$('body').on('click', '.btnOpenEnroll', function() {
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
@ -1055,10 +1101,10 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
|
||||||
function rearrangeDateFormat(inputDate) {
|
function rearrangeDateFormat(inputDate) {
|
||||||
|
|
||||||
console.log('inputDate', inputDate)
|
console.log('inputDate', inputDate)
|
||||||
// Check if inputDate is a string and not empty
|
// Check if inputDate is a string and not empty
|
||||||
@ -1077,10 +1123,10 @@
|
|||||||
// Handle the case where inputDate is not a valid string
|
// Handle the case where inputDate is not a valid string
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkDateStatus(inputDate, bg = false) {
|
function checkDateStatus(inputDate, bg = false) {
|
||||||
|
|
||||||
var givenDate = new Date(inputDate);
|
var givenDate = new Date(inputDate);
|
||||||
var currentDate = new Date();
|
var currentDate = new Date();
|
||||||
@ -1099,9 +1145,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const numberWords = {
|
const numberWords = {
|
||||||
0: "Zero",
|
0: "Zero",
|
||||||
1: "One",
|
1: "One",
|
||||||
2: "Two",
|
2: "Two",
|
||||||
@ -1130,9 +1176,9 @@
|
|||||||
70: "Seventy",
|
70: "Seventy",
|
||||||
80: "Eighty",
|
80: "Eighty",
|
||||||
90: "Ninety"
|
90: "Ninety"
|
||||||
};
|
};
|
||||||
|
|
||||||
function convertNumberToWords(number) {
|
function convertNumberToWords(number) {
|
||||||
if (number === 0) {
|
if (number === 0) {
|
||||||
return numberWords[number];
|
return numberWords[number];
|
||||||
}
|
}
|
||||||
@ -1182,10 +1228,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return word.trim();
|
return word.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function convertCommaNumberToWords(input) {
|
||||||
function convertCommaNumberToWords(input) {
|
|
||||||
|
|
||||||
let number;
|
let number;
|
||||||
|
|
||||||
@ -1222,18 +1267,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return result.trim();
|
return result.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onlyNumbers(event) {
|
||||||
function onlyNumbers(event) {
|
|
||||||
var charcode;
|
var charcode;
|
||||||
charcode = event.which || event.keyCode;
|
charcode = event.which || event.keyCode;
|
||||||
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatNumber(input, maxLength) {
|
||||||
function formatNumber(input, maxLength) {
|
|
||||||
|
|
||||||
//console.log("input", input);
|
//console.log("input", input);
|
||||||
//console.log("input value", input.value);
|
//console.log("input value", input.value);
|
||||||
@ -1249,14 +1292,14 @@
|
|||||||
|
|
||||||
|
|
||||||
// Format the number with commas using Indian numbering system
|
// Format the number with commas using Indian numbering system
|
||||||
value = parseFloat(value).toLocaleString("en-IN",{
|
value = parseFloat(value).toLocaleString("en-IN", {
|
||||||
maximumFractionDigits: 2
|
maximumFractionDigits: 2
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log('formatNumber function formetted value', value);
|
// console.log('formatNumber function formetted value', value);
|
||||||
// console.log('formatNumber function formetted value type',typeof value);
|
// console.log('formatNumber function formetted value type',typeof value);
|
||||||
|
|
||||||
if(value == 'NaN' || value == 'null' || value == 'undefined'){
|
if (value == 'NaN' || value == 'null' || value == 'undefined') {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1322,10 +1365,9 @@
|
|||||||
return;
|
return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#policy_type').change(function() {
|
||||||
$('#policy_type').change(function() {
|
|
||||||
|
|
||||||
$('#insurer').val('').change();
|
$('#insurer').val('').change();
|
||||||
$('#tpa').val('').change();
|
$('#tpa').val('').change();
|
||||||
@ -1338,9 +1380,10 @@
|
|||||||
var client_id = $('#client_id_policy').val();
|
var client_id = $('#client_id_policy').val();
|
||||||
var client_branch_id = $('#client_branch').val();
|
var client_branch_id = $('#client_branch').val();
|
||||||
|
|
||||||
var url_for_get_policy_type_list = '<?php echo base_url('util/get_policy_type_for_base_policy/') ?>' + client_id + '/' + client_branch_id;
|
var url_for_get_policy_type_list = '<?php echo base_url('util/get_policy_type_for_base_policy/') ?>' +
|
||||||
|
client_id + '/' + client_branch_id;
|
||||||
|
|
||||||
$.get(url_for_get_policy_type_list, function(response){
|
$.get(url_for_get_policy_type_list, function(response) {
|
||||||
|
|
||||||
console.log(response)
|
console.log(response)
|
||||||
// console.log(response.data)
|
// console.log(response.data)
|
||||||
@ -1424,7 +1467,7 @@
|
|||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
$('#base_danger').show();
|
$('#base_danger').show();
|
||||||
|
|
||||||
}else if($(this).val() == '3'){
|
} else if ($(this).val() == '3') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
@ -1434,18 +1477,17 @@
|
|||||||
$('#base_danger').hide();
|
$('#base_danger').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($('#inception_type').prop('checked')){
|
if ($('#inception_type').prop('checked')) {
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
$('#open_date').parent().hide();
|
$('#open_date').parent().hide();
|
||||||
$('#close_date').parent().hide();
|
$('#close_date').parent().hide();
|
||||||
$('#reminder_date').parent().hide();
|
$('#reminder_date').parent().hide();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// featch client policy to list in the Base policy Dropdown list
|
||||||
// featch client policy to list in the Base policy Dropdown list
|
function fetchClientPolicyList() {
|
||||||
function fetchClientPolicyList() {
|
|
||||||
|
|
||||||
var client_id = $('#client_id_policy').val()
|
var client_id = $('#client_id_policy').val()
|
||||||
var client_branch_id = $('#client_branch').val()
|
var client_branch_id = $('#client_branch').val()
|
||||||
@ -1487,7 +1529,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item
|
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
|
||||||
|
item
|
||||||
.id +
|
.id +
|
||||||
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
'">' + item.name + '( ' + item.policy_type + ' )</option>';
|
||||||
}
|
}
|
||||||
@ -1507,10 +1550,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var dataId = 0;
|
var dataId = 0;
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#base_policy').change(function() {
|
$('#base_policy').change(function() {
|
||||||
|
|
||||||
@ -1544,9 +1587,10 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
if(res.status == true){
|
if (res.status == true) {
|
||||||
|
|
||||||
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data.insurer_id).change();
|
$('#insurer').val(res.data.insurer_branch_id + '-' + res.data
|
||||||
|
.insurer_id).change();
|
||||||
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
$('#tpa').val(res.data.tpa_branch_id + '-' + res.data.tpa_id).change();
|
||||||
$('#policy_no').val(res.data.policy_no).change();
|
$('#policy_no').val(res.data.policy_no).change();
|
||||||
// $('#open_date').val(rearrangeDateFormat(res.data.open_date)).change();
|
// $('#open_date').val(rearrangeDateFormat(res.data.open_date)).change();
|
||||||
@ -1565,10 +1609,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// fetch the client branch list for the dropdown
|
// fetch the client branch list for the dropdown
|
||||||
function fetchClientBranch() {
|
function fetchClientBranch() {
|
||||||
|
|
||||||
//console.log('function called');
|
//console.log('function called');
|
||||||
|
|
||||||
@ -1611,10 +1655,10 @@
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//append the client branch list for the dropdown
|
//append the client branch list for the dropdown
|
||||||
function appendClientBranch(data) {
|
function appendClientBranch(data) {
|
||||||
|
|
||||||
$('#client_branch').empty();
|
$('#client_branch').empty();
|
||||||
|
|
||||||
@ -1633,10 +1677,10 @@
|
|||||||
$('#client_branch').append(option);
|
$('#client_branch').append(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//append the CD Account number for the dropdown
|
//append the CD Account number for the dropdown
|
||||||
function appendCDACNO(data, select = null) {
|
function appendCDACNO(data, select = null) {
|
||||||
|
|
||||||
//console.log('appendCDACNO', data);
|
//console.log('appendCDACNO', data);
|
||||||
//console.log('appendCDACNO', select);
|
//console.log('appendCDACNO', select);
|
||||||
@ -1660,11 +1704,10 @@
|
|||||||
|
|
||||||
$('#cd_ac_no').append(option);
|
$('#cd_ac_no').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// append Base Policy to the dropdown for edit only
|
// append Base Policy to the dropdown for edit only
|
||||||
function appendBasePolicyList(data, select = null)
|
function appendBasePolicyList(data, select = null) {
|
||||||
{
|
|
||||||
|
|
||||||
// console.log('appendBasePolicyList', 'function called');
|
// console.log('appendBasePolicyList', 'function called');
|
||||||
// console.log('appendBasePolicyList data', data);
|
// console.log('appendBasePolicyList data', data);
|
||||||
@ -1680,7 +1723,7 @@
|
|||||||
|
|
||||||
const option = $('<option>', {
|
const option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
value: item.client_policy_id,
|
||||||
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`,
|
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`,
|
||||||
'data-id': item.id
|
'data-id': item.id
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1689,10 +1732,9 @@
|
|||||||
}
|
}
|
||||||
$('#base_policy').append(option);
|
$('#base_policy').append(option);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function removepolicy(element)
|
function removepolicy(element) {
|
||||||
{
|
|
||||||
|
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
@ -1725,7 +1767,7 @@
|
|||||||
|
|
||||||
console.log('removepolicy function response', res)
|
console.log('removepolicy function response', res)
|
||||||
|
|
||||||
if(res){
|
if (res) {
|
||||||
if (res.status == true) {
|
if (res.status == true) {
|
||||||
toastr.success('Policy removed successfully.', 'success');
|
toastr.success('Policy removed successfully.', 'success');
|
||||||
location.reload();
|
location.reload();
|
||||||
@ -1739,7 +1781,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -1751,37 +1793,37 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#policy_no').change(function(){
|
$('#policy_no').change(function() {
|
||||||
|
|
||||||
var policy_no = $(this).val();
|
var policy_no = $(this).val();
|
||||||
console.log(policy_no +'-'+policy_no.length);
|
console.log(policy_no + '-' + policy_no.length);
|
||||||
policy_no = policy_no.trim();
|
policy_no = policy_no.trim();
|
||||||
console.log(policy_no +'-'+policy_no.length);
|
console.log(policy_no + '-' + policy_no.length);
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?php echo base_url('util/check_policy_no/');?>'+policy_no,
|
url: '<?php echo base_url('util/check_policy_no/');?>' + policy_no,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log(res)
|
console.log(res)
|
||||||
if(res.status == true){
|
if (res.status == true) {
|
||||||
toastr.warning(res.message, 'warning');
|
toastr.warning(res.message, 'warning');
|
||||||
$('#policy_no').val('');
|
$('#policy_no').val('');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function() {
|
||||||
// Check if the URL contains a hash
|
// Check if the URL contains a hash
|
||||||
const hash = window.location.hash;
|
const hash = window.location.hash;
|
||||||
|
|
||||||
@ -1800,9 +1842,9 @@
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function getClientPolicyDataForEdit(client_policy_id){
|
function getClientPolicyDataForEdit(client_policy_id) {
|
||||||
|
|
||||||
var policy_form_action = '';
|
var policy_form_action = '';
|
||||||
|
|
||||||
@ -1904,7 +1946,8 @@
|
|||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
|
|
||||||
} else if (res.data.policy_type_id == '1' || res.data.policy_type_id == '2' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
} else if (res.data.policy_type_id == '1' || res.data.policy_type_id == '2' || res.data
|
||||||
|
.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
@ -1912,7 +1955,7 @@
|
|||||||
$('#base_policy_id').hide();
|
$('#base_policy_id').hide();
|
||||||
$('#base_policy').prop('required', false);
|
$('#base_policy').prop('required', false);
|
||||||
|
|
||||||
}else if(res.data.policy_type_id == '3'){
|
} else if (res.data.policy_type_id == '3') {
|
||||||
|
|
||||||
$('#first').show();
|
$('#first').show();
|
||||||
$('#second').show();
|
$('#second').show();
|
||||||
@ -1957,7 +2000,8 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data.policy_type_id == '7') {
|
if (res.data.policy_type_id == '1' || res.data.policy_type_id == '6' || res.data
|
||||||
|
.policy_type_id == '7') {
|
||||||
$('#tpa').prop('required', false);
|
$('#tpa').prop('required', false);
|
||||||
$('#tpa_danger').hide()
|
$('#tpa_danger').hide()
|
||||||
} else {
|
} else {
|
||||||
@ -1969,9 +2013,11 @@
|
|||||||
$('#client_branch').val(res.data.client_branch_id).select2();
|
$('#client_branch').val(res.data.client_branch_id).select2();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
setTimeout(function(){
|
setTimeout(function() {
|
||||||
appendCDACNO(res.cd_data, res.data.cd_ac_no) // append and select the current CD Account Number
|
appendCDACNO(res.cd_data, res.data
|
||||||
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data.client_branch_id); // append and select the Base palicy
|
.cd_ac_no) // append and select the current CD Account Number
|
||||||
|
appendBasePolicyList(res.client_policy_list, res.data.base_policy, res.data
|
||||||
|
.client_branch_id); // append and select the Base palicy
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
|
|
||||||
@ -1986,14 +2032,17 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showModal(){
|
function showModal($opener) {
|
||||||
|
if($opener == 'lead_modal'){
|
||||||
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
var myModal = new bootstrap.Modal(document.getElementById('lead_modal'));
|
||||||
myModal.show();
|
myModal.show();
|
||||||
|
}else if($opener == 'rack_rate_auto_si_modal'){
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function featchClient(){
|
function featchClient() {
|
||||||
|
|
||||||
let lead_id = $('#lead_id').val();
|
let lead_id = $('#lead_id').val();
|
||||||
let client_id = $('#lead_id option:selected').data('clientid');
|
let client_id = $('#lead_id option:selected').data('clientid');
|
||||||
@ -2008,22 +2057,23 @@
|
|||||||
url: url,
|
url: url,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
if(res.status == true){
|
if (res.status == true) {
|
||||||
let client_url = '<?= base_url('client/list/') ?>' + res.client_id + '?client_policy_id=' + res.client_policy_id+'#police-tab';
|
let client_url = '<?= base_url('client/list/') ?>' + res.client_id + '?client_policy_id=' +
|
||||||
|
res.client_policy_id + '#police-tab';
|
||||||
toastr.success(res.message, 'SUCCESS')
|
toastr.success(res.message, 'SUCCESS')
|
||||||
window.location.href = client_url;
|
window.location.href = client_url;
|
||||||
}else{
|
} else {
|
||||||
toastr.success(res.message, 'WARNING');
|
toastr.success(res.message, 'WARNING');
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.close').click()
|
$('.close').click()
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error(xhr.responseText);
|
console.error(xhr.responseText);
|
||||||
console.error(status, error);
|
console.error(status, error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -2032,6 +2082,9 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
352
app/Views/rack_rate_auto_si.php
Normal file
352
app/Views/rack_rate_auto_si.php
Normal file
@ -0,0 +1,352 @@
|
|||||||
|
<div id="rack_rate_auto_si_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="fullWidthModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-full-width">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title" id="fullWidthModalLabel">Rack Rate Auto SI</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form role="form" class="parsley-examples" method="post" id="auto_si_form"
|
||||||
|
enctype="multipart/form-data">
|
||||||
|
<input type="hidden" id="auto_si_pk" name="id">
|
||||||
|
<input type="hidden" id="client_policy_pk" name="client_policy_id">
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label class="switch" style="position: relative;">
|
||||||
|
<input id="auto_si_enable" type="checkbox" name="is_auto_si">
|
||||||
|
<span class="slider round" style="height: 27px;"></span>
|
||||||
|
</label>
|
||||||
|
<label for="auto_si_enable" style="position: relative;bottom: 5px;left: 10px;">Enable Auto
|
||||||
|
SI</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div id="dynamicForm">
|
||||||
|
<div class="formGroupContainer"></div>
|
||||||
|
</div> <br><br>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-light" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="submitFormButton">Submit</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
let rowIndex = 0;
|
||||||
|
var SIAMOUNT = []; //policy_premium_2 table data, rack rate si amount
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Attach change event listener to check for duplicates
|
||||||
|
$('#dynamicForm').on('change', '.form-row input, .form-row select', function() {
|
||||||
|
checkForDuplicate($(this).closest('.form-row'), $(this));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function to add a new row
|
||||||
|
function addRow(button = null, data = null) {
|
||||||
|
rowIndex++;
|
||||||
|
|
||||||
|
// Hide the "Add More" button for the current row (if button is provided)
|
||||||
|
if (button) {
|
||||||
|
$(button).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new row
|
||||||
|
const formGroupContainer = document.querySelector('#dynamicForm .formGroupContainer');
|
||||||
|
const newRow = document.createElement('div');
|
||||||
|
newRow.className = 'row form-row';
|
||||||
|
newRow.innerHTML = `
|
||||||
|
<div class="col-md-1" style="margin-top: 45px;">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input family-checkbox" type="checkbox" id="selfCheckbox${rowIndex}" name="self" ${data && data.self == 1 ? 'checked' : ''}>
|
||||||
|
<label class="form-check-label" for="selfCheckbox${rowIndex}">Self</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2" style="margin-top: 45px;">
|
||||||
|
<div class="form-check form-check-inline">
|
||||||
|
<input class="form-check-input family-checkbox" type="checkbox" id="spouseCheckbox${rowIndex}" name="spouse" ${data && data.spouse == 1 ? 'checked' : ''}>
|
||||||
|
<label class="form-check-label" for="spouseCheckbox${rowIndex}">Spouse</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<label class="form-label" for="childrenInput${rowIndex}">Children</label>
|
||||||
|
<input type="number" class="form-control sm-input family-input" id="childrenInput${rowIndex}" placeholder="0" value="${data && data.children ? data.children : 0}" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-1">
|
||||||
|
<label class="form-label" for="eldersInput${rowIndex}">Elders</label>
|
||||||
|
<input type="number" class="form-control sm-input family-input" id="eldersInput${rowIndex}" placeholder="0" value="${data && data.elders ? data.elders : 0}" min="0">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<label class="form-label" for="siAmountSelect${rowIndex}">Choose SI Amount</label>
|
||||||
|
<select class="form-select form-control si-select" id="siAmountSelect${rowIndex}">
|
||||||
|
<option value="">Select SI</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-2" style="margin-top: 45px;">
|
||||||
|
<button type="button" class="btn btn-success addMoreBtn" onclick="addRow(this)">+</button>
|
||||||
|
<button type="button" class="btn btn-danger" onclick="removeRow(this)">-</button>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
formGroupContainer.appendChild(newRow);
|
||||||
|
let selectedValue = data && data.si ? data.si : null;
|
||||||
|
appendSIAmount(SIAMOUNT, selectedValue, rowIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to remove a row
|
||||||
|
function removeRow(button) {
|
||||||
|
const row = button.closest('.form-row');
|
||||||
|
const formGroupContainer = document.querySelector('.formGroupContainer');
|
||||||
|
|
||||||
|
// Prevent deletion of the first row
|
||||||
|
if (formGroupContainer.children.length === 1) {
|
||||||
|
alert("The first row cannot be deleted.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the removed row had the "Add More" button visible, show it for the previous row
|
||||||
|
if ($(button).siblings('.addMoreBtn').is(':visible')) {
|
||||||
|
const previousRow = row.previousElementSibling;
|
||||||
|
if (previousRow) {
|
||||||
|
$(previousRow).find('.addMoreBtn').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the row
|
||||||
|
row.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to check for duplicates
|
||||||
|
function checkForDuplicate(currentRow, changedElement) {
|
||||||
|
const currentValues = {
|
||||||
|
self: currentRow.find('input[name="self"]').is(':checked'),
|
||||||
|
spouse: currentRow.find('input[name="spouse"]').is(':checked'),
|
||||||
|
children: currentRow.find('input[id^="childrenInput"]').val(),
|
||||||
|
elders: currentRow.find('input[id^="eldersInput"]').val(),
|
||||||
|
// siAmount: currentRow.find('select[id^="siAmountSelect"]').val(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let isDuplicate = false;
|
||||||
|
|
||||||
|
$('.form-row').not(currentRow).each(function() {
|
||||||
|
const otherRow = $(this);
|
||||||
|
const otherValues = {
|
||||||
|
self: otherRow.find('input[name="self"]').is(':checked'),
|
||||||
|
spouse: otherRow.find('input[name="spouse"]').is(':checked'),
|
||||||
|
children: otherRow.find('input[id^="childrenInput"]').val(),
|
||||||
|
elders: otherRow.find('input[id^="eldersInput"]').val(),
|
||||||
|
// siAmount: otherRow.find('select[id^="siAmountSelect"]').val(),
|
||||||
|
};
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentValues.self === otherValues.self &&
|
||||||
|
currentValues.spouse === otherValues.spouse &&
|
||||||
|
currentValues.children === otherValues.children &&
|
||||||
|
currentValues.elders === otherValues.elders
|
||||||
|
// && currentValues.siAmount === otherValues.siAmount
|
||||||
|
) {
|
||||||
|
isDuplicate = true;
|
||||||
|
return false; // Exit the loop if duplicate is found
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isDuplicate) {
|
||||||
|
alert("Duplicate values are not allowed!");
|
||||||
|
// currentRow.find('input, select').val('').prop('checked', false);
|
||||||
|
if (changedElement.is('input[type="checkbox"]')) {
|
||||||
|
changedElement.prop('checked', false);
|
||||||
|
} else {
|
||||||
|
changedElement.val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Function to form submit
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('#submitFormButton').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
const formData = new FormData($('#auto_si_form')[0])
|
||||||
|
const familyComposition = getFormDataWithJSON();
|
||||||
|
|
||||||
|
console.log(formData);
|
||||||
|
console.log('familyComposition', familyComposition);
|
||||||
|
|
||||||
|
formData.append('family_composition', JSON.stringify(familyComposition));
|
||||||
|
|
||||||
|
let url = '<?= base_url('util/createAutoSI') ?>';
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
success: function(response) {
|
||||||
|
|
||||||
|
console.log(response);
|
||||||
|
|
||||||
|
if (response.status) {
|
||||||
|
if (response.status == true) {
|
||||||
|
toastr.success(response.message, 'SUCCESS');
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message, 'WARNING');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message || 'Unable to get responce', 'ERROR');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while Auto SI Form Submit.', 'ERROR');
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Function to gather form data with JSON structure
|
||||||
|
function getFormDataWithJSON() {
|
||||||
|
|
||||||
|
const familyComposition = [];
|
||||||
|
|
||||||
|
$('#dynamicForm .form-row').each(function() {
|
||||||
|
const row = $(this);
|
||||||
|
const self = row.find('input[name="self"]').is(':checked') ? 1 : 0;
|
||||||
|
const spouse = row.find('input[name="spouse"]').is(':checked') ? 1 : 0;
|
||||||
|
const children = parseInt(row.find('input[id^="childrenInput"]').val()) || 0;
|
||||||
|
const elders = parseInt(row.find('input[id^="eldersInput"]').val()) || 0;
|
||||||
|
const si = row.find('select[id^="siAmountSelect"]').val() || null;
|
||||||
|
|
||||||
|
// if (si) {
|
||||||
|
familyComposition.push({
|
||||||
|
self: self,
|
||||||
|
spouse: spouse,
|
||||||
|
children: children,
|
||||||
|
elders: elders,
|
||||||
|
si: si,
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('familyComposition', JSON.stringify(familyComposition))
|
||||||
|
return familyComposition;
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkCDAmountForBasePremium(client_policy_id) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
$('.formGroupContainer').empty();
|
||||||
|
|
||||||
|
console.log('client_policy_id', client_policy_id);
|
||||||
|
$('#client_policy_pk').val(client_policy_id);
|
||||||
|
let url = '<?= base_url('util/getRackRateSIAmountAndAutoSiDataForAutoSI') ?>';
|
||||||
|
|
||||||
|
// Data to send in the AJAX request
|
||||||
|
let requestData = {
|
||||||
|
client_policy_id: client_policy_id,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
|
console.log('Data fetched successfully:', response);
|
||||||
|
|
||||||
|
if (response.status == true) {
|
||||||
|
|
||||||
|
SIAMOUNT = response.si_amount;
|
||||||
|
|
||||||
|
if (response.auto_si_amount !== null) {
|
||||||
|
|
||||||
|
console.log(response.auto_si_amount.family_composition)
|
||||||
|
let familyComp = JSON.parse(response.auto_si_amount.family_composition)
|
||||||
|
console.log('familyComp', familyComp)
|
||||||
|
familyComp.forEach((item) => {
|
||||||
|
addRow(null, item);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#auto_si_pk').val(response.auto_si_amount.id);
|
||||||
|
|
||||||
|
if (response.auto_si_amount.is_auto_si == 1) {
|
||||||
|
$('#auto_si_enable').prop('checked', true);
|
||||||
|
} else {
|
||||||
|
$('#auto_si_enable').prop('checked', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
addRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('rack_rate_auto_si_modal'));
|
||||||
|
myModal.show();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (response.status == false && response.code == 200) {
|
||||||
|
Swal.fire({
|
||||||
|
title: response.message,
|
||||||
|
icon: 'warning',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
toastr.error(response.message || 'Unable to fetch data', 'ERROR');
|
||||||
|
addRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('An error occurred while checking the SI amount.', 'ERROR');
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
// addRow();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendSIAmount(data, selectedValue = null, rowIndex = 0) {
|
||||||
|
|
||||||
|
console.log('data', data)
|
||||||
|
console.log('selectedValue', selectedValue)
|
||||||
|
console.log('rowIndex', rowIndex)
|
||||||
|
|
||||||
|
// Dynamically target the SI Amount Select element based on the rowIndex
|
||||||
|
const selectElement = $(`#siAmountSelect${rowIndex}`);
|
||||||
|
|
||||||
|
// Empty the current options
|
||||||
|
selectElement.empty();
|
||||||
|
|
||||||
|
// Add the default "Select SI" option
|
||||||
|
selectElement.append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select SI'
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Loop through the data to create the option elements
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.si,
|
||||||
|
text: item.si,
|
||||||
|
});
|
||||||
|
|
||||||
|
// If selectedValue matches the item.id, set this option as selected
|
||||||
|
if (selectedValue == item.si) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append the option to the select element
|
||||||
|
selectElement.append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user