Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
d21a38931c
@ -4,6 +4,8 @@ namespace App\Controllers;
|
|||||||
|
|
||||||
use CodeIgniter\Controller;
|
use CodeIgniter\Controller;
|
||||||
use Kint;
|
use Kint;
|
||||||
|
use Ramsey\Uuid\Uuid;
|
||||||
|
|
||||||
|
|
||||||
class ICICILombardController extends AdminController
|
class ICICILombardController extends AdminController
|
||||||
{
|
{
|
||||||
@ -40,7 +42,12 @@ class ICICILombardController extends AdminController
|
|||||||
|
|
||||||
public function createEnrollmentBatch()
|
public function createEnrollmentBatch()
|
||||||
{
|
{
|
||||||
helper('api');
|
|
||||||
|
|
||||||
|
$client_id = $this->request->getGet('client_id');
|
||||||
|
$client_branch_id = $this->request->getGet('client_branch_id');
|
||||||
|
$policy_id = $this->request->getGet('policy_id');
|
||||||
|
$event = $this->request->getGet('event');
|
||||||
|
|
||||||
//fetch token
|
//fetch token
|
||||||
$tokenResponse = $this->generateAuthToken();
|
$tokenResponse = $this->generateAuthToken();
|
||||||
@ -52,58 +59,35 @@ class ICICILombardController extends AdminController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$token = $tokenResponse['data']['access_token'];
|
$token = $tokenResponse['data']['access_token'];
|
||||||
// dd($token);
|
|
||||||
|
|
||||||
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation';
|
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation';
|
||||||
$headers = [
|
$headers = [
|
||||||
'Authorization: Bearer ' . $token,
|
'Authorization: Bearer ' . $token,
|
||||||
'Content-Type: application/json',
|
'Content-Type: application/json',
|
||||||
//'Scope: esbgpabatchcreation'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
#old policy info start
|
|
||||||
#"PolicyNumber" => "4016/A/51974976/00/000",
|
|
||||||
# "CDBGAccountNumber" => "CD-MUM-3344",
|
|
||||||
#"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f",
|
|
||||||
#old policy inf end
|
|
||||||
|
|
||||||
#"EmployeeMemberId" => "EMPID3625556",
|
//Prepare body data
|
||||||
|
$db = \Config\Database::connect();
|
||||||
|
$data = $db->table('employee_polices ep')
|
||||||
|
->select('cp.policy_no as policyNumber,
|
||||||
|
e.id,e.emp_code as MemberEmpId, e.doj as DOJ, e.name as InsuredName, e.dob as DOB, e.relationship as Relationship,
|
||||||
|
e.gender as Gender, ep.date_coverage as DOC,ep.basic_cover_si as SumInsured, e.email_corporate as EmailId
|
||||||
|
')
|
||||||
|
->join('employees e', 'e.id = ep.employee_id')
|
||||||
|
->join('client_policy cp', 'ep.client_policy_id = cp.id')
|
||||||
|
->where('ep.client_policy_id', $policy_id)
|
||||||
|
->where('ep.status', 'active')
|
||||||
|
->where('ep.is_active', 1)
|
||||||
|
// ->where('ep.uhid', null)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
$body = $this->formatPolicyData($data);
|
||||||
|
dd($body);
|
||||||
|
|
||||||
$body = [
|
$response = call_third_party_api($url, 'POST', $headers, $body, true); // true = raw body mode
|
||||||
"PolicyNumber" => "4016/A/O/53077718/00/000",
|
|
||||||
"CDBGAccountNumber" => "CD-MUM-0026",
|
|
||||||
"CorrelationId" => "550e8400-e29b-41d4-a716-446655440001",
|
|
||||||
"MemberDetails" => [
|
|
||||||
[
|
|
||||||
"MemberEmpId" => "EMPID3625557",
|
|
||||||
"DOJ" => "21-MAR-2019",
|
|
||||||
"InsuredName" => "Kumar",
|
|
||||||
"DOB" => "7-JUL-1983",
|
|
||||||
"Relationship" => "SELF",
|
|
||||||
"Gender" => "MALE",
|
|
||||||
"DOC" => "08-JUL-2025",
|
|
||||||
"SumInsured" => "400000",
|
|
||||||
"EmailId" => "KUMAR@GMAIL.COM",
|
|
||||||
"FlagStatus" => "A"
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"MemberEmpId" => "EMPID3625557",
|
|
||||||
"DOJ" => "21-MAR-2019",
|
|
||||||
"InsuredName" => "Saranya",
|
|
||||||
"DOB" => "8-AUG-1970",
|
|
||||||
"Relationship" => "MOTHER",
|
|
||||||
"Gender" => "FEMALE",
|
|
||||||
"DOC" => "08-JUL-2025",
|
|
||||||
"SumInsured" => "400000",
|
|
||||||
"EmailId" => "Saranya@GMAIL.COM",
|
|
||||||
"FlagStatus" => "A"
|
|
||||||
],
|
|
||||||
]
|
|
||||||
];
|
|
||||||
// Kint::dump($body);
|
|
||||||
// print_rr(json_encode($body));
|
|
||||||
// dd();
|
|
||||||
$response = call_third_party_api($url, 'POST', $headers, ($body),true); // true = raw body mode
|
|
||||||
// print_rr(json_encode($response));die();
|
// print_rr(json_encode($response));die();
|
||||||
return $this->response->setJSON($response);
|
return $this->response->setJSON($response);
|
||||||
}
|
}
|
||||||
@ -178,5 +162,105 @@ class ICICILombardController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function formatPolicyData($data)
|
||||||
|
{
|
||||||
|
// Helper to format date
|
||||||
|
$formatDate = function ($date) {
|
||||||
|
return strtoupper(date('j-M-Y', strtotime($date))); // Example: 7-JUL-1983
|
||||||
|
};
|
||||||
|
|
||||||
|
// Generate UUID v4 for CorrelationId
|
||||||
|
$generateUUID = function () {
|
||||||
|
return sprintf(
|
||||||
|
'%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0x0fff) | 0x4000,
|
||||||
|
mt_rand(0, 0x3fff) | 0x8000,
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Map MemberDetails
|
||||||
|
$memberDetails = array_map(function ($row) use ($formatDate) {
|
||||||
|
return [
|
||||||
|
"MemberEmpId" => $row['MemberEmpId'],
|
||||||
|
"DOJ" => $formatDate($row['DOJ']),
|
||||||
|
"InsuredName" => $row['InsuredName'],
|
||||||
|
"DOB" => $formatDate($row['DOB']),
|
||||||
|
"Relationship" => strtoupper($row['Relationship']),
|
||||||
|
"Gender" => strtoupper($row['Gender']),
|
||||||
|
"DOC" => $formatDate($row['DOC']),
|
||||||
|
"SumInsured" => $row['SumInsured'],
|
||||||
|
"EmailId" => $row['EmailId'],
|
||||||
|
"FlagStatus" => "A" // fixed value
|
||||||
|
];
|
||||||
|
}, $data);
|
||||||
|
|
||||||
|
// Final body
|
||||||
|
return [
|
||||||
|
"PolicyNumber" => $data[0]['policyNumber'] ?? null,
|
||||||
|
"CDBGAccountNumber" => "CD-MUM-0026",
|
||||||
|
"CorrelationId" => $generateUUID(),
|
||||||
|
"MemberDetails" => $memberDetails
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// $body = [
|
||||||
|
// "PolicyNumber" => "4016/A/O/53077718/00/000",
|
||||||
|
// "CDBGAccountNumber" => "CD-MUM-0026",
|
||||||
|
// "CorrelationId" => "550e8400-e29b-41d4-a716-446655440001",
|
||||||
|
// "MemberDetails" => [
|
||||||
|
// [
|
||||||
|
// "MemberEmpId" => "EMPID3625557",
|
||||||
|
// "DOJ" => "21-MAR-2019",
|
||||||
|
// "InsuredName" => "Kumar",
|
||||||
|
// "DOB" => "7-JUL-1983",
|
||||||
|
// "Relationship" => "SELF",
|
||||||
|
// "Gender" => "MALE",
|
||||||
|
// "DOC" => "08-JUL-2025",
|
||||||
|
// "SumInsured" => "400000",
|
||||||
|
// "EmailId" => "KUMAR@GMAIL.COM",
|
||||||
|
// "FlagStatus" => "A"
|
||||||
|
// ],
|
||||||
|
// [
|
||||||
|
// "MemberEmpId" => "EMPID3625557",
|
||||||
|
// "DOJ" => "21-MAR-2019",
|
||||||
|
// "InsuredName" => "Saranya",
|
||||||
|
// "DOB" => "8-AUG-1970",
|
||||||
|
// "Relationship" => "MOTHER",
|
||||||
|
// "Gender" => "FEMALE",
|
||||||
|
// "DOC" => "08-JUL-2025",
|
||||||
|
// "SumInsured" => "400000",
|
||||||
|
// "EmailId" => "Saranya@GMAIL.COM",
|
||||||
|
// "FlagStatus" => "A"
|
||||||
|
// ],
|
||||||
|
// ]
|
||||||
|
// ];
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -145,7 +145,7 @@ class VidalApiController extends BaseController
|
|||||||
'Authorization:' .getenv('VIDAL_API_KEY').'',
|
'Authorization:' .getenv('VIDAL_API_KEY').'',
|
||||||
];
|
];
|
||||||
|
|
||||||
$body = [
|
$body = [
|
||||||
'username' => getenv('VIDAL_API_USERNAME'),
|
'username' => getenv('VIDAL_API_USERNAME'),
|
||||||
'password' => getenv('VIDAL_API_PASSWORD'),
|
'password' => getenv('VIDAL_API_PASSWORD'),
|
||||||
'policyNo' => $postData['policyNo'] ?? '',
|
'policyNo' => $postData['policyNo'] ?? '',
|
||||||
@ -191,9 +191,8 @@ class VidalApiController extends BaseController
|
|||||||
return $this->response->setJSON($response);
|
return $this->response->setJSON($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function enrollment()
|
||||||
|
{
|
||||||
public function enrollment(){
|
|
||||||
|
|
||||||
$postData = $this->request->getJSON(true);
|
$postData = $this->request->getJSON(true);
|
||||||
|
|
||||||
|
|||||||
@ -882,6 +882,7 @@ if (isset($selected_lead_type)) {
|
|||||||
if (data.salse_person_id) {
|
if (data.salse_person_id) {
|
||||||
selecSalsePerson(data.salse_person_id);
|
selecSalsePerson(data.salse_person_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
console.error('Error in dynamicLeadsDataForEdit function:', error);
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -1147,6 +1148,22 @@ if (isset($selected_lead_type)) {
|
|||||||
dateFormat: "d-m-Y"
|
dateFormat: "d-m-Y"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
let selectedOption = $('#contact_person_summary option').filter(function () {
|
||||||
|
return $(this).text().trim() === (data.contact_person_name || '').trim();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (selectedOption.length) {
|
||||||
|
selectedOption.prop('selected', true);
|
||||||
|
console.log("Selected option:", selectedOption.text().trim(), "Value:", selectedOption.val());
|
||||||
|
} else {
|
||||||
|
console.log("No match found for:", data.contact_person_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#contact_person_summary').trigger('change');
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3110,6 +3110,7 @@
|
|||||||
let unique_id = $(input).data('count');
|
let unique_id = $(input).data('count');
|
||||||
let client_id = $('#client_id').val();
|
let client_id = $('#client_id').val();
|
||||||
let client_type = $('#client_type').val();
|
let client_type = $('#client_type').val();
|
||||||
|
let policy_type_id = $('#policy_type_id').val();
|
||||||
let insurer_id = $(input).find('option:selected').attr('data-id');
|
let insurer_id = $(input).find('option:selected').attr('data-id');
|
||||||
let insurer_branch_id = $(input).find('option:selected').attr('data-bid');
|
let insurer_branch_id = $(input).find('option:selected').attr('data-bid');
|
||||||
|
|
||||||
@ -3120,7 +3121,7 @@
|
|||||||
console.log('follow_insurer_id unique_id', unique_id);
|
console.log('follow_insurer_id unique_id', unique_id);
|
||||||
|
|
||||||
if(client_id && insurer_id){
|
if(client_id && insurer_id){
|
||||||
if(client_type == 1){
|
if(client_type == 1 && policy_type_id > 7){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id + '/' + insurer_branch_id,
|
url: '<?= base_url("/util/getCDAccNoByClientAndInsurer/") ?>' + client_id + '/' + insurer_id + '/' + insurer_branch_id,
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -3328,8 +3329,10 @@
|
|||||||
|
|
||||||
$("#inception_form_id").submit(function(event) {
|
$("#inception_form_id").submit(function(event) {
|
||||||
|
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
let policy_type_id = $('#policy_type_id').val();
|
||||||
var isValid = $('#inception_form_id').parsley().validate();
|
var isValid = $('#inception_form_id').parsley().validate();
|
||||||
var client_type_id = $('#client_type').val();
|
var client_type_id = $('#client_type').val();
|
||||||
var policy_status = $('#policy_status').val();
|
var policy_status = $('#policy_status').val();
|
||||||
@ -3350,7 +3353,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client_type_id == 1 && policy_status == 'completed'){
|
if(client_type_id == 1 && policy_status == 'completed' && policy_type_id > 7){
|
||||||
|
|
||||||
let isAnyDropdownSelected = $('select[name="cd_ac_no_for_child[]"]').filter(function() {
|
let isAnyDropdownSelected = $('select[name="cd_ac_no_for_child[]"]').filter(function() {
|
||||||
return $(this).val() !== "";
|
return $(this).val() !== "";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user