Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
4429a703dc
@ -19,7 +19,7 @@ $routes->get('/logout', 'LoginController::logout');
|
|||||||
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
$routes->get('/oauth2callback', 'LoginController::receiveGoogleOAuthResponse');
|
||||||
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
$routes->get('/auth/google', 'LoginController::initiateGoogleOAuth');
|
||||||
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
$routes->get('/update-emp-policy-status', 'ClientController::updateEmpAndPolicyStatus');
|
||||||
$routes->get('download-e-card/(:segment)', 'EmployeeController::generateIDCardForEmployee/$1');
|
$routes->get('download-e-card/(:any)', 'EmployeeController::generateIDCardForEmployee/$1');
|
||||||
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
$routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocument/$1');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -783,6 +783,9 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function createClientPolicyPremium()
|
public function createClientPolicyPremium()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// echo json_encode(['key' => $this->request->getPost()]); die;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$policy_type = $this->request->getPost('policy_type');
|
$policy_type = $this->request->getPost('policy_type');
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
@ -793,6 +796,25 @@ class ClientController extends AdminController
|
|||||||
$client_id = $client_policy_data['client_id'];
|
$client_id = $client_policy_data['client_id'];
|
||||||
}
|
}
|
||||||
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
$policy_grid_id = $this->request->getPost('policy_grid_id');
|
||||||
|
$rack_rate_type = $this->request->getPost('rack_rate_type');
|
||||||
|
|
||||||
|
$self = $this->request->getPost('self') ? 1 : 0;
|
||||||
|
$spouse = $this->request->getPost('spouse')? 1 : 0;
|
||||||
|
$childrens = $this->request->getPost('childrens')? 1 : 0;
|
||||||
|
$parents = $this->request->getPost('parents')? 1 : 0;
|
||||||
|
$parents_in_law = $this->request->getPost('parents-in-law')? 1 : 0;
|
||||||
|
$either_parents_pil = $this->request->getPost('either-parents-pil')? 1 : 0;
|
||||||
|
|
||||||
|
$relation_data['self'] = $self;
|
||||||
|
$relation_data['spouse'] = $spouse;
|
||||||
|
$relation_data['childrens'] = $childrens;
|
||||||
|
$relation_data['parents'] = $parents;
|
||||||
|
$relation_data['parents_in_law'] = $parents_in_law;
|
||||||
|
$relation_data['either_parents_pil'] = $either_parents_pil;
|
||||||
|
|
||||||
|
|
||||||
|
$jsonDataForRelation = json_encode($relation_data);
|
||||||
|
|
||||||
|
|
||||||
// if($policy_grid_id == 10 || $policy_grid_id == 11){
|
// if($policy_grid_id == 10 || $policy_grid_id == 11){
|
||||||
// $premium_type = 1;
|
// $premium_type = 1;
|
||||||
@ -811,6 +833,11 @@ class ClientController extends AdminController
|
|||||||
$data['client_policy_id'] = $client_policy_id;
|
$data['client_policy_id'] = $client_policy_id;
|
||||||
$data['policy_grid_id'] = $policy_grid_id;
|
$data['policy_grid_id'] = $policy_grid_id;
|
||||||
$data['premium_type'] = $premium_type;
|
$data['premium_type'] = $premium_type;
|
||||||
|
$data['rack_rate_type'] = $rack_rate_type;
|
||||||
|
|
||||||
|
if($rack_rate_type == 1){
|
||||||
|
$data['additional_relationship'] = $jsonDataForRelation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$premium = [];
|
$premium = [];
|
||||||
@ -818,7 +845,7 @@ class ClientController extends AdminController
|
|||||||
if ($policy_grid_id == '1' || $policy_grid_id == '2') {
|
if ($policy_grid_id == '1' || $policy_grid_id == '2') {
|
||||||
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
$this->policyPremium1Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
||||||
} else {
|
} else {
|
||||||
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->set('is_active', 0)->update();
|
$this->policyPremium2Model->where('client_id', $client_id)->where('client_policy_id', $client_policy_id)->where('rack_rate_type', $rack_rate_type)->set('is_active', 0)->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -925,6 +952,9 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
$premium = $this->request->getPost('6_premium[]');
|
$premium = $this->request->getPost('6_premium[]');
|
||||||
|
|
||||||
|
print_r($premium);
|
||||||
|
|
||||||
$sum_insure = $this->request->getPost('6_si');
|
$sum_insure = $this->request->getPost('6_si');
|
||||||
$age_from = $this->request->getPost('6_age_from[]');
|
$age_from = $this->request->getPost('6_age_from[]');
|
||||||
$age_to = $this->request->getPost('6_age_to[]');
|
$age_to = $this->request->getPost('6_age_to[]');
|
||||||
@ -1135,21 +1165,24 @@ class ClientController extends AdminController
|
|||||||
$self = $policy_terms_data->family_floaters;
|
$self = $policy_terms_data->family_floaters;
|
||||||
}
|
}
|
||||||
|
|
||||||
$emp_count = $this->employeeModel->join('client_policy cp', "employees.client_id = cp.client_id")
|
// $emp_count = $this->employeeModel
|
||||||
->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
// ->join('client_policy cp', "employees.client_id = cp.client_id")
|
||||||
->where("employees.client_id", $record['client_id'])
|
// ->join('employee_polices ep', "cp.id = ep.client_policy_id AND employees.id = ep.employee_id")
|
||||||
->where("employees.emp_status", 'active')
|
// ->where("employees.client_id", $record['client_id'])
|
||||||
->where("ep.status", 'active')
|
// ->where("employees.emp_status", 'active')
|
||||||
->where("employees.is_active", 1)
|
// ->where("ep.status", 'active')
|
||||||
->where("ep.is_active", 1)
|
// ->where("employees.is_active", 1)
|
||||||
|
// ->where("ep.is_active", 1)
|
||||||
|
// ->countAllResults();
|
||||||
|
|
||||||
|
|
||||||
|
$emp_count = $this->employeePolicyModel
|
||||||
|
->join('client_policy cp', "cp.id = employee_polices.client_policy_id")
|
||||||
|
->where("employee_polices.client_policy_id", $client_policy_id)
|
||||||
|
->where("employee_polices.status", 'active')
|
||||||
|
->where("employee_polices.is_active", 1)
|
||||||
->countAllResults();
|
->countAllResults();
|
||||||
|
|
||||||
|
|
||||||
// $data = $this->employeePolicyModel->select('employee_polices.id')
|
|
||||||
// ->where('employee_polices.is_active', 1)
|
|
||||||
// ->where('employee_polices.client_policy_id', $client_policy_id)
|
|
||||||
// ->findAll();
|
|
||||||
|
|
||||||
// $emp_count = count($data);
|
// $emp_count = count($data);
|
||||||
|
|
||||||
// if($emp_count == 0){
|
// if($emp_count == 0){
|
||||||
@ -1184,6 +1217,11 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
$premiumData = "";
|
$premiumData = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($premiumData); die;
|
// print_r($premiumData); die;
|
||||||
|
|
||||||
@ -1240,19 +1278,28 @@ class ClientController extends AdminController
|
|||||||
$premiumDataa = $premiumData;
|
$premiumDataa = $premiumData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print_r($premiumData);die;
|
// $premium1 = [];
|
||||||
|
// $premium2 = [];
|
||||||
|
|
||||||
// print_r($data[0]->policy_type); die;
|
// foreach ($premiumDataa as $key => $item) {
|
||||||
// echo "hello";
|
// if ($item['rack_rate_type'] == 0) {
|
||||||
// return json_encode($premiumData);
|
// $premium1[] = $item;
|
||||||
|
// } elseif ($item['rack_rate_type'] == 1) {
|
||||||
|
// $premium2[] = $item;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// print_r($premium1);
|
||||||
|
// print_r($premium2); die;
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $resultss, 'premiumData' => json_encode($premiumDataa), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
|
||||||
} else if ($search_term === 'GPA') {
|
} else if ($search_term === 'GPA') {
|
||||||
|
|
||||||
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
return $this->respond(['status' => true, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'data' => $results, 'premiumData' => json_encode($premiumData), 'count' => $emp_count, 'policy_name' => $policy_name, 'family_floater' => $family_floater, 'self' => $self, 'client_policy_id' => $client_policy_id], 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1962,91 +2009,89 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function transformArray($data, $mapping) {
|
public function transformArray($data, $mapping)
|
||||||
|
{
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$transformedData = [];
|
$transformedData = [];
|
||||||
|
|
||||||
|
if (!is_array($data)) {
|
||||||
|
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if ($key == 'family_floaters') {
|
||||||
|
$transformedData[$key] = $this->transformFamilyFloaters($value, $data);
|
||||||
|
} else if (array_key_exists($key, $mapping)) {
|
||||||
|
$transformedData[$mapping[$key]] = $value;
|
||||||
|
} else if ($key == 'special_condition_label') {
|
||||||
|
|
||||||
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['special_condition_input'][$key];
|
||||||
|
}
|
||||||
|
} else if ($key == 'gpa_special_condition_label') {
|
||||||
|
|
||||||
|
foreach ($value as $key => $value) {
|
||||||
|
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
||||||
|
}
|
||||||
|
} else if ($key == 'age_ratio') {
|
||||||
|
|
||||||
|
if (isset($data['sumInsured2'])) {
|
||||||
|
|
||||||
|
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$transformedData[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_array($data)) {
|
|
||||||
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
|
||||||
if ($key == 'family_floaters') {
|
|
||||||
$transformedData[$key] = $this->transformFamilyFloaters($value, $data);
|
|
||||||
}else if (array_key_exists($key, $mapping)) {
|
|
||||||
$transformedData[$mapping[$key]] = $value;
|
|
||||||
}else if($key == 'special_condition_label'){
|
|
||||||
|
|
||||||
foreach ($value as $key => $value) {
|
public function transformFamilyFloaters($familyFloaters, $json)
|
||||||
$transformedData[$value] = $data['special_condition_input'][$key];
|
{
|
||||||
}
|
$result = [];
|
||||||
|
|
||||||
}else if($key == 'gpa_special_condition_label'){
|
$min = $json['age_ratio']['self'];
|
||||||
|
$max = $json['age_ratio']['self'];
|
||||||
|
|
||||||
foreach ($value as $key => $value) {
|
$spouse_min = $json['age_ratio']['spouse'];
|
||||||
$transformedData[$value] = $data['gpa_special_condition_input'][$key];
|
$spouse_max = $json['age_ratio']['spouse'];
|
||||||
}
|
|
||||||
|
|
||||||
}else if($key == 'age_ratio'){
|
$child_min = $json['age_ratio']['child'];
|
||||||
|
$child_max = $json['age_ratio']['child'];
|
||||||
|
|
||||||
if(isset($data['sumInsured2'])){
|
$elders_min = $json['age_ratio']['elders'];
|
||||||
|
$elders_max = $json['age_ratio']['elders'];
|
||||||
|
|
||||||
$transformedData['Self'] = "(Min: " . $data['age_ratio']['self']['min'] . ", Max: " . $data['age_ratio']['self']['max'] . ")";
|
foreach ($familyFloaters as $key => $value) {
|
||||||
}
|
if ($value !== 0) {
|
||||||
|
switch ($key) {
|
||||||
|
case 'self':
|
||||||
}else {
|
$result[] = "Self (Min: {$min['min']}, Max: {$max['max']})";
|
||||||
$transformedData[$key] = $value;
|
break;
|
||||||
}
|
case 'spouse':
|
||||||
}
|
$result[] = "Spouse (Min: {$spouse_min['min']}, Max: {$spouse_max['max']})";
|
||||||
|
break;
|
||||||
return json_encode($transformedData, JSON_PRETTY_PRINT);
|
case 'childrens':
|
||||||
}
|
$result[] = "Children(s) - $value (Min: {$child_min['min']}, Max: {$child_max['max']})";
|
||||||
|
break;
|
||||||
|
case 'parents':
|
||||||
public function transformFamilyFloaters($familyFloaters, $json) {
|
$result[] = "Parent(s) - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||||
$result = [];
|
break;
|
||||||
|
case 'parents-in-law':
|
||||||
$min = $json['age_ratio']['self'];
|
$result[] = "Parents-in-Law - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||||
$max = $json['age_ratio']['self'];
|
break;
|
||||||
|
case 'either-parents-pil':
|
||||||
$spouse_min = $json['age_ratio']['spouse'];
|
$result[] = "Either Parents Nor Parents-in-Law - $value (elders_min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
||||||
$spouse_max = $json['age_ratio']['spouse'];
|
break;
|
||||||
|
}
|
||||||
$child_min = $json['age_ratio']['child'];
|
|
||||||
$child_max = $json['age_ratio']['child'];
|
|
||||||
|
|
||||||
$elders_min = $json['age_ratio']['elders'];
|
|
||||||
$elders_max = $json['age_ratio']['elders'];
|
|
||||||
|
|
||||||
foreach ($familyFloaters as $key => $value) {
|
|
||||||
if ($value !== 0) {
|
|
||||||
switch ($key) {
|
|
||||||
case 'self':
|
|
||||||
$result[] = "Self (Min: {$min['min']}, Max: {$max['max']})";
|
|
||||||
break;
|
|
||||||
case 'spouse':
|
|
||||||
$result[] = "Spouse (Min: {$spouse_min['min']}, Max: {$spouse_max['max']})";
|
|
||||||
break;
|
|
||||||
case 'childrens':
|
|
||||||
$result[] = "Children(s) - $value (Min: {$child_min['min']}, Max: {$child_max['max']})";
|
|
||||||
break;
|
|
||||||
case 'parents':
|
|
||||||
$result[] = "Parent(s) - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
|
||||||
break;
|
|
||||||
case 'parents-in-law':
|
|
||||||
$result[] = "Parents-in-Law - $value (Min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
|
||||||
break;
|
|
||||||
case 'either-parents-pil':
|
|
||||||
$result[] = "Either Parents Nor Parents-in-Law - $value (elders_min: {$elders_min['min']}, Max: {$elders_max['max']})";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return implode(", ", $result);
|
return implode(", ", $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -578,6 +578,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$file = $this->batchFileModel->where('id', $file_id)->first();
|
$file = $this->batchFileModel->where('id', $file_id)->first();
|
||||||
$client_id = $file['client_id'];
|
$client_id = $file['client_id'];
|
||||||
$client_policy_id = $file['client_policy_id'];
|
$client_policy_id = $file['client_policy_id'];
|
||||||
|
$client_branch_id = $file['client_branch_id'];
|
||||||
$batch_code = $file['batch_code'];
|
$batch_code = $file['batch_code'];
|
||||||
|
|
||||||
|
|
||||||
@ -626,6 +627,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
|
->where("employee_polices.{$id} IS NULL OR employee_polices.{$id} = ''")
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
@ -976,6 +978,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$client_id = $file['client_id'];
|
$client_id = $file['client_id'];
|
||||||
$client_policy_id = $file['client_policy_id'];
|
$client_policy_id = $file['client_policy_id'];
|
||||||
|
$client_branch_id = $file['client_branch_id'];
|
||||||
$insurer_or_tpa = $file['insurer_or_tpa'];
|
$insurer_or_tpa = $file['insurer_or_tpa'];
|
||||||
$status = $file['status'];
|
$status = $file['status'];
|
||||||
$batch_code = $file['batch_code'];
|
$batch_code = $file['batch_code'];
|
||||||
@ -1031,6 +1034,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||||
$query->where('employees.client_id', $client_id);
|
$query->where('employees.client_id', $client_id);
|
||||||
|
$query->where('employees.client_branch_id', $client_branch_id);
|
||||||
$query->where('employees.name', $name);
|
$query->where('employees.name', $name);
|
||||||
$query->where('employees.emp_code', $emp_code);
|
$query->where('employees.emp_code', $emp_code);
|
||||||
if ($file['insurer_or_tpa'] == 'tpa') {
|
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||||
@ -1103,6 +1107,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'employeeIds' => $emp_policy_ids,
|
'employeeIds' => $emp_policy_ids,
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
'count' => $emp_count,
|
'count' => $emp_count,
|
||||||
'event' => $file['event_type'],
|
'event' => $file['event_type'],
|
||||||
'policy_name' => $policy_name['policy_name'],
|
'policy_name' => $policy_name['policy_name'],
|
||||||
@ -1116,6 +1121,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'employeeIds' => $emp_policy_ids,
|
'employeeIds' => $emp_policy_ids,
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
'count' => $emp_count,
|
'count' => $emp_count,
|
||||||
'event' => $file['event_type'],
|
'event' => $file['event_type'],
|
||||||
'policy_name' => $policy_name['policy_name'],
|
'policy_name' => $policy_name['policy_name'],
|
||||||
@ -1152,6 +1158,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$client_id = $import_data['client_id'];
|
$client_id = $import_data['client_id'];
|
||||||
$client_policy_id = $import_data['client_policy_id'];
|
$client_policy_id = $import_data['client_policy_id'];
|
||||||
|
$client_branch_id = $import_data['client_branch_id'];
|
||||||
$file = $import_data['file'];
|
$file = $import_data['file'];
|
||||||
|
|
||||||
$data = $this->readExcelToArray($file);
|
$data = $this->readExcelToArray($file);
|
||||||
@ -1181,6 +1188,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employee_polices.uhid', $uhid)
|
->where('employee_polices.uhid', $uhid)
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
||||||
@ -1211,10 +1219,6 @@ class EmpDataServiceController extends BaseController
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($empty_emp_tpa_uh_ids != $count){
|
|
||||||
|
|
||||||
// return 3;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if ($empty_id_count == 0) {
|
if ($empty_id_count == 0) {
|
||||||
|
|
||||||
@ -1265,6 +1269,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employee_polices.uhid', $uhid)
|
->where('employee_polices.uhid', $uhid)
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
@ -1280,6 +1285,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employee_polices.uhid', $uhid)
|
->where('employee_polices.uhid', $uhid)
|
||||||
->get()
|
->get()
|
||||||
@ -1319,6 +1325,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$client_id = $import_data['client_id'];
|
$client_id = $import_data['client_id'];
|
||||||
$client_policy_id = $import_data['client_policy_id'];
|
$client_policy_id = $import_data['client_policy_id'];
|
||||||
|
$client_branch_id = $import_data['client_branch_id'];
|
||||||
$file = $import_data['file'];
|
$file = $import_data['file'];
|
||||||
|
|
||||||
$data = $this->readExcelToArray($file);
|
$data = $this->readExcelToArray($file);
|
||||||
@ -1352,6 +1359,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employees.name', $emp_name)
|
->where('employees.name', $emp_name)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('emp_endorsement.actions', 'si')
|
->where('emp_endorsement.actions', 'si')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
||||||
@ -1449,6 +1457,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employees.name', $emp_name)
|
->where('employees.name', $emp_name)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
->first();
|
->first();
|
||||||
@ -1478,6 +1487,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employees.name', $emp_name)
|
->where('employees.name', $emp_name)
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
@ -1500,6 +1510,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
'employeeIds' => $employeeIds,
|
'employeeIds' => $employeeIds,
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'event' => $import_data['event_type'],
|
'event' => $import_data['event_type'],
|
||||||
'policy_name' => $policy_name['policy_name'],
|
'policy_name' => $policy_name['policy_name'],
|
||||||
@ -1517,6 +1528,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
$client_id = $import_data['client_id'];
|
$client_id = $import_data['client_id'];
|
||||||
$client_policy_id = $import_data['client_policy_id'];
|
$client_policy_id = $import_data['client_policy_id'];
|
||||||
|
$client_branch_id = $import_data['client_branch_id'];
|
||||||
$file = $import_data['file'];
|
$file = $import_data['file'];
|
||||||
|
|
||||||
|
|
||||||
@ -1554,6 +1566,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employees.name', $emp_name)
|
->where('employees.name', $emp_name)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('emp_endorsement.actions', 'd')
|
->where('emp_endorsement.actions', 'd')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
->where('(emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = "")')
|
||||||
@ -1644,6 +1657,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employees', 'employees.id = employee_polices.employee_id')
|
->join('employees', 'employees.id = employee_polices.employee_id')
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employees.name', $emp_name)
|
->where('employees.name', $emp_name)
|
||||||
->where('employees.emp_code', $emp_code)
|
->where('employees.emp_code', $emp_code)
|
||||||
->where('employee_polices.is_active', 1)
|
->where('employee_polices.is_active', 1)
|
||||||
@ -1674,6 +1688,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->where('emp_endorsement.emp_code', $emp_code)
|
->where('emp_endorsement.emp_code', $emp_code)
|
||||||
->where('employees.client_id', $client_id)
|
->where('employees.client_id', $client_id)
|
||||||
|
->where('employees.client_branch_id', $client_branch_id)
|
||||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||||
->where('emp_endorsement.name', $emp_name)
|
->where('emp_endorsement.name', $emp_name)
|
||||||
->where('emp_endorsement.field_name', 'emp_status')
|
->where('emp_endorsement.field_name', 'emp_status')
|
||||||
@ -1712,6 +1727,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$depositeData = [
|
$depositeData = [
|
||||||
'employeeIds' => $employeeIds,
|
'employeeIds' => $employeeIds,
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
'count' => $count,
|
'count' => $count,
|
||||||
'event' => $import_data['event_type'],
|
'event' => $import_data['event_type'],
|
||||||
@ -2239,9 +2255,10 @@ class EmpDataServiceController extends BaseController
|
|||||||
public function getDataByFileId($file_id, $status = 'success'){
|
public function getDataByFileId($file_id, $status = 'success'){
|
||||||
|
|
||||||
$data = $this->batchFileModel
|
$data = $this->batchFileModel
|
||||||
->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name')
|
->select('batch_files.*, clients.client_name, clients.short_name, policies.name as policy_name, client_branch.branch_name')
|
||||||
->join('clients', 'clients.id = batch_files.client_id')
|
->join('clients', 'clients.id = batch_files.client_id')
|
||||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||||
|
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->where('batch_files.id', $file_id)
|
->where('batch_files.id', $file_id)
|
||||||
->first();
|
->first();
|
||||||
@ -2249,12 +2266,12 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if($status == 'success'){
|
if($status == 'success'){
|
||||||
|
|
||||||
$msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
|
$msg_txt = $data['client_name'] . '( ' . $data['branch_name'] . ' )' . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
|
||||||
$msg_title = 'File Upload Success';
|
$msg_title = 'File Upload Success';
|
||||||
|
|
||||||
}else if ($status == 'failure'){
|
}else if ($status == 'failure'){
|
||||||
|
|
||||||
$msg_txt = $data['short_name'] . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
|
$msg_txt = $data['client_name'] . '( ' . $data['branch_name'] . ' )' . ' - ' . $data['policy_name'] . ' - ' . $data['event_type'] . ' - ' . $data['actions'] . ' - ' . $data['insurer_or_tpa'];
|
||||||
$msg_title = 'File Upload Failure';
|
$msg_title = 'File Upload Failure';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,7 +76,13 @@ class EmployeeController extends AdminController
|
|||||||
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
$data['status'] = ['draft' => 'Draft', 'active' => 'Active', 'inactive' => 'In-Active', 'expired' => 'Expired'];
|
||||||
if (count($this->request->getGet())) {
|
if (count($this->request->getGet())) {
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(client_id: $filterData['client_id'], policy_id: $filterData['policy_id'], status: $filterData['status']);
|
$data['employees'] = $this->employeePolicyModel->getEmployeePolicy(
|
||||||
|
client_id: $filterData['client_id'],
|
||||||
|
policy_id: $filterData['policy_id'],
|
||||||
|
status: $filterData['status'],
|
||||||
|
branch_id: $filterData['branch_id']
|
||||||
|
);
|
||||||
|
|
||||||
$data['getData'] = $filterData;
|
$data['getData'] = $filterData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +95,8 @@ class EmployeeController extends AdminController
|
|||||||
//echo $this->request->isAJAX();die();
|
//echo $this->request->isAJAX();die();
|
||||||
$result = $this->clientModel->clientsWithPolicies();
|
$result = $this->clientModel->clientsWithPolicies();
|
||||||
|
|
||||||
|
// dd($result);
|
||||||
|
|
||||||
// print_r($result);die();
|
// print_r($result);die();
|
||||||
if (!count($result)) {
|
if (!count($result)) {
|
||||||
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
return $this->respond(['dataStatus' => false, 'code' => 404, 'message' => 'no data found'], 200);
|
||||||
@ -190,10 +198,11 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$policy_id = $this->request->getPost('policy_id');
|
$policy_id = $this->request->getPost('policy_id');
|
||||||
|
$branch_id = $this->request->getPost('branch_id');
|
||||||
$action = $this->request->getPost('upload-action-type');
|
$action = $this->request->getPost('upload-action-type');
|
||||||
$status = 'inprogress';
|
$status = 'inprogress';
|
||||||
|
|
||||||
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action]); //here field policy_id have client_policy_id and not policy id from policy master
|
$file_id = $this->fileModel->insert(['file_name' => $filename, 'client_id' => $client_id, 'policy_id' => $policy_id, 'created_by' => $loggedInUserID, 'status' => $status, 'action' => $action, 'client_branch_id' => $branch_id]); //here field policy_id have client_policy_id and not policy id from policy master
|
||||||
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
$this->myLogger->logme("error", '{file_id} uploaded success', ['file_id' => $file_id]);
|
||||||
|
|
||||||
//start validation process
|
//start validation process
|
||||||
@ -232,6 +241,7 @@ class EmployeeController extends AdminController
|
|||||||
'up.first_name',
|
'up.first_name',
|
||||||
'pm.name as policy_name',
|
'pm.name as policy_name',
|
||||||
'c.short_name',
|
'c.short_name',
|
||||||
|
'cb.branch_name',
|
||||||
'cp.id as client_policy_id',
|
'cp.id as client_policy_id',
|
||||||
'(SELECT COUNT(*)
|
'(SELECT COUNT(*)
|
||||||
FROM employees e
|
FROM employees e
|
||||||
@ -244,6 +254,7 @@ class EmployeeController extends AdminController
|
|||||||
])
|
])
|
||||||
->join('user_profiles up', 'files.created_by = up.id')
|
->join('user_profiles up', 'files.created_by = up.id')
|
||||||
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
->join('client_policy cp', 'files.policy_id = cp.id', 'left')
|
||||||
|
->join('client_branch cb', 'files.client_branch_id = cb.id', 'left')
|
||||||
->join('policies pm', 'cp.policy_id = pm.id', 'left')
|
->join('policies pm', 'cp.policy_id = pm.id', 'left')
|
||||||
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
->join('clients c', 'files.client_id = c.id and files.client_id = cp.client_id', 'left')
|
||||||
->where('files.created_by', get_session_userid())
|
->where('files.created_by', get_session_userid())
|
||||||
@ -251,8 +262,9 @@ class EmployeeController extends AdminController
|
|||||||
->findAll();
|
->findAll();
|
||||||
// dd($data['fileList']);
|
// dd($data['fileList']);
|
||||||
|
|
||||||
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
|
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name, client_branch.branch_name')
|
||||||
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
|
||||||
|
->join('client_branch', 'client_branch.id = batch_files.client_branch_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
->join('clients', 'clients.id = client_policy.client_id')
|
->join('clients', 'clients.id = client_policy.client_id')
|
||||||
->orderBy('batch_files.id', 'desc')
|
->orderBy('batch_files.id', 'desc')
|
||||||
@ -351,17 +363,23 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
$client_id = $this->request->getPost('client_id');
|
$client_id = $this->request->getPost('client_id');
|
||||||
$client_policy_id = $this->request->getPost('client_policy_id');
|
$client_policy_id = $this->request->getPost('client_policy_id');
|
||||||
|
$client_branch_id = $this->request->getPost('client_branch_id');
|
||||||
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
$insurer_or_tpa = $this->request->getPost('insurer_or_tpa');
|
||||||
$event_type = $this->request->getPost('event_type');
|
$event_type = $this->request->getPost('event_type');
|
||||||
$actions = $this->request->getPost('action_type');
|
$actions = $this->request->getPost('action_type');
|
||||||
|
|
||||||
$client_data = $this->clientModel->where('id', $client_id)->first();
|
$client_data = $this->clientModel->where('id', $client_id)->first();
|
||||||
$policy_name = $this->clientPolicyModel->select('policies.name')->join('policies', 'policies.id = client_policy.policy_id')->where('client_policy.id', $client_policy_id)->first();
|
$policy_name_and_branch_name = $this->clientPolicyModel->select('policies.name, client_branch.branch_code')
|
||||||
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name['name']);
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
|
->where('client_policy.id', $client_policy_id)
|
||||||
|
->first();
|
||||||
|
$file_name = generate_filename($client_data['short_name'], $event_type, $actions, $insurer_or_tpa, $policy_name_and_branch_name['name'], $policy_name_and_branch_name['branch_code']);
|
||||||
|
|
||||||
$batch_data = [
|
$batch_data = [
|
||||||
'client_id' => $client_id,
|
'client_id' => $client_id,
|
||||||
'client_policy_id' => $client_policy_id,
|
'client_policy_id' => $client_policy_id,
|
||||||
|
'client_branch_id' => $client_branch_id,
|
||||||
'insurer_or_tpa' => $insurer_or_tpa,
|
'insurer_or_tpa' => $insurer_or_tpa,
|
||||||
'event_type' => $event_type,
|
'event_type' => $event_type,
|
||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
@ -544,8 +562,13 @@ class EmployeeController extends AdminController
|
|||||||
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
|
$data['status'] = ['pending' => 'Pending', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
|
||||||
if (count($this->request->getGet())) {
|
if (count($this->request->getGet())) {
|
||||||
$filterData = $this->request->getGet();
|
$filterData = $this->request->getGet();
|
||||||
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(client_id: $filterData['client_id'], policy_id: $filterData['policy_id'], status: $filterData['status']);
|
$data['employees'] = $this->employeePolicyModel->getEmployeeEndorsementList(
|
||||||
$data['getData'] = $filterData;
|
client_id: $filterData['client_id'],
|
||||||
|
policy_id: $filterData['policy_id'],
|
||||||
|
status: $filterData['status'],
|
||||||
|
branch_id: $filterData['branch_id']
|
||||||
|
);
|
||||||
|
$data['getData'] = $filterData;
|
||||||
// echo "<pre>";
|
// echo "<pre>";
|
||||||
// print_r($data); die;
|
// print_r($data); die;
|
||||||
}
|
}
|
||||||
@ -854,8 +877,9 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function generateIDCardForEmployee($rand_string)
|
public function generateIDCardForEmployee($rand_string, $people = 0)
|
||||||
{
|
{
|
||||||
|
// dd($rand_string, $people);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -883,9 +907,13 @@ class EmployeeController extends AdminController
|
|||||||
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
$client_policy_id = $get_emp_code_and_client_policy_id['client_policy_id'];
|
||||||
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
$emp_code = $get_emp_code_and_client_policy_id['emp_code'];
|
||||||
|
|
||||||
// $data['data'] = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
|
||||||
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
$data = $this->employeePolicyModel->getECardDataUsingMd5($client_policy_id, $emp_code);
|
||||||
|
|
||||||
|
if($people == 0){
|
||||||
|
$data = $this->employeePolicyModel->getECardSingleData($rand_string, $emp_code);
|
||||||
|
}
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
|
|
||||||
$template_data_path = WRITEPATH . 'e_card_template/';
|
$template_data_path = WRITEPATH . 'e_card_template/';
|
||||||
|
|||||||
@ -229,12 +229,13 @@ class EmployeeServiceController extends AdminController
|
|||||||
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
|
$result['error_data'][$row_key][$keys[$col_key]]['error'][] = $format_error['error'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Kint::dump($is_mandatory);
|
||||||
//allowed values check
|
//allowed values check
|
||||||
if($is_mandatory === true && isset($allowed_values) && is_array($allowed_values))
|
if(($is_mandatory === true && isset($allowed_values) && is_array($allowed_values)) || (is_array($is_mandatory) && (isset($allowed_values) && is_array($allowed_values))))
|
||||||
{
|
{
|
||||||
|
// print_r($allowed_values);
|
||||||
if(!in_array(strtolower(trim($col)),$allowed_values))
|
// dd($col);
|
||||||
|
if(!in_array((trim($col)),$allowed_values))
|
||||||
{
|
{
|
||||||
array_push($result['error_summary'],3);
|
array_push($result['error_summary'],3);
|
||||||
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
|
$result['error_data'][$row_key][$keys[$col_key]]['col_name'] = $column_dispaly_name; //push column name
|
||||||
@ -263,9 +264,9 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}//col foreach
|
||||||
|
// break;
|
||||||
}
|
}//row foreach
|
||||||
|
|
||||||
if(isset($result['error_summary']) && count($result['error_summary']))
|
if(isset($result['error_summary']) && count($result['error_summary']))
|
||||||
{
|
{
|
||||||
@ -349,6 +350,14 @@ class EmployeeServiceController extends AdminController
|
|||||||
$relationship = $this->general_relationships;
|
$relationship = $this->general_relationships;
|
||||||
|
|
||||||
$employee_data_group_by_family = data_group_by_family($excel_data);
|
$employee_data_group_by_family = data_group_by_family($excel_data);
|
||||||
|
|
||||||
|
$is_self_available_in_policy_terms = false;
|
||||||
|
if($policy_details['policy_type_id'] == 3) // GMC parents
|
||||||
|
{
|
||||||
|
$temp = $policy_terms['family_floaters'];
|
||||||
|
$temp = is_array($temp) ? $temp : (is_object($temp) ? (array)$temp : []);
|
||||||
|
$is_self_available_in_policy_terms = isset($temp['self']) ? true : false;
|
||||||
|
}
|
||||||
// dd($employee_data_group_by_family);
|
// dd($employee_data_group_by_family);
|
||||||
foreach ($employee_data_group_by_family as $emp_id => $family)
|
foreach ($employee_data_group_by_family as $emp_id => $family)
|
||||||
{
|
{
|
||||||
@ -356,7 +365,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||||
if($file['action'] == 'dependent_addition')
|
if($file['action'] == 'dependent_addition')
|
||||||
{
|
{
|
||||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active']);
|
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||||
// dd(($existing_famility_details));
|
// dd(($existing_famility_details));
|
||||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||||
@ -370,7 +379,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
|
|
||||||
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
if($file['action'] == 'inception' || $file['action'] == 'addition' || $file['action'] == 'dependent_addition')
|
||||||
{
|
{
|
||||||
$res = name_dup_check_within_family($family,$file['action']);
|
$res = name_dup_check_within_family($family,$file['action']);//in both file data & DB data
|
||||||
// dd($res);
|
// dd($res);
|
||||||
if(count($res))
|
if(count($res))
|
||||||
{
|
{
|
||||||
@ -383,7 +392,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check self availbale in uploaded file
|
//check self availbale in uploaded file
|
||||||
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents dep addon)
|
if(($file['action'] == 'inception' || $file['action'] == 'addition') && ($policy_details['policy_type_id'] == 3 && $is_self_available_in_policy_terms)) // 3 is GMC parents dep addon)
|
||||||
{
|
{
|
||||||
// dd('file check');
|
// dd('file check');
|
||||||
$res = check_self_available_in_family($family,$file['action']);
|
$res = check_self_available_in_family($family,$file['action']);
|
||||||
@ -395,10 +404,10 @@ class EmployeeServiceController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//check self avaialbe where self data is not available either same policy (i.e.) gMC parents
|
//check self avaialbe either same policy DB level(i.e.) gMC parents
|
||||||
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && $policy_details['base_policy'] == null)) // 3 is GMC parents as base policy not as dep addon)
|
if($file['action'] == 'dependent_addition' || ($policy_details['policy_type_id'] == 3 && !$is_self_available_in_policy_terms)) // 3 is GMC parents as base policy not as dep addon)
|
||||||
{
|
{
|
||||||
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active']);
|
$self_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],emp_status: ['active'],policy_status:['active'],client_branch_id:[ $file['client_branch_id'] ]);
|
||||||
// dd($self_details);
|
// dd($self_details);
|
||||||
if(!count($self_details))
|
if(!count($self_details))
|
||||||
{
|
{
|
||||||
@ -559,7 +568,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
//if action is DA then get all familiy members,transfrom them into excel array, addd data source as db or excel
|
||||||
if($file['action'] == 'dependent_addition')
|
if($file['action'] == 'dependent_addition')
|
||||||
{
|
{
|
||||||
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active']);
|
$existing_famility_details = $this->employeeModel->getEmpFamilybyEmpCode(emp_code: $emp_id,client_id: $file['client_id'],client_policy_id: $file ['policy_id'],emp_status: ['active'],policy_status:['active'],client_branch_id: [ $file['client_branch_id'] ]);
|
||||||
// dd($existing_famility_details);
|
// dd($existing_famility_details);
|
||||||
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
//transsform familiy details from db columns to exxcel row with column indexs for checking remaining functionalitites
|
||||||
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
$existing_famility_details = transform_db_data_to_excel($existing_famility_details,$file);
|
||||||
@ -669,7 +678,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// echo '<br>START- ' . $row[2];
|
// echo '<br>START- ' . $row[2];
|
||||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||||
|
|
||||||
$existing_endorsements = $this->empEndorsementModel->where('actions','d')
|
$existing_endorsements = $this->empEndorsementModel->where('actions','d')
|
||||||
->where('table_name','employees')
|
->where('table_name','employees')
|
||||||
@ -759,7 +768,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$field_value = ($field_name == 'dob' ? change_date_format($row[4],'d-M-Y','Y-m-d') : $row[4] );
|
$field_value = ($field_name == 'dob' ? change_date_format($row[4],'d-M-Y','Y-m-d') : $row[4] );
|
||||||
|
|
||||||
|
|
||||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||||
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
|
$existing_endorsements = $this->empEndorsementModel->where('actions','c')
|
||||||
->where('table_name','employees')
|
->where('table_name','employees')
|
||||||
->where('endorsement_id is null')
|
->where('endorsement_id is null')
|
||||||
@ -819,7 +828,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// echo '<br>START- ' . $row[2];
|
// echo '<br>START- ' . $row[2];
|
||||||
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->first();
|
$employee = $this->employeeModel->where('emp_code', $row[1])->where('name',$row[2])->where('client_id',$file['client_id'])->where('client_branch_id',$file['client_branch_id'])->first();
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||||
|
|
||||||
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
$existing_endorsements = $this->empEndorsementModel->where('actions','si')
|
||||||
@ -870,7 +879,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
if($file['id'] == null || $value['temp']['source'] == 'excel' || (($file['action'] == 'dependent_addition' && in_array($value['temp']['source'],[10,11]) && ($slab_details['slab_rates'][0]['premium_type'] == 1 && strtolower($value['relationship']) == 'self') || ($slab_details['slab_rates'][0]['premium_type'] == 1 || $slab_details['slab_rates'][0]['premium_type'] == null)))) //insert data come from excel and from db i.e. ( $file['id'] == null for enrollment data)
|
||||||
{
|
{
|
||||||
|
|
||||||
$employee = $this->employeeModel->checkExistingEmp($value);
|
$employee = $this->employeeModel->checkExistingEmp($value,$file['client_branch_id']);
|
||||||
$policy_data = $value['policy_details'];
|
$policy_data = $value['policy_details'];
|
||||||
$temp = $value['temp'];
|
$temp = $value['temp'];
|
||||||
unset($value['policy_details']);
|
unset($value['policy_details']);
|
||||||
@ -895,6 +904,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$value['updated_by'] = $file['created_by'];
|
$value['updated_by'] = $file['created_by'];
|
||||||
$value['id'] = $employee[0]['id'];
|
$value['id'] = $employee[0]['id'];
|
||||||
$value['emp_status'] = 'active';
|
$value['emp_status'] = 'active';
|
||||||
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
$log_message = 'Update Employee - '.$employee[0]['name'].'('.$employee[0]['emp_code'].') with PK '.$employee[0]['id'];
|
||||||
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
// $this->myLogger->logme('error',('Update - ' . $employee[0]['id'].' - '. $employee[0]['emp_code'] .' - '.$employee[0]['name']));
|
||||||
}
|
}
|
||||||
@ -902,6 +912,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
{
|
{
|
||||||
$value['emp_status'] = 'active';
|
$value['emp_status'] = 'active';
|
||||||
$value['created_by'] = $file['created_by'];
|
$value['created_by'] = $file['created_by'];
|
||||||
|
$value['client_branch_id'] = $file['client_branch_id'];
|
||||||
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
$log_message = 'Insert Employee- '.$value['name'] .'('.$value['emp_code'] .') with PK ';
|
||||||
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
// $this->myLogger->logme('error',('Insert - ' . $value['emp_code'] .' - '. $value['name']));
|
||||||
}
|
}
|
||||||
@ -946,7 +957,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
// $employee -> holds existing emp model obj and $policy_data holds new policy changes as array
|
// $employee -> holds existing emp model obj and $policy_data holds new policy changes as array
|
||||||
public function employeesSIEnhanceProcessWhileOnbboard(array $employee,array $policy_data,array $file)
|
public function employeesSIEnhanceProcessWhileOnbboard(array $employee,array $policy_data,array $file)
|
||||||
{
|
{
|
||||||
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('is_active',1)->first();
|
$employee = $this->employeeModel->where('emp_code', $employee['emp_code'])->where('name',$employee['name'])->where('client_id',$employee['client_id'])->where('client_branch_id',$file['client_id'])->where('is_active',1)->first();
|
||||||
|
|
||||||
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
$employee_policy = $this->employeePolicyModel->where('employee_id',$employee['id'])->where('client_policy_id',$file['policy_id'])->first();
|
||||||
// dd($employee_policy);
|
// dd($employee_policy);
|
||||||
@ -1108,10 +1119,11 @@ class EmployeeServiceController extends AdminController
|
|||||||
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
public function getFileMetaDataByFileId($file_id, $status = 'success'){
|
||||||
|
|
||||||
$data = $this->fileModel
|
$data = $this->fileModel
|
||||||
->select('files.*, clients.client_name, clients.short_name, policies.name as policy_name')
|
->select('files.*, clients.client_name, clients.short_name, policies.name as policy_name,client_branch.branch_code')
|
||||||
->join('clients', 'clients.id = files.client_id')
|
->join('clients', 'clients.id = files.client_id')
|
||||||
->join('client_policy', 'client_policy.id = files.policy_id')
|
->join('client_policy', 'client_policy.id = files.policy_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
|
->join('client_branch', 'client_branch.id = files.client_branch_id')
|
||||||
->where('files.id', $file_id)
|
->where('files.id', $file_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
@ -1124,7 +1136,7 @@ class EmployeeServiceController extends AdminController
|
|||||||
$msg_title = 'File Upload Failure';
|
$msg_title = 'File Upload Failure';
|
||||||
}
|
}
|
||||||
|
|
||||||
$msg_txt = $data['client_name'] . ' - ' . $data['policy_name'] . ' - ' . ucfirst($data['action']);
|
$msg_txt = $data['client_name'] . ' ('.$data['branch_code'].') - ' . $data['policy_name'] . ' - ' . ucfirst($data['action']);
|
||||||
$user_id = $data['created_by'];
|
$user_id = $data['created_by'];
|
||||||
$url = 'employee/upload';
|
$url = 'employee/upload';
|
||||||
|
|
||||||
|
|||||||
@ -175,7 +175,16 @@ class JobWorker extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$payload = is_array($payload) ? $payload : [];
|
$payload = is_array($payload) ? $payload : [];
|
||||||
$response = $jobHandler($payload,$job->id);
|
try
|
||||||
|
{
|
||||||
|
$response = $jobHandler($payload,$job->id);
|
||||||
|
}
|
||||||
|
catch(\Exception $e)
|
||||||
|
{
|
||||||
|
$job_status = self::STATUS_FAILED;
|
||||||
|
$runtime = $runtime === null ? microtime(true) - $start : $runtime;
|
||||||
|
$response = ['file_name' => $e->getFile(),'error' => $e->getMessage(),'line_no' => $e->getLine(),'info' => $e->getTraceAsString()];
|
||||||
|
}
|
||||||
|
|
||||||
$runtime = microtime(true) - $start;
|
$runtime = microtime(true) - $start;
|
||||||
$job_status = self::STATUS_DONE;
|
$job_status = self::STATUS_DONE;
|
||||||
|
|||||||
@ -95,17 +95,20 @@ class PendingActionsController extends AdminController
|
|||||||
cp.policy_status,
|
cp.policy_status,
|
||||||
cp.open_for_enrollment,
|
cp.open_for_enrollment,
|
||||||
cp.inception_type,
|
cp.inception_type,
|
||||||
|
cb.id as branch_id,
|
||||||
|
cb.branch_name,
|
||||||
COUNT(ep.id) AS employee_policy_count
|
COUNT(ep.id) AS employee_policy_count
|
||||||
');
|
');
|
||||||
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
|
$builder->join('employee_polices ep', 'cp.id = ep.client_policy_id AND ep.is_active = 1', 'left');
|
||||||
$builder->join('clients', 'cp.client_id = clients.id');
|
$builder->join('clients', 'cp.client_id = clients.id');
|
||||||
|
$builder->join('client_branch cb', 'cb.id = cp.client_branch_id');
|
||||||
$builder->join('policies', 'cp.policy_id = policies.id');
|
$builder->join('policies', 'cp.policy_id = policies.id');
|
||||||
$builder->where('cp.is_active', 1);
|
$builder->where('cp.is_active', 1);
|
||||||
$builder->where('cp.open_for_enrollment', 1);
|
$builder->where('cp.open_for_enrollment', 1);
|
||||||
$builder->where('cp.is_addon', 1);
|
$builder->where('cp.is_addon', 1);
|
||||||
$builder->where('cp.policy_status', 1);
|
$builder->where('cp.policy_status', 1);
|
||||||
$builder->where('cp.inception_type', 1);
|
$builder->where('cp.inception_type', 1);
|
||||||
$builder->whereIn('cp.policy_type_id', [1, 2, 30]);
|
$builder->whereIn('cp.policy_type_id', [1, 2, 3]);
|
||||||
$builder->groupBy('cp.id, cp.client_id, cp.policy_id, cp.policy_type_id, cp.is_addon, cp.policy_status, cp.open_for_enrollment');
|
$builder->groupBy('cp.id, cp.client_id, cp.policy_id, cp.policy_type_id, cp.is_addon, cp.policy_status, cp.open_for_enrollment');
|
||||||
$builder->having('employee_policy_count = 0 OR employee_policy_count IS NULL');
|
$builder->having('employee_policy_count = 0 OR employee_policy_count IS NULL');
|
||||||
|
|
||||||
@ -147,6 +150,8 @@ class PendingActionsController extends AdminController
|
|||||||
|
|
||||||
clients.client_name as client_name,
|
clients.client_name as client_name,
|
||||||
clients.id as client_id,
|
clients.id as client_id,
|
||||||
|
client_branch.id as branch_id,
|
||||||
|
client_branch.branch_name,
|
||||||
emp_endorsement.id,
|
emp_endorsement.id,
|
||||||
emp_endorsement.pk,
|
emp_endorsement.pk,
|
||||||
emp_endorsement.endorsement_id,
|
emp_endorsement.endorsement_id,
|
||||||
@ -159,20 +164,23 @@ class PendingActionsController extends AdminController
|
|||||||
employees.name as ename
|
employees.name as ename
|
||||||
')
|
')
|
||||||
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
|
->join('employees', 'emp_endorsement.pk = employees.id AND employees.is_active = 1 AND employees.emp_status = \'active\'')
|
||||||
->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
|
->join('clients', 'employees.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||||
->where([
|
->join('client_branch', 'client_branch.id = employees.client_branch_id', 'left')
|
||||||
|
->where([
|
||||||
'emp_endorsement.actions' => 'c',
|
'emp_endorsement.actions' => 'c',
|
||||||
'emp_endorsement.is_active' => 1,
|
'emp_endorsement.is_active' => 1,
|
||||||
'emp_endorsement.status' => 'pending',
|
'emp_endorsement.status' => 'pending',
|
||||||
'emp_endorsement.endorsement_id' => null
|
'emp_endorsement.endorsement_id' => null
|
||||||
])
|
])
|
||||||
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
|
->groupBy('emp_endorsement.pk, emp_endorsement.emp_code, emp_endorsement.table_name, emp_endorsement.actions, emp_endorsement.name');
|
||||||
|
|
||||||
// Main query builder
|
// Main query builder
|
||||||
$builder = $this->db->table('clients');
|
$builder = $this->db->table('clients');
|
||||||
$builder->select("
|
$builder->select("
|
||||||
subquery.client_name,
|
subquery.client_name,
|
||||||
subquery.client_id,
|
subquery.client_id,
|
||||||
|
subquery.branch_name,
|
||||||
|
subquery.branch_id,
|
||||||
COUNT(subquery.id) AS subquery_count,
|
COUNT(subquery.id) AS subquery_count,
|
||||||
($subQueryExport) AS batch_export_count,
|
($subQueryExport) AS batch_export_count,
|
||||||
($subQueryImport) AS batch_import_count
|
($subQueryImport) AS batch_import_count
|
||||||
@ -223,6 +231,8 @@ class PendingActionsController extends AdminController
|
|||||||
->select('
|
->select('
|
||||||
clients.client_name as client_name,
|
clients.client_name as client_name,
|
||||||
clients.id as client_id,
|
clients.id as client_id,
|
||||||
|
client_branch.id as branch_id,
|
||||||
|
client_branch.branch_name,
|
||||||
client_policy.id as client_policy_id,
|
client_policy.id as client_policy_id,
|
||||||
policies.name as policy_name,
|
policies.name as policy_name,
|
||||||
policies.id as pid,
|
policies.id as pid,
|
||||||
@ -239,6 +249,7 @@ class PendingActionsController extends AdminController
|
|||||||
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\'')
|
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\'')
|
||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1')
|
||||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
|
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1')
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
|
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1')
|
||||||
->where([
|
->where([
|
||||||
'emp_endorsement.actions' => 'si',
|
'emp_endorsement.actions' => 'si',
|
||||||
@ -256,6 +267,8 @@ class PendingActionsController extends AdminController
|
|||||||
subquery.client_id,
|
subquery.client_id,
|
||||||
subquery.client_policy_id,
|
subquery.client_policy_id,
|
||||||
subquery.policy_name,
|
subquery.policy_name,
|
||||||
|
subquery.branch_name,
|
||||||
|
subquery.branch_id,
|
||||||
COUNT(subquery.id) AS subquery_count,
|
COUNT(subquery.id) AS subquery_count,
|
||||||
($subQueryExport) AS batch_export_count,
|
($subQueryExport) AS batch_export_count,
|
||||||
($subQueryImport) AS batch_import_count
|
($subQueryImport) AS batch_import_count
|
||||||
@ -304,8 +317,10 @@ class PendingActionsController extends AdminController
|
|||||||
// Build the subquery
|
// Build the subquery
|
||||||
$subqueryBuilder = $this->db->table('emp_endorsement')
|
$subqueryBuilder = $this->db->table('emp_endorsement')
|
||||||
->select('
|
->select('
|
||||||
clients.client_name as client_name,
|
|
||||||
clients.id as client_id,
|
clients.id as client_id,
|
||||||
|
clients.client_name as client_name,
|
||||||
|
client_branch.id as branch_id,
|
||||||
|
client_branch.branch_name,
|
||||||
client_policy.id as client_policy_id,
|
client_policy.id as client_policy_id,
|
||||||
policies.name as policy_name,
|
policies.name as policy_name,
|
||||||
policies.id as pid,
|
policies.id as pid,
|
||||||
@ -317,10 +332,12 @@ class PendingActionsController extends AdminController
|
|||||||
emp_endorsement.actions,
|
emp_endorsement.actions,
|
||||||
emp_endorsement.name,
|
emp_endorsement.name,
|
||||||
emp_endorsement.status
|
emp_endorsement.status
|
||||||
|
|
||||||
')
|
')
|
||||||
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\' AND emp_endorsement.table_name = \'employee_polices\'', 'left')
|
->join('employee_polices', 'emp_endorsement.pk = employee_polices.id AND employee_polices.is_active = 1 AND employee_polices.status = \'active\' AND emp_endorsement.table_name = \'employee_polices\'', 'left')
|
||||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
|
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1', 'left')
|
||||||
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
->join('clients', 'client_policy.client_id = clients.id AND clients.is_active = 1', 'left')
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id', 'left')
|
||||||
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
|
->join('policies', 'client_policy.policy_id = policies.id AND policies.is_active = 1', 'left')
|
||||||
->where([
|
->where([
|
||||||
'emp_endorsement.actions' => 'd',
|
'emp_endorsement.actions' => 'd',
|
||||||
@ -339,6 +356,8 @@ class PendingActionsController extends AdminController
|
|||||||
subquery.client_id,
|
subquery.client_id,
|
||||||
subquery.client_policy_id,
|
subquery.client_policy_id,
|
||||||
subquery.policy_name,
|
subquery.policy_name,
|
||||||
|
subquery.branch_name,
|
||||||
|
subquery.branch_id,
|
||||||
COUNT(subquery.id) AS subquery_count,
|
COUNT(subquery.id) AS subquery_count,
|
||||||
($subQueryExport) AS batch_export_count,
|
($subQueryExport) AS batch_export_count,
|
||||||
($subQueryImport) AS batch_import_count
|
($subQueryImport) AS batch_import_count
|
||||||
@ -389,10 +408,12 @@ class PendingActionsController extends AdminController
|
|||||||
->select('c.short_name')
|
->select('c.short_name')
|
||||||
->select('p.name as policy_name')
|
->select('p.name as policy_name')
|
||||||
->select('ep.uhid')
|
->select('ep.uhid')
|
||||||
|
->select('cb.branch_name, cb.id as branch_id')
|
||||||
->select("($subQueryExport) AS batch_export_count", false)
|
->select("($subQueryExport) AS batch_export_count", false)
|
||||||
->select("($subQueryImport) AS batch_import_count", false)
|
->select("($subQueryImport) AS batch_import_count", false)
|
||||||
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
|
->join('client_policy cp', 'ep.client_policy_id = cp.id AND cp.is_active = 1 AND cp.policy_status = 1')
|
||||||
->join('clients c', 'c.id = cp.client_id')
|
->join('clients c', 'c.id = cp.client_id')
|
||||||
|
->join('client_branch cb', 'cb.id = cp.client_branch_id')
|
||||||
->join('policies p', 'p.id = cp.policy_id')
|
->join('policies p', 'p.id = cp.policy_id')
|
||||||
->where('ep.uhid IS NULL')
|
->where('ep.uhid IS NULL')
|
||||||
->where('ep.status', 'active')
|
->where('ep.status', 'active')
|
||||||
@ -439,13 +460,16 @@ class PendingActionsController extends AdminController
|
|||||||
clients.short_name,
|
clients.short_name,
|
||||||
clients.client_name,
|
clients.client_name,
|
||||||
policies.name as policy_name,
|
policies.name as policy_name,
|
||||||
clients.id as client_id
|
clients.id as client_id,
|
||||||
|
client_branch.id as branch_id,
|
||||||
|
client_branch.branch_name
|
||||||
');
|
');
|
||||||
$builder->select("($subQueryExport) AS batch_export_count", false);
|
$builder->select("($subQueryExport) AS batch_export_count", false);
|
||||||
$builder->select("($subQueryImport) AS batch_import_count", false);
|
$builder->select("($subQueryImport) AS batch_import_count", false);
|
||||||
|
|
||||||
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
|
$builder->join('client_policy', 'employee_polices.client_policy_id = client_policy.id AND client_policy.is_active = 1 AND client_policy.policy_status = 1');
|
||||||
$builder->join('clients', 'clients.id = client_policy.client_id');
|
$builder->join('clients', 'clients.id = client_policy.client_id');
|
||||||
|
$builder->join('client_branch', 'client_branch.id = client_policy.client_branch_id');
|
||||||
$builder->join('policies', 'policies.id = client_policy.policy_id');
|
$builder->join('policies', 'policies.id = client_policy.policy_id');
|
||||||
$builder->where('employee_polices.tpa_id', null);
|
$builder->where('employee_polices.tpa_id', null);
|
||||||
$builder->where('employee_polices.uhid IS NOT NULL');
|
$builder->where('employee_polices.uhid IS NOT NULL');
|
||||||
|
|||||||
@ -359,7 +359,7 @@ if (!function_exists('read_excel_file_to_array')) {
|
|||||||
|
|
||||||
|
|
||||||
if (! function_exists('generate_filename')) {
|
if (! function_exists('generate_filename')) {
|
||||||
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name) {
|
function generate_filename($client_short_name, $event_type, $actions, $insurer_or_tpa, $policy_name, $branch_code) {
|
||||||
|
|
||||||
$evenTypeLabel = '';
|
$evenTypeLabel = '';
|
||||||
if($event_type == 'inception'){
|
if($event_type == 'inception'){
|
||||||
@ -387,9 +387,10 @@ if (! function_exists('generate_filename')) {
|
|||||||
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
$currentDateTime = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
||||||
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
|
$formattedDateTime = $currentDateTime->format('d-m-Y_H-i-s');
|
||||||
$policy_name = str_replace(' ', '_', $policy_name);
|
$policy_name = str_replace(' ', '_', $policy_name);
|
||||||
|
$branch_code = isset($branch_code) ? str_replace(' ', '_', $branch_code) : '_';
|
||||||
|
|
||||||
// Generate file name
|
// Generate file name
|
||||||
$file_name = $client_short_name. '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
|
$file_name = $client_short_name. '_' . $branch_code . '_' . $policy_name . '_' . $insurer_or_tpa_lable . $actions . $evenTypeLabel . '_' . $formattedDateTime . '.xlsx';
|
||||||
return $file_name;
|
return $file_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -405,7 +405,7 @@ if (!function_exists('name_and_empid_check_in_db'))
|
|||||||
|
|
||||||
foreach ($family_data as $rkey => $row)
|
foreach ($family_data as $rkey => $row)
|
||||||
{
|
{
|
||||||
if(isset($row['temp']) && $row['temp']['source'] != 'db')
|
if(($current_action == 'inception' || $current_action == 'addition') || ($current_action == 'dependent_addition' && (isset($row['temp']) && $row['temp']['source'] != 'db')))
|
||||||
{
|
{
|
||||||
$res = $employeeModel
|
$res = $employeeModel
|
||||||
->join('client_policy cp',"employees.client_id = cp.client_id")
|
->join('client_policy cp',"employees.client_id = cp.client_id")
|
||||||
|
|||||||
@ -188,6 +188,7 @@ if (!function_exists('get_base64_image')) {
|
|||||||
if (!function_exists('format_indian_number')) {
|
if (!function_exists('format_indian_number')) {
|
||||||
function format_indian_number($number) {
|
function format_indian_number($number) {
|
||||||
// Round the number to two decimal places
|
// Round the number to two decimal places
|
||||||
|
$number = isset($number) ? $number : 0;
|
||||||
$number = round($number, 2);
|
$number = round($number, 2);
|
||||||
|
|
||||||
// Split the number into integer and decimal parts
|
// Split the number into integer and decimal parts
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class BatchFileModel extends Model
|
|||||||
"amount",
|
"amount",
|
||||||
"status",
|
"status",
|
||||||
"error_data",
|
"error_data",
|
||||||
|
"client_branch_id",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace App\Models;
|
|||||||
|
|
||||||
use CodeIgniter\Model;
|
use CodeIgniter\Model;
|
||||||
use App\Models\ClientPolicyModel;
|
use App\Models\ClientPolicyModel;
|
||||||
|
use App\Models\ClientBranchModel;
|
||||||
|
|
||||||
class ClientModel extends Model
|
class ClientModel extends Model
|
||||||
{
|
{
|
||||||
@ -41,7 +42,8 @@ class ClientModel extends Model
|
|||||||
|
|
||||||
foreach ($clients as &$client) {
|
foreach ($clients as &$client) {
|
||||||
$clientPolicyModel = new ClientPolicyModel();
|
$clientPolicyModel = new ClientPolicyModel();
|
||||||
$clientPolicies = $clientPolicyModel->select(['client_policy.id','p.name','pt.policy_type'])
|
$clientPolicies = $clientPolicyModel->select(['client_branch.id as branch_id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id', 'client_policy.id as client_policy_id','p.name','pt.policy_type',])
|
||||||
|
->join('client_branch', 'client_branch.id = client_policy.client_branch_id')
|
||||||
->join('policies p', 'p.id = client_policy.policy_id')
|
->join('policies p', 'p.id = client_policy.policy_id')
|
||||||
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
->join('policy_type pt','client_policy.policy_type_id = pt.id')
|
||||||
->where('client_policy.client_id',$client['id'])
|
->where('client_policy.client_id',$client['id'])
|
||||||
@ -50,6 +52,13 @@ class ClientModel extends Model
|
|||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
$client['policies'] = $clientPolicies;
|
$client['policies'] = $clientPolicies;
|
||||||
|
|
||||||
|
$clientBranchModel = new ClientBranchModel();
|
||||||
|
$clientBranchs = $clientBranchModel->select(['client_branch.id','client_branch.branch_name','client_branch.branch_code', 'client_branch.client_id'])
|
||||||
|
->where('client_branch.client_id',$client['id'])
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
$client['branchs'] = $clientBranchs;
|
||||||
}
|
}
|
||||||
//print_r(($clients));die();
|
//print_r(($clients));die();
|
||||||
return $clients;
|
return $clients;
|
||||||
|
|||||||
@ -37,7 +37,8 @@ class EmployeeModel extends Model
|
|||||||
"is_active",
|
"is_active",
|
||||||
"file_id",
|
"file_id",
|
||||||
"is_addon_value",
|
"is_addon_value",
|
||||||
"is_createdby_hr"
|
"is_createdby_hr",
|
||||||
|
"client_branch_id"
|
||||||
];
|
];
|
||||||
|
|
||||||
// Callbacks
|
// Callbacks
|
||||||
@ -76,7 +77,7 @@ class EmployeeModel extends Model
|
|||||||
|
|
||||||
|
|
||||||
// for emp onboard process do not change
|
// for emp onboard process do not change
|
||||||
public function checkExistingEmp($arr)
|
public function checkExistingEmp($arr,$client_branch_id)
|
||||||
{
|
{
|
||||||
|
|
||||||
if($arr['temp']['emp_id'] == null)
|
if($arr['temp']['emp_id'] == null)
|
||||||
@ -84,9 +85,12 @@ class EmployeeModel extends Model
|
|||||||
return $this->where('emp_code',$arr['emp_code'])
|
return $this->where('emp_code',$arr['emp_code'])
|
||||||
->where('name',$arr['name'])
|
->where('name',$arr['name'])
|
||||||
->where('client_id',$arr['client_id'])
|
->where('client_id',$arr['client_id'])
|
||||||
|
->where('client_branch_id',$client_branch_id)
|
||||||
->where('is_active',1)
|
->where('is_active',1)
|
||||||
->where('gender',$arr['gender'])
|
->where('gender',$arr['gender'])
|
||||||
->where('dob',$arr['dob'])
|
->where('dob',$arr['dob'])
|
||||||
|
->where('is_active',1)
|
||||||
|
->where('emp_status','active')
|
||||||
->find();
|
->find();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -96,9 +100,9 @@ class EmployeeModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [])
|
public function getEmpFamilybyEmpCode(string $client_policy_id = null,string $emp_code = null,string $client_id = null,array $emp_status = [],array $policy_status = [],array $relationship = [],array $client_branch_id = [])
|
||||||
{
|
{
|
||||||
$result = $this->select(['employees.id as emp_id', 'employees.client_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policies.name as policy_name','client_policy.is_addon'])
|
$result = $this->select(['employees.id as emp_id', 'employees.client_id','employees.client_branch_id', 'employees.relationship', 'employees.relationship_code', 'employees.change_event', 'employees.emp_code', 'employees.name', 'employees.email_personal', 'employees.email_corporate', 'employees.mobile', 'employees.gender', 'employees.dob', 'employees.doj', 'employees.basic_pay', 'employees.band', 'employees.designation', 'employees.emp_status','employee_polices.id as emp_policy_id', 'employee_polices.employee_id', 'employee_polices.client_policy_id', 'employee_polices.tpa_id', 'employee_polices.uhid', 'employee_polices.batch_code', 'employee_polices.status', 'employee_polices.pre_existing_alignments', 'employee_polices.basic_cover_si', 'employee_polices.date_coverage', 'employee_polices.policy_end_date', 'employee_polices.days', 'employee_polices.premium', 'employee_polices.rata_premimum', 'employee_polices.gst', 'employee_polices.date_of_exit', 'employee_polices.reason_for_exit','policies.name as policy_name','client_policy.is_addon'])
|
||||||
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
->join('employee_polices', 'employee_polices.employee_id = employees.id')
|
||||||
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
|
||||||
->join('policies', 'policies.id = client_policy.policy_id')
|
->join('policies', 'policies.id = client_policy.policy_id')
|
||||||
@ -116,6 +120,9 @@ class EmployeeModel extends Model
|
|||||||
})
|
})
|
||||||
->when(count($emp_status), function($query) use ($emp_status){
|
->when(count($emp_status), function($query) use ($emp_status){
|
||||||
return $query->whereIn('employees.emp_status', $emp_status);
|
return $query->whereIn('employees.emp_status', $emp_status);
|
||||||
|
})
|
||||||
|
->when(count($client_branch_id), function($query) use ($client_branch_id){
|
||||||
|
return $query->whereIn('employees.client_branch_id', $client_branch_id);
|
||||||
})
|
})
|
||||||
->when(count($relationship), function($query) use ($relationship){
|
->when(count($relationship), function($query) use ($relationship){
|
||||||
return $query->whereIn('employees.relationship', $relationship);
|
return $query->whereIn('employees.relationship', $relationship);
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
public function getEmployeePolicy($client_id,$policy_id,$status)
|
public function getEmployeePolicy($client_id,$policy_id,$status, $branch_id)
|
||||||
{
|
{
|
||||||
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
$result = $this->select(['employee_polices.*','pm.name as policy_name','im.short_name as insurer_short_name','ib.branch_name as insurer_branch_name','ib.branch_code as insurer_branch_code','tpam.name as tpa_name','tpam.short_name as tpa_short_name','tpab.branch_code as tpa_branch_code','cm.client_name','cm.short_name as client_short_name','emp.relationship','emp.relationship_code','emp.change_event','emp.emp_code','emp.name','emp.email_corporate','emp.dob','emp.gender','emp.emp_status','emp.is_active as emp_is_active','emp.mobile as mobile'])
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
@ -88,6 +88,7 @@ class EmployeePolicyModel extends Model
|
|||||||
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
->join('tpa_branch tpab', 'cp.tpa_branch_id = tpab.id') //tpab - tpa brach
|
||||||
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
->join('clients cm', 'cp.client_id = cm.id') //cm - client master
|
||||||
->where('emp.client_id',$client_id)
|
->where('emp.client_id',$client_id)
|
||||||
|
->where('emp.client_branch_id',$branch_id)
|
||||||
->where('employee_polices.is_active',1)
|
->where('employee_polices.is_active',1)
|
||||||
->where('emp.is_active',1)
|
->where('emp.is_active',1)
|
||||||
->where('employee_polices.client_policy_id',$policy_id)
|
->where('employee_polices.client_policy_id',$policy_id)
|
||||||
@ -119,6 +120,7 @@ class EmployeePolicyModel extends Model
|
|||||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
||||||
{
|
{
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
$event = $ref_data['event_type'];
|
$event = $ref_data['event_type'];
|
||||||
|
|
||||||
@ -173,7 +175,8 @@ class EmployeePolicyModel extends Model
|
|||||||
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||||
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
WHERE employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
|
AND (employee_polices.{$id} IS NULL OR employee_polices.{$id} = '')
|
||||||
AND employee_polices.is_active = 1";
|
AND employee_polices.is_active = 1
|
||||||
|
AND employees.client_branch_id = '{$client_branch_id}'";
|
||||||
|
|
||||||
// Get the result set
|
// Get the result set
|
||||||
$query = $this->db->query($sql);
|
$query = $this->db->query($sql);
|
||||||
@ -187,6 +190,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$client_id = $ref_data['client_id'];
|
$client_id = $ref_data['client_id'];
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
@ -235,6 +239,7 @@ class EmployeePolicyModel extends Model
|
|||||||
AND batch_data.bl IS NULL
|
AND batch_data.bl IS NULL
|
||||||
AND employees.client_id = '{$client_id}'
|
AND employees.client_id = '{$client_id}'
|
||||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
|
AND employees.client_branch_id = '{$client_branch_id}'
|
||||||
AND emp_endorsement.actions = 'c'
|
AND emp_endorsement.actions = 'c'
|
||||||
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
AND (emp_endorsement.endorsement_id IS NULL OR emp_endorsement.endorsement_id = '')";
|
||||||
|
|
||||||
@ -254,6 +259,7 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$client_id = $ref_data['client_id'];
|
$client_id = $ref_data['client_id'];
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
@ -344,6 +350,7 @@ class EmployeePolicyModel extends Model
|
|||||||
batch_data.bf IS NULL
|
batch_data.bf IS NULL
|
||||||
AND batch_data.bl IS NULL
|
AND batch_data.bl IS NULL
|
||||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||||
|
AND employees.client_branch_id = '{$client_policy_id}'
|
||||||
AND employee_polices.is_active = '1'
|
AND employee_polices.is_active = '1'
|
||||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
AND (a.endorsement_id IS NULL OR a.endorsement_id = '')
|
||||||
AND a.field_name = 'si_enhancement_date'
|
AND a.field_name = 'si_enhancement_date'
|
||||||
@ -361,10 +368,11 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
$client_id = $ref_data['client_id'];
|
$client_id = $ref_data['client_id'];
|
||||||
$client_policy_id = $ref_data['client_policy_id'];
|
$client_policy_id = $ref_data['client_policy_id'];
|
||||||
|
$client_branch_id = $ref_data['client_branch_id'];
|
||||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||||
|
|
||||||
$query = $this->db->query("
|
$query = $this->db->query("
|
||||||
SELECT
|
SELECT DISTINCT
|
||||||
a.id as endorsement_primarykey,
|
a.id as endorsement_primarykey,
|
||||||
employee_polices.id as primaryKey,
|
employee_polices.id as primaryKey,
|
||||||
employees.name AS emp_name,
|
employees.name AS emp_name,
|
||||||
@ -435,6 +443,7 @@ class EmployeePolicyModel extends Model
|
|||||||
batch_data.bf IS NULL
|
batch_data.bf IS NULL
|
||||||
AND batch_data.bl IS NULL
|
AND batch_data.bl IS NULL
|
||||||
AND employee_polices.client_policy_id = {$client_policy_id}
|
AND employee_polices.client_policy_id = {$client_policy_id}
|
||||||
|
AND employees.client_branch_id = {$client_branch_id}
|
||||||
AND employee_polices.is_active = 1
|
AND employee_polices.is_active = 1
|
||||||
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
|
AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
|
||||||
");
|
");
|
||||||
@ -592,7 +601,7 @@ class EmployeePolicyModel extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getEmployeeEndorsementList($client_id, $policy_id, $status)
|
public function getEmployeeEndorsementList($client_id, $policy_id, $status, $branch_id)
|
||||||
{
|
{
|
||||||
$query1 = $this->db->table('emp_endorsement e');
|
$query1 = $this->db->table('emp_endorsement e');
|
||||||
$query1->select('
|
$query1->select('
|
||||||
@ -609,14 +618,16 @@ class EmployeePolicyModel extends Model
|
|||||||
insurers.short_name as insurer_short_name
|
insurers.short_name as insurer_short_name
|
||||||
');
|
');
|
||||||
$query1->distinct();
|
$query1->distinct();
|
||||||
$query1->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
$query1->join('employee_polices ep', 'ep.id = e.pk');
|
||||||
$query1->join('employees', 'employees.id = ep.employee_id', 'left');
|
$query1->join('employees', 'employees.id = ep.employee_id');
|
||||||
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
$query1->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||||
$query1->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
$query1->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||||
$query1->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
$query1->join('policies', 'policies.id = client_policy.policy_id');
|
||||||
|
$query1->join('insurers', 'insurers.id = policies.insurer_id');
|
||||||
$query1->whereIn('e.actions', ['c']);
|
$query1->whereIn('e.actions', ['c']);
|
||||||
$query1->where('ep.client_policy_id', $client_id);
|
$query1->where('ep.client_policy_id', $policy_id);
|
||||||
$query1->where('employees.client_id', $policy_id);
|
$query1->where('employees.client_id', $client_id);
|
||||||
|
$query1->where('employees.client_branch_id', $branch_id);
|
||||||
if($status != 0 && !empty($status)){
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
$query1->where('e.status', $status);
|
$query1->where('e.status', $status);
|
||||||
@ -640,14 +651,16 @@ class EmployeePolicyModel extends Model
|
|||||||
policies.name as policy_name,
|
policies.name as policy_name,
|
||||||
insurers.short_name as insurer_short_name
|
insurers.short_name as insurer_short_name
|
||||||
');
|
');
|
||||||
$query2->join('employee_polices ep', 'ep.id = e.pk', 'left');
|
$query2->join('employee_polices ep', 'ep.id = e.pk');
|
||||||
$query2->join('employees', 'employees.id = ep.employee_id', 'left');
|
$query2->join('employees', 'employees.id = ep.employee_id');
|
||||||
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id', 'left');
|
$query2->join('client_policy', 'client_policy.id = ep.client_policy_id');
|
||||||
$query2->join('policies', 'policies.id = client_policy.policy_id', 'left');
|
$query2->join('client_branch', 'client_branch.id = employees.client_branch_id');
|
||||||
$query2->join('insurers', 'insurers.id = policies.insurer_id', 'left');
|
$query2->join('policies', 'policies.id = client_policy.policy_id');
|
||||||
|
$query2->join('insurers', 'insurers.id = policies.insurer_id');
|
||||||
$query2->whereIn('e.actions', ['si', 'd']);
|
$query2->whereIn('e.actions', ['si', 'd']);
|
||||||
$query2->where('ep.client_policy_id', $client_id);
|
$query2->where('ep.client_policy_id', $policy_id);
|
||||||
$query2->where('employees.client_id', $policy_id);
|
$query2->where('employees.client_id', $policy_id);
|
||||||
|
$query1->where('employees.client_branch_id', $branch_id);
|
||||||
if($status != 0 && !empty($status)){
|
if($status != 0 && !empty($status)){
|
||||||
|
|
||||||
$query2->where('e.status', $status);
|
$query2->where('e.status', $status);
|
||||||
@ -769,6 +782,72 @@ class EmployeePolicyModel extends Model
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getECardSingleData($rand_string, $emp_code){
|
||||||
|
|
||||||
|
$result = $this->db->table('employees e')
|
||||||
|
->select('e.id,
|
||||||
|
e.name, e.mobile,
|
||||||
|
e.relationship,
|
||||||
|
e.relationship_code,
|
||||||
|
e.emp_code,
|
||||||
|
e.email_personal,
|
||||||
|
e.email_corporate,
|
||||||
|
e.gender,
|
||||||
|
e.dob,
|
||||||
|
e.doj,
|
||||||
|
e.band,
|
||||||
|
TIMESTAMPDIFF(YEAR, e.dob, CURDATE()) AS emp_age,
|
||||||
|
(SELECT name FROM employees WHERE relationship = "Self" and emp_code = ' . $this->db->escape($emp_code) . ') AS self,
|
||||||
|
|
||||||
|
|
||||||
|
ep.tpa_id,
|
||||||
|
ep.uhid,
|
||||||
|
ep.policy_end_date,
|
||||||
|
|
||||||
|
clients.client_name,
|
||||||
|
clients.short_name AS client_short_name,
|
||||||
|
|
||||||
|
cp.policy_start_date,
|
||||||
|
cp.policy_no,
|
||||||
|
|
||||||
|
policies.name AS policy_name,
|
||||||
|
|
||||||
|
insurers.name AS insurer_name,
|
||||||
|
insurers.short_name AS insurer_short_name,
|
||||||
|
insurers.insurer_logo,
|
||||||
|
|
||||||
|
insurer_branch.branch_name,
|
||||||
|
insurer_branch.branch_code,
|
||||||
|
insurer_branch.city as insurer_branch_city,
|
||||||
|
|
||||||
|
tpa.name AS tpa_name,
|
||||||
|
tpa.tpa_logo AS tpa_logo,
|
||||||
|
tpa.front_card,
|
||||||
|
tpa.back_card,
|
||||||
|
tpa.short_name AS tpa_short_name'
|
||||||
|
)
|
||||||
|
|
||||||
|
->join('employee_polices ep', 'ep.employee_id = e.id')
|
||||||
|
->join('client_policy cp', 'cp.id = ep.client_policy_id')
|
||||||
|
->join('clients', 'clients.id = cp.client_id')
|
||||||
|
->join('policies', 'policies.id = cp.policy_id')
|
||||||
|
->join('insurers', 'insurers.id = cp.insurer_id')
|
||||||
|
->join('insurer_branch', 'insurer_branch.id = cp.insurer_branch_id')
|
||||||
|
->join('tpa', 'tpa.id = cp.tpa_id')
|
||||||
|
->where("ep.tpa_id IS NOT NULL AND ep.tpa_id <> ''")
|
||||||
|
->where('e.emp_status', 'active')
|
||||||
|
->where('e.is_active', '1')
|
||||||
|
->where('ep.status', 'active')
|
||||||
|
->where('ep.is_active', '1')
|
||||||
|
->where('ep.rand_string', $rand_string)
|
||||||
|
->get()
|
||||||
|
->getResultArray();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,8 @@ class FileModel extends Model
|
|||||||
"reason",
|
"reason",
|
||||||
"action",
|
"action",
|
||||||
"client_id",
|
"client_id",
|
||||||
"policy_id"
|
"policy_id",
|
||||||
|
"client_branch_id",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -69,6 +69,7 @@ class MessageModel extends Model
|
|||||||
$builder->orWhere('messages.role_id', $roleId);
|
$builder->orWhere('messages.role_id', $roleId);
|
||||||
$builder->orWhere('messages.team_id', $teamId);
|
$builder->orWhere('messages.team_id', $teamId);
|
||||||
$builder->groupEnd();
|
$builder->groupEnd();
|
||||||
|
$builder->orderBy('id', 'desc');
|
||||||
|
|
||||||
$query = $builder->get();
|
$query = $builder->get();
|
||||||
return $query->getResult();
|
return $query->getResult();
|
||||||
|
|||||||
@ -25,6 +25,8 @@ class PolicyPremium2Model extends Model
|
|||||||
'is_active',
|
'is_active',
|
||||||
'premium_type',
|
'premium_type',
|
||||||
'relationship',
|
'relationship',
|
||||||
|
'additional_relationship',
|
||||||
|
'rack_rate_type',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
<th class="font-weight-medium">Batch <br> Code</th>
|
<th class="font-weight-medium">Batch <br> Code</th>
|
||||||
<th class="font-weight-medium">File Name</th>
|
<th class="font-weight-medium">File Name</th>
|
||||||
<th class="font-weight-medium">Client</th>
|
<th class="font-weight-medium">Client</th>
|
||||||
|
<th class="font-weight-medium">Client <br> Branch</th>
|
||||||
<th class="font-weight-medium">Client Policy</th>
|
<th class="font-weight-medium">Client Policy</th>
|
||||||
<th class="font-weight-medium">Event <br> Type</th>
|
<th class="font-weight-medium">Event <br> Type</th>
|
||||||
<th class="font-weight-medium">Insurer/ <br> TPA</th>
|
<th class="font-weight-medium">Insurer/ <br> TPA</th>
|
||||||
@ -50,6 +51,7 @@
|
|||||||
<?php echo strlen($file['file_name']) > 5 ? substr($file['file_name'], 0, 10) . "..." : $file['file_name'] ?>
|
<?php echo strlen($file['file_name']) > 5 ? substr($file['file_name'], 0, 10) . "..." : $file['file_name'] ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $file['client_short_name'] ?></td>
|
<td><?php echo $file['client_short_name'] ?></td>
|
||||||
|
<td><?php echo $file['branch_name'] ?></td>
|
||||||
<td><?php echo $file['policy_name'] ?></td>
|
<td><?php echo $file['policy_name'] ?></td>
|
||||||
<td><?php echo $file['event_type'] ?></td>
|
<td><?php echo $file['event_type'] ?></td>
|
||||||
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
<td><?php echo $file['insurer_or_tpa'] ?></td>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<div class="row" style="margin-bottom:1rem;">
|
<div class="row" style="margin-bottom:1rem;">
|
||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-6" style="align-self: center;">
|
||||||
|
|
||||||
<h4 class="header-title" style="position: relative;">Client Deposit -
|
<h4 style="position: relative;">Client Deposit -
|
||||||
<?php echo $clientName[0]['client_name'];?></h4>
|
<?php echo $clientName[0]['client_name'];?></h4>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="kyc_docs">File<span
|
<label for="kyc_docs">File<span
|
||||||
class="text-danger">*</span></label>
|
class="text-danger">*</span></label>
|
||||||
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required>
|
<input class="form-control" type="file" name="file_name" multiple="true" id="kyc_docs_file" required accept=".pdf, .jpeg, .jpg, .png">
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
<!-- <div class="form-group col-md-4 align-self-end"> -->
|
||||||
<div class="form-group col-md-4" style="margin-top: 42px;">
|
<div class="form-group col-md-4" style="margin-top: 42px;">
|
||||||
@ -100,6 +100,7 @@
|
|||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||||
|
|
||||||
$('#others').hide()
|
$('#others').hide()
|
||||||
$('#other_docs_table').hide();
|
$('#other_docs_table').hide();
|
||||||
|
|
||||||
@ -176,10 +177,10 @@
|
|||||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||||
$('#form_'+item.kyc_doc_type_id).hide();
|
$('#form_'+item.kyc_doc_type_id).hide();
|
||||||
|
|
||||||
console.log('step 1')
|
// console.log('step 1')
|
||||||
|
|
||||||
if(item.file_name != null && item.file_name != ""){
|
if(item.file_name != null && item.file_name != ""){
|
||||||
console.log('step 2')
|
// console.log('step 2')
|
||||||
|
|
||||||
$('#download_'+item.kyc_doc_type_id).show();
|
$('#download_'+item.kyc_doc_type_id).show();
|
||||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||||
@ -187,14 +188,14 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log('step 3')
|
// console.log('step 3')
|
||||||
|
|
||||||
$('#download_'+item.kyc_doc_type_id).hide();
|
$('#download_'+item.kyc_doc_type_id).hide();
|
||||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||||
$('#delete_'+item.kyc_doc_type_id).hide();
|
$('#delete_'+item.kyc_doc_type_id).hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log('step 4')
|
// console.log('step 4')
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -217,6 +218,9 @@
|
|||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
url: '<?= base_url("client/kyc/list/"); ?>' + '<?= isset($client['entity_type_id']) ? $client['entity_type_id'] : '' ?>',
|
||||||
type: "GET",
|
type: "GET",
|
||||||
@ -224,6 +228,7 @@
|
|||||||
processData: false,
|
processData: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
@ -270,9 +275,20 @@
|
|||||||
var table = '';
|
var table = '';
|
||||||
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
var data = <?= isset($client_kyc) ? json_encode($client_kyc) : '[]' ?>;
|
||||||
|
|
||||||
console.log(data)
|
// console.log('other documents data', data)
|
||||||
|
|
||||||
|
|
||||||
$('#other_docs tr').remove();
|
$('#other_docs tr').remove();
|
||||||
|
|
||||||
|
var other_docs_count = 0;
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
if(item.other_docs_name != ""){
|
||||||
|
|
||||||
|
other_docs_count++;
|
||||||
|
}
|
||||||
|
|
||||||
if(item.kyc_doc_type_id == '0'){
|
if(item.kyc_doc_type_id == '0'){
|
||||||
table += `
|
table += `
|
||||||
<tr id="kyc-${item.id}">
|
<tr id="kyc-${item.id}">
|
||||||
@ -288,6 +304,11 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#other_docs').append(table);
|
$('#other_docs').append(table);
|
||||||
|
|
||||||
|
if(other_docs_count > 0){
|
||||||
|
$('#others').show()
|
||||||
|
$('#other_docs_table').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
@ -299,19 +320,17 @@
|
|||||||
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
$('#name_'+item.kyc_doc_type_id).html(item.file_name);
|
||||||
$('#form_'+item.kyc_doc_type_id).hide();
|
$('#form_'+item.kyc_doc_type_id).hide();
|
||||||
|
|
||||||
console.log('step 1')
|
// console.log('step 1')
|
||||||
|
|
||||||
if(item.file_name != null && item.file_name != ""){
|
if(item.file_name != null && item.file_name != ""){
|
||||||
console.log('step 2')
|
// console.log('step 2')
|
||||||
|
|
||||||
$('#download_'+item.kyc_doc_type_id).show();
|
$('#download_'+item.kyc_doc_type_id).show();
|
||||||
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
$('#download_' + item.kyc_doc_type_id).attr('href', '<?= base_url('download-kyc-docs/') ?>' + item.file_name);
|
||||||
$('#delete_'+item.kyc_doc_type_id).show();
|
$('#delete_'+item.kyc_doc_type_id).show();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log('step 3')
|
// console.log('step 3')
|
||||||
|
|
||||||
$('#download_'+item.kyc_doc_type_id).hide();
|
$('#download_'+item.kyc_doc_type_id).hide();
|
||||||
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
$('#download_' + item.kyc_doc_type_id).attr('href', '#');
|
||||||
@ -319,7 +338,7 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log('step 4')
|
// console.log('step 4')
|
||||||
|
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@ -369,7 +388,7 @@
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
console.log(res);
|
// console.log(res);
|
||||||
$('#kyc_form').trigger('reset');
|
$('#kyc_form').trigger('reset');
|
||||||
if(res){
|
if(res){
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -380,23 +399,36 @@
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var other_docs_count = 0;
|
||||||
|
|
||||||
$('#other_docs tr').remove();
|
$('#other_docs tr').remove();
|
||||||
$.each(res.data, function(index, item) {
|
$.each(res.data, function(index, item) {
|
||||||
console.log("Current item:", item);
|
|
||||||
|
if(item.other_docs_name != ""){
|
||||||
|
|
||||||
|
other_docs_count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log("Current item:", item);
|
||||||
if (item.kyc_doc_type_id == '0') {
|
if (item.kyc_doc_type_id == '0') {
|
||||||
console.log("Appending item:", item);
|
// console.log("Appending item:", item);
|
||||||
var rowHtml = `
|
var rowHtml = `
|
||||||
<tr id="kyc-${item.id}">
|
<tr id="kyc-${item.id}">
|
||||||
<td>${item.other_docs_name}</td>
|
<td>${item.other_docs_name}</td>
|
||||||
<td>${item.file_name}</td>
|
<td>${item.file_name}</td>
|
||||||
<td>
|
<td>
|
||||||
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
<i data-id="${item.id}" class="mdi mdi-delete btnKycOtherDelete" style="font-size:18px;"></i>
|
||||||
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px; display: none" download></a>
|
<a href = "<?= base_url('download-kyc-docs/') ?>${item.file_name}" data-id="${item.id}" class="fa fa-download" style="font-size:18px;" download></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
$('#other_docs').append(rowHtml);
|
$('#other_docs').append(rowHtml);
|
||||||
|
|
||||||
|
if(other_docs_count > 0){
|
||||||
|
$('#others').show()
|
||||||
|
$('#other_docs_table').show();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -431,8 +463,8 @@
|
|||||||
|
|
||||||
var kyc_id = $(this).attr('data-id');
|
var kyc_id = $(this).attr('data-id');
|
||||||
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
|
$.get('<?php echo base_url('client/kyc/delete/');?>'+kyc_id, function (data) {
|
||||||
console.log('kyc-'+ kyc_id)
|
// console.log('kyc-'+ kyc_id)
|
||||||
console.log(data)
|
// console.log(data)
|
||||||
if(data){
|
if(data){
|
||||||
$('#form_'+kyc_id).show();
|
$('#form_'+kyc_id).show();
|
||||||
$('#name_'+kyc_id).hide();
|
$('#name_'+kyc_id).hide();
|
||||||
@ -458,7 +490,7 @@
|
|||||||
|
|
||||||
var kyc_id = $(this).attr('data-id');
|
var kyc_id = $(this).attr('data-id');
|
||||||
$.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) {
|
$.get('<?php echo base_url('util/kyc-other-docs-delete/');?>'+kyc_id, function (data) {
|
||||||
console.log('kyc-'+ kyc_id)
|
// console.log('kyc-'+ kyc_id)
|
||||||
if(data){
|
if(data){
|
||||||
$('#kyc-'+ kyc_id).remove();
|
$('#kyc-'+ kyc_id).remove();
|
||||||
}
|
}
|
||||||
@ -468,30 +500,4 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function validateForm() {
|
|
||||||
var isValid = true;
|
|
||||||
|
|
||||||
|
|
||||||
$('#kyc_form input, #kyc_form select').each(function() {
|
|
||||||
if ($(this).is('input[type="text"]') || $(this).is('select')) {
|
|
||||||
if ($.trim($(this).val()) == '') {
|
|
||||||
console.log('Please fill in all fields');
|
|
||||||
isValid = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($(this).is('input[type="file"]')) {
|
|
||||||
var fileInput = $(this)[0];
|
|
||||||
if (fileInput.files.length === 0) {
|
|
||||||
console.log('Please select an image file');
|
|
||||||
isValid = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return isValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
File diff suppressed because it is too large
Load Diff
@ -29,6 +29,15 @@ table.dataTable tbody td {
|
|||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="branch_id" class="form-control" id="branch_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
@ -80,6 +89,7 @@ $(document).ready(function() {
|
|||||||
// Initialize select2
|
// Initialize select2
|
||||||
$("#clients").select2();
|
$("#clients").select2();
|
||||||
$("#policies").select2();
|
$("#policies").select2();
|
||||||
|
$("#branch_id").select2();
|
||||||
|
|
||||||
// if ($('.select2-selection__arrow').length > 0) {
|
// if ($('.select2-selection__arrow').length > 0) {
|
||||||
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
// $('.select2-selection__arrow').removeClass('select2-selection__arrow').addClass('fa fa-chevron-down');
|
||||||
@ -88,7 +98,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var clientPoliciesWithBranch = {
|
||||||
|
policies: []
|
||||||
|
};
|
||||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -107,7 +122,7 @@ function fetchClientPolicies() {
|
|||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
console.log('fetchClientPolicies');
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -122,17 +137,42 @@ function fetchClientPolicies() {
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
console.log('1',clientPolicies);
|
|
||||||
|
response.data.forEach(policy => {
|
||||||
|
// console.log('policies', policy.policies);
|
||||||
|
policy.policies.forEach(p => {
|
||||||
|
clientPoliciesWithBranch.policies.push(p);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log('1',clientPolicies);
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
//this function for reselect the policy
|
//this function for reselect the policy
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (client_id != 0 ) {
|
if (client_id != 0 ) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
console.log(typeof item.id)
|
// console.log(typeof item.id)
|
||||||
return item.id == client_id;
|
return item.id == client_id;
|
||||||
});
|
});
|
||||||
appendPolicies(foundPolicies.policies);
|
appendBranch(foundPolicies.branchs);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_branch_id != 0 ) {
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === client_branch_id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (foundPolicies) {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
} else {
|
||||||
|
console.log('No policies found for the selected client');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
//end
|
//end
|
||||||
@ -170,6 +210,26 @@ function appendClients(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendBranch(data) {
|
||||||
|
|
||||||
|
$('#branch_id').empty();
|
||||||
|
$('#branch_id').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
@ -179,13 +239,13 @@ function appendPolicies(data) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
||||||
console.log(PolicyID)
|
// console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.client_policy_id,
|
||||||
text: item.name + ' - ' + item.policy_type
|
text: item.name + ' - ' + item.policy_type
|
||||||
});
|
});
|
||||||
if (PolicyID == item.id) {
|
if (PolicyID == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
}
|
}
|
||||||
$('#policies').append(option);
|
$('#policies').append(option);
|
||||||
@ -195,20 +255,56 @@ function appendPolicies(data) {
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#clients').on('change', function() {
|
$('#clients').on('change', function() {
|
||||||
|
|
||||||
|
$('#policies').empty();
|
||||||
|
$('#policies').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
console.log('selectedClient', selectedClient);
|
// console.log('selectedClient', selectedClient);
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
// Check if the selected option exists in apiData
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
return item.id === selectedClient;
|
return item.id === selectedClient;
|
||||||
});
|
});
|
||||||
console.log(foundPolicies.policies);
|
// console.log(foundPolicies.branchs);
|
||||||
appendPolicies(foundPolicies.policies);
|
appendBranch(foundPolicies.branchs);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#branch_id').on('change', function() {
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
|
// console.log('selectedBranch', selectedClient);
|
||||||
|
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === selectedClient;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
|
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
// Function to convert object to query parameters
|
||||||
function objectToQueryString(obj) {
|
function objectToQueryString(obj) {
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
@ -221,8 +317,9 @@ function fetchEmpolyeeList(event) {
|
|||||||
var client_id = $('#clients').val();
|
var client_id = $('#clients').val();
|
||||||
var policy_id = $('#policies').val();
|
var policy_id = $('#policies').val();
|
||||||
var status = $('#status2').val();
|
var status = $('#status2').val();
|
||||||
|
var branch_id = $('#branch_id').val();
|
||||||
|
|
||||||
console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
return;
|
return;
|
||||||
@ -232,12 +329,13 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
client_id: client_id,
|
client_id: client_id,
|
||||||
policy_id: policy_id,
|
policy_id: policy_id,
|
||||||
|
branch_id: branch_id,
|
||||||
status : status,
|
status : status,
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
window.location.href = apiURL;
|
window.location.href = apiURL;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,13 @@ option:disabled {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="branch_id" class="form-control" id="branch_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
<select name="policy_id" class="form-control" id="policy_id" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)">
|
||||||
@ -43,6 +50,10 @@ option:disabled {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Event</label> <br />
|
<label>Event</label> <br />
|
||||||
<select name="upload-action-type" class="form-control"
|
<select name="upload-action-type" class="form-control"
|
||||||
@ -166,24 +177,28 @@ $(document).ready(function() {
|
|||||||
// Initialize select2
|
// Initialize select2
|
||||||
$("#client_id").select2();
|
$("#client_id").select2();
|
||||||
$("#policy_id").select2();
|
$("#policy_id").select2();
|
||||||
|
$("#branch_id").select2();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var clientPoliciesWithBranch = {
|
||||||
|
policies: []
|
||||||
|
};
|
||||||
var client_id_param = 0;
|
var client_id_param = 0;
|
||||||
|
var client_branch_id_param = 0;
|
||||||
var client_policy_param = 0;
|
var client_policy_param = 0;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
console.log("document loaded");
|
// console.log("document loaded");
|
||||||
//fetchClientPolicies();
|
//fetchClientPolicies();
|
||||||
//for modal pop up
|
//for modal pop up
|
||||||
$('#file-err-modal').on('show.bs.modal', function(event) {
|
$('#file-err-modal').on('show.bs.modal', function(event) {
|
||||||
// console.log(event.relatedTarget);
|
// console.log(event.relatedTarget);
|
||||||
var myVal = $(event.relatedTarget).data('err');
|
var myVal = $(event.relatedTarget).data('err');
|
||||||
console.log(myVal);
|
// console.log(myVal);
|
||||||
var loader =
|
var loader =
|
||||||
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
'<div style="text-align: center;"><img src="<?php echo base_url()?>public/assets/images/simple_loader.gif" height="50px" width="50px" ></div>';
|
||||||
$('#file-err-modal').find(".modal-body").html(loader);
|
$('#file-err-modal').find(".modal-body").html(loader);
|
||||||
@ -196,7 +211,7 @@ $(document).ready(function() {
|
|||||||
//for form submit
|
//for form submit
|
||||||
$("#emp-upload-form").submit(function(event) {
|
$("#emp-upload-form").submit(function(event) {
|
||||||
event.preventDefault(); // Prevent default form submission
|
event.preventDefault(); // Prevent default form submission
|
||||||
console.log('submit called');
|
// console.log('submit called');
|
||||||
|
|
||||||
|
|
||||||
var isValid = $('#emp-upload-form').parsley().validate();
|
var isValid = $('#emp-upload-form').parsley().validate();
|
||||||
@ -207,7 +222,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
var action_item = $('#upload-action-type').val();
|
var action_item = $('#upload-action-type').val();
|
||||||
var policy_id = $('#policy_id').val();
|
var policy_id = $('#policy_id').val();
|
||||||
console.log('action_item - ' + action_item);
|
// console.log('action_item - ' + action_item);
|
||||||
if (action_item != 'correction' && policy_id == "") {
|
if (action_item != 'correction' && policy_id == "") {
|
||||||
// $('#policy_id').attr('required', true);
|
// $('#policy_id').attr('required', true);
|
||||||
// $('#policy_id').prop('title', 'plz choose policy');
|
// $('#policy_id').prop('title', 'plz choose policy');
|
||||||
@ -226,10 +241,10 @@ $(document).ready(function() {
|
|||||||
// Create FormData object
|
// Create FormData object
|
||||||
var formData = new FormData($(this)[0]);
|
var formData = new FormData($(this)[0]);
|
||||||
for (var pair of formData.entries()) {
|
for (var pair of formData.entries()) {
|
||||||
console.log(pair[0] + ', ' + pair[1]);
|
// console.log(pair[0] + ', ' + pair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(formData);
|
// console.log(formData);
|
||||||
$('#emp_form_submit_button').prop('disabled', true);
|
$('#emp_form_submit_button').prop('disabled', true);
|
||||||
$('#emp_form_submit_button').html(
|
$('#emp_form_submit_button').html(
|
||||||
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
|
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
|
||||||
@ -248,7 +263,7 @@ $(document).ready(function() {
|
|||||||
success: function(response) {
|
success: function(response) {
|
||||||
// Request successful, handle response
|
// Request successful, handle response
|
||||||
$('#policy_id').attr('required', false);
|
$('#policy_id').attr('required', false);
|
||||||
console.log(response);
|
// console.log(response);
|
||||||
if (response.code === 200 && response.dataStatus === true && response
|
if (response.code === 200 && response.dataStatus === true && response
|
||||||
.data !== "") {
|
.data !== "") {
|
||||||
toastr.success(
|
toastr.success(
|
||||||
@ -298,11 +313,12 @@ $(window).on("load", function() {
|
|||||||
// Get the value of 'client_id' and 'client_policy_id'
|
// Get the value of 'client_id' and 'client_policy_id'
|
||||||
client_id_param = params.get('client_id');
|
client_id_param = params.get('client_id');
|
||||||
client_policy_param = params.get('client_policy_id');
|
client_policy_param = params.get('client_policy_id');
|
||||||
|
client_branch_id_param = params.get('client_branch_id');
|
||||||
inception_param = params.get('actions');
|
inception_param = params.get('actions');
|
||||||
|
|
||||||
console.log('client_id:', client_id_param);
|
// console.log('client_id:', client_id_param);
|
||||||
console.log('client_policy_id:', client_policy_param);
|
// console.log('client_policy_id:', client_policy_param);
|
||||||
console.log('inception_param:', inception_param);
|
// console.log('inception_param:', inception_param);
|
||||||
|
|
||||||
if(inception_param != null){
|
if(inception_param != null){
|
||||||
$('#upload-action-type').val('inception').change()
|
$('#upload-action-type').val('inception').change()
|
||||||
@ -324,8 +340,8 @@ $(window).on("load", function() {
|
|||||||
function fetchClientPolicies() {
|
function fetchClientPolicies() {
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
// console.log('fetchClientPolicies');
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -334,27 +350,55 @@ function fetchClientPolicies() {
|
|||||||
"X-Requested-With": "XMLHttpRequest"
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// console.log(response.code);
|
|
||||||
|
// console.log(response);
|
||||||
// console.log(response.dataStatus);
|
// console.log(response.dataStatus);
|
||||||
// console.log(response.data);
|
// console.log(response.data);
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data)
|
||||||
// console.log(clientPolicies);
|
// console.log(clientPolicies);
|
||||||
|
|
||||||
|
response.data.forEach(policy => {
|
||||||
|
// console.log('policies', policy.policies);
|
||||||
|
policy.policies.forEach(p => {
|
||||||
|
clientPoliciesWithBranch.policies.push(p);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log(clientPoliciesWithBranch);
|
||||||
|
|
||||||
appendClients(clientPolicies);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
|
||||||
//this function for reselect the policy
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (client_id_param != null ) {
|
if (client_id_param != null ) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
console.log(typeof item.id)
|
// console.log(typeof item.id)
|
||||||
return item.id == client_id_param;
|
return item.id == client_id_param;
|
||||||
});
|
});
|
||||||
appendPolicies(foundPolicies.policies);
|
appendBranch(foundPolicies.branchs);
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
//end
|
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_branch_id_param != null ) {
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === client_branch_id_param;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (foundPolicies) {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
} else {
|
||||||
|
console.log('No policies found for the selected client');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
@ -377,8 +421,8 @@ function fetchClientPolicies() {
|
|||||||
function fetchFileError(file_id) {
|
function fetchFileError(file_id) {
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/get-file-error/' + file_id;
|
var apiURL = '<?php echo base_url();?>' + 'util/get-file-error/' + file_id;
|
||||||
console.log('fetchFileError');
|
// console.log('fetchFileError');
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -390,7 +434,7 @@ function fetchFileError(file_id) {
|
|||||||
$(this).find(".modal-body").html("");
|
$(this).find(".modal-body").html("");
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
console.log((JSON.parse(response.data)));
|
// console.log((JSON.parse(response.data)));
|
||||||
var file_error_data = (JSON.parse(response.data));
|
var file_error_data = (JSON.parse(response.data));
|
||||||
var file_error_html = "";
|
var file_error_html = "";
|
||||||
|
|
||||||
@ -515,7 +559,7 @@ function fetchFileError(file_id) {
|
|||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
|
|
||||||
console.log('client_id_param', client_id_param)
|
// console.log('client_id_param', client_id_param)
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
@ -530,44 +574,108 @@ function appendClients(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies(data) {
|
function appendBranch(data) {
|
||||||
|
|
||||||
$('#policy_id').empty();
|
$('#branch_id').empty();
|
||||||
$('#policy_id').append($('<option>', {
|
$('#branch_id').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
text: 'Select'
|
text: 'Select'
|
||||||
}));
|
}));
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id_param == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendPolicies(data) {
|
||||||
|
|
||||||
|
// console.log(data)
|
||||||
|
|
||||||
|
$('#policy_id').empty();
|
||||||
|
|
||||||
|
$('#policy_id').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select',
|
||||||
|
selected: true
|
||||||
|
}));
|
||||||
|
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
|
||||||
|
// console.log(item)
|
||||||
|
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.client_policy_id,
|
||||||
text: item.name + ' - ' + item.policy_type
|
text: item.name + ' - ' + item.policy_type
|
||||||
});
|
});
|
||||||
if (client_policy_param == item.id) {
|
if (client_policy_param == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
}
|
}
|
||||||
$('#policy_id').append(option);
|
$('#policy_id').append(option);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#client_id').on('change', function() {
|
$('#client_id').on('change', function() {
|
||||||
|
|
||||||
|
$('#policy_id').empty();
|
||||||
|
|
||||||
|
$('#policy_id').append($('<option>', {
|
||||||
|
value: '',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
console.log('selectedClient', selectedClient);
|
// console.log('selectedClient', selectedClient);
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
// Check if the selected option exists in apiData
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
return item.id === selectedClient;
|
return item.id === selectedClient;
|
||||||
});
|
});
|
||||||
console.log(foundPolicies.policies);
|
console.log('foundPolicies.branchs', foundPolicies.branchs);
|
||||||
appendPolicies(foundPolicies.policies);
|
appendBranch(foundPolicies.branchs);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#branch_id').on('change', function() {
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
|
// console.log('selectedBranch', selectedClient);
|
||||||
|
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === selectedClient;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
|
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
// Function to convert object to query parameters
|
||||||
function objectToQueryString(obj) {
|
function objectToQueryString(obj) {
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
@ -579,7 +687,7 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
var client_id = $('#client_id').val();
|
var client_id = $('#client_id').val();
|
||||||
var policy_id = $('#policy_id').val();
|
var policy_id = $('#policy_id').val();
|
||||||
console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
toastr.warning('Please select values in both dropdowns.');
|
toastr.warning('Please select values in both dropdowns.');
|
||||||
return;
|
return;
|
||||||
@ -592,7 +700,7 @@ function fetchEmpolyeeList(event) {
|
|||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
window.location.href = apiURL;
|
window.location.href = apiURL;
|
||||||
|
|
||||||
|
|
||||||
@ -641,7 +749,7 @@ $('#excel_download').click(function() {
|
|||||||
// If href attribute is not set, show an error message
|
// If href attribute is not set, show an error message
|
||||||
toastr.warning('Please select an Action to download a sample Excel.', 'Warning');
|
toastr.warning('Please select an Action to download a sample Excel.', 'Warning');
|
||||||
} else {
|
} else {
|
||||||
console.log('Download action triggered.');
|
// console.log('Download action triggered.');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -657,15 +765,15 @@ $('#fetch_enrolled_data').click(function()
|
|||||||
|
|
||||||
var policy_id = $('#policy_id').val();
|
var policy_id = $('#policy_id').val();
|
||||||
var uri = '<?= base_url('util/init-Emp-onboard/') ?>' + policy_id;
|
var uri = '<?= base_url('util/init-Emp-onboard/') ?>' + policy_id;
|
||||||
console.log(policy_id);
|
// console.log(policy_id);
|
||||||
console.log(uri);
|
// console.log(uri);
|
||||||
$('#fetch_btn').attr('href', uri);
|
$('#fetch_btn').attr('href', uri);
|
||||||
|
|
||||||
$('#emp_data').empty();
|
$('#emp_data').empty();
|
||||||
var client_id = $('#client_id').val();
|
var client_id = $('#client_id').val();
|
||||||
var policy_id = $('#policy_id').val();
|
var policy_id = $('#policy_id').val();
|
||||||
var action = $('#upload-action-type').val();
|
var action = $('#upload-action-type').val();
|
||||||
console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
toastr.warning('please select the client and policy for this uploaing event', 'warning')
|
toastr.warning('please select the client and policy for this uploaing event', 'warning')
|
||||||
$('#full-width-modal').modal('hide');
|
$('#full-width-modal').modal('hide');
|
||||||
@ -678,14 +786,14 @@ $('#fetch_enrolled_data').click(function()
|
|||||||
action: action
|
action: action
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('queryParams', queryParams)
|
// console.log('queryParams', queryParams)
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
console.log('queryString', queryString)
|
// console.log('queryString', queryString)
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
var uri = '<?= base_url('util/featch-emp-list')?>?' + queryString
|
var uri = '<?= base_url('util/featch-emp-list')?>?' + queryString
|
||||||
console.log(uri)
|
// console.log(uri)
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: uri,
|
url: uri,
|
||||||
@ -699,7 +807,7 @@ $('#fetch_enrolled_data').click(function()
|
|||||||
contentType: false,
|
contentType: false,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
|
|
||||||
console.log(res);
|
// console.log(res);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
@ -729,13 +837,13 @@ $(document).ready(function() {
|
|||||||
$('#policy_id').change(function(){
|
$('#policy_id').change(function(){
|
||||||
|
|
||||||
var selectedpolicy = $(this).val();
|
var selectedpolicy = $(this).val();
|
||||||
console.log('selectedpolicy',selectedpolicy)
|
// console.log('selectedpolicy',selectedpolicy)
|
||||||
$('#upload-action-type').val('').change();
|
$('#upload-action-type').val('').change();
|
||||||
$('#file_upload').hide();
|
$('#file_upload').hide();
|
||||||
$('#excel_download').removeAttr('href');
|
$('#excel_download').removeAttr('href');
|
||||||
|
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
|
var apiURL = '<?php echo base_url();?>' + 'util/fetch-emp-count/' + selectedpolicy;
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@ -745,11 +853,11 @@ $(document).ready(function() {
|
|||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
console.log('responce data emp_count', response);
|
// console.log('responce data emp_count', response);
|
||||||
|
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
console.log(response.emp_count.length)
|
// console.log(response.emp_count.length)
|
||||||
if(response.emp_count > 0){
|
if(response.emp_count > 0){
|
||||||
|
|
||||||
var select = document.getElementById("upload-action-type");
|
var select = document.getElementById("upload-action-type");
|
||||||
@ -800,11 +908,13 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
function checkPolicyTermsAndRackRatesHasDefiend(event)
|
function checkPolicyTermsAndRackRatesHasDefiend(event)
|
||||||
{
|
{
|
||||||
console.log(event.target.id);
|
// console.log(event.target.id);
|
||||||
var policy_id = (event.target.value);
|
var policy_id = (event.target.value);
|
||||||
console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
// console.log('checkPolicyTermsAndRackRatesHasDefiend called ' + policy_id);
|
||||||
|
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
|
||||||
|
{
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
var apiURL = '<?php echo base_url();?>' + 'util/has_policy_config_completed/' + policy_id;
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
@ -824,7 +934,7 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
|||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
console.log('check policy responce', response);
|
// console.log('check policy responce', response);
|
||||||
|
|
||||||
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
if (response.code === 200 && response.dataStatus === true && response.message !== null) {
|
||||||
toastr.error(response.message, 'Error');
|
toastr.error(response.message, 'Error');
|
||||||
@ -848,11 +958,12 @@ function checkPolicyTermsAndRackRatesHasDefiend(event)
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 1000);
|
}, 1000);
|
||||||
toastr.error('Something went wrong! Try Later', 'Error');
|
// toastr.error('Something went wrong! Try Later', 'Error');
|
||||||
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
<style>
|
<style>
|
||||||
.table th,
|
.table th,
|
||||||
.table td {
|
.table td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.dataTable tbody td {
|
table.dataTable tbody td {
|
||||||
padding: 4px 4px !important;
|
padding: 4px 4px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class{
|
|
||||||
position: relative;
|
|
||||||
left: 79px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
.btn .btn-secondary .buttons-csv .buttons-html5 .my_class {
|
||||||
|
position: relative;
|
||||||
|
left: 79px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -20,8 +19,7 @@ table.dataTable tbody td {
|
|||||||
<div id="accordion" class="mb-3">
|
<div id="accordion" class="mb-3">
|
||||||
<div class="card mb-1">
|
<div class="card mb-1">
|
||||||
<h5 class="m-1">
|
<h5 class="m-1">
|
||||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
|
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||||
aria-expanded="true">
|
|
||||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||||
</a>
|
</a>
|
||||||
</h5>
|
</h5>
|
||||||
@ -36,6 +34,14 @@ table.dataTable tbody td {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="branch_id" class="form-control" id="branch_id">
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy</label> <br />
|
<label>Policy</label> <br />
|
||||||
<select class="form-control" id="policies">
|
<select class="form-control" id="policies">
|
||||||
@ -47,11 +53,10 @@ table.dataTable tbody td {
|
|||||||
<label>Status</label> <br />
|
<label>Status</label> <br />
|
||||||
<select class="form-control" id="status1">
|
<select class="form-control" id="status1">
|
||||||
<option value="0">Select</option>
|
<option value="0">Select</option>
|
||||||
<?php foreach($status as $key => $value) { ?>
|
<?php foreach ($status as $key => $value) { ?>
|
||||||
<option value="<?= $key ?>"
|
<option value="<?= $key ?>" <?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
||||||
<?= (isset($getData) && $getData['status'] == $key) ? 'selected' : '' ?>>
|
<?= $value ?>
|
||||||
<?= $value ?>
|
</option>
|
||||||
</option>
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -59,9 +64,7 @@ table.dataTable tbody td {
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12" style="text-align: right;">
|
<div class="col-12" style="text-align: right;">
|
||||||
<a href="<?= base_url("employee/endorsement-list"); ?>"
|
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||||
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
|
|
||||||
onclick="fetchEmpolyeeList(event);">Submit</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
@ -84,8 +87,7 @@ table.dataTable tbody td {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
|
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
|
||||||
id="tickets-table">
|
|
||||||
<thead class="bg-light">
|
<thead class="bg-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
@ -101,47 +103,45 @@ table.dataTable tbody td {
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody class="font-12">
|
<tbody class="font-12">
|
||||||
<?php
|
<?php
|
||||||
if(isset($employees))
|
if (isset($employees)) {
|
||||||
{
|
foreach ($employees as $key => $employee) { ?>
|
||||||
foreach ($employees as $key => $employee) { ?>
|
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><b><?php echo ($key + 1)?></b></td>
|
<td><b><?php echo ($key + 1) ?></b></td>
|
||||||
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
|
<td><?php echo $employee['name'] ?>( <?php echo $employee['emp_code'] ?> )</td>
|
||||||
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
<td><?php echo isset($employee['policy_name']) ? $employee['policy_name'] : '' ?></td>
|
||||||
<td><?php echo $employee['endorsement_id']?></td>
|
<td><?php echo $employee['endorsement_id'] ?></td>
|
||||||
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
<td><?php echo isset($employee['insurer_short_name']) ? $employee['insurer_short_name'] : '' ?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $employee['remarks']?></td>
|
<td><?php echo $employee['remarks'] ?></td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ($employee['actions'] == 'c') {
|
if ($employee['actions'] == 'c') {
|
||||||
echo 'Correction';
|
echo 'Correction';
|
||||||
} elseif ($employee['actions'] == 'si') {
|
} elseif ($employee['actions'] == 'si') {
|
||||||
echo 'SI Enhancement';
|
echo 'SI Enhancement';
|
||||||
} elseif ($employee['actions'] == 'd') {
|
} elseif ($employee['actions'] == 'd') {
|
||||||
echo 'Deletion';
|
echo 'Deletion';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
if ($employee['status'] == 'pending') {
|
if ($employee['status'] == 'pending') {
|
||||||
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
echo '<span class="badge badge-danger">' . $employee['status'] . '</span>';
|
||||||
} elseif ($employee['status'] == 'inprogress') {
|
} elseif ($employee['status'] == 'inprogress') {
|
||||||
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
echo '<span class="badge badge-warning">' . $employee['status'] . '</span>';
|
||||||
} elseif ($employee['status'] == 'complete') {
|
} elseif ($employee['status'] == 'complete') {
|
||||||
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
echo '<span class="badge badge-success">' . $employee['status'] . '</span>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-center"><a href="#" data-id="<?php echo $employee['id']?>"
|
<td class="text-center"><a href="#" data-id="<?php echo $employee['id'] ?>" class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal" data-target="#centermodal"></a>
|
||||||
class="fa fa-eye emp_data_model" aria-hidden="true" data-toggle="modal"
|
</td>
|
||||||
data-target="#centermodal"></a>
|
</tr>
|
||||||
</td>
|
<?php }
|
||||||
</tr>
|
} ?>
|
||||||
<?php }}?>
|
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -153,7 +153,7 @@ table.dataTable tbody td {
|
|||||||
|
|
||||||
|
|
||||||
<!-- Center modal content -->
|
<!-- Center modal content -->
|
||||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||||
<div class="modal-dialog modal-dialog-centered">
|
<div class="modal-dialog modal-dialog-centered">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header" style="background-color: gainsboro;">
|
<div class="modal-header" style="background-color: gainsboro;">
|
||||||
@ -179,351 +179,436 @@ table.dataTable tbody td {
|
|||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Initialize select2
|
||||||
|
$("#clients").select2();
|
||||||
|
$("#policies").select2();
|
||||||
|
$("#branch_id").select2();
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
// Declare a global variable to store API response data
|
||||||
// Initialize select2
|
var clientPolicies = [];
|
||||||
$("#clients").select2();
|
var clientPoliciesWithBranch = {
|
||||||
$("#policies").select2();
|
policies: []
|
||||||
});
|
};
|
||||||
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
// Declare a global variable to store API response data
|
$(window).on("load", function() {
|
||||||
var clientPolicies = [];
|
console.log("window loaded");
|
||||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
fetchClientPolicies();
|
||||||
|
});
|
||||||
$(window).on("load", function() {
|
|
||||||
console.log("window loaded");
|
|
||||||
fetchClientPolicies();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
function fetchClientPolicies() {
|
||||||
|
|
||||||
$('#loader').show();
|
$('#loader').show();
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/clients-with-policies';
|
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
console.log('fetchClientPolicies');
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: apiURL,
|
url: apiURL,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
},
|
},
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
// console.log(response.code);
|
// console.log(response.code);
|
||||||
// console.log(response.dataStatus);
|
// console.log(response.dataStatus);
|
||||||
// console.log(response.data);
|
// console.log(response.data);
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
console.log(clientPolicies);
|
|
||||||
appendClients(clientPolicies);
|
|
||||||
|
|
||||||
//this function for reselect policy
|
|
||||||
setTimeout(function() {
|
response.data.forEach(policy => {
|
||||||
if (client_id) {
|
// console.log('policies', policy.policies);
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
policy.policies.forEach(p => {
|
||||||
console.log(typeof item.id)
|
clientPoliciesWithBranch.policies.push(p);
|
||||||
return item.id == client_id;
|
|
||||||
});
|
});
|
||||||
appendPolicies(foundPolicies.policies);
|
});
|
||||||
}
|
|
||||||
}, 500);
|
|
||||||
//end
|
|
||||||
|
|
||||||
} catch (error) {
|
// console.log(clientPolicies);
|
||||||
console.error('Error parsing API response data:', error);
|
appendClients(clientPolicies);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id) {
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
// console.log(typeof item.id)
|
||||||
|
return item.id == client_id;
|
||||||
|
});
|
||||||
|
appendBranch(foundPolicies.branchs);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_branch_id) {
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === client_branch_id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (foundPolicies) {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
} else {
|
||||||
|
console.log('No policies found for the selected client');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing API response data:', error);
|
||||||
|
}
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
|
} else {
|
||||||
|
console.error('Something went wrong!');
|
||||||
}
|
}
|
||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
},
|
||||||
console.error('no data found', response);
|
error: function(xhr, status, error) {
|
||||||
} else {
|
console.error('Error fetching data from API:', error);
|
||||||
console.error('Something went wrong!');
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error('Error fetching data from API:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#loader').hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function appendClients(data) {
|
|
||||||
|
|
||||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
|
||||||
$.each(data, function(index, item) {
|
|
||||||
var option = $('<option>', {
|
|
||||||
value: item.id,
|
|
||||||
text: item.client_name
|
|
||||||
});
|
});
|
||||||
if (clientID == item.id) {
|
|
||||||
option.attr('selected', true);
|
|
||||||
}
|
|
||||||
$('#clients').append(option);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$('#loader').hide();
|
||||||
function appendPolicies(data) {
|
|
||||||
|
|
||||||
$('#policies').empty();
|
|
||||||
$('#policies').append($('<option>', {
|
|
||||||
value: '0',
|
|
||||||
text: 'Select'
|
|
||||||
}));
|
|
||||||
|
|
||||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0'?>;
|
|
||||||
console.log(PolicyID)
|
|
||||||
$.each(data, function(index, item) {
|
|
||||||
var option = $('<option>', {
|
|
||||||
value: item.id,
|
|
||||||
text: item.name
|
|
||||||
});
|
|
||||||
if (PolicyID == item.id) {
|
|
||||||
option.attr('selected', true);
|
|
||||||
}
|
|
||||||
$('#policies').append(option);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$('#clients').on('change', function() {
|
|
||||||
var selectedClient = $(this).val();
|
|
||||||
console.log(selectedClient);
|
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
|
||||||
return item.id === selectedClient;
|
|
||||||
});
|
|
||||||
console.log(foundPolicies.policies);
|
|
||||||
appendPolicies(foundPolicies.policies);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to convert object to query parameters
|
|
||||||
function objectToQueryString(obj) {
|
|
||||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
|
||||||
}
|
|
||||||
|
|
||||||
function fetchEmpolyeeList(event) {
|
|
||||||
event.preventDefault(); // Prevent default action
|
|
||||||
|
|
||||||
var client_id = $('#clients').val();
|
|
||||||
var policy_id = $('#policies').val();
|
|
||||||
var status = $('#status1').val();
|
|
||||||
console.log(client_id + '-' + policy_id);
|
|
||||||
if (client_id == '0' || policy_id == '0') {
|
|
||||||
alert('Please select values in both dropdowns.');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var queryParams = {
|
|
||||||
client_id: client_id,
|
|
||||||
policy_id: policy_id,
|
|
||||||
status: status,
|
|
||||||
};
|
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
function appendClients(data) {
|
||||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
|
||||||
console.log(apiURL);
|
|
||||||
window.location.href = apiURL;
|
|
||||||
|
|
||||||
}
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
|
$.each(data, function(index, item) {
|
||||||
document.getElementById('toggleIcon').addEventListener('click', function() {
|
var option = $('<option>', {
|
||||||
var icon = document.getElementById('icon');
|
value: item.id,
|
||||||
icon.classList.toggle('mdi-chevron-down');
|
text: item.client_name
|
||||||
icon.classList.toggle('mdi-chevron-up');
|
});
|
||||||
});
|
if (clientID == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#clients').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$('.emp_data_model').click(function() {
|
function appendBranch(data) {
|
||||||
var myVal = $(this).data('id');
|
|
||||||
console.log(myVal);
|
|
||||||
fetchEmpEndorsementData(myVal)
|
|
||||||
|
|
||||||
});
|
$('#branch_id').empty();
|
||||||
|
$('#branch_id').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function fetchEmpEndorsementData(id) {
|
function appendPolicies(data) {
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('#policies').empty();
|
||||||
$('.loader-mask').fadeIn();
|
$('#policies').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
var apiURL = '<?php echo base_url();?>' + 'util/get-emp-endorsement/' + id;
|
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>;
|
||||||
console.log('fetchEmpEndorsementData');
|
// console.log(PolicyID)
|
||||||
console.log(apiURL);
|
$.each(data, function(index, item) {
|
||||||
$.ajax({
|
var option = $('<option>', {
|
||||||
url: apiURL,
|
value: item.client_policy_id,
|
||||||
method: 'GET',
|
text: item.name
|
||||||
headers: {
|
});
|
||||||
"Content-Type": "application/json",
|
if (PolicyID == item.client_policy_id) {
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
option.attr('selected', true);
|
||||||
},
|
}
|
||||||
success: function(response) {
|
$('#policies').append(option);
|
||||||
console.log(response);
|
});
|
||||||
if (response.code === 200 && response.dataStatus === true) {
|
}
|
||||||
try {
|
|
||||||
endorsementData = (response.data);
|
|
||||||
endorsementData2 = (response.data2);
|
|
||||||
|
|
||||||
e_actions = endorsementData2[0]['actions'];
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#clients').on('change', function() {
|
||||||
|
|
||||||
|
$('#policies').empty();
|
||||||
|
$('#policies').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
// console.log(selectedClient);
|
||||||
|
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||||
|
|
||||||
|
// Check if the selected option exists in apiData
|
||||||
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
|
return item.id === selectedClient;
|
||||||
|
});
|
||||||
|
// console.log(foundPolicies.branchs);
|
||||||
|
appendBranch(foundPolicies.branchs);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#branch_id').on('change', function() {
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
|
// console.log('selectedBranch', selectedClient);
|
||||||
|
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === selectedClient;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
var heading = "";
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
if (endorsementData2[0]['actions'] == 'si') {
|
|
||||||
heading = ' - ' + 'SI Enhancement';
|
|
||||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
|
||||||
} else if (endorsementData2[0]['actions'] == 'd') {
|
|
||||||
heading = ' - ' + 'Deletion';
|
|
||||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
|
||||||
} else if (endorsementData2[0]['actions'] == 'c') {
|
|
||||||
heading = ' - ' + 'Correction';
|
|
||||||
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#heading').html(heading);
|
appendPolicies(foundPolicies);
|
||||||
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
$('#table_data').empty();
|
|
||||||
$('#table_head_data').empty();
|
|
||||||
|
|
||||||
|
} else {
|
||||||
if(e_actions == 'd'){
|
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies(foundPolicies);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$.each(endorsementData, function(index, item) {
|
});
|
||||||
var tableHtml = `
|
|
||||||
|
// Function to convert object to query parameters
|
||||||
|
function objectToQueryString(obj) {
|
||||||
|
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fetchEmpolyeeList(event) {
|
||||||
|
event.preventDefault(); // Prevent default action
|
||||||
|
|
||||||
|
var client_id = $('#clients').val();
|
||||||
|
var policy_id = $('#policies').val();
|
||||||
|
var status = $('#status1').val();
|
||||||
|
var branch_id = $('#branch_id').val();
|
||||||
|
// console.log(client_id + '-' + policy_id);
|
||||||
|
if (client_id == '0' || policy_id == '0') {
|
||||||
|
alert('Please select values in both dropdowns.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var queryParams = {
|
||||||
|
client_id: client_id,
|
||||||
|
policy_id: policy_id,
|
||||||
|
branch_id: branch_id,
|
||||||
|
status: status,
|
||||||
|
};
|
||||||
|
|
||||||
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||||
|
// console.log(apiURL);
|
||||||
|
window.location.href = apiURL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('toggleIcon').addEventListener('click', function() {
|
||||||
|
var icon = document.getElementById('icon');
|
||||||
|
icon.classList.toggle('mdi-chevron-down');
|
||||||
|
icon.classList.toggle('mdi-chevron-up');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.emp_data_model').click(function() {
|
||||||
|
var myVal = $(this).data('id');
|
||||||
|
// console.log(myVal);
|
||||||
|
fetchEmpEndorsementData(myVal)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function fetchEmpEndorsementData(id) {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
var apiURL = '<?php echo base_url(); ?>' + 'util/get-emp-endorsement/' + id;
|
||||||
|
console.log('fetchEmpEndorsementData');
|
||||||
|
// console.log(apiURL);
|
||||||
|
$.ajax({
|
||||||
|
url: apiURL,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
// console.log(response);
|
||||||
|
if (response.code === 200 && response.dataStatus === true) {
|
||||||
|
try {
|
||||||
|
endorsementData = (response.data);
|
||||||
|
endorsementData2 = (response.data2);
|
||||||
|
|
||||||
|
e_actions = endorsementData2[0]['actions'];
|
||||||
|
|
||||||
|
|
||||||
|
var heading = "";
|
||||||
|
if (endorsementData2[0]['actions'] == 'si') {
|
||||||
|
heading = ' - ' + 'SI Enhancement';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'd') {
|
||||||
|
heading = ' - ' + 'Deletion';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
} else if (endorsementData2[0]['actions'] == 'c') {
|
||||||
|
heading = ' - ' + 'Correction';
|
||||||
|
heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#heading').html(heading);
|
||||||
|
|
||||||
|
$('#table_data').empty();
|
||||||
|
$('#table_head_data').empty();
|
||||||
|
|
||||||
|
|
||||||
|
if (e_actions == 'd') {
|
||||||
|
|
||||||
|
$.each(endorsementData, function(index, item) {
|
||||||
|
var tableHtml = `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.field_name}</td>
|
<td>${item.field_name}</td>
|
||||||
<td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
<td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
$('#table_data').append(tableHtml);
|
$('#table_data').append(tableHtml);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
var table_head = `
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var table_head = `
|
||||||
<tr>
|
<tr>
|
||||||
<th class="font-weight-medium"></th>
|
<th class="font-weight-medium"></th>
|
||||||
<th class="font-weight-medium">Old Value</th>
|
<th class="font-weight-medium">Old Value</th>
|
||||||
<th class="font-weight-medium">New Value</th>
|
<th class="font-weight-medium">New Value</th>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
$('#table_head_data').append(table_head);
|
$('#table_head_data').append(table_head);
|
||||||
|
|
||||||
$.each(endorsementData, function(index, item) {
|
$.each(endorsementData, function(index, item) {
|
||||||
var tableHtml = `
|
var tableHtml = `
|
||||||
<tr>
|
<tr>
|
||||||
<td>${item.field_name}</td>
|
<td>${item.field_name}</td>
|
||||||
<td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
<td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
||||||
<td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
<td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
$('#table_data').append(tableHtml);
|
$('#table_data').append(tableHtml);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error parsing API response data:', error);
|
||||||
}
|
}
|
||||||
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
|
console.error('no data found', response);
|
||||||
} catch (error) {
|
} else {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Something went wrong!');
|
||||||
}
|
}
|
||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
},
|
||||||
console.error('no data found', response);
|
error: function(xhr, status, error) {
|
||||||
} else {
|
console.error('Error fetching data from API:', error);
|
||||||
console.error('Something went wrong!');
|
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error('Error fetching data from API:', error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatNumberToIndianLocale(value, field_name, action) {
|
function formatNumberToIndianLocale(value, field_name, action) {
|
||||||
|
|
||||||
// Check if the value is a valid number (either as a number or as a string)
|
// Check if the value is a valid number (either as a number or as a string)
|
||||||
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||||
|
|
||||||
// Convert the value to a number and format it using Indian English locale
|
// Convert the value to a number and format it using Indian English locale
|
||||||
var return_val = parseFloat(value).toLocaleString('en-IN');
|
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||||
|
|
||||||
if(field_name == 'Period of non coverage'){
|
if (field_name == 'Period of non coverage') {
|
||||||
|
|
||||||
return value + ' days';
|
return value + ' days';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(field_name == 'Total Amount'){
|
if (field_name == 'Total Amount') {
|
||||||
|
|
||||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(field_name == 'Total'){
|
|
||||||
|
|
||||||
if(action == 'd'){
|
|
||||||
|
|
||||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
|
||||||
}else if(action == 'si'){
|
|
||||||
|
|
||||||
return '₹ ' + return_val + ' ( To be paid )';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (field_name == 'Total') {
|
||||||
|
|
||||||
|
if (action == 'd') {
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||||
|
|
||||||
|
} else if (action == 'si') {
|
||||||
|
|
||||||
|
return '₹ ' + return_val + ' ( To be paid )';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return '₹ ' + return_val;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Return the original value if it's not a valid number
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '₹ ' + return_val;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// Return the original value if it's not a valid number
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$('.close').click(function(){
|
$('.close').click(function() {
|
||||||
|
|
||||||
$('#table_data').empty();
|
$('#table_data').empty();
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#tickets-table').DataTable({
|
$('#tickets-table').DataTable({
|
||||||
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
dom: "<'row'<'col-sm-0'f><'col-sm-9 text-right'B>>" +
|
||||||
"<'row'<'col-sm-12'tr>>" +
|
"<'row'<'col-sm-12'tr>>" +
|
||||||
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
"buttons": [{
|
"buttons": [{
|
||||||
"extend": 'csv',
|
"extend": 'csv',
|
||||||
"text": 'CSV',
|
"text": 'CSV',
|
||||||
"title": 'Endorsement-List',
|
"title": 'Endorsement-List',
|
||||||
"className": 'my_class',
|
"className": 'my_class',
|
||||||
"exportOptions": {
|
"exportOptions": {
|
||||||
"columns": ':not(:last-child)'
|
"columns": ':not(:last-child)'
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
"initComplete": function(settings, json) {
|
"initComplete": function(settings, json) {
|
||||||
$('.my_class').css({
|
$('.my_class').css({
|
||||||
"position": "relative",
|
"position": "relative",
|
||||||
"left": "79px"
|
"left": "79px"
|
||||||
|
});
|
||||||
|
},
|
||||||
|
language: {
|
||||||
|
search: "_INPUT_",
|
||||||
|
searchPlaceholder: "Search..."
|
||||||
|
},
|
||||||
|
paging: true,
|
||||||
|
// pagingType: 'full_numbers'
|
||||||
});
|
});
|
||||||
},
|
|
||||||
language: {
|
|
||||||
search: "_INPUT_",
|
|
||||||
searchPlaceholder: "Search..."
|
|
||||||
},
|
|
||||||
paging: true ,
|
|
||||||
// pagingType: 'full_numbers'
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -25,6 +25,7 @@
|
|||||||
<th class="font-weight-medium">SNO</th>
|
<th class="font-weight-medium">SNO</th>
|
||||||
<th class="font-weight-medium">File name</th>
|
<th class="font-weight-medium">File name</th>
|
||||||
<th class="font-weight-medium">Client</th>
|
<th class="font-weight-medium">Client</th>
|
||||||
|
<th class="font-weight-medium">Client Branch</th>
|
||||||
<th class="font-weight-medium">Policy</th>
|
<th class="font-weight-medium">Policy</th>
|
||||||
<th class="font-weight-medium">Event</th>
|
<th class="font-weight-medium">Event</th>
|
||||||
<th class="font-weight-medium">User/Time</th>
|
<th class="font-weight-medium">User/Time</th>
|
||||||
@ -47,6 +48,7 @@
|
|||||||
<td><b><?php echo ($key + 1)?></b></td>
|
<td><b><?php echo ($key + 1)?></b></td>
|
||||||
<td><?php echo $file['file_name']?></td>
|
<td><?php echo $file['file_name']?></td>
|
||||||
<td><?php echo $file['short_name']?></td>
|
<td><?php echo $file['short_name']?></td>
|
||||||
|
<td><?php echo $file['branch_name']?></td>
|
||||||
<td><?php echo $file['policy_name']?></td>
|
<td><?php echo $file['policy_name']?></td>
|
||||||
<td><?php echo $file['action']?></td>
|
<td><?php echo $file['action']?></td>
|
||||||
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?>
|
<td><?php echo fancy_date_time_format($file['created_at']).' by <strong>'.$file['first_name'].'</strong>'?>
|
||||||
|
|||||||
@ -23,13 +23,24 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group col-md-4">
|
||||||
|
<label>Branch</label> <br />
|
||||||
|
<select name="client_branch_id" class="form-control" id="client_branch_id" required>
|
||||||
|
<option value="0">Select</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Policy<span class="text-danger" id="policy_danger">*</span></label> <br />
|
<label>Policy<span class="text-danger" id="policy_danger">*</span></label> <br />
|
||||||
<select name="client_policy_id" class="form-control" id="policy" required>
|
<select name="client_policy_id" class="form-control" id="policy" onchange="checkPolicyTermsAndRackRatesHasDefiend(event)" required>
|
||||||
<option value="">Select</option>
|
<option value="">Select</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Insurer/TPA Data<span class="text-danger">*</span></label> <br />
|
<label>Insurer/TPA Data<span class="text-danger">*</span></label> <br />
|
||||||
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa" required>
|
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa" required>
|
||||||
@ -43,9 +54,6 @@
|
|||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-row">
|
|
||||||
|
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label>Action<span class="text-danger">*</span></label> <br />
|
<label>Action<span class="text-danger">*</span></label> <br />
|
||||||
@ -121,13 +129,18 @@
|
|||||||
// Initialize select2
|
// Initialize select2
|
||||||
$("#client").select2();
|
$("#client").select2();
|
||||||
$("#policy").select2();
|
$("#policy").select2();
|
||||||
|
$("#client_branch_id").select2();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Declare a global variable to store API response data
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
var clientPolicies = [];
|
||||||
|
var clientPoliciesWithBranch2 = {
|
||||||
|
policies: []
|
||||||
|
};
|
||||||
|
|
||||||
var client_id_param2 = 0;
|
var client_id_param2 = 0;
|
||||||
|
var client_branch_id_param2 = 0;
|
||||||
var client_policy_param2 = 0;
|
var client_policy_param2 = 0;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -161,7 +174,7 @@
|
|||||||
// Create FormData object
|
// Create FormData object
|
||||||
var formData = new FormData($(this)[0]);
|
var formData = new FormData($(this)[0]);
|
||||||
for (var pair of formData.entries()) {
|
for (var pair of formData.entries()) {
|
||||||
console.log(pair[0] + ', ' + pair[1]);
|
// console.log(pair[0] + ', ' + pair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -175,7 +188,7 @@
|
|||||||
contentType: false, // Let jQuery handle the content type
|
contentType: false, // Let jQuery handle the content type
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
console.log(response);
|
// console.log(response);
|
||||||
if (response.code === 200 && response.status === true) {
|
if (response.code === 200 && response.status === true) {
|
||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
@ -193,7 +206,7 @@
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error('Something went wrong!');
|
console.error('Something went wrong!');
|
||||||
toastr.error('Something went wrong! Try later', 'Error');
|
// toastr.error('Something went wrong! Try later', 'Error');
|
||||||
// window.location.reload(true);
|
// window.location.reload(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -203,7 +216,7 @@
|
|||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
$("#import_export_excel_form")[0].reset()
|
$("#import_export_excel_form")[0].reset()
|
||||||
toastr.error('Something went wrong! Try later', 'Error');
|
// toastr.error('Something went wrong! Try later', 'Error');
|
||||||
// window.location.reload(true);
|
// window.location.reload(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -231,17 +244,18 @@
|
|||||||
// Get the value of 'client_id' and 'client_policy_id'
|
// Get the value of 'client_id' and 'client_policy_id'
|
||||||
client_id_param2 = params.get('client_id');
|
client_id_param2 = params.get('client_id');
|
||||||
client_policy_param2 = params.get('client_policy_id');
|
client_policy_param2 = params.get('client_policy_id');
|
||||||
|
client_branch_id_param2 = params.get('client_branch_id');
|
||||||
actions = params.get('actions');
|
actions = params.get('actions');
|
||||||
insurer_or_tpa = params.get('insurer_or_tpa');
|
insurer_or_tpa = params.get('insurer_or_tpa');
|
||||||
event = params.get('event');
|
event = params.get('event');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log('client_id2:', client_id_param2);
|
// console.log('client_id2:', client_id_param2);
|
||||||
console.log('client_policy_id2:', client_policy_param2);
|
// console.log('client_policy_id2:', client_policy_param2);
|
||||||
console.log('actions:', actions);
|
// console.log('actions:', actions);
|
||||||
console.log('insurer_or_tpa:', insurer_or_tpa);
|
// console.log('insurer_or_tpa:', insurer_or_tpa);
|
||||||
console.log('event:', event);
|
// console.log('event:', event);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -252,7 +266,7 @@
|
|||||||
$('#insurer_or_tpa').val(insurer_or_tpa).change()
|
$('#insurer_or_tpa').val(insurer_or_tpa).change()
|
||||||
|
|
||||||
var selectedValue = actions;
|
var selectedValue = actions;
|
||||||
console.log(selectedValue);
|
// console.log(selectedValue);
|
||||||
|
|
||||||
if (selectedValue == '') {
|
if (selectedValue == '') {
|
||||||
$('#import_excel_btn').hide();
|
$('#import_excel_btn').hide();
|
||||||
@ -292,20 +306,46 @@
|
|||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
try {
|
||||||
clientPolicies = (response.data);
|
clientPolicies = (response.data);
|
||||||
console.log(clientPolicies);
|
// console.log(clientPolicies);
|
||||||
|
|
||||||
|
|
||||||
|
response.data.forEach(policy => {
|
||||||
|
// console.log('policies', policy.policies);
|
||||||
|
policy.policies.forEach(p => {
|
||||||
|
clientPoliciesWithBranch2.policies.push(p);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
appendClients2(clientPolicies);
|
appendClients2(clientPolicies);
|
||||||
|
|
||||||
//this function for reselect the policy
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (client_id_param2 != null) {
|
if (client_branch_id_param2 != null) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
console.log(typeof item.id)
|
// console.log(typeof item.id)
|
||||||
return item.id == client_id_param2;
|
return item.id == client_id_param2;
|
||||||
});
|
});
|
||||||
appendPolicies2(foundPolicies.policies);
|
appendBranch2(foundPolicies.branchs);
|
||||||
|
}
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
if (client_id_param2 != null) {
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
|
||||||
|
// console.log('item', item);
|
||||||
|
return item.branch_id === client_branch_id_param2;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
if (foundPolicies) {
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies2(foundPolicies);
|
||||||
|
} else {
|
||||||
|
console.log('No policies found for the selected client');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
//end
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
console.error('Error parsing API response data:', error);
|
||||||
@ -313,7 +353,7 @@
|
|||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
} else if (response.code === 404 && response.dataStatus === false) {
|
||||||
console.error('no data found', response);
|
console.error('no data found', response);
|
||||||
} else {
|
} else {
|
||||||
console.error('Something went wrong!');
|
// console.error('Something went wrong!');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
@ -327,7 +367,7 @@
|
|||||||
|
|
||||||
function appendClients2(data) {
|
function appendClients2(data) {
|
||||||
|
|
||||||
console.log('client_id_param2', client_id_param2)
|
// console.log('client_id_param2', client_id_param2)
|
||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
@ -342,6 +382,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function appendBranch2(data) {
|
||||||
|
|
||||||
|
// console.log(data)
|
||||||
|
|
||||||
|
$('#client_branch_id').empty();
|
||||||
|
$('#client_branch_id').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
var option = $('<option>', {
|
||||||
|
value: item.id,
|
||||||
|
text: item.branch_name
|
||||||
|
});
|
||||||
|
if (client_branch_id_param2 == item.id) {
|
||||||
|
option.attr('selected', true);
|
||||||
|
}
|
||||||
|
$('#client_branch_id').append(option);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function appendPolicies2(data) {
|
function appendPolicies2(data) {
|
||||||
|
|
||||||
$('#policy').empty();
|
$('#policy').empty();
|
||||||
@ -352,10 +414,10 @@
|
|||||||
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.id,
|
value: item.client_policy_id,
|
||||||
text: item.name + ' - ' + item.policy_type
|
text: item.name + ' - ' + item.policy_type
|
||||||
});
|
});
|
||||||
if (client_policy_param2 == item.id) {
|
if (client_policy_param2 == item.client_policy_id) {
|
||||||
option.attr('selected', true);
|
option.attr('selected', true);
|
||||||
}
|
}
|
||||||
$('#policy').append(option);
|
$('#policy').append(option);
|
||||||
@ -365,16 +427,54 @@
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
$('#client').on('change', function() {
|
$('#client').on('change', function() {
|
||||||
|
|
||||||
|
$('#policy').empty();
|
||||||
|
$('#policy').append($('<option>', {
|
||||||
|
value: '0',
|
||||||
|
text: 'Select'
|
||||||
|
}));
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
console.log(selectedClient);
|
// console.log(selectedClient);
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
// Check if the selected option exists in apiData
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
var foundPolicies = clientPolicies.find(function(item) {
|
||||||
return item.id === selectedClient;
|
return item.id === selectedClient;
|
||||||
});
|
});
|
||||||
console.log(foundPolicies.policies);
|
// console.log(foundPolicies.branchs);
|
||||||
appendPolicies2(foundPolicies.policies);
|
appendBranch2(foundPolicies.branchs);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#client_branch_id').on('change', function() {
|
||||||
|
|
||||||
|
var selectedClient = $(this).val();
|
||||||
|
|
||||||
|
// console.log('selectedBranch', selectedClient);
|
||||||
|
// console.log('clientPolicies', clientPoliciesWithBranch2);
|
||||||
|
|
||||||
|
var foundPolicies = clientPoliciesWithBranch2.policies.filter(function(item) {
|
||||||
|
return item.branch_id === selectedClient;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||||
|
|
||||||
|
appendPolicies2(foundPolicies);
|
||||||
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// console.log('foundPolicies', foundPolicies);
|
||||||
|
appendPolicies2(foundPolicies);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -389,7 +489,7 @@
|
|||||||
|
|
||||||
var client_id = $('#client').val();
|
var client_id = $('#client').val();
|
||||||
var policy_id = $('#policy').val();
|
var policy_id = $('#policy').val();
|
||||||
console.log(client_id + '-' + policy_id);
|
// console.log(client_id + '-' + policy_id);
|
||||||
if (client_id == '0' || policy_id == '0') {
|
if (client_id == '0' || policy_id == '0') {
|
||||||
alert('Please select values in both dropdowns.');
|
alert('Please select values in both dropdowns.');
|
||||||
return;
|
return;
|
||||||
@ -402,7 +502,7 @@
|
|||||||
|
|
||||||
const queryString = objectToQueryString2(queryParams);
|
const queryString = objectToQueryString2(queryParams);
|
||||||
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
|
||||||
console.log(apiURL);
|
// console.log(apiURL);
|
||||||
window.location.href = apiURL;
|
window.location.href = apiURL;
|
||||||
|
|
||||||
|
|
||||||
@ -414,7 +514,7 @@
|
|||||||
$('#action_type').change(function() {
|
$('#action_type').change(function() {
|
||||||
|
|
||||||
var selectedValue = $(this).val();
|
var selectedValue = $(this).val();
|
||||||
console.log(selectedValue);
|
// console.log(selectedValue);
|
||||||
|
|
||||||
if (selectedValue == '') {
|
if (selectedValue == '') {
|
||||||
$('#import_excel_btn').hide();
|
$('#import_excel_btn').hide();
|
||||||
@ -444,7 +544,7 @@
|
|||||||
|
|
||||||
$('#event_type').change(function() {
|
$('#event_type').change(function() {
|
||||||
var selectedVal = $(this).val();
|
var selectedVal = $(this).val();
|
||||||
console.log(selectedVal);
|
// console.log(selectedVal);
|
||||||
|
|
||||||
if (selectedVal === 'correction') {
|
if (selectedVal === 'correction') {
|
||||||
$('#policy').prop('required', false);
|
$('#policy').prop('required', false);
|
||||||
|
|||||||
@ -48,9 +48,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Pending Action Header -->
|
<!-- Pending Action Header -->
|
||||||
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 text-uppercase bg-light fixed-header">
|
<h6 class="font-weight-medium px-3 m-0 py-2 font-13 bg-light fixed-header">
|
||||||
<i class="mdi mdi-format-list-checks font-22"></i>
|
<i class="mdi mdi-format-list-checks font-22"></i>
|
||||||
<span class="header-title">Pending Action</span>
|
<span class="header-title">TO DOs</span>
|
||||||
</h6>
|
</h6>
|
||||||
<div class="scrollable-content">
|
<div class="scrollable-content">
|
||||||
<ul class="list-unstyled" id="messages-list-2">
|
<ul class="list-unstyled" id="messages-list-2">
|
||||||
@ -164,7 +164,7 @@
|
|||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
console.log('responce', response)
|
//console.log('responce', response)
|
||||||
|
|
||||||
let messagesList = $('#messages-list');
|
let messagesList = $('#messages-list');
|
||||||
messagesList.empty();
|
messagesList.empty();
|
||||||
@ -260,11 +260,11 @@
|
|||||||
|
|
||||||
$('#messages-list').on('click', 'li', function(event) {
|
$('#messages-list').on('click', 'li', function(event) {
|
||||||
|
|
||||||
console.log('messages-list click li')
|
//console.log('messages-list click li')
|
||||||
|
|
||||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||||
|
|
||||||
console.log('.rm_msg')
|
//console.log('.rm_msg')
|
||||||
|
|
||||||
let messageId = $(this).data('id');
|
let messageId = $(this).data('id');
|
||||||
let url = $(this).data('url');
|
let url = $(this).data('url');
|
||||||
@ -276,11 +276,11 @@
|
|||||||
|
|
||||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||||
|
|
||||||
console.log('redirect_page')
|
//console.log('redirect_page')
|
||||||
|
|
||||||
let messageId = $(this).data('id');
|
let messageId = $(this).data('id');
|
||||||
let url = $(this).data('url');
|
let url = $(this).data('url');
|
||||||
console.log('url : ', url)
|
//console.log('url : ', url)
|
||||||
acknowledgeMessage(messageId);
|
acknowledgeMessage(messageId);
|
||||||
|
|
||||||
window.location.href = '<?= base_url() ?>' + url;
|
window.location.href = '<?= base_url() ?>' + url;
|
||||||
@ -291,7 +291,7 @@
|
|||||||
|
|
||||||
fetchMessages();
|
fetchMessages();
|
||||||
|
|
||||||
setInterval(fetchMessages, 10000); // Fetch messages every minute
|
setInterval(fetchMessages, 10000); // Fetch messages every ten seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
@ -304,7 +304,7 @@
|
|||||||
method: 'GET',
|
method: 'GET',
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
|
|
||||||
console.log(response);
|
//console.log(response);
|
||||||
|
|
||||||
if (response.length == 0) {
|
if (response.length == 0) {
|
||||||
|
|
||||||
@ -325,13 +325,14 @@
|
|||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
client_policy_id: item.client_policy_id,
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
actions: 'inception'
|
actions: 'inception'
|
||||||
};
|
};
|
||||||
|
|
||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString
|
var url = 'employee/upload?' + queryString
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
@ -339,9 +340,17 @@
|
|||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.policy_name;
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
//console.log(toast_body_data);
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
}
|
||||||
|
|
||||||
|
////console.log(item.branch_name);
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -376,6 +385,7 @@
|
|||||||
|
|
||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
event: 'correction',
|
event: 'correction',
|
||||||
actions: 'export',
|
actions: 'export',
|
||||||
insurer_or_tpa: 'tpa',
|
insurer_or_tpa: 'tpa',
|
||||||
@ -384,7 +394,7 @@
|
|||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
@ -392,15 +402,25 @@
|
|||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
|
|
||||||
var title = 'Correction Export Pending';
|
var title = 'Correction Pending';
|
||||||
|
|
||||||
if (item.batch_export_count > 0) {
|
|
||||||
|
|
||||||
title = 'Correction Import Pending';
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toast_body_data = item.client_name;
|
////console.log(item.branch_name);
|
||||||
//console.log(toast_body_data);
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Correction Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + ' - ' + item.branch_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -439,6 +459,7 @@
|
|||||||
|
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
client_policy_id: item.client_policy_id,
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
event: 'deletion',
|
event: 'deletion',
|
||||||
actions: 'export',
|
actions: 'export',
|
||||||
insurer_or_tpa: 'tpa',
|
insurer_or_tpa: 'tpa',
|
||||||
@ -448,22 +469,32 @@
|
|||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
var title = 'Deletion Export Pending';
|
var title = 'Deletion Pending';
|
||||||
|
|
||||||
if (item.batch_export_count > 0) {
|
|
||||||
|
|
||||||
title = 'Deletion Import Pending';
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.policy_name;
|
////console.log(item.branch_name);
|
||||||
//console.log(toast_body_data);
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Deletion Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -501,6 +532,7 @@
|
|||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
client_policy_id: item.client_policy_id,
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
event: 'si_enhancement',
|
event: 'si_enhancement',
|
||||||
actions: 'export',
|
actions: 'export',
|
||||||
insurer_or_tpa: 'tpa',
|
insurer_or_tpa: 'tpa',
|
||||||
@ -509,22 +541,32 @@
|
|||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
var title = 'SI Enhancement Export Pending';
|
var title = 'SI Enhancement Pending';
|
||||||
|
|
||||||
if (item.batch_export_count > 0) {
|
|
||||||
|
|
||||||
title = 'SI Enhancement Import Pending';
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.policy_name;
|
////console.log(item.branch_name);
|
||||||
//console.log(toast_body_data);
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'SI Enhancement Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -562,6 +604,7 @@
|
|||||||
var queryParams = {
|
var queryParams = {
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
client_policy_id: item.client_policy_id,
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
event: 'inception',
|
event: 'inception',
|
||||||
insurer_or_tpa: 'tpa',
|
insurer_or_tpa: 'tpa',
|
||||||
actions: 'export',
|
actions: 'export',
|
||||||
@ -570,22 +613,31 @@
|
|||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
var title = 'TPA Export Pending';
|
var title = 'TPA Pending';
|
||||||
|
|
||||||
if (item.batch_export_count > 0) {
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
title = 'TPA Import Pending';
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.policy_name;
|
////console.log(item.branch_name);
|
||||||
//console.log(toast_body_data);
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'TPA Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -623,6 +675,7 @@
|
|||||||
|
|
||||||
client_id: item.client_id,
|
client_id: item.client_id,
|
||||||
client_policy_id: item.client_policy_id,
|
client_policy_id: item.client_policy_id,
|
||||||
|
client_branch_id: item.branch_id,
|
||||||
event: 'inception',
|
event: 'inception',
|
||||||
insurer_or_tpa: 'insurer',
|
insurer_or_tpa: 'insurer',
|
||||||
actions: 'export',
|
actions: 'export',
|
||||||
@ -631,21 +684,31 @@
|
|||||||
const queryString = objectToQueryString(queryParams);
|
const queryString = objectToQueryString(queryParams);
|
||||||
|
|
||||||
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
var url = 'employee/upload?' + queryString + '#KYC-DOC-tab'
|
||||||
//console.log(url)
|
////console.log(url)
|
||||||
|
|
||||||
var toast_body_css = 'background : #bfd7eb !important;';
|
var toast_body_css = 'background : #bfd7eb !important;';
|
||||||
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
var toast_head_css = 'background-color : rgb(2, 168, 181) !important; color :#000; border-bottom: 0;';
|
||||||
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
var toast_icon = 'mdi mdi-checkbox-marked-circle mr-auto';
|
||||||
var toast_status_word = 'Info';
|
var toast_status_word = 'Info';
|
||||||
var title = 'Insurer Export Pending';
|
var title = 'Insurer Pending';
|
||||||
|
|
||||||
if (item.batch_export_count > 0) {
|
|
||||||
|
|
||||||
title = 'Insurer Import Pending';
|
if (!item.branch_name.toLowerCase().includes('branch')) {
|
||||||
|
|
||||||
|
//console.log(item.branch_name)
|
||||||
|
item.branch_name += ' branch';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var toast_body_data = item.client_name + ' - ' + item.policy_name;
|
////console.log(item.branch_name);
|
||||||
//console.log(toast_body_data);
|
|
||||||
|
// if (item.batch_export_count > 0) {
|
||||||
|
|
||||||
|
// title = 'Insurer Import Pending';
|
||||||
|
// }
|
||||||
|
|
||||||
|
var toast_body_data = item.client_name + '( ' + item.branch_name + ' ) ' + ' - ' + item.policy_name;
|
||||||
|
////console.log(toast_body_data);
|
||||||
|
|
||||||
var html = ` <li data-id="" data-url="${url}">
|
var html = ` <li data-id="" data-url="${url}">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
@ -690,11 +753,11 @@
|
|||||||
|
|
||||||
$('#messages-list-2').on('click', 'li', function(event) {
|
$('#messages-list-2').on('click', 'li', function(event) {
|
||||||
|
|
||||||
console.log('messages-list-2 click li')
|
//console.log('messages-list-2 click li')
|
||||||
|
|
||||||
if ($(event.target).closest('.rm_msg').length > 0) {
|
if ($(event.target).closest('.rm_msg').length > 0) {
|
||||||
|
|
||||||
console.log('.rm_msg')
|
//console.log('.rm_msg')
|
||||||
|
|
||||||
$(this).delay(300).fadeOut('slow', function() {
|
$(this).delay(300).fadeOut('slow', function() {
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
@ -702,10 +765,10 @@
|
|||||||
|
|
||||||
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
} else if ($(event.target).closest('.redirect_page').length > 0) {
|
||||||
|
|
||||||
console.log('redirect_page')
|
//console.log('redirect_page')
|
||||||
|
|
||||||
let url = $(this).data('url');
|
let url = $(this).data('url');
|
||||||
console.log('url : ', url);
|
//console.log('url : ', url);
|
||||||
|
|
||||||
window.location.href = '<?= base_url() ?>' + url;
|
window.location.href = '<?= base_url() ?>' + url;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -589,7 +589,8 @@
|
|||||||
$currentUrl = base_url();
|
$currentUrl = base_url();
|
||||||
$parsedUrl = parse_url($currentUrl);
|
$parsedUrl = parse_url($currentUrl);
|
||||||
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
$baseUrl = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/';
|
||||||
$redirectUrl = $baseUrl . 'Ticketing/staff/login?' . http_build_query(['token' => $sessionData]);
|
$hashedEmail = hash('sha256', $sessionData->email);
|
||||||
|
$redirectUrl = $baseUrl . getenv('hepldeskURL') .'/staff/login?' . http_build_query(['token' => $hashedEmail]);
|
||||||
?>
|
?>
|
||||||
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
<a href="<?php echo $redirectUrl; ?>" target="_blank">
|
||||||
<i class="mdi mdi-lifebuoy"></i>
|
<i class="mdi mdi-lifebuoy"></i>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
412
app/Views/policy_grid_excel.php
Normal file
412
app/Views/policy_grid_excel.php
Normal file
@ -0,0 +1,412 @@
|
|||||||
|
<style>
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
td,
|
||||||
|
th {
|
||||||
|
padding: 0.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error {
|
||||||
|
background-color: #f8d7da;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duplicate {
|
||||||
|
background-color: #fff3cd;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compact-table td,
|
||||||
|
.compact-table th {
|
||||||
|
padding: 0.1rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const formatType = 0; // Specify the format type here
|
||||||
|
const excel_headers = {
|
||||||
|
3: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
4: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
5: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
6: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
7: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
8: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"grade": "Grade",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
9: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
10: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
11: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"grade": "Grade",
|
||||||
|
"premium": "Premium",
|
||||||
|
"max_si": "Max Si"
|
||||||
|
},
|
||||||
|
12: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"relationship": "Relationship",
|
||||||
|
"premium": "Premium"
|
||||||
|
},
|
||||||
|
13: {
|
||||||
|
"sum_insured": "Sum Insured",
|
||||||
|
"relationship": "Relationship",
|
||||||
|
"from_age": "From Age",
|
||||||
|
"to_age": "To Age",
|
||||||
|
"premium": "Premium"
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
function slugify(text) {
|
||||||
|
return text.toString().toLowerCase().replace(/\s+/g, '_').replace(/[^\w\-]+/g, '').replace(/\-\-+/g, '_')
|
||||||
|
.replace(/^-+/, '').replace(/-+$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyHeaders(rack_rate_type) {
|
||||||
|
|
||||||
|
let formatType = $('#grid').val();
|
||||||
|
var obj = $('#grid');
|
||||||
|
if(rack_rate_type == 1){
|
||||||
|
formatType = $('#additional_grid').val();
|
||||||
|
obj = $('#additional_grid');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(obj)
|
||||||
|
console.log(formatType)
|
||||||
|
|
||||||
|
if(!formatType && formatType == ""){
|
||||||
|
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const headerString = Object.values(excel_headers[formatType]).join("\t"); // Using specified format type for copying headers
|
||||||
|
navigator.clipboard.writeText(headerString).then(function() {
|
||||||
|
toastr.success('Headers copied to clipboard', 'success');
|
||||||
|
}, function(err) {
|
||||||
|
toastr.error(err, 'Could not copy headers:');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateTable(rack_rate_type) {
|
||||||
|
|
||||||
|
var data = $('#copied_excel_data').val();
|
||||||
|
let formatType = $('#grid').val();
|
||||||
|
var obj = $('#grid');
|
||||||
|
|
||||||
|
if (rack_rate_type == 1) {
|
||||||
|
data = $('#additional_copied_excel_data').val();
|
||||||
|
formatType = $('#additional_grid').val();
|
||||||
|
obj = $('#additional_grid');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(obj);
|
||||||
|
console.log(formatType);
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (!formatType || formatType == "") {
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
toastr.warning('Please select the Policy Premium Type', 'Warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if Excel data is empty
|
||||||
|
if (!data.trim()) {
|
||||||
|
toastr.warning('Excel data is empty.', 'Warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var rows = data.split("\n");
|
||||||
|
|
||||||
|
// Filter out empty rows
|
||||||
|
rows = rows.filter(rowText => rowText.split("\t").some(cell => cell.trim()));
|
||||||
|
|
||||||
|
if (rows.length === 0) {
|
||||||
|
toastr.warning('All rows are empty after filtering.', 'Warning');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var header = rows[0].split("\t");
|
||||||
|
|
||||||
|
// Determine the columns to keep (non-empty columns)
|
||||||
|
var columnsToKeep = [];
|
||||||
|
for (let i = 0; i < header.length; i++) {
|
||||||
|
if (rows.some(rowText => rowText.split("\t")[i].trim())) {
|
||||||
|
columnsToKeep.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter header based on columns to keep
|
||||||
|
header = columnsToKeep.map(i => slugify(header[i]));
|
||||||
|
|
||||||
|
if (!excel_headers[formatType]) {
|
||||||
|
toastr.warning("Unknown format type. Please check the header columns.", 'Warning');
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var expectedHeader = Object.keys(excel_headers[formatType]);
|
||||||
|
|
||||||
|
if (JSON.stringify(header) !== JSON.stringify(expectedHeader)) {
|
||||||
|
const expectedHeaders = JSON.stringify(Object.values(excel_headers[formatType]));
|
||||||
|
const receivedHeaders = JSON.stringify(columnsToKeep.map(i => rows[0].split("\t")[i]));
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Header Mismatch",
|
||||||
|
html: `
|
||||||
|
<p>Header columns do not match expected format:</p>
|
||||||
|
<p><strong>Expected:</strong> ${expectedHeaders}</p>
|
||||||
|
<p><strong>Received:</strong> ${receivedHeaders}</p>
|
||||||
|
`,
|
||||||
|
icon: "error"
|
||||||
|
});
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var table = $('<table class="table table-striped compact-table" />');
|
||||||
|
var uniqueRows = new Set();
|
||||||
|
var emptyCellCount = 0;
|
||||||
|
|
||||||
|
rows.forEach((rowText, y) => {
|
||||||
|
var cells = rowText.split("\t").filter((_, i) => columnsToKeep.includes(i));
|
||||||
|
var row = $('<tr />');
|
||||||
|
|
||||||
|
// Skip empty rows after filtering columns
|
||||||
|
if (cells.every(cell => !cell.trim())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cells.forEach(cellText => {
|
||||||
|
row.append('<td>' + cellText + '</td>');
|
||||||
|
if (!cellText.trim()) {
|
||||||
|
emptyCellCount++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var key;
|
||||||
|
switch (formatType) {
|
||||||
|
case 3:
|
||||||
|
key = cells[0] + "|" + cells[1] // Sum Insured, Premium
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Grade, Premium
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
key = cells[0] + "|" + cells[1]; // Sum Insured, Premium
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3]; // Sum Insured, Grade, Premium, Max SI
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2]; // Sum Insured, Relationship, Premium
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
key = cells[0] + "|" + cells[1] + "|" + cells[2] + "|" + cells[3] + "|" + cells[4]; // Sum Insured, Relationship, From Age, To Age, Premium
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
key = cells.join("|");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y > 0 && uniqueRows.has(key)) {
|
||||||
|
row.addClass('duplicate');
|
||||||
|
} else {
|
||||||
|
uniqueRows.add(key);
|
||||||
|
}
|
||||||
|
table.append(row);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (rack_rate_type == 1) {
|
||||||
|
$('#additional_excel_table').empty();
|
||||||
|
$('#additional_excel_table').html(table);
|
||||||
|
} else if (rack_rate_type == 0) {
|
||||||
|
$('#excel_table').empty();
|
||||||
|
$('#excel_table').html(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($('.duplicate').length > 0) {
|
||||||
|
console.log('test');
|
||||||
|
toastr.warning("Duplicates found!", "warning");
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emptyCellCount > 0) {
|
||||||
|
toastr.warning('Number of empty cells: ' + emptyCellCount);
|
||||||
|
$('.excel_table_class').empty();
|
||||||
|
$('.excel_textarea').val('');
|
||||||
|
}
|
||||||
|
submitData(rack_rate_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function submitData(rack_rate_type) {
|
||||||
|
|
||||||
|
let formatType = $('#grid').val();
|
||||||
|
var table = $('#excel_table table');
|
||||||
|
var obj = $('#grid');
|
||||||
|
|
||||||
|
if(rack_rate_type == 1){
|
||||||
|
|
||||||
|
formatType = $('#additional_grid').val();
|
||||||
|
table = $('#additional_excel_table table');
|
||||||
|
obj = $('#additional_grid');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var headers = $(table).find('tr').first().find('td').map(function() {
|
||||||
|
return slugify($(this).text());
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
var rows = $(table).find('tr:gt(0)').map(function() {
|
||||||
|
return $(this).find('td').map(function() {
|
||||||
|
return $(this).text();
|
||||||
|
}).get();
|
||||||
|
}).get();
|
||||||
|
|
||||||
|
var jsonData = [];
|
||||||
|
|
||||||
|
$(table).find('tr:gt(0)').each(function(idx) {
|
||||||
|
var row = $(this).find('td').map(function() {
|
||||||
|
return $(this).text();
|
||||||
|
}).get();
|
||||||
|
var rowData = {};
|
||||||
|
row.forEach((cell, colIdx) => {
|
||||||
|
rowData[headers[colIdx]] = cell;
|
||||||
|
});
|
||||||
|
jsonData.push(rowData);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(jsonData);
|
||||||
|
|
||||||
|
jsonData.forEach(obj => {
|
||||||
|
|
||||||
|
if ('sum_insured' in obj) {
|
||||||
|
obj.si = obj.sum_insured;
|
||||||
|
delete obj.sum_insured;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('from_age' in obj) {
|
||||||
|
obj.age_from = obj.from_age;
|
||||||
|
delete obj.from_age;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('to_age' in obj) {
|
||||||
|
obj.age_to = obj.to_age;
|
||||||
|
delete obj.to_age;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(jsonData);
|
||||||
|
|
||||||
|
|
||||||
|
if(rack_rate_type == 1){
|
||||||
|
|
||||||
|
$('#additional_grid_content_input').empty()
|
||||||
|
|
||||||
|
if ($('#copyfromexcelforadditional').text() == "Manual entry") {
|
||||||
|
$('#copyfromexcelforadditional').text("Copy from excel")
|
||||||
|
} else {
|
||||||
|
$('#copyfromexcelforadditional').text("Copy from excel");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#additional_grid_content_input').toggle();
|
||||||
|
$('#additional_grid_content_from_excel').toggle();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
$('#grid_content_input').empty()
|
||||||
|
|
||||||
|
if ($('#copyfromexcel').text() == "Manual entry") {
|
||||||
|
$('#copyfromexcel').text("Copy from excel")
|
||||||
|
} else {
|
||||||
|
$('#copyfromexcel').text("Copy from excel");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#grid_content_input').toggle();
|
||||||
|
$('#grid_content_from_excel').toggle();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(jsonData, function(index, item) {
|
||||||
|
appendGridtHtml(formatType, rack_rate_type, item)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('input[name="11_max_si[]"]').each(function() {
|
||||||
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$(`input[name="${formatType}_si[]"]`).each(function() {
|
||||||
|
// console.log($(this));
|
||||||
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
|
||||||
|
$(`input[name="${formatType}_premium[]"]`).each(function() {
|
||||||
|
// console.log($(this));
|
||||||
|
$(this).trigger('keyup');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
<div class="row" style="margin-bottom:1rem;">
|
<div class="row" style="margin-bottom:1rem;">
|
||||||
<div class="col-6" style="align-self: center;">
|
<div class="col-6" style="align-self: center;">
|
||||||
<h4 class="header-title" style="position: relative;">Transaction Details</h4>
|
<h4 style="position: relative;">Transaction Details</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
<div class="col-6" style="text-align: right; position: relative;top: 53px;">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user