Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
dfa24eada8
@ -15,6 +15,7 @@ use App\Filters\CloseDbConnection;
|
||||
use App\Filters\AuthClientApi;
|
||||
use App\Filters\CommissionApiFilter;
|
||||
use App\Filters\VerifyAppSignature;
|
||||
use App\Filters\Cors;
|
||||
|
||||
use App\Filters\AuthJWT;
|
||||
|
||||
@ -41,6 +42,7 @@ class Filters extends BaseConfig
|
||||
'CloseDbConnection' => CloseDbConnection::class,
|
||||
'CommissionApiFilter'=> CommissionApiFilter::class,
|
||||
'appSignature' => VerifyAppSignature::class,
|
||||
'Cors' => Cors::class,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@ -432,6 +432,8 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->get("list/(:any)", "PolicyTransactionController::getInceptionDataForEdit/$1");
|
||||
$routes->get("remove/(:any)", "PolicyTransactionController::removeCDMaster/$1");
|
||||
$routes->get("removePolicyTransaction/(:any)", "PolicyTransactionController::removePolicyTransaction/$1");
|
||||
$routes->match(['get', 'post'], 'list2', 'PolicyTransactionController::viewInception2');
|
||||
$routes->get("list2/(:any)", "PolicyTransactionController::getInceptionDataForEdit2/$1");
|
||||
});
|
||||
|
||||
$routes->group("endorsement", ["filter" => "authMVC"], function ($routes) {
|
||||
@ -530,16 +532,54 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
|
||||
$routes->get("getSSORedirectUrl", "ApiServiceController::getSSORedirectUrl");
|
||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
$routes->get("getEmployeePolicy", "EmployeeRestController::getEmployeePolicy");
|
||||
|
||||
$routes->group("employeeRest", ["filter" => ["authJWT" , "appSignature"]], function ($routes) {
|
||||
$routes->group("employeeRest", ['filter' => ["appSignature"] ], function ($routes) {
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
$routes->post("verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
// MPIN api's
|
||||
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
|
||||
$routes->post("forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||
$routes->post("updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||
|
||||
// PASSWORD api's
|
||||
$routes->post("savePassword", "RestAuthenticationController::savePassword");
|
||||
$routes->post("changePassword", "RestAuthenticationController::changePassword");
|
||||
$routes->post("verifyPassword", "RestAuthenticationController::verifyPassword");
|
||||
$routes->post("verifyOtp", "RestAuthenticationController::verifyOtp");
|
||||
$routes->post("checkPassword", "RestAuthenticationController::checkPassword");
|
||||
|
||||
//HR login api's
|
||||
$routes->post("verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||
$routes->post("getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
$routes->post("updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||
$routes->get("getHRAccessData", "RestAuthenticationController::getHRAccessData");
|
||||
|
||||
$routes->post("getPostEmployeeDataForAuth", "RestAuthenticationController::getPostEmployeeDataForAuth");
|
||||
|
||||
$routes->get("getClientDetails", "EmployeeRestController::getClientDetails");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
|
||||
});
|
||||
|
||||
$routes->group("employeeRest", ["filter" => ["authJWT"]], function ($routes) {
|
||||
|
||||
$routes->post("ecardRequest", "ApiServiceController::ecardRequest");
|
||||
$routes->get("getWellnessURL", "ApiServiceController::getWellnessURL");
|
||||
|
||||
|
||||
$routes->post("logHrActivity", "RestAuthenticationController::logHrActivity");
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
// $routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
|
||||
|
||||
$routes->post("getChatResponse", "ChatBotController::getChatResponse");
|
||||
@ -599,48 +639,14 @@ $routes->group("employeeRest", ["filter" => ["authJWT" , "appSignature"]], funct
|
||||
$routes->get('get_ticket_type',"EmployeeRestController::get_ticket_type");
|
||||
$routes->get('get_ticket_data',"EmployeeRestController::get_ticket_data");
|
||||
|
||||
// add retail policy
|
||||
$routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
||||
|
||||
// get insurer and policy type
|
||||
$routes->get("getPolicyTypeAndInsurer", "EmployeeRestController::getPolicyTypeAndInsurer");
|
||||
|
||||
});
|
||||
|
||||
$routes->group("employeeRest", ['filter' => ["appSignature"] ], function ($routes) {
|
||||
|
||||
//Employee login api's
|
||||
$routes->post("verifyEmployeeNumber", "RestAuthenticationController::verifyEmployeeWithMobileNumber");
|
||||
$routes->post("getVerifiedUserData", "RestAuthenticationController::getVerifiedUserData");
|
||||
$routes->post("verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
// MPIN api's
|
||||
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->post("verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("updateEmpMPIN", "RestAuthenticationController::updateEmpMPIN");
|
||||
$routes->post("forgotMPIN", "RestAuthenticationController::forgotMPIN");
|
||||
$routes->post("updateMobileNumber", "RestAuthenticationController::updateMobileNumber");
|
||||
|
||||
// PASSWORD api's
|
||||
$routes->post("savePassword", "RestAuthenticationController::savePassword");
|
||||
$routes->post("changePassword", "RestAuthenticationController::changePassword");
|
||||
$routes->post("verifyPassword", "RestAuthenticationController::verifyPassword");
|
||||
$routes->post("verifyOtp", "RestAuthenticationController::verifyOtp");
|
||||
$routes->post("checkPassword", "RestAuthenticationController::checkPassword");
|
||||
|
||||
//HR login api's
|
||||
$routes->post("verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
$routes->post("verifyHrWithEmail", "RestAuthenticationController::verifyHrWithEmail");
|
||||
$routes->post("getVerifiedHrData", "RestAuthenticationController::getVerifiedHrData");
|
||||
$routes->post("updateHROTP", "RestAuthenticationController::updateHROTP");
|
||||
$routes->get("getHRAccessData", "RestAuthenticationController::getHRAccessData");
|
||||
|
||||
$routes->post("getPostEmployeeDataForAuth", "RestAuthenticationController::getPostEmployeeDataForAuth");
|
||||
|
||||
$routes->get("getClientDetails", "EmployeeRestController::getClientDetails");
|
||||
$routes->get("getAdvertisementImage", "EmployeeRestController::getAdvertisementImage");
|
||||
|
||||
});
|
||||
|
||||
|
||||
$routes->get("hrFileDownload", "EmployeeRestController::hrFileDownload");
|
||||
$routes->post("hrFileList", "EmployeeRestController::hrFileList");
|
||||
$routes->get("getEmployeeActiveOrInactivePolicy", "EmployeeRestController::getEmployeeActiveOrInactivePolicy");
|
||||
@ -650,6 +656,9 @@ $routes->get("getPolicyLevelEmployeeSummaryData", "EmployeeRestController::getPo
|
||||
$routes->get("cdTransactionData", "EmployeeRestController::cdTransactionData");
|
||||
$routes->match( ['get', 'post'], 'claimsSearch','EmployeeRestController::claimsSearch');
|
||||
$routes->get("getBackToEnrolledDetails", "EmployeeRestController::getBackToEnrolledDetails");
|
||||
// $routes->post("addEmpRetailPolicy", "EmployeeRestController::addEmpRetailPolicy");
|
||||
// $routes->get("getPolicyTypeAndInsurer", "EmployeeRestController::getPolicyTypeAndInsurer");
|
||||
|
||||
|
||||
// Ticketing System
|
||||
|
||||
@ -809,7 +818,6 @@ $routes->group('commission', function($routes) {
|
||||
});
|
||||
|
||||
//BDS BULK UPLOAD
|
||||
|
||||
$routes->group('bds_upload', function($routes) {
|
||||
$routes->match (['get','post'],'list',"PolicyTransactionController::policyBulkUpload");
|
||||
$routes->get('downloadBDSDumpFile/(:any)',"PolicyTransactionController::downloadBDSDumpFile/$1");
|
||||
|
||||
@ -5282,8 +5282,17 @@ class EmpDataServiceController extends BaseController
|
||||
$action_type_string = "addition";
|
||||
}
|
||||
|
||||
$user_data = db_connect()->table('user_profiles')->where('is_active', 1)->where('id', $lead_data['created_by'] ?? null)->get()->getRowArray();
|
||||
// get the acm data for service person id
|
||||
$acm_data = db_connect()->table('client_rm')->where('is_active', 1)->where('client_id', $policy_data['client_id'] ?? null)->where('level', 3) ->get() ->getRowArray();
|
||||
$service_person_id = null;
|
||||
if(!empty($acm_data)){
|
||||
$service_person_id = $acm_data['user_id'] ?? null;
|
||||
}else{
|
||||
$service_person_id = $params['created_by'] ?? null;
|
||||
}
|
||||
|
||||
// get the user data for salse person id
|
||||
$user_data = db_connect()->table('user_profiles')->where('is_active', 1)->where('id', $lead_data['created_by'] ?? null)->get()->getRowArray();
|
||||
$salse_person_id = null;
|
||||
if(isset($lead_data['salse_person_id']) && !empty($lead_data['salse_person_id'])){
|
||||
$salse_person_array = json_decode($lead_data['salse_person_id'] ?? '{}', true) ?? [];
|
||||
@ -5337,7 +5346,7 @@ class EmpDataServiceController extends BaseController
|
||||
'entry_from' => 2,
|
||||
|
||||
'sales_generated_by' => $salse_person_id,
|
||||
'serviced_by' => $params['created_by'] ?? null,
|
||||
'serviced_by' => $service_person_id,
|
||||
];
|
||||
|
||||
$this->myLogger->logme("error", "Constructed policy transaction data: " . json_encode($policyTransactionData));
|
||||
@ -5366,6 +5375,12 @@ class EmpDataServiceController extends BaseController
|
||||
'amount' => ($params['base_premium'] ?? 0) + ($params['gst'] ?? 0),
|
||||
];
|
||||
|
||||
if(isset($policy_data['gst']) && $policy_data['gst'] != null){
|
||||
$coShareData['bp_igst'] = $policy_data['gst'];
|
||||
$coShareData['bp_sgst'] = 0;
|
||||
$coShareData['bp_cgst'] = 0;
|
||||
}
|
||||
|
||||
if(isset($lead_data['agreed_percentage']) && !empty($lead_data['agreed_percentage'])){
|
||||
$coShareData['exp_amt'] = (($params['base_premium'] ?? 0) * ($lead_data['agreed_percentage'] ?? 0)) / 100;
|
||||
}else{
|
||||
|
||||
@ -549,8 +549,7 @@ class EmployeeController extends AdminController
|
||||
];
|
||||
|
||||
|
||||
$batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false) ? change_date_format($policy_issue_date) : null;
|
||||
|
||||
$batch_data['policy_issue_date'] = (!empty($policy_issue_date) && strtotime($policy_issue_date) !== false) ? change_date_format($policy_issue_date, 'd/m/Y', 'Y-m-d') : null;
|
||||
|
||||
if ($actions == 'export') {
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ use App\Models\TicketMessageModel;
|
||||
use App\Models\HRAccessControlModel;
|
||||
use App\Models\InsurerModel;
|
||||
use App\Models\HrFileUploadModel;
|
||||
use App\Models\EmployeeRetailPolicy;
|
||||
|
||||
|
||||
|
||||
@ -97,6 +98,7 @@ class EmployeeRestController extends AdminController
|
||||
protected $insurerModel;
|
||||
protected $hrFileUploadModel;
|
||||
protected $ticketMailTemplateModel;
|
||||
protected $employeeRetailPolicy;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -124,6 +126,7 @@ class EmployeeRestController extends AdminController
|
||||
$this->claimStatusModel = new TicketClaimStatusModel();
|
||||
$this->ticketMaster = new TicketMasterModel();
|
||||
$this->ticketMessage = new TicketMessageModel();
|
||||
$this->employeeRetailPolicy = new EmployeeRetailPolicy();
|
||||
|
||||
$this->ticketController = new TicketController();
|
||||
$this->hrAccessControlModel = new HRAccessControlModel();
|
||||
@ -2993,7 +2996,10 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
}
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'emp_name' => $employeeName, 'pre_policy_count' => $prePolicyCount], 200);
|
||||
$emp_reatail_policy_data = $this->getEmpRetailPolicy($employeeSelfData);
|
||||
$emp_wellness_data = $this->getWellnessUrl($employeeSelfData->id ?? null);
|
||||
|
||||
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result, 'emp_name' => $employeeName, 'pre_policy_count' => $prePolicyCount, 'retail_policy_data' => $emp_reatail_policy_data, 'wellness_data' => $emp_wellness_data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 200);
|
||||
}
|
||||
@ -4586,4 +4592,242 @@ class EmployeeRestController extends AdminController
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public function addEmpRetailPolicy()
|
||||
{
|
||||
$this->myLogger->logme("error", "EMPLOYEE-RETAIL-POLICY-CONTROLLER - addEmpRetailPolicy: Received payload = " . json_encode($this->request->getJSON() ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$payload = $this->request->getJSON(true);
|
||||
$pk = $payload['retail_policy_id'] ?? null;
|
||||
$emp_id = $payload['emp_id'] ?? null;
|
||||
|
||||
if (empty($emp_id)) {
|
||||
$this->myLogger->logme("error", "addEmpRetailPolicy: emp_id is missing");
|
||||
return $this->respond(['status' => 'failed','code' => 400,'message' => 'emp_id is required' ], 200);
|
||||
}
|
||||
|
||||
if(empty($pk)){
|
||||
$payload['created_by'] = $emp_id;
|
||||
$emp_retail_policy_id = $this->employeeRetailPolicy->insert($payload);
|
||||
}else{
|
||||
$payload['updated_by'] = $emp_id;
|
||||
$emp_retail_policy_id = $this->employeeRetailPolicy->where('id', $pk)->set($payload)->update();
|
||||
}
|
||||
|
||||
if ($emp_retail_policy_id) {
|
||||
|
||||
$this->myLogger->logme("error", "addEmpRetailPolicy: Employee Retail Policy created successfully. Policy ID = " . $emp_retail_policy_id);
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'message' => 'Employee Retail Policy created successfully',
|
||||
'data' => [
|
||||
'emp_retail_policy_id' => $emp_retail_policy_id
|
||||
]
|
||||
], 200);
|
||||
} else {
|
||||
$this->myLogger->logme( "error", "addEmpRetailPolicy: Failed to create Employee Retail Policy. Insert returned false" );
|
||||
return $this->respond(['status' => 'failed','code' => 500,'message' => 'Failed to create Employee Retail Policy'], 500);
|
||||
}
|
||||
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
$this->myLogger->logme("error", "addEmpRetailPolicy: Exception occurred - " . $th->getMessage());
|
||||
return $this->respond(['status' => 'failed','code' => 500,'message' => 'Internal server error: ' . $th->getMessage()], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getEmpRetailPolicy($employeeData)
|
||||
{
|
||||
$this->myLogger->logme("error", "EMPLOYEE-REST-CONTROLLER - getEmpRetailPolicy: Given params: " . json_encode($employeeData ?? []));
|
||||
|
||||
try {
|
||||
|
||||
$emp_id = $employeeData->id ?? null;
|
||||
$mobile_number = $employeeData->mobile ?? null;
|
||||
|
||||
$emp_retail_policy_data = [];
|
||||
if ($emp_id != null) {
|
||||
|
||||
$emp_retail_policy_data = $this->employeeRetailPolicy
|
||||
->select("
|
||||
employee_retail_policies.emp_id,
|
||||
employee_retail_policies.insurer_id,
|
||||
employee_retail_policies.policy_type_id,
|
||||
employee_retail_policies.policy_no,
|
||||
DATE_FORMAT(employee_retail_policies.policy_start_date, '%d-%b-%Y') as policy_start_date,
|
||||
DATE_FORMAT(employee_retail_policies.policy_end_date, '%d-%b-%Y') as policy_end_date,
|
||||
policy_type.policy_type,
|
||||
policy_type.long_name as policy_type_long_name,
|
||||
insurers.name as insurer_name,
|
||||
insurers.short_name as insurer_short_name
|
||||
")
|
||||
->join('insurers', 'employee_retail_policies.insurer_id = insurers.id')
|
||||
->join('policy_type', 'employee_retail_policies.policy_type_id = policy_type.id')
|
||||
->where('employee_retail_policies.is_active', 1)
|
||||
->where('emp_id', $emp_id)
|
||||
->findAll();
|
||||
|
||||
}
|
||||
|
||||
$emp_retail_client_data = [];
|
||||
|
||||
if (!empty($mobile_number)) {
|
||||
$emp_retail_client_data = $this->clientModel
|
||||
->select("
|
||||
$emp_id as emp_id,
|
||||
policy_transaction.insurer_id,
|
||||
policy_transaction.policy_type_id,
|
||||
policy_transaction.policy_no,
|
||||
DATE_FORMAT(policy_transaction.policy_start_date, '%d-%b-%Y') as policy_start_date,
|
||||
DATE_FORMAT(policy_transaction.policy_end_date, '%d-%b-%Y') as policy_end_date,
|
||||
policy_type.policy_type,
|
||||
policy_type.long_name as policy_type_long_name,
|
||||
insurers.name as insurer_name,
|
||||
insurers.short_name as insurer_short_name
|
||||
")
|
||||
->join('policy_transaction', 'policy_transaction.client_id = clients.id')
|
||||
->join('insurers', 'policy_transaction.insurer_id = insurers.id')
|
||||
->join('policy_type', 'policy_transaction.policy_type_id = policy_type.id')
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->where('clients.is_active', 1)
|
||||
->where('clients.phone', $mobile_number)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
// print_r($emp_retail_policy_data); die;
|
||||
|
||||
$complete_emp_retail_policy_data = array_values(
|
||||
array_column(
|
||||
array_merge($emp_retail_client_data ?: [], $emp_retail_policy_data ?: []),
|
||||
null,
|
||||
'policy_no'
|
||||
)
|
||||
);
|
||||
|
||||
return $complete_emp_retail_policy_data;
|
||||
} catch (\Throwable $th) {
|
||||
|
||||
$errorData = [
|
||||
'message' => $th->getMessage(),
|
||||
'file' => $th->getFile(),
|
||||
'line' => $th->getLine(),
|
||||
'code' => $th->getCode(),
|
||||
'trace' => $th->getTraceAsString(),
|
||||
'trace_array' => $th->getTrace(), // full array version (optional)
|
||||
'function' => $th->getTrace()[0]['function'] ?? null,
|
||||
'class' => $th->getTrace()[0]['class'] ?? null,
|
||||
];
|
||||
|
||||
$this->myLogger->logme("error", "EMPLOYEE-REST-CONTROLLER - getEmpRetailPolicy: Exception: " . json_encode($errorData ?? []));
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public function getWellnessUrl($emp_id)
|
||||
{
|
||||
// $emp_id = $this->request->getGet('emp_id');
|
||||
|
||||
$db = \Config\Database::connect();
|
||||
$data = $db->table('employees e')
|
||||
->select('pt.policy_type,
|
||||
e.name, e.email_corporate as email, e.mobile as phone, e.emp_code as memberId, e.gender, e.dob, e.relationship as relation,
|
||||
cp.policy_no as policyNumber, cp.policy_no as employeeId, cp.policy_start_date as policyStartDate, cp.policy_end_date as policyEndDate , cp.wellness_plan_id as planId')
|
||||
->join('employee_polices ep', 'e.id = ep.employee_id')
|
||||
->join('client_policy cp', 'ep.client_policy_id = cp.id')
|
||||
->join('policy_type pt', 'cp.policy_type_id = pt.id')
|
||||
->where('e.id', $emp_id)
|
||||
->where('e.emp_status', 'active')
|
||||
->where('ep.status', 'active')
|
||||
->where('e.is_active', 1)
|
||||
->where('ep.is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
|
||||
$userParams = [];
|
||||
foreach ($data as $row) {
|
||||
if ($row['planId'] != null) {
|
||||
$userParams['name'] = $row['name'];
|
||||
$userParams['email'] = $row['email'];
|
||||
$userParams['phone'] = $row['phone'];
|
||||
$userParams['memberId'] = $row['employeeId']; // memberId is unique primary key.
|
||||
$userParams['gender'] = $row['gender'];
|
||||
$userParams['dob'] = $row['dob'];
|
||||
$userParams['relation'] = $row['relation'];
|
||||
$userParams['policyNumber'] = $row['policyNumber'];
|
||||
$userParams['employeeId'] = $row['memberId'];
|
||||
$userParams['policyStartDate']= $row['policyStartDate'];
|
||||
$userParams['policyEndDate'] = $row['policyEndDate'];
|
||||
$userParams['policyName'] = $row['policy_type'];
|
||||
$userParams['planId'] = $row['planId'];
|
||||
$userParams['moduleName'] = 'home';
|
||||
break; // stop after first GMC match
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($userParams)) {
|
||||
return ['status' => 'failed','message' => 'Coming soon........!'];
|
||||
}
|
||||
|
||||
// echo 'coming';die();
|
||||
// Derive 32-byte key from SHA256
|
||||
$derivedKey = hash('sha256', env('VISIT_SECRET_KEY'), true);
|
||||
|
||||
// Build query string like Node.js
|
||||
$plainText = '';
|
||||
foreach ($userParams as $k => $v) {
|
||||
$plainText .= "&{$k}={$v}";
|
||||
}
|
||||
$plainText = ltrim($plainText, '&');
|
||||
|
||||
// Encrypt
|
||||
$algorithm = "aes-256-cbc";
|
||||
$encrypted = openssl_encrypt($plainText, $algorithm, $derivedKey, OPENSSL_RAW_DATA, env('VISIT_IV'));
|
||||
|
||||
// Base64URL encode (same as Node.js output)
|
||||
$output = rtrim(strtr(base64_encode($encrypted), '+/', '-_'), '=');
|
||||
|
||||
$baseURL = env('VISIT_BASE_URL');
|
||||
$clientId = env('VISIT_CLIENT_ID');
|
||||
$finalUrl = $baseURL . '/sso?userParams=' . $output . '&clientId=' . $clientId;
|
||||
|
||||
if (!empty($finalUrl)) {
|
||||
log_message('error', 'VISIT SSO | emp_id: '.$emp_id.' | URL: '.$finalUrl);
|
||||
return ['status' => 'success','data' => $finalUrl];
|
||||
} else {
|
||||
return ['status' => 'failed','message' => 'Coming soon........!'];
|
||||
}
|
||||
}
|
||||
|
||||
public function getPolicyTypeAndInsurer()
|
||||
{
|
||||
$policy_type_ids = [8, 37, 38, 39, 62];
|
||||
$policy_type = $this->policyTypeModel
|
||||
->select('id as policy_type_id, policy_type, long_name as policy_type_long_name')
|
||||
->where('is_active', 1)
|
||||
->whereIn('id', $policy_type_ids)
|
||||
->findAll();
|
||||
|
||||
$insurer_category = ['general'];
|
||||
$insurers = $this->insurerModel
|
||||
->select('id as insurer_id, name as insurer_name, short_name as insurer_short_name')
|
||||
->where('is_active', 1)
|
||||
->where('category', $insurer_category)
|
||||
->findAll();
|
||||
|
||||
return $this->respond([
|
||||
'status' => 'success',
|
||||
'code' => 200,
|
||||
'data' => [
|
||||
'insurer' => $insurers,
|
||||
'policy_type' => $policy_type
|
||||
]
|
||||
], 200);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1372,7 +1372,7 @@ class EmployeeServiceController extends AdminController
|
||||
$existing_units = $this->clientBranchModel->getExisitingUnits(client_id: $file['client_id'],client_branch_id: $file['client_branch_id']);
|
||||
|
||||
$employee_data_group_by_family = data_group_by_family($excel_data, 'excel', '', $current_column_action);
|
||||
// dd($employee_data_group_by_family);
|
||||
// dd($employee_data_group_by_family);
|
||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||
{
|
||||
|
||||
@ -1385,8 +1385,8 @@ class EmployeeServiceController extends AdminController
|
||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||
// Kint::dump($existing_famility_details);
|
||||
$family = array_merge($family,$existing_famility_details);
|
||||
$family = data_group_by_family($family, 'excel', 1)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
// dd($family);
|
||||
$family = data_group_by_family($family, 'excel', 1)[ $emp_id ];// reason to call this again is bring self to first index of the array
|
||||
// dd($family);
|
||||
$self = current(array_filter($family, fn($r) => strtolower($r[5] ?? '') === 'self'));
|
||||
$premium = (int)($self['temp']['rata_premimum'] ?? 0);
|
||||
foreach ($family as &$r) if (strtolower($r[5] ?? '') !== 'self') $r['self_rata_premium'] = $premium;
|
||||
@ -1394,9 +1394,6 @@ class EmployeeServiceController extends AdminController
|
||||
|
||||
// Kint::dump($family);
|
||||
$data = calculate_premium_new(family_data:$family,policy_terms: $policy_terms,slab_details : $slab_details,fileArr: $file, existing_units:$existing_units);
|
||||
if($file['action'] == 'dependent_addition') {
|
||||
$data = validatet_family_floter_rata_premium($data);
|
||||
}
|
||||
// dd($data);
|
||||
$employee_data_group_by_family[$emp_id] = $data;
|
||||
$this->employeesOnboardProcess(['familiy_data' => $data,'file' => $file]);
|
||||
|
||||
@ -397,21 +397,21 @@
|
||||
'params' => null
|
||||
],
|
||||
|
||||
'total' => [
|
||||
'col_idx' => 23,
|
||||
'col_cell_name' => 'X',
|
||||
'col_name' => 'Total',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'total' => [
|
||||
// 'col_idx' => 23,
|
||||
// 'col_cell_name' => 'X',
|
||||
// 'col_name' => 'Total',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'agreed_amount' => [
|
||||
'col_idx' => 24,
|
||||
'col_cell_name' => 'Y',
|
||||
'col_idx' => 23,
|
||||
'col_cell_name' => 'X',
|
||||
'col_name' => 'Agreed Amount',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
@ -422,8 +422,8 @@
|
||||
],
|
||||
|
||||
'agreed_bp_percentage' => [
|
||||
'col_idx' => 25,
|
||||
'col_cell_name' => 'Z',
|
||||
'col_idx' => 24,
|
||||
'col_cell_name' => 'Y',
|
||||
'col_name' => 'Agreed BP Percentage',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
@ -434,8 +434,8 @@
|
||||
],
|
||||
|
||||
'agreed_tp_percentage' => [
|
||||
'col_idx' => 26,
|
||||
'col_cell_name' => 'AA',
|
||||
'col_idx' => 25,
|
||||
'col_cell_name' => 'Z',
|
||||
'col_name' => 'Agreed TP Percentage',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
@ -445,101 +445,101 @@
|
||||
'params' => null
|
||||
],
|
||||
|
||||
'actual_bp_amount' => [
|
||||
'col_idx' => 27,
|
||||
'col_cell_name' => 'AB',
|
||||
'col_name' => 'Actual BP Amount',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_bp_amount' => [
|
||||
// 'col_idx' => 27,
|
||||
// 'col_cell_name' => 'AB',
|
||||
// 'col_name' => 'Actual BP Amount',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'actual_tp_amount' => [
|
||||
'col_idx' => 28,
|
||||
'col_cell_name' => 'AC',
|
||||
'col_name' => 'Actual TP Amount',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_tp_amount' => [
|
||||
// 'col_idx' => 28,
|
||||
// 'col_cell_name' => 'AC',
|
||||
// 'col_name' => 'Actual TP Amount',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'actual_bp_percentage' => [
|
||||
'col_idx' => 29,
|
||||
'col_cell_name' => 'AD',
|
||||
'col_name' => 'Actual BP Percentage',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_bp_percentage' => [
|
||||
// 'col_idx' => 29,
|
||||
// 'col_cell_name' => 'AD',
|
||||
// 'col_name' => 'Actual BP Percentage',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'actual_tp_percentage' => [
|
||||
'col_idx' => 30,
|
||||
'col_cell_name' => 'AE',
|
||||
'col_name' => 'Actual TP Percentage',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_tp_percentage' => [
|
||||
// 'col_idx' => 30,
|
||||
// 'col_cell_name' => 'AE',
|
||||
// 'col_name' => 'Actual TP Percentage',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'actual_bp_brokerage_amount' => [
|
||||
'col_idx' => 31,
|
||||
'col_cell_name' => 'AF',
|
||||
'col_name' => 'Actual BP Brokerage Amount',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_bp_brokerage_amount' => [
|
||||
// 'col_idx' => 31,
|
||||
// 'col_cell_name' => 'AF',
|
||||
// 'col_name' => 'Actual BP Brokerage Amount',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'actual_tp_brokerage_amount' => [
|
||||
'col_idx' => 32,
|
||||
'col_cell_name' => 'AG',
|
||||
'col_name' => 'Actual TP Brokerage Amount',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'actual_tp_brokerage_amount' => [
|
||||
// 'col_idx' => 32,
|
||||
// 'col_cell_name' => 'AG',
|
||||
// 'col_name' => 'Actual TP Brokerage Amount',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'expected_amount' => [
|
||||
'col_idx' => 33,
|
||||
'col_cell_name' => 'AH',
|
||||
'col_name' => 'Expected Amount',
|
||||
'is_mandatory' => true,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'expected_amount' => [
|
||||
// 'col_idx' => 33,
|
||||
// 'col_cell_name' => 'AH',
|
||||
// 'col_name' => 'Expected Amount',
|
||||
// 'is_mandatory' => true,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
'rewards' => [
|
||||
'col_idx' => 34,
|
||||
'col_cell_name' => 'AI',
|
||||
'col_name' => 'Rewards',
|
||||
'is_mandatory' => false,
|
||||
'data_type' => '',
|
||||
'format' => null,
|
||||
'allowed_values' => null,
|
||||
'custom' => null,
|
||||
'params' => null
|
||||
],
|
||||
// 'rewards' => [
|
||||
// 'col_idx' => 34,
|
||||
// 'col_cell_name' => 'AI',
|
||||
// 'col_name' => 'Rewards',
|
||||
// 'is_mandatory' => false,
|
||||
// 'data_type' => '',
|
||||
// 'format' => null,
|
||||
// 'allowed_values' => null,
|
||||
// 'custom' => null,
|
||||
// 'params' => null
|
||||
// ],
|
||||
|
||||
];
|
||||
|
||||
@ -671,8 +671,9 @@
|
||||
|
||||
// Fetch Sales Team
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*')
|
||||
->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
|
||||
->where('user_teams.team_id', 5)
|
||||
->where('user_teams.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
@ -690,6 +691,7 @@
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
// echo '<pre>';
|
||||
|
||||
// print_r($data['ppTeamsData']); die;
|
||||
|
||||
// dd($data);
|
||||
@ -698,6 +700,160 @@
|
||||
$this->loadLayout('policy_transaction_inception_list', $data);
|
||||
}
|
||||
|
||||
public function viewInception2()
|
||||
{
|
||||
$bds_edit_pt_id = $this->request->getGet('pt_id') ?? null;
|
||||
$data['tab_name'] = 'Policies';
|
||||
$data['page_name'] = 'Policies';
|
||||
|
||||
// Static arrays for dropdowns
|
||||
$data['issuer'] = [1 => 'JIBS', 2 => 'Nhance'];
|
||||
$data['issuer_branch'] = $this->nhanceBranchModel->where('is_active', 1)->findAll();
|
||||
$data['client_type'] = [1 => 'Group', 2 => 'Individual'];
|
||||
$data['issuing_type'] = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||
$data['policy_status'] = [
|
||||
'under_process' => 'Under Process',
|
||||
'client_pending' => 'Client Pending',
|
||||
'insurer_pending' => 'Insurer Pending',
|
||||
'co_insurer_pending' => 'Co-Insurer Pending',
|
||||
'tpa_pending' => 'TPA Pending',
|
||||
'validated' => 'Validated',
|
||||
'cancelled' => 'Cancelled',
|
||||
'instalment_pending' => 'Instalment Pending',
|
||||
'completed' => 'Completed',
|
||||
'lost' => 'Lost',
|
||||
];
|
||||
$data['invoice_status_array'] = [
|
||||
'yet_to_generate' => 'Pending',
|
||||
'generated' => 'Generated',
|
||||
'send' => 'Sent',
|
||||
'recived' => 'Payment Received',
|
||||
];
|
||||
// $data['vehicle_type'] = [
|
||||
// 'two_wheeler' => 'Two Wheeler',
|
||||
// 'four_wheeler' => 'Four Wheeler',
|
||||
// 'truck' => 'Truck',
|
||||
// 'bus' => 'Bus',
|
||||
// 'van' => 'Van',
|
||||
// 'suv' => 'SUV',
|
||||
// 'motorcycle' => 'Motorcycle',
|
||||
// 'bicycle' => 'Bicycle'
|
||||
// ];
|
||||
$data['vehicle_type'] = db_connect()->table('vehicle_type')->where('is_active', 1)->get()->getResultArray();
|
||||
$data['rto_details'] = db_connect()->table('rto_master')->where('is_active', 1)->get()->getResultArray();
|
||||
|
||||
$data['vehicle_des'] = [
|
||||
'commercial' => 'Commercial',
|
||||
'private' => 'Private',
|
||||
];
|
||||
$data['date_type'] = [
|
||||
'policy_issue_date' => 'Policy Issue Date',
|
||||
'policy_start_date' => 'Policy Start Date',
|
||||
'policy_end_date' => 'Policy End Date',
|
||||
];
|
||||
|
||||
// Filter data
|
||||
$start_date = $this->request->getGet('start_date');
|
||||
$end_date = $this->request->getGet('end_date');
|
||||
$client_id = $this->request->getGet('client_id');
|
||||
$insurer_id = $this->request->getGet('insurer_id');
|
||||
$policy_type_id = $this->request->getGet('policy_type_id');
|
||||
$date_type = $this->request->getGet('date_type');
|
||||
$issuer = $this->request->getGet('issuer');
|
||||
$status = $this->request->getGet('status');
|
||||
|
||||
// Handle null or empty values
|
||||
$start_date = empty($start_date) ? 0 : $start_date;
|
||||
$end_date = empty($end_date) ? 0 : $end_date;
|
||||
$client_id = empty($client_id) ? 0 : $client_id;
|
||||
$insurer_id = empty($insurer_id) ? 0 : $insurer_id;
|
||||
$policy_type_id = empty($policy_type_id) ? 0 : $policy_type_id;
|
||||
$date_type = empty($date_type) ? 0 : $date_type;
|
||||
$issuer = empty($issuer) ? 0 : $issuer;
|
||||
$status = empty($status) ? 0 : $status; // Corrected from `$issuer`
|
||||
|
||||
if(empty($bds_edit_pt_id)){
|
||||
if ($this->request->is('get')) {
|
||||
|
||||
// Fetch inception data list
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date,
|
||||
$end_date,
|
||||
$client_id,
|
||||
$insurer_id,
|
||||
$policy_type_id,
|
||||
$date_type,
|
||||
$issuer,
|
||||
$status
|
||||
);
|
||||
} else {
|
||||
|
||||
$ids = $this->request->getPost('ids');
|
||||
$ids = array_filter(explode(',', $ids));
|
||||
$data['inception_data_list'] = $this->policyTransactionModel->getInceptionTranctionListData(
|
||||
$start_date = 0,
|
||||
$end_date = 0,
|
||||
$client_id = 0,
|
||||
$insurer_id = 0,
|
||||
$policy_type_id = 0,
|
||||
$date_type = 0,
|
||||
$issuer = 0,
|
||||
$status = 0,
|
||||
$ids
|
||||
);
|
||||
}
|
||||
}else{
|
||||
$data['inception_data_list'] = [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Fetch additional data
|
||||
$data['client'] = $this->clientModel->where('is_active', 1)->findAll();
|
||||
$data['client_branch'] = $this->clientBranchModel->where('is_active', 1)->findAll();
|
||||
$data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['insurer'] = $this->insurerModel->where('is_active', 1)->findAll();
|
||||
$data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||
$data['policy_types'] = $this->policyTypeModel->where('is_active', 1)->findAll();
|
||||
$data['insurer_branch'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
|
||||
$data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
|
||||
|
||||
// Fetch PP Teams Data
|
||||
$data['ppTeamsData'] = $this->userModel
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch Sales Team
|
||||
$data['salse_team'] = $this->userModel
|
||||
->select('user_profiles.*,nhance_branch.id as nhance_branch_id, nhance_branch.branch_name as nhance_branch_name')
|
||||
->join('user_teams', 'user_profiles.id = user_teams.user_id')
|
||||
->join('nhance_branch', 'user_profiles.nhance_branch_id = nhance_branch.id','left')
|
||||
->where('user_teams.team_id', 5)
|
||||
->where('user_teams.is_active', 1)
|
||||
->where('user_profiles.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
// Fetch Partner Agent
|
||||
$data['partner_agent'] = db_connect()->table('partner_agent')
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Fetch ACM
|
||||
$data['ACM'] = $this->userModel
|
||||
->where('role', 3) // Assuming `role` is in `user_profiles`
|
||||
->where('is_active', 1)
|
||||
->findAll();
|
||||
// echo '<pre>';
|
||||
|
||||
// print_r($data['ppTeamsData']); die;
|
||||
|
||||
// dd($data);
|
||||
|
||||
// Load view
|
||||
$this->loadLayout('policy_transaction_inception_list_2', $data);
|
||||
}
|
||||
|
||||
// policy Transaction Create function start
|
||||
public function createInceptionPolicy()
|
||||
{
|
||||
@ -1483,6 +1639,276 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Get the Single Inception Tranction data for edit
|
||||
public function getInceptionDataForEdit2($id)
|
||||
{
|
||||
$data = $this->policyTransactionModel
|
||||
->select('
|
||||
policy_transaction.*,
|
||||
clients.short_name as client_short_name,
|
||||
clients.client_type,
|
||||
clients.entity_type_id,
|
||||
policy_type.policy_type,
|
||||
client_policy.tpa_id as master_tpa_id,
|
||||
client_policy.tpa_branch_id as master_tpa_branch_id,
|
||||
client_policy.policy_type_id as master_policy_type_id,
|
||||
client_policy.is_addon,
|
||||
client_policy.base_policy,
|
||||
(
|
||||
select last_action_date
|
||||
from policy_transaction_status
|
||||
where policy_tran_id = policy_transaction.id
|
||||
and status = policy_transaction.status
|
||||
order by id desc
|
||||
limit 1
|
||||
|
||||
) as last_action_date
|
||||
')
|
||||
->join('clients', 'clients.id = policy_transaction.client_id')
|
||||
->join('client_policy', 'policy_transaction.client_policy_id = client_policy.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('policy_transaction.id', $id)
|
||||
->where('policy_transaction.is_active', 1)
|
||||
->first();
|
||||
|
||||
$data['created_at'] = (isset($data['created_at']) && $data['created_at'] !== null && $data['created_at'] !== '')
|
||||
? date('d/m/Y h:i:s A', strtotime($data['created_at']))
|
||||
: null;
|
||||
|
||||
$data['updated_at'] = (isset($data['updated_at']) && $data['updated_at'] !== null && $data['updated_at'] !== '')
|
||||
? date('d/m/Y h:i:s A', strtotime($data['updated_at']))
|
||||
: null;
|
||||
|
||||
|
||||
if (!empty($data['policy_issue_date'])) {
|
||||
$data['policy_issue_date'] = change_date_format($data['policy_issue_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['policy_start_date'])) {
|
||||
$data['policy_start_date'] = change_date_format($data['policy_start_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['policy_end_date'])) {
|
||||
$data['policy_end_date'] = change_date_format($data['policy_end_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['renewal_date'])) {
|
||||
$data['renewal_date'] = change_date_format($data['renewal_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['rollover_date'])) {
|
||||
$data['rollover_date'] = change_date_format($data['rollover_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['endorse_eff_date'])) {
|
||||
$data['endorse_eff_date'] = change_date_format($data['endorse_eff_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['last_action_date'])) {
|
||||
$data['last_action_date'] = change_date_format($data['last_action_date'], 'Y-m-d', 'd/m/Y');
|
||||
}
|
||||
|
||||
if (!empty($data['month'])) {
|
||||
$data['month'] = change_date_format($data['month'], 'Y-m-d', 'M/Y');
|
||||
} else {
|
||||
$data['month'] = null;
|
||||
}
|
||||
|
||||
// print_r($data); die;
|
||||
|
||||
$data['renewal_policy'] = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.client_id', $data['client_id'])
|
||||
->where('client_policy.client_branch_id', $data['client_branch_id'])
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$data['base_policy_data'] = $this->clientPolicyModel
|
||||
->select('client_policy.*, policy_type.policy_type')
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
|
||||
->where('client_policy.client_id', $data['client_id'])
|
||||
->where('client_policy.client_branch_id', $data['client_branch_id'])
|
||||
->whereIn('client_policy.policy_type_id', [2, 3])
|
||||
->where('client_policy.is_active', 1)
|
||||
->findAll();
|
||||
|
||||
$pt_bp_amt = $this->PTCOShareDetailsModel
|
||||
->select('bp_amt, amount')
|
||||
->where('pt_id', $id)
|
||||
->where('co_share_type', 1)
|
||||
->where('is_active', 1)
|
||||
->first();
|
||||
|
||||
// dd(db_connect()->getLastQuery() ,$pt_bp_amt);
|
||||
$data['base_cd_amount'] = $pt_bp_amt['amount'] ?? null;
|
||||
|
||||
|
||||
$ptFileQuery = $this->PTFileModel
|
||||
->join('policy_transaction', 'pt_files.pt_id = policy_transaction.id')
|
||||
->where('pt_files.pt_id', $id)
|
||||
->where('pt_files.is_active', 1);
|
||||
|
||||
if (!in_array(get_role_id(), [1, 5]) && empty(array_intersect(user_team(), [MANAGEMENT_TEAM_ID, FINANCE_TEAM_ID, BUSINESS_TEAM_ID]))) {
|
||||
|
||||
if (get_role_id() == 4 && in_array(POS_TEAM_ID, user_team())) {
|
||||
$ptFileQuery->where('pt_files.created_by', get_session_userid());
|
||||
}
|
||||
}
|
||||
|
||||
$data['pt_files'] = $ptFileQuery->findAll();
|
||||
|
||||
|
||||
|
||||
$data['pt_co_share_details'] = $this->PTCOShareDetailsModel
|
||||
->select("
|
||||
pt_co_share_details.*,
|
||||
|
||||
(
|
||||
SELECT
|
||||
COUNT(*)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_stmt_details.co_share_id = pt_co_share_details.id
|
||||
AND co_share_stmt_details.is_active = 1
|
||||
) AS record_count,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_amount,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_percentage,
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_per)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_percentage,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_bp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_bp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tp_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tp_brokerage_amount,
|
||||
|
||||
|
||||
(
|
||||
SELECT
|
||||
SUM(actual_tep_brokerage_amt)
|
||||
FROM
|
||||
co_share_stmt_details
|
||||
WHERE
|
||||
co_share_id = pt_co_share_details.id
|
||||
AND is_active = 1
|
||||
|
||||
) AS actual_tep_brokerage_amount,
|
||||
|
||||
DATE_FORMAT(pt_policy_issue_date, '%d/%m/%Y') AS pt_policy_issue_date
|
||||
|
||||
")
|
||||
->where('pt_id', $id)
|
||||
->where('is_active', 1)
|
||||
->orderBy('id', 'asc')
|
||||
->findAll();
|
||||
|
||||
$data['emp_data'] = $this->employeeModel
|
||||
->select('employees.*, employee_polices.id as emp_policy_id')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->where('employees.client_id', $data['client_id'])
|
||||
->where('employees.is_active', 1)->findAll();
|
||||
// $data['client_kyc'] = $this->clientKYCDocsModel->where('client_id', $data['client_id'])->findAll();
|
||||
|
||||
$clientController = new ClientController();
|
||||
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
|
||||
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
|
||||
|
||||
$data['vehicle_docs'] = $this->clientKYCDocsModel
|
||||
->where('client_id', $data['client_id'])
|
||||
->where('vehicle_id', $data['vehicle_id'])
|
||||
->findAll();
|
||||
|
||||
// print_r( $data['pt_co_share_details']); die;
|
||||
// return $data;
|
||||
if ($data) {
|
||||
return $this->respond(['status' => true, 'data' => $data], 200);
|
||||
} else {
|
||||
return $this->respond(['status' => false], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function removePolicyTransaction($id, $type = 0)
|
||||
{
|
||||
if ($id) {
|
||||
@ -4140,18 +4566,26 @@
|
||||
$cgst = trim($row[20]);
|
||||
$sgst = trim($row[21]);
|
||||
$stamp_duty = trim($row[22]);
|
||||
$total = trim($row[23]);
|
||||
$agreed_amount = trim($row[24]);
|
||||
$agreed_bp_percentage = trim($row[25]);
|
||||
$agreed_tp_percentage = trim($row[26]);
|
||||
$actual_bp_amount = trim($row[27]);
|
||||
$actual_tp_amount = trim($row[28]);
|
||||
$actual_bp_percentage = trim($row[29]);
|
||||
$actual_tp_percentage = trim($row[30]);
|
||||
$actual_bp_brokerage_amount = trim($row[31]);
|
||||
$actual_tp_brokerage_amount = trim($row[32]);
|
||||
$expected_amount = trim($row[33]);
|
||||
$rewards = trim($row[34]);
|
||||
// $total = trim($row[23]);
|
||||
$agreed_amount = trim($row[23]);
|
||||
$agreed_bp_percentage = trim($row[24]);
|
||||
$agreed_tp_percentage = trim($row[25]);
|
||||
// $actual_bp_amount = trim($row[27]);
|
||||
// $actual_tp_amount = trim($row[28]);
|
||||
// $actual_bp_percentage = trim($row[29]);
|
||||
// $actual_tp_percentage = trim($row[30]);
|
||||
// $actual_bp_brokerage_amount = trim($row[31]);
|
||||
// $actual_tp_brokerage_amount = trim($row[32]);
|
||||
// $expected_amount = trim($row[33]);
|
||||
// $rewards = trim($row[34]);
|
||||
$actual_bp_amount = 0;
|
||||
$actual_tp_amount = 0;
|
||||
$actual_bp_percentage = 0;
|
||||
$actual_tp_percentage = 0;
|
||||
$actual_bp_brokerage_amount = 0;
|
||||
$actual_tp_brokerage_amount = 0;
|
||||
$expected_amount = 0;
|
||||
$rewards = 0;
|
||||
|
||||
$calculation = calculateMotorPolicyAmounts([
|
||||
'base_premium' => trim($row[16]),
|
||||
@ -4161,11 +4595,9 @@
|
||||
'cgst' => trim($row[20]),
|
||||
'sgst' => trim($row[21]),
|
||||
'stamp_duty' => trim($row[22]),
|
||||
'agreed_amount' => trim($row[24]),
|
||||
'agreed_bp_percentage' => trim($row[25]),
|
||||
'agreed_tp_percentage' => trim($row[26]),
|
||||
'actual_bp_brokerage_amount' => trim($row[31]),
|
||||
'actual_tp_brokerage_amount' => trim($row[32]),
|
||||
'agreed_amount' => trim($row[23]),
|
||||
'agreed_bp_percentage' => trim($row[24]),
|
||||
'agreed_tp_percentage' => trim($row[25]),
|
||||
'standard_bp_percentage' => 15.00,
|
||||
'standard_tp_percentage' => 2.5
|
||||
]);
|
||||
@ -4275,7 +4707,7 @@
|
||||
'variance' => 0,
|
||||
|
||||
'remark' => null,
|
||||
'amount' => $calculation['total_amount'] ?? $total,
|
||||
'amount' => $calculation['total_amount'] ?? 0,
|
||||
'stamp_duty' => $stamp_duty,
|
||||
|
||||
'cop_amt' => $base_premium,
|
||||
|
||||
@ -107,11 +107,11 @@ class Cors implements FilterInterface
|
||||
);
|
||||
}
|
||||
|
||||
$this->log('CORS filter initialized', [
|
||||
'allowed_origins' => $this->allowedOrigins,
|
||||
'allow_credentials' => $this->allowCredentials,
|
||||
'allowed_methods' => $this->allowedMethods,
|
||||
]);
|
||||
// $this->log('CORS filter initialized', [
|
||||
// 'allowed_origins' => $this->allowedOrigins,
|
||||
// 'allow_credentials' => $this->allowCredentials,
|
||||
// 'allowed_methods' => $this->allowedMethods,
|
||||
// ]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -945,6 +945,10 @@ if (!function_exists('calculate_premium_new')) {
|
||||
// $result[] = $transformed_familiy_member_data;
|
||||
}
|
||||
|
||||
if($fileArr['action'] == 'dependent_addition') {
|
||||
$result = validatet_family_floter_rata_premium($result);
|
||||
}
|
||||
|
||||
// dd($result);
|
||||
return ($result);
|
||||
//
|
||||
@ -1923,6 +1927,7 @@ if (!function_exists('transform_db_data_to_excel')) {
|
||||
$row['temp']['emp_status'] = $value['emp_status'];
|
||||
$row['temp']['policy_status'] = $value['status'];
|
||||
$row['temp']['rata_premimum'] = $value['rata_premimum'];
|
||||
$row['temp']['premium'] = $value['premium'];
|
||||
$row['temp']['file_id'] = $value['file_id'];
|
||||
|
||||
array_push($return_data, ($row));
|
||||
@ -2883,66 +2888,73 @@ if (!function_exists('is_valid_or_empty_email')) {
|
||||
}
|
||||
|
||||
if (!function_exists('validatet_family_floter_rata_premium')) {
|
||||
function validatet_family_floter_rata_premium($family){
|
||||
|
||||
// print_rr($family); die;
|
||||
function validatet_family_floter_rata_premium($family)
|
||||
{
|
||||
// If only two members, skip
|
||||
if (count($family) === 2) {
|
||||
return $family; // skip if only two members
|
||||
return $family;
|
||||
}
|
||||
|
||||
$excelCount = count(array_filter($family, fn($r) => ($r['data_from'] ?? '') === 'excel') ?? []);
|
||||
$reset_family_premium = false;
|
||||
// Count excel rows
|
||||
$excelCount = count(array_filter($family, fn($r) =>
|
||||
($r['data_from'] ?? '') === 'excel'
|
||||
));
|
||||
|
||||
// Extract self row
|
||||
$selfDataArr = array_filter($family, fn($r) =>
|
||||
strtolower($r['relationship'] ?? '') === 'self'
|
||||
);
|
||||
$selfData = reset($selfDataArr);
|
||||
|
||||
$dependentRataGiven = false;
|
||||
|
||||
if($excelCount == 1){
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
* 1. RESET DEPENDENT PREMIUM IF SELF HAS SAME RATA
|
||||
* ---------------------------------------------------
|
||||
*/
|
||||
if (
|
||||
!empty($selfData['temp']) &&
|
||||
!empty($selfData['policy_details']) &&
|
||||
($selfData['temp']['premium'] ?? 0) == ($selfData['policy_details']['premium'] ?? 0)
|
||||
) {
|
||||
foreach ($family as &$row) {
|
||||
|
||||
$selfPremium = 0;
|
||||
$familyPremium = 0;
|
||||
|
||||
foreach ($family as $row) {
|
||||
|
||||
// Get self premium
|
||||
if (isset($row['relationship']) && strtolower($row['relationship']) == 'self') {
|
||||
$selfPremium = (float) ($row['policy_details']['rata_premimum'] ?? 0);
|
||||
if (strtolower($row['relationship'] ?? '') === 'self') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Sum the dependents premium
|
||||
if (isset($row['relationship']) && strtolower($row['relationship']) !== 'self')
|
||||
{
|
||||
$familyPremium += (float) ($row['policy_details']['rata_premimum'] ?? 0);
|
||||
if (
|
||||
($row['temp']['premium_type'] ?? null) == 1 &&
|
||||
($row['data_from'] ?? '') === 'excel'
|
||||
) {
|
||||
$row['policy_details']['rata_premimum'] = 0;
|
||||
$row['policy_details']['gst'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($selfPremium > $familyPremium || $selfPremium == $familyPremium){
|
||||
$reset_family_premium = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ---------------------------------------------------
|
||||
* 2. APPLY FINAL PREMIUM ADJUSTMENT TO DEPENDENTS
|
||||
* ---------------------------------------------------
|
||||
*/
|
||||
foreach ($family as &$row) {
|
||||
|
||||
// Skip if the member is self
|
||||
if (isset($row['relationship']) && strtolower($row['relationship']) == 'self') {
|
||||
if (strtolower($row['relationship'] ?? '') === 'self') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// For dependents
|
||||
if (isset($row['temp']['premium_type']) && $row['temp']['premium_type'] == 1) {
|
||||
if (($row['temp']['premium_type'] ?? null) == 1) {
|
||||
|
||||
if (!$dependentRataGiven && isset($row['data_from']) && $row['data_from'] === 'excel') {
|
||||
// First eligible dependent keeps premium
|
||||
// FIRST excel dependent keeps premium
|
||||
if (!$dependentRataGiven && ($row['data_from'] ?? '') === 'excel') {
|
||||
$dependentRataGiven = true;
|
||||
} else if(isset($row['data_from']) && $row['data_from'] === 'excel'){
|
||||
} else if (($row['data_from'] ?? '') === 'excel') {
|
||||
$row['policy_details']['rata_premimum'] = 0;
|
||||
$row['policy_details']['gst'] = 0;
|
||||
}
|
||||
|
||||
if($reset_family_premium == true && isset($row['data_from']) && $row['data_from'] === 'excel'){
|
||||
$row['policy_details']['rata_premimum'] = 0;
|
||||
$row['policy_details']['gst'] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $family;
|
||||
@ -2950,6 +2962,7 @@ if (!function_exists('validatet_family_floter_rata_premium')) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!function_exists('validate_excel_value')) {
|
||||
function validate_excel_value($value, $data_type, $format = null, $allowed_values = null)
|
||||
{
|
||||
@ -3402,9 +3415,6 @@ if (!function_exists('calculateMotorPolicyAmounts')) {
|
||||
$std_bp_per = floatval($data['standard_bp_percentage'] ?? 0);
|
||||
$std_tp_per = floatval($data['standard_tp_percentage'] ?? 0);
|
||||
|
||||
$actual_bp_amt = floatval($data['actual_bp_brokerage_amount'] ?? 0);
|
||||
$actual_tp_amt = floatval($data['actual_tp_brokerage_amount'] ?? 0);
|
||||
|
||||
// Determine GST %
|
||||
$gst_per = ($igst > 0) ? $igst : ($cgst + $sgst);
|
||||
|
||||
@ -3447,20 +3457,12 @@ if (!function_exists('calculateMotorPolicyAmounts')) {
|
||||
(($tp * $std_tp_per) / 100);
|
||||
}
|
||||
|
||||
// Variance
|
||||
$variance =
|
||||
($actual_bp_amt + $actual_tp_amt) - $expected_amount;
|
||||
|
||||
// Final return array
|
||||
return [
|
||||
'tp_total' => round($tpTotal, 2),
|
||||
'gst_per' => round($gst_per, 2),
|
||||
'gst_amount' => round($gst_amount, 2),
|
||||
'total_amount' => round($total_amount, 2),
|
||||
'expected_amount' => round($expected_amount, 2),
|
||||
'variance' => round($variance, 2),
|
||||
'actual_bp_amount'=> $actual_bp_amt,
|
||||
'actual_tp_amount'=> $actual_tp_amt,
|
||||
];
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
|
||||
57
app/Models/EmployeeRetailPolicy.php
Normal file
57
app/Models/EmployeeRetailPolicy.php
Normal file
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class EmployeeRetailPolicy extends Model
|
||||
{
|
||||
protected $table = 'employee_retail_policies';
|
||||
protected $primaryKey = 'id';
|
||||
protected $allowedFields = [
|
||||
'id',
|
||||
'emp_id',
|
||||
'insurer_id',
|
||||
'policy_type_id',
|
||||
'policy_no',
|
||||
'policy_start_date',
|
||||
'policy_end_date',
|
||||
'created_by',
|
||||
'updated_at',
|
||||
'created_at',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -1890,6 +1890,9 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/inception/list2') ?>">Policy 2</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/policy_tranction/endorsement/list') ?>">Endorsement</a>
|
||||
</li>
|
||||
|
||||
@ -1105,6 +1105,11 @@
|
||||
$('#table_tr_37').show();
|
||||
}
|
||||
|
||||
if (res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7 || res.data.client_type == 2) {
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
}
|
||||
|
||||
// if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){
|
||||
// $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false);
|
||||
// }else{
|
||||
|
||||
@ -2160,6 +2160,12 @@
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
if (res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7 || res.data.client_type == 2) {
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
}
|
||||
|
||||
}, 4000)
|
||||
|
||||
// Set additional fields
|
||||
|
||||
6498
app/Views/policy_transaction_inception_form_2.php
Normal file
6498
app/Views/policy_transaction_inception_form_2.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -1768,4 +1768,17 @@ function removePolicyTransaction(input, pt_id, policy_type_id) {
|
||||
});
|
||||
}
|
||||
|
||||
function showForm(form) {
|
||||
|
||||
if (form == 1) {
|
||||
$('#form1').show();
|
||||
$('#form2').hide();
|
||||
}
|
||||
|
||||
if (form == 2) {
|
||||
$('#form1').hide();
|
||||
$('#form2').show();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
1784
app/Views/policy_transaction_inception_list_2.php
Normal file
1784
app/Views/policy_transaction_inception_list_2.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,7 +7,7 @@
|
||||
<button class="scroll-btn left-btn" type="button">◀</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active" id="general_tab">
|
||||
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active-tab active" id="general_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Policy</span>
|
||||
</a>
|
||||
|
||||
90
app/Views/pt_form_file_upload_tab_2.php
Normal file
90
app/Views/pt_form_file_upload_tab_2.php
Normal file
@ -0,0 +1,90 @@
|
||||
<div class="row" id="pt_onboarding" style="position: relative; bottom: 25px; display:none;">
|
||||
<div class="col-xl-12">
|
||||
<div class="card-body">
|
||||
<div class="tab-wrapper position-relative">
|
||||
<ul class="nav nav-pills navtab-bg" id="myTab">
|
||||
<li class="nav-item d-flex justify-content-center align-items-center">
|
||||
<button class="scroll-btn left-btn" type="button">◀</button>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#form" data-toggle="tab" aria-expanded="false" class="nav-link px-3 py-2 active-tab active" id="general_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-contacts"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Policy</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#KYC-DOC-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab2">
|
||||
<span class="mr-1"><i class="mdi mdi-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">KYC Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" id="hide_file_upload" style="display: none;">
|
||||
<a href="#fileupload" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="kyc_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">File Upload</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item" id="hide_vehicle_tab" style="display: none;">
|
||||
<a href="#vehicle-docs-tab" data-toggle="tab" aria-expanded="true" class="nav-link px-3 py-2" id="vehicle_tab">
|
||||
<span class="mr-1"><i class="mdi mdi-file"></i></span>
|
||||
<span class="d-none d-sm-inline-block">Vehicle Docs</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item d-flex justify-content-center align-items-center">
|
||||
<!-- Right Arrow -->
|
||||
<button class="scroll-btn right-btn" type="button">▶</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-content">
|
||||
<?php include('policy_transaction_inception_form_2.php'); ?>
|
||||
<?php include('drive_file_upload.php'); ?>
|
||||
<?php include('client_kyc.php'); ?>
|
||||
<?php include('vehicle_docs.php'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#kyc_tab').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
if (!ptId) { // Check if ptId is empty or null
|
||||
e.preventDefault(); // Prevent the tab from opening
|
||||
$('#g_drive_file_upload_sbt_btn').hide()
|
||||
toastr.warning('Please create Policy before proceeding to File Upload.');
|
||||
} else {
|
||||
$('#g_drive_file_upload_sbt_btn').show()
|
||||
}
|
||||
});
|
||||
|
||||
$('#kyc_tab2').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
if (!ptId) { // Check if ptId is empty or null
|
||||
e.preventDefault(); // Prevent the tab from opening
|
||||
$('#btn_other_docs').hide()
|
||||
toastr.warning('Please create Policy before proceeding to File Upload.');
|
||||
} else {
|
||||
$('#btn_other_docs').show()
|
||||
}
|
||||
});
|
||||
|
||||
$('#vehicle_tab').on('click', function(e) {
|
||||
var ptId = $('#policy_tranction_primarykey').val();
|
||||
|
||||
if (!ptId) { // Check if ptId is empty or null
|
||||
e.preventDefault(); // Prevent the tab from opening
|
||||
$('#vehicle_file_upload_sbt_btn').hide()
|
||||
toastr.warning('Please create Policy before proceeding to File Upload.');
|
||||
} else {
|
||||
$('#vehicle_file_upload_sbt_btn').show()
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user