diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index c92798d5..c4d1de44 100755
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -362,15 +362,18 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
-
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
+
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
$routes->post("getChatResponse", "ChatBotController::getChatResponse");
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
+
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
+
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
+
$routes->get("getEmployeeAndDependence", "EmployeeRestController::getEmployeeAndDependence");
$routes->post("editEmployeeAndDependence", "EmployeeRestController::editEmployeeAndDependence");
$routes->post("addEmployeeAndDependence", "EmployeeRestController::addEmployeeAndDependence");
diff --git a/app/Controllers/ChatBotController.php b/app/Controllers/ChatBotController.php
index 71001f95..afc79b5e 100755
--- a/app/Controllers/ChatBotController.php
+++ b/app/Controllers/ChatBotController.php
@@ -147,17 +147,28 @@ class ChatBotController extends AdminController
$text = $this->request->getVar('text');
$value = $this->request->getVar('value');
+
$Data = $this->ChatBotModel->where('options', $text)->where('is_active', 1 )->first();
+
if($Data){
if($Data['options'] == 'Please Enter Your Mobile Number To View Your Policies')
{
+
$result = $this->getAllPolicyByMobileNumber($value,'text');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
+
}else if($Data['options'] == 'Please Enter Your Mobile Number To Raise Claim'){
+
$result = $this->getAllPolicyByMobileNumber($value,'options');
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
- }
+
+ }else if( $Data['options'] == 'Enter Your Claim Number'){
+
+ $result = $this->getTicket($value,$emp_code,$client_id);
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
+
+ }
}else{
@@ -192,10 +203,11 @@ class ChatBotController extends AdminController
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
+
}else{
- $result = $this->sendDefaultMessage();
- return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
+ $result = $this->sendDefaultMessage();
+ return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
}
}
@@ -396,6 +408,40 @@ class ChatBotController extends AdminController
}
}
+ public function getTicket($value, $emp_code, $client_id)
+ {
+ // Construct the URL with query parameters
+ $url = 'https://venbait.in/nhance/helpdesk/dev/api/tickets/show/' . $value;
+
+ $token = 'uncp8FvG310bEyYdV9MmStlo7KDRZ65fLWTeXCI2JzwPrNHjBqQhUiAgxsaO';
+ $headers = [
+ 'Token: ' . $token,
+ ];
+
+ // Initialize cURL session
+ $ch = curl_init();
+
+ // Set cURL options
+ curl_setopt($ch, CURLOPT_URL, $url);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+
+ // Execute cURL request
+ $response = curl_exec($ch);
+
+ // Check for errors
+ if (curl_errno($ch)) {
+ $error = curl_error($ch);
+ curl_close($ch);
+ return ['status' => 'failed', 'response' => $error];
+ } else {
+ // Close cURL session
+ curl_close($ch);
+ return ['status' => 'success', 'response' => $response];
+ }
+ }
+
+
diff --git a/app/Controllers/EmployeeRestController.php b/app/Controllers/EmployeeRestController.php
index ed934ed8..8ad5366a 100755
--- a/app/Controllers/EmployeeRestController.php
+++ b/app/Controllers/EmployeeRestController.php
@@ -1411,10 +1411,7 @@ class EmployeeRestController extends AdminController
}
}
- public function getGTLIPolicy($empData,$emp_code,$client_id,$client_branch_id)
- {
-
- }
+
public function FloterConvertion($array){
@@ -1948,7 +1945,7 @@ class EmployeeRestController extends AdminController
$client_policy_id = $this->request->getVar('client_policy_id') ?? $clientPolicyId;
$emp_code = $this->request->getVar('emp_code') ?? $empCode;
$default_si = $this->request->getVar('si') ?? $default_si;// si amt which choosed in add on policy
-
+ $client_branch_id = $this->request->getVar('client_branch_id') ?? $client_branch_id;
// dd($client_policy_id);
@@ -2219,7 +2216,6 @@ class EmployeeRestController extends AdminController
{
if($this->request->getGet('type') == 'Active'){ $policy_status = 1; }else{ $policy_status = 0; }
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.policy_type as policy_type,insurers.name as insurer_name,tpa.name as tpa_name')
-
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
@@ -2227,9 +2223,10 @@ class EmployeeRestController extends AdminController
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id') )
->where('client_policy.is_active', 1 )
->where('client_policy.policy_status', $policy_status)
+ ->where('client_policy.enrolment_visibility', 1 )
->orderby('client_policy.id' , 'ASC')
->findAll();
-// dd($ClientPolicyData);
+
// Retrieve employee and dependents data by passing the employee code
$employeeData = $this->employeeModel->where('emp_code',$this->request->getGet('emp_code'))
->where('client_id',$this->request->getGet('client_id'))
@@ -2278,10 +2275,11 @@ class EmployeeRestController extends AdminController
if($ClientPolicyValue['policy_type_id'] == 4){ $data['heading'] = 'Group Medical Coverage - Top Up'; }else
if($ClientPolicyValue['policy_type_id'] == 5){ $data['heading'] = 'Group Medical Coverage - Parents (Top Up)'; }
- if($ClientPolicyValue['policy_type_id'] == 1){ $data['floter_text_heading'] = 'Sum Insured'; }
- else
+ if($ClientPolicyValue['policy_type_id'] == 1 || $ClientPolicyValue['policy_type_id'] == 6 || $ClientPolicyValue['policy_type_id'] == 7)
{
- if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
+ $data['floter_text_heading'] = 'Sum Insured';
+ }else{
+ if($terms->family_floater == 1){ $data['floter_text_heading'] = 'Floter Sum Insured'; }else{ $data['floter_text_heading'] = 'Sum Insured'; }
}
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
diff --git a/app/Controllers/PolicyTransactionController.php b/app/Controllers/PolicyTransactionController.php
index f3cdc177..eb676b0c 100644
--- a/app/Controllers/PolicyTransactionController.php
+++ b/app/Controllers/PolicyTransactionController.php
@@ -80,15 +80,14 @@ class PolicyTransactionController extends BaseController
$this->employeeModel = new EmployeeModel();
$this->userTeamsModel = new UserTeamsModel();
$this->userModel = new UserModel();
- $this->employeePolicyModel = new EmployeePolicyModel();
- $this->insurerStatements = new InsurerStatements();
- $this->invPaymentDetailsModel = new InvPaymentDetailsModel();
+ $this->employeePolicyModel = new EmployeePolicyModel();
+ $this->insurerStatements = new InsurerStatements();
+ $this->invPaymentDetailsModel = new InvPaymentDetailsModel();
$this->invoiceStatus = [
'pending' => 'Pending',
'generated' => 'Generated',
'sent' => 'Sent',
'payment_received' => 'Payment Received',
-
];
}
@@ -147,6 +146,7 @@ class PolicyTransactionController extends BaseController
clients.client_name,
client_branch.branch_name AS client_branch_name,
insurers.name AS insurer_name,
+ insurers.short_name AS insurer_short_name,
policy_type.policy_type,
pt_co_share_details.agreed_amt AS amount,
pt_co_share_details.bp_amt AS bp,
@@ -155,7 +155,7 @@ class PolicyTransactionController extends BaseController
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
- ->join('insurers', 'policy_transaction.insurer_id = insurers.id', 'left')
+ ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id', 'left')
->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.is_active', 1)
@@ -321,7 +321,6 @@ class PolicyTransactionController extends BaseController
return $this->respondError("Failed to update policy transaction");
}
-
private function insertOrUpdateCoShareDetails($data, $pt_id)
{
// Prepare data for insertion and updating
@@ -671,12 +670,14 @@ class PolicyTransactionController extends BaseController
clients.short_name as client_short_name,
clients.client_code,
client_branch.branch_name as client_branch_name,
- insurers.name as insurer_name,
+ insurers.name AS insurer_name,
+ insurers.short_name AS insurer_short_name,
policy_type.policy_type
')
+ ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'policy_transaction.client_id = clients.id', 'left')
->join('client_branch', 'policy_transaction.client_branch_id = client_branch.id', 'left')
- ->join('insurers', 'policy_transaction.insurer_id = insurers.id','left')
+ ->join('insurers', 'pt_co_share_details.insurer_id = insurers.id','left')
->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.is_active', 1)
@@ -696,7 +697,6 @@ class PolicyTransactionController extends BaseController
$this->loadLayout('policy_transaction_endorsement_list', $data);
}
-
public function createEndorsementPolicy()
{
$id = $this->request->getPost('id');
@@ -712,7 +712,7 @@ class PolicyTransactionController extends BaseController
private function preparePolicyTransactionData()
{
$data = $this->request->getPost();
- // print_r($data);
+ // print_r($data); die;
$data_received_date = (string)$this->request->getPost('data_received_date');
$closure_date = (string)$this->request->getPost('closure_date');
@@ -730,11 +730,57 @@ class PolicyTransactionController extends BaseController
$issue_type = $this->policyTransactionModel
->where('action_type', 'inception')
->where('client_id', $this->request->getPost('client_id'))
- ->where('client_branch_id', $this->request->getPost('client_branch_id'))
+ ->where('client_policy_id', $this->request->getPost('client_policy_id'))
->first();
+
$data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1);
- // print_r($data); die;
+ $client_branch_id = $data['client_branch_id'];
+ if($data['client_branch_id'] == ""){
+ $client_branch_id = $issue_type['client_branch_id'];
+ }
+
+ if(!$data['id']){
+ $data += [
+ 'issuer' => $issue_type['issuer'] ?? null,
+ 'client_type' => $data['client_type'] ?? $issue_type['client_type'] ?? null,
+ 'policy_type_id' => $issue_type['policy_type_id'] ?? null,
+ 'policy_type_id' => $issue_type['policy_type_id'] ?? null,
+ 'issue_type' => $issue_type['issue_type'] ?? null,
+ 'source_client_policy_id' => $issue_type['source_client_policy_id'] ?? null,
+ 'cd_ac_no' => $issue_type['issue_type'] ?? null,
+ 'policy_issue_date' => $issue_type['policy_issue_date'] ?? null,
+ 'policy_start_date' => $issue_type['policy_start_date'] ?? null,
+ 'policy_end_date' => $issue_type['policy_end_date'] ?? null,
+ 'revenue_type' => $issue_type['revenue_type'] ?? null,
+ 'co_share' => $issue_type['co_share'] ?? 0,
+ 'bro_payable_by' => $issue_type['bro_payable_by'] ?? 0,
+ 'installment' => $issue_type['installment'] ?? null,
+ 'installment_data' => $issue_type['installment_data'] ?? null,
+ 'location' => $issue_type['location'] ?? null,
+ 'links' => $issue_type['links'] ??null,
+ 'stage' => $issue_type['stage'] ?? null,
+ 'etat' => $issue_type['etat'] ?? null,
+ 'etat_band' => $issue_type['etat_band'] ?? null,
+ 'edate' => $issue_type['edate'] ?? null,
+ 'renewal_date' => $issue_type['renewal_date'] ?? null,
+ 'rollover_date' => $issue_type['rollover_date'] ?? null,
+ 'policy_holder_name' => $issue_type['policy_holder_name'] ?? null,
+ 'same_as_proposer' => $issue_type['same_as_proposer'] ?? 1,
+ 'ref' => $issue_type['ref'] ?? null,
+ 'spl' => $issue_type['spl'] ?? null,
+ 'fund_received' => $issue_type['fund_received'] ?? null,
+ 'listed_insurers' => $issue_type['listed_insurers'] ?? null,
+ 'ppteam' => $issue_type['ppteam'] ?? null,
+ 'sales_generated_by' => $issue_type['sales_generated_by'] ?? null,
+ 'serviced_by' => $issue_type['serviced_by'] ?? null
+ ];
+
+ $data['client_branch_id'] = $client_branch_id;
+ }
+ // print_r($issue_type);
+ // print_r($data);
+ // die;
return $data;
}
@@ -744,11 +790,11 @@ class PolicyTransactionController extends BaseController
$insert = $this->policyTransactionModel->insert($data);
if ($insert) {
+
$this->insertTransactionStatus($insert, $data['status'], 1);
$this->handleCompletedStatus($data, $insert);
$this->insertOrUpdateCoShareDetails($data, $insert);
-
return $this->respond(['status' => true, 'message' => 'Endorsement transaction created successfully'], 200);
}
@@ -799,7 +845,6 @@ class PolicyTransactionController extends BaseController
}
}
-
public function getEndorsementDataForEdit($id)
{
$data = $this->policyTransactionModel
@@ -908,6 +953,7 @@ class PolicyTransactionController extends BaseController
->join('policy_transaction', 'policy_transaction.id = pt_co_share_details.pt_id')
->where('policy_transaction.client_id', $client_id)
->where('policy_transaction.client_policy_id', $client_policy_id)
+ ->where('policy_transaction.action_type', 'inception')
->findAll();
if ($totalCount) {
diff --git a/app/Views/policy_transaction_endorsement_form.php b/app/Views/policy_transaction_endorsement_form.php
index 3b7b4ae0..8478f296 100644
--- a/app/Views/policy_transaction_endorsement_form.php
+++ b/app/Views/policy_transaction_endorsement_form.php
@@ -284,13 +284,15 @@
Premium Details
+