CHANGE_Post_app_having_pre_branch_id - VADIVEL J 2025-09-03
This commit is contained in:
parent
a58b397e47
commit
ae0d624911
@ -124,6 +124,8 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->post("edit", "ClientController::editClientBranch");
|
$routes->post("edit", "ClientController::editClientBranch");
|
||||||
$routes->get("list/(:any)", "ClientController::getSingleBranchDataById/$1");
|
$routes->get("list/(:any)", "ClientController::getSingleBranchDataById/$1");
|
||||||
$routes->get("remove/(:any)", "ClientController::removeClientBranch/$1");
|
$routes->get("remove/(:any)", "ClientController::removeClientBranch/$1");
|
||||||
|
$routes->post("auto_fetch_branch","ClientController::auto_fetch_branch");
|
||||||
|
$routes->post("auto_fetch_branch_details","ClientController::auto_fetch_branch_details");
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->group("relation", ["filter" => "authMVC"], function ($routes) {
|
$routes->group("relation", ["filter" => "authMVC"], function ($routes) {
|
||||||
|
|||||||
@ -218,7 +218,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||||
$client_policy_id = array_unique($client_policy_ids2);
|
$client_policy_id = array_unique($client_policy_ids2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$client_policy_id = json_decode($policy_id, true);
|
$client_policy_id = json_decode($policy_id, true);
|
||||||
}
|
}
|
||||||
@ -233,8 +232,7 @@ class ClientController extends AdminController
|
|||||||
$mail_send_return1 = '';
|
$mail_send_return1 = '';
|
||||||
$mail_send_return2 = '';
|
$mail_send_return2 = '';
|
||||||
|
|
||||||
if (!is_null($client_policy_id) && is_array($client_policy_id))
|
if (!is_null($client_policy_id) && is_array($client_policy_id)) {
|
||||||
{
|
|
||||||
|
|
||||||
$empData = $this->employeeModel->where('emp_code', $emp_code)->where('client_id', $client_id)->where('is_active', 1)->findAll();
|
$empData = $this->employeeModel->where('emp_code', $emp_code)->where('client_id', $client_id)->where('is_active', 1)->findAll();
|
||||||
// dd($empData);
|
// dd($empData);
|
||||||
@ -243,8 +241,7 @@ class ClientController extends AdminController
|
|||||||
// dd($filteredEmpData);
|
// dd($filteredEmpData);
|
||||||
|
|
||||||
$array_list = [];
|
$array_list = [];
|
||||||
foreach ($client_policy_id as $key => $value)
|
foreach ($client_policy_id as $key => $value) {
|
||||||
{
|
|
||||||
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value, emp_code: $emp_code, client_id: $client_id, emp_status: ['draft', 'enrolled'], policy_status: ['draft', 'enrolled']);
|
$find = $this->employeeModel->getEmpFamilybyEmpCode(client_policy_id: $value, emp_code: $emp_code, client_id: $client_id, emp_status: ['draft', 'enrolled'], policy_status: ['draft', 'enrolled']);
|
||||||
if (count($find) > 0) {
|
if (count($find) > 0) {
|
||||||
$array_list[] = $find;
|
$array_list[] = $find;
|
||||||
@ -325,7 +322,6 @@ class ClientController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme("error", 'Member Review Mail Configuration not Enable for this client');
|
$this->myLogger->logme("error", 'Member Review Mail Configuration not Enable for this client');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print_r($wholeData);
|
print_r($wholeData);
|
||||||
@ -359,7 +355,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
$client_policy_ids2 = array_column($client_policy_ids, 'client_policy_id');
|
||||||
$client_policy_id = array_unique($client_policy_ids2);
|
$client_policy_id = array_unique($client_policy_ids2);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$client_policy_id = json_decode($policy_id, true);
|
$client_policy_id = json_decode($policy_id, true);
|
||||||
}
|
}
|
||||||
@ -623,6 +618,10 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// dd($data['placeHolders']);
|
// dd($data['placeHolders']);
|
||||||
|
|
||||||
|
// auto fetch client list and branch list from pre
|
||||||
|
$data['auto_fetch_client_list'] = $this->getClientListFromPre();
|
||||||
|
|
||||||
|
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_onboarding', $data);
|
echo view('client_onboarding', $data);
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
@ -644,7 +643,9 @@ class ClientController extends AdminController
|
|||||||
$data['balances'] = $balances;
|
$data['balances'] = $balances;
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
if($requestFrom == 'rest'){ return $data; }
|
if ($requestFrom == 'rest') {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_deposit_list', $data);
|
echo view('client_deposit_list', $data);
|
||||||
@ -677,8 +678,7 @@ class ClientController extends AdminController
|
|||||||
$headerData['page_name'] = 'Clients';
|
$headerData['page_name'] = 'Clients';
|
||||||
$loggedInUserID = get_session_userid();
|
$loggedInUserID = get_session_userid();
|
||||||
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
// $data['clientData']= $this->clientPolicyModel->getinsurerswithinsurenceid($insurerId);
|
||||||
if($requestFrom == 'rest')
|
if ($requestFrom == 'rest') {
|
||||||
{
|
|
||||||
$clientId = $param['client_id'];
|
$clientId = $param['client_id'];
|
||||||
$cd_ac_pk = $param['cd_ac_pk'];
|
$cd_ac_pk = $param['cd_ac_pk'];
|
||||||
} else {
|
} else {
|
||||||
@ -692,7 +692,9 @@ class ClientController extends AdminController
|
|||||||
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId, $cd_ac_pk);
|
$data['deposiamount'] = $this->clientPolicyModel->getDepositSummary($clientId, $insurerId, $cd_ac_pk);
|
||||||
$data['cd_ac_pk'] = $cd_ac_pk;
|
$data['cd_ac_pk'] = $cd_ac_pk;
|
||||||
|
|
||||||
if($requestFrom == 'rest'){ return $data; }
|
if ($requestFrom == 'rest') {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
// Load the view for the new list page;
|
// Load the view for the new list page;
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
@ -798,6 +800,10 @@ class ClientController extends AdminController
|
|||||||
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
$editData['placeHolders'] = ['member_name', 'member_mobile', 'nhance_logo', 'tpa_id', 'ecard_download_link', 'client_logo', 'policy_no', 'member_summary', 'app_link', 'post_enrollment_app_link', 'client_name'];
|
||||||
$editData['api_data'] = $this->clientApi->where("client_id", $id)->where("is_active", 1)->first();
|
$editData['api_data'] = $this->clientApi->where("client_id", $id)->where("is_active", 1)->first();
|
||||||
// dd($editData);
|
// dd($editData);
|
||||||
|
|
||||||
|
$editData['auto_fetch_client_list'] = $this->getClientListFromPre();
|
||||||
|
|
||||||
|
|
||||||
echo view('layout/header', $headerData);
|
echo view('layout/header', $headerData);
|
||||||
echo view('client_onboarding', $editData);
|
echo view('client_onboarding', $editData);
|
||||||
echo view('layout/footer');
|
echo view('layout/footer');
|
||||||
@ -1074,7 +1080,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$this->myLogger->logme('error', 'Client branch CREATE function called');
|
$this->myLogger->logme('error', 'Client branch CREATE function called');
|
||||||
$data = $this->request->getPost();
|
$data = $this->request->getPost();
|
||||||
// var_dump($data); die;
|
|
||||||
if (!isset($data['sez'])) {
|
if (!isset($data['sez'])) {
|
||||||
$data['sez'] = 0;
|
$data['sez'] = 0;
|
||||||
} elseif ($data['sez']) {
|
} elseif ($data['sez']) {
|
||||||
@ -1508,7 +1514,6 @@ class ClientController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to remove policy'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The policy has active employees'], 200);
|
return $this->respond(['status' => false, 'code' => 404, 'message' => 'The policy has active employees'], 200);
|
||||||
@ -1994,8 +1999,15 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// Check differences and prepare update data
|
// Check differences and prepare update data
|
||||||
$fields_to_check = [
|
$fields_to_check = [
|
||||||
'client_branch_id', 'policy_type', 'insurer_id', 'insurer_branch_id',
|
'client_branch_id',
|
||||||
'cd_ac_pk', 'policy_end_date', 'policy_start_date', 'tpa_id', 'tpa_branch_id'
|
'policy_type',
|
||||||
|
'insurer_id',
|
||||||
|
'insurer_branch_id',
|
||||||
|
'cd_ac_pk',
|
||||||
|
'policy_end_date',
|
||||||
|
'policy_start_date',
|
||||||
|
'tpa_id',
|
||||||
|
'tpa_branch_id'
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($fields_to_check as $field) {
|
foreach ($fields_to_check as $field) {
|
||||||
@ -2049,12 +2061,10 @@ class ClientController extends AdminController
|
|||||||
'message' => "Policy transaction(s) updated.",
|
'message' => "Policy transaction(s) updated.",
|
||||||
'updated_ids' => $updated_pt_ids
|
'updated_ids' => $updated_pt_ids
|
||||||
];
|
];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->myLogger->logme("error", "No active policy_transaction records found for update.");
|
$this->myLogger->logme("error", "No active policy_transaction records found for update.");
|
||||||
return ['status' => "Failed", 'message' => "No active policy_transaction records found."];
|
return ['status' => "Failed", 'message' => "No active policy_transaction records found."];
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->myLogger->logme("error", "Exception during policy_transaction update: " . $e->getMessage());
|
$this->myLogger->logme("error", "Exception during policy_transaction update: " . $e->getMessage());
|
||||||
return [
|
return [
|
||||||
@ -2100,7 +2110,6 @@ class ClientController extends AdminController
|
|||||||
$errors[] = "No change or failed update for ID {$row['id']}";
|
$errors[] = "No change or failed update for ID {$row['id']}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$errors[] = "Error updating pt_id {$pt_id}: " . $e->getMessage();
|
$errors[] = "Error updating pt_id {$pt_id}: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
@ -2189,7 +2198,8 @@ class ClientController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateKycPrimaryTable($client_id){
|
public function generateKycPrimaryTable($client_id)
|
||||||
|
{
|
||||||
|
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$builder = $db->table('kyc_docs kd');
|
$builder = $db->table('kyc_docs kd');
|
||||||
@ -2214,7 +2224,8 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateKycOthersTable($client_id){
|
public function generateKycOthersTable($client_id)
|
||||||
|
{
|
||||||
|
|
||||||
$result['data'] = $this->clientKYCDocsModel
|
$result['data'] = $this->clientKYCDocsModel
|
||||||
->where('is_active', 1)
|
->where('is_active', 1)
|
||||||
@ -3867,7 +3878,6 @@ class ClientController extends AdminController
|
|||||||
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
||||||
|
|
||||||
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$data[$key] = $value;
|
$data[$key] = $value;
|
||||||
@ -4534,7 +4544,6 @@ class ClientController extends AdminController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$client_insert = $this->clientModel->insert($client_data);
|
$client_insert = $this->clientModel->insert($client_data);
|
||||||
|
|
||||||
} else if ($client_type == 1) {
|
} else if ($client_type == 1) {
|
||||||
|
|
||||||
$client_data = [
|
$client_data = [
|
||||||
@ -4660,7 +4669,6 @@ class ClientController extends AdminController
|
|||||||
];
|
];
|
||||||
|
|
||||||
$client_insert = $this->clientModel->insert($client_data);
|
$client_insert = $this->clientModel->insert($client_data);
|
||||||
|
|
||||||
} else if ($client_type == 1) {
|
} else if ($client_type == 1) {
|
||||||
|
|
||||||
$client_data = [
|
$client_data = [
|
||||||
@ -4738,11 +4746,9 @@ class ClientController extends AdminController
|
|||||||
'vehicles' => $vehicles,
|
'vehicles' => $vehicles,
|
||||||
'message' => 'Vehicle created successfully'
|
'message' => 'Vehicle created successfully'
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (isset($data['owner']) && !empty($data['owner'])) {
|
} else if (isset($data['owner']) && !empty($data['owner'])) {
|
||||||
|
|
||||||
$vehicle_data = [
|
$vehicle_data = [
|
||||||
@ -4784,7 +4790,6 @@ class ClientController extends AdminController
|
|||||||
'vehicles' => $vehicles,
|
'vehicles' => $vehicles,
|
||||||
'message' => 'Vehicle created successfully'
|
'message' => 'Vehicle created successfully'
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
return $this->respond(['status' => false, 'message' => 'Failed to created vehicle'], 200);
|
||||||
}
|
}
|
||||||
@ -5043,11 +5048,9 @@ class ClientController extends AdminController
|
|||||||
if (in_array($data[$i]['policy_type_id'], [2, 3]) && $is_addon == 1) {
|
if (in_array($data[$i]['policy_type_id'], [2, 3]) && $is_addon == 1) {
|
||||||
|
|
||||||
$payable_arr = ["self" => 0, "spouse" => 0, "childern" => 0, "elders" => 0,];
|
$payable_arr = ["self" => 0, "spouse" => 0, "childern" => 0, "elders" => 0,];
|
||||||
|
|
||||||
} else if ($data[$i]['policy_type_id'] == 3 && $is_addon == 3) {
|
} else if ($data[$i]['policy_type_id'] == 3 && $is_addon == 3) {
|
||||||
|
|
||||||
$payable_arr = ["self" => 1, "spouse" => 1, "childern" => 1, "elders" => 1,];
|
$payable_arr = ["self" => 1, "spouse" => 1, "childern" => 1, "elders" => 1,];
|
||||||
|
|
||||||
} else if (in_array($data[$i]['policy_type_id'], [4, 5])) {
|
} else if (in_array($data[$i]['policy_type_id'], [4, 5])) {
|
||||||
|
|
||||||
$payable_arr = ["self" => 1, "spouse" => 1, "childern" => 1, "elders" => 1,];
|
$payable_arr = ["self" => 1, "spouse" => 1, "childern" => 1, "elders" => 1,];
|
||||||
@ -5110,7 +5113,6 @@ class ClientController extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// add is_payable_employee for the GMC Policy
|
// add is_payable_employee for the GMC Policy
|
||||||
@ -5137,7 +5139,6 @@ class ClientController extends AdminController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($orderedPolicyTerms as $term) {
|
foreach ($orderedPolicyTerms as $term) {
|
||||||
@ -5208,7 +5209,6 @@ class ClientController extends AdminController
|
|||||||
if (!isset($policyTerms['enrollment_display_key'])) {
|
if (!isset($policyTerms['enrollment_display_key'])) {
|
||||||
$policyTerms['enrollment_display_key'] = $this->existingGMCDisplayValueTransform($policyTerms);
|
$policyTerms['enrollment_display_key'] = $this->existingGMCDisplayValueTransform($policyTerms);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ($data[$i]['policy_type_id'] == 1) {
|
} else if ($data[$i]['policy_type_id'] == 1) {
|
||||||
|
|
||||||
if (!isset($policyTerms['medical_expenses_medical_extension'])) {
|
if (!isset($policyTerms['medical_expenses_medical_extension'])) {
|
||||||
@ -5254,7 +5254,6 @@ class ClientController extends AdminController
|
|||||||
if (!isset($policyTerms['enrollment_display_key'])) {
|
if (!isset($policyTerms['enrollment_display_key'])) {
|
||||||
$policyTerms['enrollment_display_key'] = $this->existingGPADisplayValueTransform($policyTerms);
|
$policyTerms['enrollment_display_key'] = $this->existingGPADisplayValueTransform($policyTerms);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($policyTerms);
|
// dd($policyTerms);
|
||||||
@ -5843,11 +5842,7 @@ class ClientController extends AdminController
|
|||||||
$base_policy_id = $client_policy_details['base_policy'] ?? 0;
|
$base_policy_id = $client_policy_details['base_policy'] ?? 0;
|
||||||
|
|
||||||
if (!empty($base_policy_id)) {
|
if (!empty($base_policy_id)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6588,7 +6583,6 @@ class ClientController extends AdminController
|
|||||||
$emptyKeyData[$key] = $value;
|
$emptyKeyData[$key] = $value;
|
||||||
} else {
|
} else {
|
||||||
$others[$key] = $value;
|
$others[$key] = $value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6770,7 +6764,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
if (!empty($receivedData['id'])) {
|
if (!empty($receivedData['id'])) {
|
||||||
$status = $this->clientApi->save($receivedData);
|
$status = $this->clientApi->save($receivedData);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$status = $this->clientApi->insert($receivedData);
|
$status = $this->clientApi->insert($receivedData);
|
||||||
}
|
}
|
||||||
@ -6781,7 +6774,6 @@ class ClientController extends AdminController
|
|||||||
} else {
|
} else {
|
||||||
return $this->respond(['status' => "Failed", 'message' => "Submission Faild"], 500);
|
return $this->respond(['status' => "Failed", 'message' => "Submission Faild"], 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendToken()
|
public function sendToken()
|
||||||
@ -6821,7 +6813,8 @@ class ClientController extends AdminController
|
|||||||
$post_client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
|
$post_client_data = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
|
||||||
|
|
||||||
$hrAccessData['post_hr_data'] = $this->clientBranchModel
|
$hrAccessData['post_hr_data'] = $this->clientBranchModel
|
||||||
->select('lc.id as post_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail')
|
->select('lc.id as post_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail ,
|
||||||
|
client_branch.id as post_branch_id , client_branch.branch_name as post_branch_name')
|
||||||
->join('level_contacts lc', 'client_branch.id = lc.ref_id')
|
->join('level_contacts lc', 'client_branch.id = lc.ref_id')
|
||||||
->where('client_branch.is_active', 1)
|
->where('client_branch.is_active', 1)
|
||||||
->where('lc.is_active', 1)
|
->where('lc.is_active', 1)
|
||||||
@ -6830,7 +6823,7 @@ class ClientController extends AdminController
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$hrAccessData['post_policy_data'] = $this->clientPolicyModel
|
$hrAccessData['post_policy_data'] = $this->clientPolicyModel
|
||||||
->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status')
|
->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status , client_policy.client_branch_id as branch_id')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->where('client_policy.client_id', $client_id)
|
->where('client_policy.client_id', $client_id)
|
||||||
@ -6859,7 +6852,7 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$hrAccessData['pre_hr_data'] = [];
|
$hrAccessData['pre_hr_data'] = [];
|
||||||
$hrAccessData['pre_policy_data'] = [];
|
$hrAccessData['pre_policy_data'] = [];
|
||||||
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id);
|
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id , $pre_client_data['id']??'');
|
||||||
return $combinedHrAccessData;
|
return $combinedHrAccessData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6869,12 +6862,13 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$hrAccessData['pre_hr_data'] = [];
|
$hrAccessData['pre_hr_data'] = [];
|
||||||
$hrAccessData['pre_policy_data'] = [];
|
$hrAccessData['pre_policy_data'] = [];
|
||||||
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id);
|
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id , $pre_client_data['id']??'');
|
||||||
return $combinedHrAccessData;
|
return $combinedHrAccessData;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hrAccessData['pre_hr_data'] = $db2->table('client_branch')
|
$hrAccessData['pre_hr_data'] = $db2->table('client_branch')
|
||||||
->select('lc.id as pre_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail')
|
->select('lc.id as pre_hr_id, lc.name as hr_name, lc.mobile as hr_mobile, lc.email as hr_mail
|
||||||
|
, client_branch.id as pre_branch_id , client_branch.branch_name as pre_branch_name ' )
|
||||||
->join('level_contacts lc', 'client_branch.id = lc.ref_id')
|
->join('level_contacts lc', 'client_branch.id = lc.ref_id')
|
||||||
->where('client_branch.is_active', 1)
|
->where('client_branch.is_active', 1)
|
||||||
->where('lc.is_active', 1)
|
->where('lc.is_active', 1)
|
||||||
@ -6884,7 +6878,7 @@ class ClientController extends AdminController
|
|||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
$hrAccessData['pre_policy_data'] = $db2->table('client_policy')
|
$hrAccessData['pre_policy_data'] = $db2->table('client_policy')
|
||||||
->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status')
|
->select('client_policy.id as client_policy_id, client_policy.policy_no as policy_no, policy_type.policy_type, client_policy.policy_status , client_policy.client_branch_id as branch_id')
|
||||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
->join('policy_type', 'client_policy.policy_type_id = policy_type.id')
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
->where('client_policy.client_id', $pre_client_data['id'])
|
->where('client_policy.client_id', $pre_client_data['id'])
|
||||||
@ -6892,16 +6886,16 @@ class ClientController extends AdminController
|
|||||||
->orderBy('client_policy.policy_status', 'desc')
|
->orderBy('client_policy.policy_status', 'desc')
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
// dd($hrAccessData);
|
// dd($hrAccessData);
|
||||||
|
|
||||||
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id);
|
$combinedHrAccessData = $this->constructHrAccessData($hrAccessData, $client_id ,$pre_client_data['id']);
|
||||||
return $combinedHrAccessData;
|
return $combinedHrAccessData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function constructHrAccessData($data, $client_id)
|
public function constructHrAccessData($data, $client_id , $pre_client_id)
|
||||||
{
|
{
|
||||||
// dd($data);
|
// print_rr($data);die;
|
||||||
|
|
||||||
$preHrs = $data['pre_hr_data'];
|
$preHrs = $data['pre_hr_data'];
|
||||||
$postHrs = $data['post_hr_data'];
|
$postHrs = $data['post_hr_data'];
|
||||||
$hrAccessTableData = $data['hr_access_table_data'];
|
$hrAccessTableData = $data['hr_access_table_data'];
|
||||||
@ -6917,7 +6911,10 @@ class ClientController extends AdminController
|
|||||||
'post_hr_id' => $post['post_hr_id'],
|
'post_hr_id' => $post['post_hr_id'],
|
||||||
'hr_name' => $post['hr_name'],
|
'hr_name' => $post['hr_name'],
|
||||||
'hr_mobile' => $post['hr_mobile'],
|
'hr_mobile' => $post['hr_mobile'],
|
||||||
'hr_mail' => $post['hr_mail']
|
'hr_mail' => $post['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
];
|
];
|
||||||
unset($preHrs[$index]); // remove matched pre_hr
|
unset($preHrs[$index]); // remove matched pre_hr
|
||||||
$found = true;
|
$found = true;
|
||||||
@ -6931,7 +6928,10 @@ class ClientController extends AdminController
|
|||||||
'post_hr_id' => $post['post_hr_id'],
|
'post_hr_id' => $post['post_hr_id'],
|
||||||
'hr_name' => $post['hr_name'],
|
'hr_name' => $post['hr_name'],
|
||||||
'hr_mobile' => $post['hr_mobile'],
|
'hr_mobile' => $post['hr_mobile'],
|
||||||
'hr_mail' => $post['hr_mail']
|
'hr_mail' => $post['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6943,7 +6943,10 @@ class ClientController extends AdminController
|
|||||||
'post_hr_id' => null,
|
'post_hr_id' => null,
|
||||||
'hr_name' => $pre['hr_name'],
|
'hr_name' => $pre['hr_name'],
|
||||||
'hr_mobile' => $pre['hr_mobile'],
|
'hr_mobile' => $pre['hr_mobile'],
|
||||||
'hr_mail' => $pre['hr_mail']
|
'hr_mail' => $pre['hr_mail'],
|
||||||
|
'pre_branch_id' => $pre['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $post['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $post['post_branch_name'] ?? null
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6968,9 +6971,12 @@ class ClientController extends AdminController
|
|||||||
'hr_name' => $hr['hr_name'] ?? null,
|
'hr_name' => $hr['hr_name'] ?? null,
|
||||||
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
||||||
'hr_mail' => $hr['hr_mail'] ?? null,
|
'hr_mail' => $hr['hr_mail'] ?? null,
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// First create a map of HR data by post_hr_id for quick lookup
|
// First create a map of HR data by post_hr_id for quick lookup
|
||||||
$hrMap = [];
|
$hrMap = [];
|
||||||
@ -7004,7 +7010,11 @@ class ClientController extends AdminController
|
|||||||
'allowed_cd' => json_decode($access['allowed_cd'], true) ?? [],
|
'allowed_cd' => json_decode($access['allowed_cd'], true) ?? [],
|
||||||
'hr_name' => $hr['hr_name'],
|
'hr_name' => $hr['hr_name'],
|
||||||
'hr_mobile' => $hr['hr_mobile'],
|
'hr_mobile' => $hr['hr_mobile'],
|
||||||
'hr_mail' => $hr['hr_mail']
|
'hr_mail' => $hr['hr_mail'],
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
];
|
];
|
||||||
|
|
||||||
// Remove from map so we know it's been processed
|
// Remove from map so we know it's been processed
|
||||||
@ -7029,6 +7039,10 @@ class ClientController extends AdminController
|
|||||||
'hr_name' => $hr['hr_name'] ?? null,
|
'hr_name' => $hr['hr_name'] ?? null,
|
||||||
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
'hr_mobile' => $hr['hr_mobile'] ?? null,
|
||||||
'hr_mail' => $hr['hr_mail'] ?? null,
|
'hr_mail' => $hr['hr_mail'] ?? null,
|
||||||
|
'pre_branch_id' => $hr['pre_branch_id'] ?? null,
|
||||||
|
'post_branch_id' => $hr['post_branch_id'] ?? null ,
|
||||||
|
'post_branch_name' => $hr['post_branch_name'] ?? null ,
|
||||||
|
'pre_client_id' => $pre_client_id ?? null
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7038,8 +7052,6 @@ class ClientController extends AdminController
|
|||||||
$resultData['pre_policy_data'] = $data['pre_policy_data'];
|
$resultData['pre_policy_data'] = $data['pre_policy_data'];
|
||||||
$resultData['post_policy_data'] = $data['post_policy_data'];
|
$resultData['post_policy_data'] = $data['post_policy_data'];
|
||||||
$resultData['post_cd_data'] = $data['post_cd_data'];
|
$resultData['post_cd_data'] = $data['post_cd_data'];
|
||||||
// echo '**********************************************';
|
|
||||||
// print_rr($resultData);die();
|
|
||||||
|
|
||||||
return $resultData;
|
return $resultData;
|
||||||
}
|
}
|
||||||
@ -7082,6 +7094,10 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
// INSERT or UPDATE
|
// INSERT or UPDATE
|
||||||
if (empty($value['pk']) || (int)$value['pk'] === 0) {
|
if (empty($value['pk']) || (int)$value['pk'] === 0) {
|
||||||
|
print_rr("inside insert block");
|
||||||
|
print_rr($value);die;
|
||||||
|
|
||||||
|
|
||||||
unset($value['pk']); // Prevent insert error
|
unset($value['pk']); // Prevent insert error
|
||||||
$insertedId = $this->HRAccessControlModel->insert($value);
|
$insertedId = $this->HRAccessControlModel->insert($value);
|
||||||
if ($insertedId === false) {
|
if ($insertedId === false) {
|
||||||
@ -7090,6 +7106,9 @@ class ClientController extends AdminController
|
|||||||
$success[] = "Inserted row at index {$index} with ID {$insertedId}.";
|
$success[] = "Inserted row at index {$index} with ID {$insertedId}.";
|
||||||
} else {
|
} else {
|
||||||
$update = $this->HRAccessControlModel->update($value['pk'], $value);
|
$update = $this->HRAccessControlModel->update($value['pk'], $value);
|
||||||
|
print_rr("inside update block");
|
||||||
|
print_rr($value);die;
|
||||||
|
|
||||||
if ($update === false) {
|
if ($update === false) {
|
||||||
throw new \Exception('Update failed for ID ' . $value['pk'] . ': ' . json_encode($this->HRAccessControlModel->errors()));
|
throw new \Exception('Update failed for ID ' . $value['pk'] . ': ' . json_encode($this->HRAccessControlModel->errors()));
|
||||||
}
|
}
|
||||||
@ -7123,7 +7142,6 @@ class ClientController extends AdminController
|
|||||||
'details' => $success,
|
'details' => $success,
|
||||||
'data' => $html,
|
'data' => $html,
|
||||||
], 200);
|
], 200);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => false,
|
'status' => false,
|
||||||
@ -7461,6 +7479,84 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
return $this->respond(['status' => true, 'message' => 'Demo client data wiped successfully'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getClientlistFromPre (){
|
||||||
|
$db2 = \Config\Database::connect('preDB');
|
||||||
|
|
||||||
|
$auto_fetch_client_list = $db2->table('clients')
|
||||||
|
->select('id,client_name')
|
||||||
|
->where('is_active',1)
|
||||||
|
->get()->getResultArray()??[];
|
||||||
|
|
||||||
|
return $auto_fetch_client_list;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function auto_fetch_branch(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
|
$db2 = \Config\Database::connect('preDB');
|
||||||
|
|
||||||
|
$auto_fetch_branch_list = $db2->table('client_branch')
|
||||||
|
->select('id,branch_name')
|
||||||
|
->where('client_id',$data['client_id'])
|
||||||
|
->where('is_active',1)
|
||||||
|
->get()->getResultArray()??[];
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
empty($auto_fetch_branch_list)
|
||||||
|
|
||||||
|
? $this->response->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'branch list is empty',
|
||||||
|
'data' => []
|
||||||
|
])->setStatusCode(400)
|
||||||
|
|
||||||
|
: $this->response->setJSON([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'branch list is found' ,
|
||||||
|
'data' => $auto_fetch_branch_list
|
||||||
|
])->setStatusCode(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function auto_fetch_branch_details(){
|
||||||
|
|
||||||
|
$data = $this->request->getPost();
|
||||||
|
|
||||||
|
$db2 = \Config\Database::connect('preDB');
|
||||||
|
|
||||||
|
$auto_fetch_branch_details = $db2->table('client_branch')
|
||||||
|
->where('client_id',$data['client_id'])
|
||||||
|
->where('id',$data['branch_id'])
|
||||||
|
->where('is_active',1)
|
||||||
|
->get()->getResultArray()??[];
|
||||||
|
|
||||||
|
return empty($auto_fetch_branch_details)
|
||||||
|
|
||||||
|
? $this->response->setJSON([
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'branch details is empty',
|
||||||
|
'data' => []
|
||||||
|
])->setStatusCode(400)
|
||||||
|
|
||||||
|
: $this->response->setJSON([
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'branch details found' ,
|
||||||
|
'data' => $auto_fetch_branch_details
|
||||||
|
])->setStatusCode(200);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ class ClientBranchModel extends Model
|
|||||||
"gst",
|
"gst",
|
||||||
"sez",
|
"sez",
|
||||||
"units",
|
"units",
|
||||||
|
"pre_branch_id"
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getBranchAndContactByBranchId($branch_id){
|
public function getBranchAndContactByBranchId($branch_id){
|
||||||
|
|||||||
@ -13,6 +13,9 @@ class HRAccessControlModel extends Model
|
|||||||
'pre_hr_id',
|
'pre_hr_id',
|
||||||
'post_hr_id',
|
'post_hr_id',
|
||||||
'post_client_id',
|
'post_client_id',
|
||||||
|
'pre_client_id',
|
||||||
|
'pre_branch_id',
|
||||||
|
'post_branch_id',
|
||||||
'allowed_modules',
|
'allowed_modules',
|
||||||
'allowed_pre_policies',
|
'allowed_pre_policies',
|
||||||
'allowed_active_policies',
|
'allowed_active_policies',
|
||||||
|
|||||||
@ -70,6 +70,13 @@
|
|||||||
<div class="row" id="add_branch">
|
<div class="row" id="add_branch">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row float-left" style="position: relative; bottom: 20px; left: 13px;">
|
||||||
|
<button type="button" id="btnAutoBranchFetch"
|
||||||
|
class="btn btn-primary waves-effect waves-light btn-sm "> Auto Fetch branch Details</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
<div class="row float-right" style="position: relative; bottom: 20px; right: 13px;">
|
||||||
<button type="button" id="btnBranchBack"
|
<button type="button" id="btnBranchBack"
|
||||||
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted"
|
class="btn btn-primary waves-effect waves-light btn-sm btnBack"><span class="mdi mdi-format-list-bulleted"
|
||||||
@ -82,7 +89,12 @@
|
|||||||
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||||
<input type="hidden" name="client_id" id="client_id_branch"
|
<input type="hidden" name="client_id" id="client_id_branch"
|
||||||
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||||
|
|
||||||
|
<input type="hidden" name="pre_branch_id" id="pre_branch_id"
|
||||||
|
value="<?= isset($pre_branch_id) ? $pre_branch_id : '' ?>" />
|
||||||
|
|
||||||
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey" />
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-6">
|
||||||
|
|||||||
@ -401,6 +401,57 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="modal fade" id="autoFetchBranchModal" tabindex="-1" role="dialog" aria-labelledby="autoFetchBranchModalLabel" accesskey=""
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" style="margin-left: 400px !important;">
|
||||||
|
<div class="modal-content modal-lg">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="autoFetchBranchModalLabel">Auto Fetch Branch Details</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body" style="min-height:auto !important;">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="auto_fetch_client">Client List<span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="auto_fetch_client" name="auto_fetch_client" required>
|
||||||
|
<option value="">Select Client</option>
|
||||||
|
<?php if (!empty($auto_fetch_client_list)): ?>
|
||||||
|
<?php foreach ($auto_fetch_client_list as $client_list): ?>
|
||||||
|
<option value="<?= esc($client_list['id']) ?>">
|
||||||
|
<?= esc($client_list['client_name']) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="form-group col-md-12">
|
||||||
|
<label for="auto_fetch_branch">Branch List<span class="text-danger">*</span></label>
|
||||||
|
<select class="form-control" id="auto_fetch_branch" name="auto_fetch_branch" required>
|
||||||
|
<option value="">Select Branch</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn cancel-btn" data-dismiss="modal">Cancel</button>
|
||||||
|
<button type="button" class="btn btn-primary submit-btn" id="submitAutoFetch">Submit</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let hrAccessControlHtmlAppended = false;
|
let hrAccessControlHtmlAppended = false;
|
||||||
let hrActivityHistoryHtmlAppended = false;
|
let hrActivityHistoryHtmlAppended = false;
|
||||||
@ -699,7 +750,10 @@
|
|||||||
allowed_pre_policies: getCheckedValues(`${userId}_pre_policies`),
|
allowed_pre_policies: getCheckedValues(`${userId}_pre_policies`),
|
||||||
allowed_active_policies: getCheckedValues(`${userId}_active_policies`),
|
allowed_active_policies: getCheckedValues(`${userId}_active_policies`),
|
||||||
allowed_cd: getCheckedValues(`${userId}_cd`),
|
allowed_cd: getCheckedValues(`${userId}_cd`),
|
||||||
allowed_claims: getCheckedValues(`${userId}_claims`)
|
allowed_claims: getCheckedValues(`${userId}_claims`),
|
||||||
|
pre_branch_id: formData.get(`${userId}_pre_branch_id`),
|
||||||
|
post_branch_id: formData.get(`${userId}_post_branch_id`),
|
||||||
|
pre_client_id: formData.get(`${userId}_pre_client_id`)
|
||||||
};
|
};
|
||||||
|
|
||||||
users.push(user);
|
users.push(user);
|
||||||
@ -717,7 +771,10 @@
|
|||||||
allowed_pre_policies: user.allowed_pre_policies.length ? `[${user.allowed_pre_policies.join(',')}]` : '[]',
|
allowed_pre_policies: user.allowed_pre_policies.length ? `[${user.allowed_pre_policies.join(',')}]` : '[]',
|
||||||
allowed_active_policies: user.allowed_active_policies.length ? `[${user.allowed_active_policies.join(',')}]` : '[]',
|
allowed_active_policies: user.allowed_active_policies.length ? `[${user.allowed_active_policies.join(',')}]` : '[]',
|
||||||
allowed_cd: user.allowed_cd.length ? `[${user.allowed_cd.join(',')}]` : '[]',
|
allowed_cd: user.allowed_cd.length ? `[${user.allowed_cd.join(',')}]` : '[]',
|
||||||
allowed_claims: user.allowed_claims.length ? `[${user.allowed_claims.join(',')}]` : '[]'
|
allowed_claims: user.allowed_claims.length ? `[${user.allowed_claims.join(',')}]` : '[]',
|
||||||
|
pre_client_id: user.pre_client_id || "",
|
||||||
|
pre_branch_id: user.pre_branch_id || "",
|
||||||
|
post_branch_id: user.post_branch_id || ""
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -972,3 +1029,130 @@
|
|||||||
// console.log('--- END ---');
|
// console.log('--- END ---');
|
||||||
// });
|
// });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#btnAutoBranchFetch').click(function() {
|
||||||
|
|
||||||
|
var myModal = new bootstrap.Modal(document.getElementById('autoFetchBranchModal'));
|
||||||
|
myModal.show();
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#auto_fetch_client').change(function() {
|
||||||
|
|
||||||
|
$('#auto_fetch_branch').html(`<option value="">Select Branch</option>`);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "<?php echo base_url('client/branch/auto_fetch_branch'); ?>",
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
client_id: $('#auto_fetch_client').val()
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response, textStatus, xhr) {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
let options = `<option value="">Select Branch</option>`;
|
||||||
|
|
||||||
|
response.data.forEach((data) => {
|
||||||
|
options += `<option value="${data.id}">${data.branch_name}</option>`;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#auto_fetch_branch').html(options);
|
||||||
|
} else {
|
||||||
|
$('#auto_fetch_branch').html('<option value="">No Branch Found</option>');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error("Error occurred:", status, error);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
console.log("auto_fetch_client call is completed..!!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#submitAutoFetch').click(function() {
|
||||||
|
|
||||||
|
let client_id = $('#auto_fetch_client').val();
|
||||||
|
let branch_id = $('#auto_fetch_branch').val();
|
||||||
|
|
||||||
|
if (client_id == "" || branch_id == "") {
|
||||||
|
Swal.fire({
|
||||||
|
icon: 'warning',
|
||||||
|
title: 'Missing Data',
|
||||||
|
text: 'Please select both Client and its Branch!',
|
||||||
|
confirmButtonText: 'OK'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "<?php echo base_url('client/branch/auto_fetch_branch_details'); ?>",
|
||||||
|
type: "POST",
|
||||||
|
data: {
|
||||||
|
client_id,
|
||||||
|
branch_id
|
||||||
|
},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(response, textStatus, xhr) {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
|
||||||
|
let result = response.data[0]??[];
|
||||||
|
|
||||||
|
if(response.data[0] == []){
|
||||||
|
console.log("Empty array ..!!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let units = JSON.parse(result['units']);
|
||||||
|
|
||||||
|
let $select = $('#selected');
|
||||||
|
$select.empty();
|
||||||
|
|
||||||
|
units.forEach(unit => {
|
||||||
|
// If you want to mark them as selected, set 'selected' attribute
|
||||||
|
$select.append(`<option value="${unit}" selected>${unit}</option>`);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#pre_branch_id').val(branch_id);
|
||||||
|
$('#branch_name').val(result['branch_name']??'');
|
||||||
|
$('#branch_code').val(result['branch_code']??'');
|
||||||
|
$('#address1').val(result['address1']??'');
|
||||||
|
$('#address2').val(result['address2']??'');
|
||||||
|
$('#state').val(result['state']??'');
|
||||||
|
$('#district').val(result['district']??'');
|
||||||
|
$('#branch_city').val(result['city']??'');
|
||||||
|
$('#pincode').val(result['pincode']??'');
|
||||||
|
$('#gst').val(result['gst']??'');
|
||||||
|
$('#sez').val(result['sez']??'');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.log("User Error thrown");
|
||||||
|
console.log("status" + xhr.status);
|
||||||
|
}
|
||||||
|
|
||||||
|
closeModalById('autoFetchBranchModal');
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function(xhr, status, error) {
|
||||||
|
console.error("Error occurred:", status, error);
|
||||||
|
},
|
||||||
|
complete: function() {
|
||||||
|
console.log("auto_fetch_branch_details call is completed..!!");
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@ -65,7 +65,10 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
||||||
<?php if (isset($hr_access_data) && !empty($hr_access_data)) { ?>
|
<?php if (isset($hr_access_data) && !empty($hr_access_data)) {
|
||||||
|
$listed_pre = [];
|
||||||
|
$listed_post = [];
|
||||||
|
?>
|
||||||
<form id="insuranceForm" onsubmit="submitForm(event)">
|
<form id="insuranceForm" onsubmit="submitForm(event)">
|
||||||
|
|
||||||
<?php foreach ($hr_access_data as $key => $value) {
|
<?php foreach ($hr_access_data as $key => $value) {
|
||||||
@ -79,13 +82,17 @@
|
|||||||
<input type="hidden" name="<?= 'user' . $key ?>_pre_hr_id" value="<?= $value['pre_hr_id'] ?>">
|
<input type="hidden" name="<?= 'user' . $key ?>_pre_hr_id" value="<?= $value['pre_hr_id'] ?>">
|
||||||
<input type="hidden" name="<?= 'user' . $key ?>_post_hr_id" value="<?= $value['post_hr_id'] ?>">
|
<input type="hidden" name="<?= 'user' . $key ?>_post_hr_id" value="<?= $value['post_hr_id'] ?>">
|
||||||
<input type="hidden" name="<?= 'user' . $key ?>_post_client_id" value="<?= $value['post_client_id'] ?>">
|
<input type="hidden" name="<?= 'user' . $key ?>_post_client_id" value="<?= $value['post_client_id'] ?>">
|
||||||
|
<input type="hidden" name="<?= 'user' . $key ?>_pre_branch_id" value="<?= $value['pre_branch_id'] ?>">
|
||||||
|
<input type="hidden" name="<?= 'user' . $key ?>_post_branch_id" value="<?= $value['post_branch_id'] ?>">
|
||||||
|
<input type="hidden" name="<?= 'user' . $key ?>_pre_client_id" value="<?= $value['pre_client_id'] ?>">
|
||||||
|
|
||||||
<div class="card-header" onclick="toggleAccordion(this)" style="background-color: #F5FFFF;">
|
<div class="card-header" onclick="toggleAccordion(this)" style="background-color: #F5FFFF;">
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<h5 class="mb-0"><?= $value['hr_name'] ?>
|
<h5 class="mb-0"> Name -<?= $value['hr_name'] ?>
|
||||||
<!-- <i class="mdi mdi-information-outline" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
|
<!-- <i class="mdi mdi-information-outline" aria-hidden="true" data-id="<?= (!empty($value['pre_hr_id']) ? $value['pre_hr_id'] : 0) . '-' . (!empty($value['post_hr_id']) ? $value['post_hr_id'] : 0) ?>"></i> -->
|
||||||
</h5>
|
</h5>
|
||||||
<p class="user-email"><?= $value['hr_mail'] ?></p>
|
<p style="color: black;"> <b>branch - <?= $value['post_branch_name']?></b></p>
|
||||||
|
<p class="user-email"> Mail - <?= $value['hr_mail'] ?></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="accordion-icon">
|
<div class="accordion-icon">
|
||||||
<i class="mdi mdi-chevron-down"></i>
|
<i class="mdi mdi-chevron-down"></i>
|
||||||
@ -128,6 +135,15 @@
|
|||||||
<?php foreach ($pre_policy_data as $key1 => $policies) {
|
<?php foreach ($pre_policy_data as $key1 => $policies) {
|
||||||
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
|
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
|
||||||
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
|
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
|
||||||
|
if (
|
||||||
|
in_array($policies['branch_id'].'-'.$policies['policy_no'], $listed_pre)
|
||||||
|
&&
|
||||||
|
$value['pre_branch_id'] != $policies['branch_id']
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
$listed_pre[] = $policies['branch_id'].'-'.$policies['policy_no'];
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="checkbox-item">
|
<div class="checkbox-item">
|
||||||
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>"
|
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" name="<?= 'user' . $key ?>_pre_policies" data-user="<?= $key ?>" data-group="pre" value="<?= $policies['client_policy_id'] ?>"
|
||||||
@ -180,12 +196,26 @@
|
|||||||
<?php foreach ($post_policy_data as $key2 => $policies) {
|
<?php foreach ($post_policy_data as $key2 => $policies) {
|
||||||
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
|
$statusText = $policies['policy_status'] == 1 ? 'Active' : 'In-Active';
|
||||||
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
|
$statusClass = $policies['policy_status'] == 1 ? 'active' : 'inactive';
|
||||||
|
if(
|
||||||
|
in_array($policies['branch_id'].'-'.$policies['policy_no'] , $listed_post)
|
||||||
|
&&
|
||||||
|
$value['post_branch_id'] != $policies['branch_id']
|
||||||
|
)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$listed_post[] = $policies['branch_id'].'-'.$policies['policy_no'];
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="checkbox-item">
|
<div class="checkbox-item">
|
||||||
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post"
|
<input type="checkbox" class="policy-checkbox <?= $statusClass ?>" id="<?= 'user' . $key ?>-gmc2" name="<?= 'user' . $key ?>_active_policies" data-user="<?= $key ?>" data-group="post"
|
||||||
value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {
|
value="<?= $policies['client_policy_id'] ?>" <?php if (in_array($policies['client_policy_id'], $value['allowed_active_policies'])) {
|
||||||
echo 'checked';
|
echo 'checked';
|
||||||
} ?>>
|
} ?>>
|
||||||
|
|
||||||
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if ($policies['policy_status'] == 0) {
|
<label for="<?= 'user' . $key ?>-gmc2" style="<?php if ($policies['policy_status'] == 0) {
|
||||||
echo 'color:#ff5757';
|
echo 'color:#ff5757';
|
||||||
} ?>">
|
} ?>">
|
||||||
|
|||||||
@ -1122,6 +1122,29 @@ $(function(){
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function closeModalById(modalId) {
|
||||||
|
// Get the modal element
|
||||||
|
var modal = document.getElementById(modalId);
|
||||||
|
if (!modal) return; // Exit if no modal found
|
||||||
|
|
||||||
|
// Hide it by removing "show" or "in" classes and setting display:none
|
||||||
|
modal.style.display = 'none';
|
||||||
|
modal.classList.remove('in', 'show'); // 'in' for BS3, 'show' for BS4/5
|
||||||
|
modal.setAttribute('aria-hidden', 'true');
|
||||||
|
modal.removeAttribute('aria-modal'); // optional
|
||||||
|
modal.removeAttribute('role'); // optional
|
||||||
|
|
||||||
|
// Remove backdrop if present
|
||||||
|
var backdrop = document.querySelector('.modal-backdrop');
|
||||||
|
if (backdrop) backdrop.remove();
|
||||||
|
|
||||||
|
// Allow page scrolling again
|
||||||
|
document.body.classList.remove('modal-open');
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user