MERGE_TEST_MULTI_TAB_ISSUE
This commit is contained in:
commit
3caa5de0a0
@ -435,6 +435,7 @@ $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationControll
|
||||
|
||||
//HR login api's
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("/employeeRest/verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||
$routes->post("/employeeRest/getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
|
||||
$routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
@ -476,7 +477,8 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("iAgreeForAddOn", "EmployeeRestController::iAgreeForAddOn");
|
||||
|
||||
$routes->get("exportDataByClientPolicyId", "EmployeeRestController::exportDataByClientPolicyId");
|
||||
$routes->get("getCashDepositData", "EmployeeRestController::getCashDepositData");
|
||||
|
||||
$routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPolicyLevelEmployeeSummaryData");
|
||||
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
|
||||
|
||||
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
|
||||
|
||||
@ -10,6 +10,7 @@ use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Helpers\sendMailNotification;
|
||||
use App\Helpers\EmployeeHelper;
|
||||
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
@ -75,6 +76,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $clientBranchModel;
|
||||
protected $auditHistoryModel;
|
||||
protected $siMappingModel;
|
||||
protected $employeeHelper;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -100,6 +102,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->clientBranchModel = new ClientBranchModel();
|
||||
$this->auditHistoryModel = new AuditHistoryModel();
|
||||
$this->siMappingModel = new SIMappingModel();
|
||||
$this->employeeHelper = new EmployeeHelper();
|
||||
|
||||
}
|
||||
|
||||
@ -227,10 +230,23 @@ class EmployeeRestController extends AdminController
|
||||
try {
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
// dd($data);
|
||||
|
||||
//enrolment check
|
||||
$openForEnrollment = $this->findThePolicyIsOpenForEnrollment($data[0]->client_policy_id);
|
||||
if($openForEnrollment == false){ return $this->respond(['status' => 'failed','code' => 404,'data' => 'Enrollment closed'], 404); }
|
||||
if($openForEnrollment == false){
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => 'Enrollment closed.'], 200);
|
||||
}
|
||||
|
||||
//dependent duplicate check
|
||||
if ( ! isset($data[0]->id) ) {
|
||||
$validationFailed = $this->employeeHelper->validation_addEmployeeAndDependence($data);
|
||||
|
||||
if($validationFailed){
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => [],'message' => "Relation already exists."], 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($data) {
|
||||
|
||||
@ -279,14 +295,14 @@ class EmployeeRestController extends AdminController
|
||||
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code , $data[0]->client_branch_id);
|
||||
|
||||
$result = [];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result], 200);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result,'message' => "Successfully updated."], 200);
|
||||
} else {
|
||||
$result = "No Matches";
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result], 404);
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result,'message' => "Action failed."], 200);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()], 500);
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage(),'message' => "Action failed."], 500);
|
||||
}
|
||||
|
||||
}
|
||||
@ -2471,72 +2487,46 @@ class EmployeeRestController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
public function getCashDepositData()
|
||||
public function getPolicyLevelEmployeeSummaryData()
|
||||
{
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.client_id as clientId , client_policy.insurer_id as insurerId,insurers.name as insurer_name')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->groupBy('client_policy.insurer_id')
|
||||
->findAll();
|
||||
$result = [];
|
||||
|
||||
if(count($ClientPolicyData))
|
||||
{
|
||||
foreach ($ClientPolicyData as $key => $value) {
|
||||
|
||||
$data['clientId'] = $value['clientId'];
|
||||
$data['insurerId'] = $value['insurerId'];
|
||||
$data['insurerName'] = $value['insurer_name'];
|
||||
$data['depositData'] = $this->clientPolicyModel->getdepositData($value['clientId'],$value['insurerId']);
|
||||
$data['balance'] = count($data['depositData']) ? $data['depositData'][0]->balance : 0;
|
||||
|
||||
$data['policyDetails'] = [];
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
||||
|
||||
->where('client_policy.insurer_id', $value['insurerId'] )
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.id as client_policy_id , client_policy.client_id as client_id, client_policy.policy_type_id as policy_type_id, client_policy.is_addon as is_addon , client_policy.open_for_enrollment as OpenForEnrollment , client_policy.inception_type as inception_type ')
|
||||
->where('client_policy.client_id', $this->request->getGet('client_id') )
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->findAll();
|
||||
$result = [];
|
||||
// dd( $ClientPolicyData);
|
||||
foreach ($ClientPolicyData as $key => $value)
|
||||
{
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
||||
$value['type'] = $policyTypeData->policy_type;
|
||||
$value['policy_name'] = $policyTypeData->long_name;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
if(count($employeeDetails))
|
||||
{
|
||||
$policyTypeData = $this->policyTypeModel->where('id',$value['policy_type_id'])->get()->getRow();
|
||||
$value['type'] = $policyTypeData->policy_type;
|
||||
$value['policy_name'] = $policyTypeData->long_name;
|
||||
$employeeDetails = $this->employeePolicyModel->getEmployeePolicy( client_id:$value['client_id'],policy_id: $value['client_policy_id'],status:0,branch_id:$this->request->getGet('client_branch_id'));
|
||||
$enrolledCount = 0;
|
||||
$draftCount = 0;
|
||||
if(count($employeeDetails))
|
||||
{
|
||||
foreach ($employeeDetails as $item) {
|
||||
if ($item['emp_status'] === 'enrolled') {
|
||||
$enrolledCount++;
|
||||
} elseif ($item['emp_status'] === 'draft') {
|
||||
$draftCount++;
|
||||
}
|
||||
foreach ($employeeDetails as $item) {
|
||||
if ($item['emp_status'] === 'enrolled') {
|
||||
$enrolledCount++;
|
||||
} elseif ($item['emp_status'] === 'draft') {
|
||||
$draftCount++;
|
||||
}
|
||||
}
|
||||
|
||||
$value['totalMembersCount'] = count($employeeDetails);
|
||||
$value['membersCountOfEnrolled'] = $enrolledCount;
|
||||
$value['membersCountOfDraft'] = $draftCount;
|
||||
|
||||
array_push($data['policyDetails'],$value);
|
||||
}
|
||||
|
||||
|
||||
array_push($result,$data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$value['totalMembersCount'] = count($employeeDetails);
|
||||
$value['membersCountOfEnrolled'] = $enrolledCount;
|
||||
$value['membersCountOfDraft'] = $draftCount;
|
||||
|
||||
|
||||
array_push($result,$value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($result)
|
||||
{
|
||||
|
||||
@ -75,7 +75,7 @@ class RestAuthenticationController extends AdminController
|
||||
|
||||
|
||||
|
||||
|
||||
// employee auth api's start
|
||||
|
||||
public function verifyEmployeeWithMobileNumber()
|
||||
{
|
||||
@ -90,7 +90,7 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.mobile', $mobile_number)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||
->whereIn('EP.status', ['draft', 'enrolled', 'expired'])
|
||||
->first();
|
||||
|
||||
|
||||
@ -131,7 +131,7 @@ class RestAuthenticationController extends AdminController
|
||||
->where('employees.emp_status !=', 'truncated')
|
||||
->where('employees.email_corporate', $email)
|
||||
->where('EP.is_active', 1)
|
||||
->whereIn('EP.status', ['draft', 'enrolled'])
|
||||
->whereIn('EP.status', ['draft', 'enrolled', 'expired'])
|
||||
->first();
|
||||
|
||||
if (isset($employeeData['employee_id'])) {
|
||||
@ -268,6 +268,11 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
// employee auth api's end
|
||||
|
||||
|
||||
// HR auth api's start
|
||||
|
||||
public function verifyHrWithMobileNumber()
|
||||
{
|
||||
try {
|
||||
@ -283,8 +288,74 @@ class RestAuthenticationController extends AdminController
|
||||
$result = ['user_verification' => true ,'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
} else {
|
||||
$result = ['user_verification' => false , 'message' => "User not found"];
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
|
||||
// Call the third-party API function
|
||||
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithMobileNumber');
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
}
|
||||
}
|
||||
|
||||
public function verifyHrWithEmail()
|
||||
{
|
||||
try {
|
||||
|
||||
$data = $this->request->getJSON();
|
||||
|
||||
$email = $data->email;
|
||||
|
||||
$HrData = $this->hrModel->where('email', $email)
|
||||
->where('contact_type', 'client')
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
if ($HrData) {
|
||||
|
||||
$otp = random_int(100000, 999999);
|
||||
|
||||
$sql = "
|
||||
UPDATE level_contacts
|
||||
SET otp = ?
|
||||
WHERE email = ?
|
||||
AND contact_type = 'client'
|
||||
AND is_active = 1
|
||||
";
|
||||
|
||||
$db = db_connect();
|
||||
$update = $db->query($sql, [$otp, $email]);
|
||||
|
||||
if($update)
|
||||
{
|
||||
$data->otp = $otp;
|
||||
$this->callThirdPartyAPI($data, 'updateHROTP');
|
||||
|
||||
$common = [
|
||||
'login_type' => 'HR login',
|
||||
'login_email' => $email,
|
||||
'mail_type' => 'otp_mail'
|
||||
];
|
||||
$subject = 'Nhance user verification - OTP';
|
||||
$mail_content = $otp . ' is your verification code for Nhance.';
|
||||
$res = MailHelper::send_email(['mail' => $email, 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
|
||||
$this->myLogger->logme("info", $res);
|
||||
|
||||
if (json_decode($res)->status == 'success') {
|
||||
$result = ['user_verification' => true, 'message' => "Verified Successfully"];
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||
} else {
|
||||
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
} else {
|
||||
|
||||
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Call the third-party API function
|
||||
return $this->callThirdPartyAPI($this->request->getJSON(),'verifyHrWithEmail');
|
||||
|
||||
}
|
||||
} catch (\Throwable $th) {
|
||||
@ -296,11 +367,23 @@ class RestAuthenticationController extends AdminController
|
||||
public function getVerifiedHrData()
|
||||
{
|
||||
try {
|
||||
$mobile_number = $this->request->getJSON()->mobile_number;
|
||||
$otp_verification = $this->request->getJSON()->otp_verification;
|
||||
// mobile number
|
||||
$otp_verification = isset($this->request->getJSON()->otp_verification) ? $this->request->getJSON()->otp_verification : null;
|
||||
$mobile_number = isset($this->request->getJSON()->mobile_number) ? $this->request->getJSON()->mobile_number : null;
|
||||
// email id
|
||||
$otp = isset($this->request->getJSON()->otp) ? $this->request->getJSON()->otp : null;
|
||||
$email = isset($this->request->getJSON()->email) ? $this->request->getJSON()->email : null;
|
||||
|
||||
if (isset($mobile_number))
|
||||
{
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->where('contact_type', 'client')->first();
|
||||
}else{
|
||||
$hrData = $this->hrModel->where('email', $email)->where('contact_type', 'client')->where('otp', $otp)->first();
|
||||
}
|
||||
|
||||
if ($hrData && $otp_verification == true || $hrData && isset($this->request->getJSON()->otp) )
|
||||
{
|
||||
|
||||
$hrData = $this->hrModel->where('mobile', $mobile_number)->first();
|
||||
if ($hrData && $otp_verification == true) {
|
||||
$auth = HttpRequestHelper::getRequestInfo();
|
||||
if ($auth) {
|
||||
$data = [
|
||||
@ -316,15 +399,37 @@ class RestAuthenticationController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
if(isset($this->request->getJSON()->mobile_number)){
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->find();
|
||||
|
||||
}else if(isset($this->request->getJSON()->otp)){
|
||||
|
||||
$this->hrModel->where('email', $email)->where('otp', $otp)->where('contact_type', 'client')->set(['otp'=>null])->update();
|
||||
|
||||
$hrData = $this->hrModel ->select('level_contacts.* , client_branch.client_id as client_id')
|
||||
->join('client_branch', 'level_contacts.ref_id = client_branch.id', 'left')
|
||||
->where('level_contacts.mobile', $mobile_number )
|
||||
->where('level_contacts.email', $email )
|
||||
->where('level_contacts.contact_type', 'client')
|
||||
->find();
|
||||
}
|
||||
|
||||
$result = JWTToken::encode($hrData['0']);
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200);
|
||||
|
||||
// Call the third-party API function
|
||||
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result , 'post_enrollment'=> json_decode($apiResponse, true)],200);
|
||||
|
||||
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP"],200);
|
||||
|
||||
// Call the third-party API function
|
||||
$apiResponse = $this->callThirdPartyAPI($this->request->getJSON(),'getVerifiedHrData');
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => "Invalid OTP" , 'post_enrollment'=> json_decode($apiResponse, true)],200);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return $this->respond(['status' => 'failed','code' => 500,'data' => $e->getMessage()],500);
|
||||
|
||||
337
app/Helpers/EmployeeHelper.php
Normal file
337
app/Helpers/EmployeeHelper.php
Normal file
@ -0,0 +1,337 @@
|
||||
<?php
|
||||
// File: App\Helpers\DepositHelper.php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
use App\Models\EmployeeModel;
|
||||
use App\Models\ClientPolicyModel;
|
||||
use App\Models\EmployeePolicyModel;
|
||||
|
||||
use CodeIgniter\API\ResponseTrait;
|
||||
use PhpOffice\PhpSpreadsheet\Calculation\Logical\Boolean;
|
||||
|
||||
class EmployeeHelper
|
||||
{
|
||||
use ResponseTrait ;
|
||||
|
||||
protected $employeeModel ;
|
||||
protected $clientPolicyModel;
|
||||
protected $employeePolicyModel;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
$this->employeeModel = new EmployeeModel();
|
||||
$this->employeePolicyModel = new EmployeePolicyModel();
|
||||
$this->clientPolicyModel = new ClientPolicyModel();
|
||||
|
||||
}
|
||||
|
||||
public function validation_addEmployeeAndDependence($data){
|
||||
|
||||
|
||||
$employeeData = $this->employeeModel->where('emp_code',$data[0]->emp_code)
|
||||
->where('client_id',$data[0]->client_id)
|
||||
->where('client_branch_id',$data[0]->client_branch_id)
|
||||
->where('is_active', 1 )
|
||||
->where('is_addon_value',0)
|
||||
->findAll();
|
||||
|
||||
$arr [] = $data;
|
||||
|
||||
$client_policy_id = $data[0]->client_policy_id ;
|
||||
|
||||
$array = $this->clientPolicyModel
|
||||
->where('id',$client_policy_id)
|
||||
->find();
|
||||
|
||||
$array = $array[0];
|
||||
|
||||
$array = $this->arrayToObject($array);
|
||||
|
||||
|
||||
// Map family floaters that already exist in the employee table
|
||||
$familyFloates = json_decode( $array->policy_terms)->family_floaters;
|
||||
|
||||
$decodedArray = json_decode( $array->policy_terms);
|
||||
|
||||
// Generate Notes string based on familyFloates terms
|
||||
$array->notes = $this->FloterNotesConvertion($familyFloates);
|
||||
|
||||
// remove parent and parent-in-law from familyFloaters
|
||||
if($familyFloates->{'either-parents-pil'} != 0){
|
||||
unset($familyFloates->parents);
|
||||
unset($familyFloates->parents_in_law);
|
||||
}
|
||||
|
||||
$floters = $this->FloterConvertion($familyFloates);
|
||||
|
||||
$newData = [];
|
||||
$dependent_and_si_value = 0;
|
||||
$dependent_and_si_premium_value = 0;
|
||||
$dependent_and_si_gst_value = 0;
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
$dependent = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
if(count($employeeData)){
|
||||
foreach ($employeeData as $key => $value) {
|
||||
if ($value['family_floater_key'] === $dependent) {
|
||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$value['id'])->where('client_policy_id',$array->id)->where('is_active', 1 )->get()->getRow();
|
||||
if(isset($employee_policy->basic_cover_si)){ $dependent_and_si_value = ($dependent_and_si_value == 0) ? $employee_policy->basic_cover_si : $dependent_and_si_value; }
|
||||
if(isset($employee_policy->payable_employee) && $employee_policy->payable_employee == 1)
|
||||
{
|
||||
if(isset($employee_policy->rata_premimum)){ $dependent_and_si_premium_value = $dependent_and_si_premium_value + $employee_policy->rata_premimum;}
|
||||
if(isset($employee_policy->gst)){ $dependent_and_si_gst_value = $dependent_and_si_gst_value + $employee_policy->gst;}
|
||||
}
|
||||
|
||||
$temp['is_value_exist'] = true;
|
||||
$temp['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp['data']['employee_id'] = $value['id'];
|
||||
$temp['data']['relationship'] = $value['relationship'];
|
||||
$temp['data']['name'] = $value['name'];
|
||||
$temp['data']['dob'] = $this->convertDateFormatDMY($value['dob']);
|
||||
$temp['data']['client_policy_id'] = $array->id;
|
||||
$temp['data']['form_type'] = $dependent;
|
||||
$temp['data']['basic_cover_si'] = isset($employee_policy->basic_cover_si) ? $employee_policy->basic_cover_si : 0;
|
||||
|
||||
|
||||
$temp['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
|
||||
array_push($newData,$temp);
|
||||
unset($employeeData[$key]);
|
||||
$floters = array_diff($floters, [$familyFloatesValue]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Remove Unwanted floter key from floters array based on either-parents-pil term value
|
||||
if($familyFloates->{'either-parents-pil'} == 1 && count($floters))
|
||||
{
|
||||
$count_parent = 0;
|
||||
$count_parent_in_law = 0;
|
||||
foreach ($floters as $value) {
|
||||
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||
}
|
||||
if($count_parent != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent_in_law') === false);
|
||||
}
|
||||
if($count_parent_in_law != 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false || strpos($value, 'parent_in_law') !== false);
|
||||
}
|
||||
}
|
||||
else if($familyFloates->{'either-parents-pil'} == 2 && count($floters))
|
||||
{
|
||||
$count_parent = 0;
|
||||
$count_parent_in_law = 0;
|
||||
foreach ($floters as $value) {
|
||||
if (preg_replace('/\d/', '', $value) == 'parent') { $count_parent++; }
|
||||
if (preg_replace('/\d/', '', $value) == 'parent_in_law') {$count_parent_in_law++;}
|
||||
}
|
||||
if(($count_parent + $count_parent_in_law) == 2) {
|
||||
$floters = array_filter($floters, fn($value) => strpos($value, 'parent') === false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Add family floter buttons placement data for FE validation
|
||||
if(count($floters)){
|
||||
foreach ($floters as $familyFloatesValue) {
|
||||
|
||||
$temp2['is_value_exist'] = false;
|
||||
$temp2['data']['family_floater_key'] = $familyFloatesValue;
|
||||
$temp2['data']['client_policy_id'] = $array->id;
|
||||
$temp2['data']['button_name'] = 'Add '.ucfirst(str_replace('_', ' ', preg_replace('/\d/', '', $familyFloatesValue)));
|
||||
$temp2['data']['form_type'] = preg_replace('/\d/', '', $familyFloatesValue);
|
||||
|
||||
|
||||
$temp2['data']['age_validation'] = $this->getAgeRange($decodedArray,$familyFloatesValue);
|
||||
|
||||
array_push($newData,$temp2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$validationFailed = true ;
|
||||
|
||||
$input_relationship = $data[0]->relationship ;
|
||||
|
||||
|
||||
foreach($newData as $index => $eachData){
|
||||
|
||||
if($eachData['is_value_exist'] == false){
|
||||
|
||||
if( $eachData['data']['form_type'] == 'child' && ($input_relationship == 'Son' || $input_relationship == "Daughter")){
|
||||
|
||||
$validationFailed = false ;
|
||||
|
||||
}
|
||||
|
||||
if( $eachData['data']['form_type'] == 'parent' && ($input_relationship == 'Father' || $input_relationship == "Mother")){
|
||||
|
||||
$validationFailed = false ;
|
||||
}
|
||||
|
||||
if( $eachData['data']['form_type'] == 'spouse' && ($input_relationship == 'Spouse') ){
|
||||
|
||||
$validationFailed = false ;
|
||||
}
|
||||
|
||||
if( $eachData['data']['form_type'] == 'parent_in_law' && ($input_relationship == 'Father in Law' || $input_relationship == "Mother in Law")){
|
||||
|
||||
$validationFailed = false ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(empty($newData) && $validationFailed){
|
||||
$validationFailed = false ;
|
||||
}
|
||||
|
||||
|
||||
return $validationFailed ;
|
||||
|
||||
}
|
||||
|
||||
function arrayToObject($array) {
|
||||
if (!is_array($array)) {
|
||||
return $array;
|
||||
}
|
||||
|
||||
$object = new \stdClass();
|
||||
foreach ($array as $key => $value) {
|
||||
$object->$key = $this->arrayToObject($value);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
function objectToArray($object) {
|
||||
|
||||
if (is_object($object)) {
|
||||
$object = get_object_vars($object);
|
||||
}
|
||||
|
||||
if (is_array($object)) {
|
||||
return array_map('objectToArray', $object);
|
||||
}
|
||||
|
||||
return $object;
|
||||
}
|
||||
|
||||
public function FloterNotesConvertion($array){
|
||||
|
||||
$result = ' ';
|
||||
foreach ($array as $key => $value) {
|
||||
if ($value > 0) {
|
||||
if($value == 1 && $key ==='either-parents-pil') {
|
||||
$result .= ' + Either 2 Parents or 2 Parents in law';
|
||||
}else if($value == 2 && $key ==='either-parents-pil') {
|
||||
$result .= ' + Any 2 of Parents and Parents in law';
|
||||
}else if($value != 0 && $key ==='spouse') {
|
||||
$string = str_replace('-', ' ', $key);
|
||||
$string = ucwords($string);
|
||||
$result .= ' + '.$string;
|
||||
}else if($value != 0 && $key ==='self') {
|
||||
$result = 'Allowed members Self ';
|
||||
}else if($value != 0 && $key ==='childrens') {
|
||||
if($value > 1){ $result .= ' + '.$value.' Children'; }else{ $result .= ' + '.$value.' Child'; }
|
||||
}else if($value != 0 && $key ==='elders_count') {
|
||||
|
||||
}else{
|
||||
$string = str_replace('-', ' ', $key);
|
||||
$string = ucwords($string);
|
||||
$result .= ' + '.$value.' '.$string;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$first_two_chars = substr($result, 0, 3);
|
||||
|
||||
if($first_two_chars == " +"){
|
||||
$modified_string = substr($result, 3);
|
||||
return "Allowed members ".$modified_string;
|
||||
}else{
|
||||
return $result;
|
||||
}
|
||||
return substr($result, 0, 2) !== " +";
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getAgeRange($terms,$familyFloatesValue)
|
||||
{
|
||||
|
||||
$ageRangeArray = ['self' => ['min' => 18, 'max' => 60] , 'spouse' => ['min' => 18, 'max' => 60] , 'child' => ['min' => 0, 'max' => 25] , 'elders' => ['min' => 18, 'max' => 60] ];
|
||||
|
||||
$ageKey = (preg_replace('/\d/', '', $familyFloatesValue) == 'parent' || preg_replace('/\d/', '', $familyFloatesValue) == 'parent_in_law') ? 'elders' : preg_replace('/\d/', '', $familyFloatesValue);
|
||||
if(isset($terms->age_ratio)){
|
||||
return $terms->age_ratio->$ageKey;
|
||||
}else{
|
||||
return $ageRangeArray[$ageKey];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function FloterConvertion($array){
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($array as $key => $value) {
|
||||
if ($value > 0 && $key != 'elders_count') {
|
||||
if ($value != 0 && $key === 'childrens') {
|
||||
|
||||
// if($value > 2){ $value = 2; }
|
||||
|
||||
for ($i = 1; $i <= $value; $i++) {
|
||||
$result[] = "child" . $i;
|
||||
}
|
||||
} else if($value != 0 && $key ==='parents') {
|
||||
for ($i = 1; $i <= $value; $i++) {
|
||||
$result[] = "parent" . $i;
|
||||
}
|
||||
}else if($value != 0 && $key ==='parents-in-law') {
|
||||
for ($i = 1; $i <= $value; $i++) {
|
||||
$result[] = "parent_in_law" . $i;
|
||||
}
|
||||
}else if($value != 0 && $key ==='either-parents-pil') {
|
||||
for ($i = 1; $i <= 2; $i++) {
|
||||
$result[] = "parent" . $i;
|
||||
$result[] = "parent_in_law" . $i;
|
||||
}
|
||||
}else {
|
||||
$result[] = $key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function convertDateFormatDMY($dateString)
|
||||
{
|
||||
// Attempt to create a DateTime object from the provided date string
|
||||
$dateTime = \DateTime::createFromFormat('Y-m-d', $dateString);
|
||||
|
||||
if ($dateTime instanceof \DateTime) {
|
||||
return $dateTime->format('d-m-Y');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -97,8 +97,6 @@ label {
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<div id="policyGMCTerms" style="display:none">
|
||||
<span id="policyGMCTermsClose"
|
||||
style="float: right;font-size: 26px;color: red;margin-top: -42px;margin-left: 3px;margin-right: 7px;">x</span>
|
||||
@ -892,85 +890,85 @@ $('.close').click(function() {
|
||||
|
||||
});
|
||||
|
||||
$('input[name="ayudhtreatmentcover"]').change(function() {
|
||||
// $('input[name="ayudhtreatmentcover"]').change(function() {
|
||||
|
||||
////console.log($(this).val());
|
||||
// ////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="ailmentcapping"]').change(function() {
|
||||
// $('input[name="ailmentcapping"]').change(function() {
|
||||
|
||||
////console.log($(this).val());
|
||||
// ////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="copayzonewisecopay"]').change(function() {
|
||||
// $('input[name="copayzonewisecopay"]').change(function() {
|
||||
|
||||
////console.log($(this).val());
|
||||
// ////console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="cataract"]').change(function() {
|
||||
// $('input[name="cataract"]').change(function() {
|
||||
|
||||
//console.log($(this).val());
|
||||
// //console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
$('input[name="waiverofpreexistingdiseases"]').change(function() {
|
||||
// $('input[name="waiverofpreexistingdiseases"]').change(function() {
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
var element2 = $(this).parent().parent().next().next()[0];
|
||||
$(element2).css("display", "");
|
||||
var element3 = $(this).parent().parent().next().next().next()[0];
|
||||
$(element3).css("display", "");
|
||||
var element4 = $(this).parent().parent().next().next().next().next()[0];
|
||||
$(element4).css("display", "");
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
var element2 = $(this).parent().parent().next().next()[0];
|
||||
$(element2).css("display", "none");
|
||||
var element3 = $(this).parent().parent().next().next().next()[0];
|
||||
$(element3).css("display", "none");
|
||||
var element4 = $(this).parent().parent().next().next().next().next()[0];
|
||||
$(element4).css("display", "none");
|
||||
}
|
||||
});
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
// var element2 = $(this).parent().parent().next().next()[0];
|
||||
// $(element2).css("display", "");
|
||||
// var element3 = $(this).parent().parent().next().next().next()[0];
|
||||
// $(element3).css("display", "");
|
||||
// var element4 = $(this).parent().parent().next().next().next().next()[0];
|
||||
// $(element4).css("display", "");
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// var element2 = $(this).parent().parent().next().next()[0];
|
||||
// $(element2).css("display", "none");
|
||||
// var element3 = $(this).parent().parent().next().next().next()[0];
|
||||
// $(element3).css("display", "none");
|
||||
// var element4 = $(this).parent().parent().next().next().next().next()[0];
|
||||
// $(element4).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
$("#policyJsonForm").submit(function(event) {
|
||||
|
||||
@ -475,75 +475,75 @@ $('.close').click(function() {
|
||||
});
|
||||
|
||||
|
||||
$('input[name="burnExpenses"]').change(function() {
|
||||
// $('input[name="burnExpenses"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
// console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="compassionateVisitExpenses"]').change(function() {
|
||||
// $('input[name="compassionateVisitExpenses"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
// console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="carriageOfDeadBody"]').change(function() {
|
||||
// $('input[name="carriageOfDeadBody"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
// console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="ambulanceCharges"]').change(function() {
|
||||
// $('input[name="ambulanceCharges"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
// console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$('input[name="brokenBoneExpenses"]').change(function() {
|
||||
// $('input[name="brokenBoneExpenses"]').change(function() {
|
||||
|
||||
console.log($(this).val());
|
||||
// console.log($(this).val());
|
||||
|
||||
if ($(this).val() == '1') {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "");
|
||||
// if ($(this).val() == '1') {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "");
|
||||
|
||||
} else {
|
||||
var element = $(this).parent().parent().next()[0];
|
||||
$(element).css("display", "none");
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// var element = $(this).parent().parent().next()[0];
|
||||
// $(element).css("display", "none");
|
||||
// }
|
||||
// });
|
||||
|
||||
$("#policyGPATerms").submit(function(event) {
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@
|
||||
onchange="addGridHTML(this)" required>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<input type="hidden" id="hidden_unit" />
|
||||
<div class="form-group col-md-6"
|
||||
style="position: relative; left: 45px; display:none" id="premium_type">
|
||||
<label for="css"> Premium Calculation </label>
|
||||
@ -380,11 +380,22 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('rack rate responce', res)
|
||||
console.log('rack rate responce', (res.ranch_units))
|
||||
console.log('rack rate responce jsonArray', res.jsonArray);
|
||||
// console.log('rack rate responce.premium data', res.premiumData)
|
||||
// console.log('rack rate responce.premium data parsed', JSON.parse(res.premiumData));
|
||||
|
||||
|
||||
console.log('rack rate responce length', JSON.parse(res.branch_units).length);
|
||||
|
||||
branch_units = JSON.parse(res.branch_units) ?? [];
|
||||
|
||||
if (branch_units && branch_units.length == 1) {
|
||||
|
||||
$("#hidden_unit").val(branch_units[0]);
|
||||
console.log('unit', branch_units[0]);
|
||||
$("#gpa_unit1").val(branch_units[0]);
|
||||
}
|
||||
|
||||
var data_for_the_rack_rate = JSON.parse(res.premiumData) ?? [];
|
||||
var groupedData = groupByRackRateName(data_for_the_rack_rate) ?? [];
|
||||
rarc_rate_json_array.push(res.jsonArray);
|
||||
@ -492,7 +503,8 @@ $('body').on('click', '.btnPolicyModel', function()
|
||||
}
|
||||
|
||||
addGridHTML(false, premiumData[0], premiumData[0].policy_grid_id, si_or_bp_value);
|
||||
|
||||
// alert("hi");
|
||||
// alert('policy_grid_id_value', policy_grid_id_value);
|
||||
$('#tabname').text(premiumData[0].rack_rate_name);
|
||||
$('#rack_rate_name').val(premiumData[0].rack_rate_name);
|
||||
|
||||
@ -623,8 +635,12 @@ $(document).on('change', 'select[id^="grid_"]', function(event)
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000);
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -673,8 +689,12 @@ $('#grid').change(function()
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000);
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -734,6 +754,9 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
|
||||
var id_var = 'grid_';
|
||||
|
||||
var default_unit = $('#hidden_unit').val();
|
||||
// alert(default_unit);
|
||||
|
||||
var dataIdValue = ''
|
||||
if (event === false) {
|
||||
var dataIdValue = ui_type
|
||||
@ -802,13 +825,13 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
<div id="si_or_bp_sum_insure" class="form-row">
|
||||
|
||||
<div class="form-row col-md-4" style="margin-left: 346px; margin-top: -114px;">
|
||||
<label for="mobile">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<label for="mobile" style = "margin-bottom: -10px;margin-top: 17px;">Premium Multiplier<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.multiplier : '') : ''}" type="text" class="form-control" placeholder="Multiplier" name="gpa_sum_multiplier" id="gpa_sum_multiplier" onchange="gpaSumInsureMultiplier(this)" required>
|
||||
</div>
|
||||
<div class="form-row" style="width:101%;padding: 10px;" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : '') : ''}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? (data.si_or_bp == '1' ? data.unit : default_unit) : default_unit}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
@ -1341,8 +1364,12 @@ function addGridHTML(event = false, data = false, ui_type = false, si_or_bp = fa
|
||||
}
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000);
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -1399,7 +1426,7 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
html = `<div class="form-row gpa_sum_insure_remove" style="width:101%" id="removeChild_${Count}">
|
||||
<div class="form-group col-md-3 unitDiv">
|
||||
<label for="mobile">Units<span class="text-danger">*</span></label>
|
||||
<input value="${data !== false && data !== undefined && data !== '' ? data.unit : ''}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
<input value="${data !== false && data !== undefined && data !== default_unit ? data.unit : default_unit}"}" type="text" class="form-control" placeholder="Enter Unit" name="gpa_unit_1[]" id="gpa_unit1" required>
|
||||
</div>
|
||||
<div class="form-group col-md-3" id="">
|
||||
<label for="mobile">Sum Insured<span class="text-danger">*</span></label>
|
||||
@ -1840,8 +1867,12 @@ function appendGridtHtml(ui_type = false, secondary = false, data = false)
|
||||
// Count++
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000);
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -2770,7 +2801,7 @@ function si_orbp_change_function()
|
||||
$('#gpa_sum_multiplier').attr('required', true);
|
||||
$('#gpa_sum_si').attr('required', true);
|
||||
$('#gpa_sum_premium').attr('required', true);
|
||||
$('#gpa_unit1').attr('required', true);
|
||||
$('#gpa_unit1').attr('required', false);
|
||||
|
||||
var gridContentInput = $('#grid_content_input');
|
||||
|
||||
@ -3936,8 +3967,12 @@ function appendFourthAndSixthRackRate(data = null, uniqueId = null)
|
||||
grid_container.insertAdjacentHTML('beforeend', grid_html);
|
||||
|
||||
if(unit_length == 1 || unit_length == 0){
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv').find('input').removeAttr('required');
|
||||
// $('.unitDiv').hide();
|
||||
// $('.unitDiv').find('input').removeAttr('required');
|
||||
setTimeout(() => {
|
||||
$('.unitDiv').hide();
|
||||
$('.unitDiv input').removeAttr('required');
|
||||
}, 1000);
|
||||
}else{
|
||||
$('.unitDiv').show();
|
||||
$('.unitDiv').find('input').attr('required', true);
|
||||
@ -3960,7 +3995,7 @@ function checkValideUnits(unique_id = null)
|
||||
container = $('#grid_content_input_for_additional_'+unique_id);
|
||||
}
|
||||
|
||||
console.log('checkValideUnits id', id);
|
||||
console.log('checkValideUnits id', id.value);
|
||||
console.log('checkValideUnits container', container);
|
||||
|
||||
if (id.value === '3') {
|
||||
@ -4285,6 +4320,7 @@ function checkValideUnits(unique_id = null)
|
||||
} else if (id.value === '1') {
|
||||
|
||||
var selectedValue = $('#si_or_bp').val();
|
||||
console.log('checkValideUnits selectedValue', selectedValue);
|
||||
if (selectedValue == 1) {
|
||||
|
||||
var units = container.find('input[name="gpa_unit_1[]"]');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user