FIX_MASTER_BRANCH_ISSUE_RESOLVED : RV

This commit is contained in:
VENKATESHWARAN 2024-03-27 09:23:11 +05:30
parent 2e79864c40
commit 934823b6de
20 changed files with 1771 additions and 1262 deletions

View File

@ -230,7 +230,8 @@ class ClientController extends AdminController
{ {
$this->myLogger->logme('error','Client general info function called'); $this->myLogger->logme('error','Client general info function called');
$file_name = file_Upload($this->request->getFile('client_logo')); $uploadFilePath = ROOTPATH . 'public/uploads/logo/';
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
$data = $this->request->getPost(); $data = $this->request->getPost();
$data['created_by'] = get_session_userid(); $data['created_by'] = get_session_userid();
$data['client_logo'] = $file_name; $data['client_logo'] = $file_name;
@ -248,7 +249,8 @@ class ClientController extends AdminController
public function editClientGeneralInfo() public function editClientGeneralInfo()
{ {
$this->myLogger->logme('error','edit client general info function called'); $this->myLogger->logme('error','edit client general info function called');
$file_name = file_Upload($this->request->getFile('client_logo')); $uploadFilePath = ROOTPATH . 'public/uploads/logo/';
$file_name = file_Upload($this->request->getFile('client_logo'), $uploadFilePath);
$id = $this->request->getPost('PrimaryKey'); $id = $this->request->getPost('PrimaryKey');
$data = $this->request->getPost(); $data = $this->request->getPost();
$data['updated_by'] = get_session_userid(); $data['updated_by'] = get_session_userid();
@ -268,7 +270,8 @@ class ClientController extends AdminController
$this->myLogger->logme('error','create Client kyc function called'); $this->myLogger->logme('error','create Client kyc function called');
$data = $this->request->getPost(); $data = $this->request->getPost();
unset($data['file_name']); unset($data['file_name']);
$File = file_Upload($this->request->getFile('file_name')); $uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
if(!empty($File)){ if(!empty($File)){
$data['file_name'] = $File; $data['file_name'] = $File;
} }
@ -288,7 +291,8 @@ class ClientController extends AdminController
{ {
$this->myLogger->logme('error','edit client kyc function called'); $this->myLogger->logme('error','edit client kyc function called');
$File = file_Upload($this->request->getFile('file_name')); $uploadFilePath = WRITEPATH . 'uploads/client_kyc_documents';
$File = file_Upload($this->request->getFile('file_name'), $uploadFilePath);
if(!empty($File)){ if(!empty($File)){
$data['file_name'] = $File; $data['file_name'] = $File;
} }
@ -452,7 +456,7 @@ class ClientController extends AdminController
{ {
$this->myLogger->logme('error','Client branch EDIT function called'); $this->myLogger->logme('error','Client branch EDIT function called');
$id = $this->request->getPost('PrimaryKey'); $id = $this->request->getPost('branch_id_primarykey');
$client_id = $this->request->getPost('client_id'); $client_id = $this->request->getPost('client_id');
$data = $this->request->getPost(); $data = $this->request->getPost();
$data['updated_by'] = get_session_userid(); $data['updated_by'] = get_session_userid();

File diff suppressed because it is too large Load Diff

View File

@ -191,7 +191,7 @@ class EmployeeController extends AdminController
} }
$data['actions'] = ['inception' => 'Inception + Addition + Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement']; $data['actions'] = ['inception' => 'Inception + Addition + Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
$data['events'] = ['inception' => 'Inception + Addition','correction' =>'Correction', 'deletion'=>'Deletion' ,'si_enhancement' =>'SI Enhancement']; $data['events'] = ['inception' => 'Inception (Employee + Dependents)','addition' => 'Addition (Employee + Dependents)','dependent_addition' => 'Dependent Addition (Only Dependents)','deletion' => 'Deletion','correction' =>'Correction','si_enhancement' =>'SI Enhancement'];
$data['import_or_export'] = ['import' => 'Import','export' =>'Export']; $data['import_or_export'] = ['import' => 'Import','export' =>'Export'];
$data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA']; $data['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
$data['fileList'] = $this->fileModel $data['fileList'] = $this->fileModel
@ -200,6 +200,14 @@ class EmployeeController extends AdminController
->join('policies pm','files.policy_id = pm.id') ->join('policies pm','files.policy_id = pm.id')
->join('clients c','files.client_id = c.id') ->join('clients c','files.client_id = c.id')
->where('files.created_by',8)->orderBy('files.created_at','desc')->findAll(); ->where('files.created_by',8)->orderBy('files.created_at','desc')->findAll();
$data['batch_list'] = $this->batchFileModel->select('batch_files.*, policies.name as policy_name, clients.short_name as client_short_name')
->join('client_policy', 'client_policy.id = batch_files.client_policy_id')
->join('policies', 'policies.id = client_policy.policy_id')
->join('clients', 'clients.id = client_policy.client_id')
->orderBy('batch_files.id','desc')
->findAll();
// dd($data['fileList']);die(); // dd($data['fileList']);die();
if($this->request->getMethod() == "get") if($this->request->getMethod() == "get")
{ {
@ -222,8 +230,18 @@ class EmployeeController extends AdminController
} }
/**This downloadSampleExcelFile() function facilitates downloading various sample Excel files /**
** based on user-selected actions, handling file retrieval and download processes. **/ * The below function Downloads a sample Excel file based on the provided action type.
*
* @param string|null $actionType The type of action :
*
* - inception
* - correction
* - si_enhancement for selecting the appropriate sample Excel file.
*
* @return redirect back with an error message if the file is not found, otherwise sends the file to the user for download.
*/
public function downloadSampleExcelFile($actionType = null) public function downloadSampleExcelFile($actionType = null)
{ {
// $actionType = $this->request->getGet(); // $actionType = $this->request->getGet();
@ -254,6 +272,16 @@ class EmployeeController extends AdminController
} }
/**
* The below function are Handles import and export operations based on the provided parameters.
*
* This function logs the call, retrieves necessary data, generates a filename,
* and then either exports data to an Excel file or imports data from an Excel file
* depending on the provided action type and event type.
*
* @return void Redirects the user to the appropriate page with flash messages indicating success or failure.
*/
public function importExport() public function importExport()
{ {
@ -279,16 +307,18 @@ class EmployeeController extends AdminController
'file_name' => $file_name, 'file_name' => $file_name,
]; ];
// $event_type = 'si_enhancement';
if($actions == 'export'){ if($actions == 'export'){
if($event_type == 'inception'){ if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' ){
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data); $return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
if(!$return){ if(!$return){
session()->setFlashdata('error', 'No data found about this action'); session()->setFlashdata('error', 'No data found about this action');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
} else{ } else{
$this->myLogger->logme('error','Successfully exported Excel file in Inception/Addition/DependentAddition.'); $this->myLogger->logme('error','Successfully exported Excel file in {data}.', ['data' => $event_type]);
} }
} else if($event_type == 'correction'){ } else if($event_type == 'correction'){
@ -325,379 +355,72 @@ class EmployeeController extends AdminController
}else if($actions == 'import'){ }else if($actions == 'import'){
if($event_type == 'inception'){ $batch_data['file'] = $this->request->getFile('import_file_data');
$file = $this->request->getFile('import_file_data'); if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition'){
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
$filename = $file->getName();
$this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]); $return = $empDataServiceController->importExcelDataForInception($batch_data);
$random_number_count = 4; if($return == 1){
$batch_code = generate_random_string($random_number_count); session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
$this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]);
$batch_data['batch_code'] = $batch_code; }else if($return == 2){
$batch_data['created_by'] = get_session_userid(); session()->setFlashdata('error', 'File not found');
$batch_data['file_name'] = $filename; return redirect()->to(base_url('employee/upload'));
// $insert = $this->batchFileModel->insert($batch_data);
$batch_file_batch_code = $this->batchFileModel->where('id', 2)->first();
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code']; }else if($return == 0){
$batch_code_for_batch_list['created_by'] = get_session_userid(); session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
//check the file exist or not
if(!file_exists($file_name_with_path))
{
// session()->setFlashdata('error', 'File not found');
// return redirect()->to(base_url('employee/upload'));
} }
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]);
array_pop($data);
$count = count($data);
// $this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data );
$employeeIds = [];
foreach ($data as $key => $value) {
// Check if the array is not empty and has the necessary data
if (!empty($value) && (isset($value[15]) || isset($value[16]))) {
// Extract the client_policy_id and tpa_id from the array
$tpa_id = $value[15] != null ? $value[15] : '';
$uhid = $value[16] != null ? $value[16] : '';
$emp_code = $value[2];
$name = $value[1];
$val = $this->employeePolicyModel
->select('employee_polices.id')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employees.name', $name)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
->first();
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list);
array_push($employeeIds, $val['id']);
$this->employeePolicyModel->updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
}else{
// session()->setFlashdata('error', 'Something went wrong');
// return redirect()->to(base_url('employee/upload'));
}
}
$action = ['action' => 'inception'];
// $depositeData = [
// $employeeIds,
// ];
// print_r($employeeIds); die;
$empDataServiceController->cashDepositCalculationForInception($employeeIds);
// echo '<pre>';
// print_r($depositeData); die;
// session()->setFlashdata('success', 'Data updated successfully');
// return redirect()->to(base_url('employee/upload'));
}else if($event_type == 'correction'){ }else if($event_type == 'correction'){
$file = $this->request->getFile('import_file_data'); $return = $empDataServiceController->importExcelDataForCorrection($batch_data);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); if($return == 1){
$filename = $file->getName(); session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
$this->myLogger->logme('error','Correction Import file name : {data}', ['data'=> $filename ]); }else if($return == 2){
$random_number_count = 4;
$batch_code = generate_random_string($random_number_count);
$this->myLogger->logme('error','Correction Import BATCH CODE : {data}', ['data'=> $batch_code ]);
$batch_data['batch_code'] = $batch_code;
$batch_data['created_by'] = get_session_userid();
$batch_data['file_name'] = $filename;
$insert = $this->batchFileModel->insert($batch_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
$batch_code_for_batch_list['created_by'] = get_session_userid();
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'File not found');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
} }
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]);
$count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data);
foreach ($data as $key => $value) {
if (!empty($value) && isset($value[10])) {
$emp_code = $value[0];
$uhid = $value[1];
$endorsement_id = $value[10] != null ? $value[10] : '';
$val = $this->employeePolicyModel
->select('employees.id')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employee_polices.uhid', $uhid)
->where('employees.emp_code', $emp_code)
->where('employees.is_active', 1)
->first();
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list);
// $this->employeePolicyModel->updateCorrectionData($emp_code, $uhid, $endorsement_id);
$queryData = $this->empEndorsementModel->select('emp_endorsement.*')
->join('employees', 'employees.id = emp_endorsement.pk')
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code', $emp_code)
->where('employees.client_id', $client_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.uhid', $uhid)
->get()
->getResultArray();
// dd($queryData);
foreach ($queryData as $endorsementData) {
$emp_endoresment_id = $endorsementData['id'];
$emp_id = $endorsementData['emp_id'];
$field_name = $endorsementData['field_name'];
$new_value = $endorsementData['new_value'];
$this->empEndorsementModel->where('id', $emp_endoresment_id)->set('endorsement_id', $endorsement_id)->update();
$this->employeeModel->where('id', $emp_id)->set($field_name, $new_value)->update();
}
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
}else{
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
}
}
session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
}else if($event_type == 'si_enhancement'){ }else if($event_type == 'si_enhancement'){
$file = $this->request->getFile('import_file_data'); $return = $empDataServiceController->importExcelDataForSIEnhancement($batch_data);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); if($return == 1){
$filename = $file->getName(); session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
$this->myLogger->logme('error','SI_Enhancement Import file name : {data}', ['data'=> $filename ]); }else if($return == 2){
$random_number_count = 4;
$batch_code = generate_random_string($random_number_count);
$this->myLogger->logme('error','SI_Enhancement Import BATCH CODE : {data}', ['data'=> $batch_code ]);
$batch_data['batch_code'] = $batch_code;
$batch_data['created_by'] = get_session_userid();
$batch_data['file_name'] = $filename;
$insert = $this->batchFileModel->insert($batch_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
$batch_code_for_batch_list['created_by'] = get_session_userid();
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'File not found');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
} }
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]);
$count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
// dd($data);
foreach ($data as $key => $value) {
if (!empty($value) && isset($value[19])) {
$emp_name = $value[1];
$emp_code = $value[2];
// echo $emp_name .'-'. $emp_code; die;
$endorsement_id = $value[19] != null ? $value[19] : '';
$val = $this->employeePolicyModel
->select('employee_polices.id')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
->first();
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list);
$this->employeePolicyModel->updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id);
$queryData = $this->employeePolicyModel
->select('employee_polices.*')
->join('employees', 'employee_polices.employee_id = employees.id')
->where('employees.emp_code', $emp_code)
->where('employees.name', $emp_name)
->where('employees.client_id', $client_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.is_active', 1)
->first();
$queryData['is_active'] = 0;
$this->employeePolicyModel->save($queryData);
unset($queryData['id']);
unset($queryData['created_by']);
unset($queryData['created_at']);
unset($queryData['updated_by']);
unset($queryData['updated_at']);
unset($queryData['is_active']);
$queryData['basic_cover_si'] = $value[8];
$queryData['premium'] = $value[14];
$queryData['si_enhancement_date'] = $value[10];
$queryData['rata_premimum'] = $value[16];
$queryData['gst'] = $value[17];
$queryData['created_by'] = get_session_userid();
//new insert
$this->employeePolicyModel->save($queryData);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
}else{
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
}
}
session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
}else if($event_type == 'deletion'){ }else if($event_type == 'deletion'){
$file = $this->request->getFile('import_file_data'); $return = $empDataServiceController->importExcelDataForDeletion($batch_data);
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel'); if($return == 1){
$filename = $file->getName(); session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
$this->myLogger->logme('error','Deletion Import file name : {data}', ['data'=> $filename ]); }else if($return == 2){
$random_number_count = 4;
$batch_code = generate_random_string($random_number_count);
$this->myLogger->logme('error','Deletion Import BATCH CODE : {data}', ['data'=> $batch_code ]);
$batch_data['batch_code'] = $batch_code;
$batch_data['created_by'] = get_session_userid();
$batch_data['file_name'] = $filename;
$insert = $this->batchFileModel->insert($batch_data);
$batch_file_batch_code = $this->batchFileModel->where('id', $insert)->first();
$batch_code_for_batch_list['batch_code'] = $batch_file_batch_code['batch_code'];
$batch_code_for_batch_list['created_by'] = get_session_userid();
$file_name_with_path = WRITEPATH."/uploads/import_excel/".$batch_file_batch_code['file_name'];
if(!file_exists($file_name_with_path))
{
session()->setFlashdata('error', 'File not found'); session()->setFlashdata('error', 'File not found');
return redirect()->to(base_url('employee/upload')); return redirect()->to(base_url('employee/upload'));
}else if($return == 0){
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
} }
$data = read_excel_file_to_array($file_name_with_path);
unset($data[0]);
array_pop($data);
$count = count($data);
$this->batchFileModel->where('id', $insert)->set('count', $count)->update();
foreach ($data as $key => $value) {
if (!empty($value) && isset($value[15])) {
$emp_name = $value[2]; //employee name
$emp_code = $value[1]; //employee code
$date_of_exit = $value[7]; // date of releving
// echo $emp_name .'-'. $emp_code .'-'. $date_of_exit; die;
$endorsement_id = $value[15] != null ? $value[15] : ''; //endorsement id
$val = $this->employeePolicyModel
->select('employee_polices.id')
->join('employees', 'employees.id = employee_polices.employee_id')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employees.client_id', $client_id)
->where('employees.name', $emp_name)
->where('employees.emp_code', $emp_code)
->where('employee_polices.is_active', 1)
->first();
$batch_code_for_batch_list['emp_policy_id'] = $val['id'];
$this->batchListModel->insert($batch_code_for_batch_list);
$this->employeePolicyModel->updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id);
$deletionDataForEmployee = $this->empEndorsementModel
->select('emp_endorsement.new_value, employees.id')
->join('employees', 'emp_endorsement.emp_code = employees.emp_code')
->join('employee_polices', 'employee_polices.employee_id = employees.id')
->where('emp_endorsement.emp_code', $emp_code)
->where('employees.client_id', $client_id)
->where('employee_polices.client_policy_id', $client_policy_id)
->where('emp_endorsement.name', $emp_name)
->where('emp_endorsement.field_name', 'emp_status')
->first();
$deletionDataForEmployee['updated_by'] = get_session_userid();
$this->employeeModel->save($deletionDataForEmployee);
$deletionDataForEmployeePolicy = $this->employeePolicyModel->fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name);
$deletionDataForEmployeePolicy['updated_by'] = get_session_userid();
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
// echo '<pre>';
// print_r($deletionDataForEmployeePolicy); die;
$this->employeePolicyModel->save($deletionDataForEmployeePolicy);
// $query = $this->employeePolicyModel->getLastQuery();
// echo $query . "<br>";
}else{
session()->setFlashdata('error', 'Something went wrong');
return redirect()->to(base_url('employee/upload'));
}
}
session()->setFlashdata('success', 'Data updated successfully');
return redirect()->to(base_url('employee/upload'));
} }
} }

View File

@ -90,7 +90,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','Edit Insurer Onboarding function called'); $this->myLogger->logme('error','Edit Insurer Onboarding function called');
$headerData['page_name'] = 'Edit Insurer Onboarding'; $headerData['page_name'] = 'Edit Insurer Master';
$types = array( $types = array(
(object) array('id' => 'pvt', 'name' => 'PVT'), (object) array('id' => 'pvt', 'name' => 'PVT'),
@ -122,7 +122,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','Insurer Onboarding function called'); $this->myLogger->logme('error','Insurer Onboarding function called');
$headerData['page_name'] = 'Insurer Onboarding'; $headerData['page_name'] = 'Insurer Master';
$types = array( $types = array(
(object) array('id' => 'pvt', 'name' => 'PVT'), (object) array('id' => 'pvt', 'name' => 'PVT'),
@ -228,12 +228,6 @@ class MasterController extends AdminController
} }
public function editInsurerGet($id = null) public function editInsurerGet($id = null)
{ {
$this->myLogger->logme('error','Edit TPA Onboarding function called'); $this->myLogger->logme('error','Edit TPA Onboarding function called');
@ -248,10 +242,6 @@ class MasterController extends AdminController
exit(); exit();
} }
public function editInsurerBranch() public function editInsurerBranch()
{ {
$this->myLogger->logme('error','Insurer branch CREATE function called'); $this->myLogger->logme('error','Insurer branch CREATE function called');
@ -259,11 +249,6 @@ class MasterController extends AdminController
$data = $this->request->getPost(); $data = $this->request->getPost();
$update = $this->insurerBranchModel->update($id, $data); $update = $this->insurerBranchModel->update($id, $data);
// print_r($this->request->getPost('name[]'));
// print_r($this->request->getPost('email[]'));
// print_r($this->request->getPost('mobile[]'));
// print_r($this->request->getPost('designation[]'));
if($update){ if($update){
$contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult(); $contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult();
foreach ($contactsToDelete as $contact) { foreach ($contactsToDelete as $contact) {
@ -285,10 +270,10 @@ class MasterController extends AdminController
} }
if($update){ if($update){
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll(); $branchData = $this->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
echo json_encode(array("status" => true , 'data' => $branchData)); echo json_encode(array("status" => true , 'data' => $branchData, 'edit'));
}else{ }else{
echo json_encode(array("status" => false)); echo json_encode(array("status" => false, 'edit'));
} }
} }
@ -325,7 +310,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','TPA Onboarding function called'); $this->myLogger->logme('error','TPA Onboarding function called');
$headerData['page_name'] = 'TPA Onboarding'; $headerData['page_name'] = 'TPA Master';
// print_r($data['types']);die(); // print_r($data['types']);die();
@ -408,7 +393,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','Edit TPA Onboarding function called'); $this->myLogger->logme('error','Edit TPA Onboarding function called');
$headerData['page_name'] = 'Edit TPA Onboarding'; $headerData['page_name'] = 'Edit TPA Master';
$editData['tpa'] = $this->tpaModel->where(['id' => $id, 'is_active' => 1])->first(); $editData['tpa'] = $this->tpaModel->where(['id' => $id, 'is_active' => 1])->first();
$editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll(); $editData['tpa_branch'] = $this->tpaBranchModel->where(['tpa_id' => $id, 'is_active' => 1])->findAll();
@ -546,7 +531,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','KYC Onboarding function called'); $this->myLogger->logme('error','KYC Onboarding function called');
$headerData['page_name'] = 'KYC Onboarding'; $headerData['page_name'] = 'KYC Master';
// print_r($data['types']);die(); // print_r($data['types']);die();
@ -610,7 +595,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','Edit KYC Onboarding function called'); $this->myLogger->logme('error','Edit KYC Onboarding function called');
$headerData['page_name'] = 'Edit KYC Onboarding'; $headerData['page_name'] = 'Edit KYC Master';
$editData['kyc'] = $this->kycEntityTypeModel->where(['id' => $id, 'is_active' => 1])->first(); $editData['kyc'] = $this->kycEntityTypeModel->where(['id' => $id, 'is_active' => 1])->first();
$editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll(); $editData['kyc_docs'] = $this->kycDocsModel->where(['kyc_type_id' => $id, 'is_active' => 1])->findAll();
@ -716,7 +701,7 @@ class MasterController extends AdminController
{ {
$this->myLogger->logme('error','Policy Type Onboarding function called'); $this->myLogger->logme('error','Policy Type Onboarding function called');
$headerData['page_name'] = 'Policy Type Onboarding'; $headerData['page_name'] = 'Policy Type Master';
// print_r($data['types']);die(); // print_r($data['types']);die();
@ -776,13 +761,11 @@ class MasterController extends AdminController
} }
public function editPolicyTypeOnboarding($id = null) public function editPolicyTypeOnboarding($id = null)
{ {
$this->myLogger->logme('error','Edit KYC Onboarding function called'); $this->myLogger->logme('error','Edit KYC Onboarding function called');
$headerData['page_name'] = 'Edit KYC Onboarding'; $headerData['page_name'] = 'Edit KYC Master';
$editData['policytype'] = $this->policyTypeModel->where(['id' => $id, 'is_active' => 1])->first(); $editData['policytype'] = $this->policyTypeModel->where(['id' => $id, 'is_active' => 1])->first();
$editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll(); $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
@ -794,9 +777,6 @@ class MasterController extends AdminController
} }
public function editPolicyType() public function editPolicyType()
{ {
$this->myLogger->logme('error','edit Policy general info function called'); $this->myLogger->logme('error','edit Policy general info function called');
@ -812,15 +792,13 @@ class MasterController extends AdminController
} }
public function policesList($id = null) public function policesList($id = null)
{ {
$this->myLogger->logme('error','Edit Policies Onboarding function called'); $this->myLogger->logme('error','Edit Policies Onboarding function called');
// $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll(); // $editData['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
$policies = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll(); $policies = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
foreach ($policies as $policy) { foreach ($policies as $policy) {
@ -848,9 +826,7 @@ class MasterController extends AdminController
public function editPoliciesGet($id = null) public function editPoliciesGet($id = null)
{ {
$this->myLogger->logme('error','Edit Policies Onboarding function called'); $this->myLogger->logme('error','Edit Policies Onboarding function called');
$editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first(); $editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first();
// Return JSON response // Return JSON response
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($editData); echo json_encode($editData);
@ -858,8 +834,6 @@ class MasterController extends AdminController
} }
public function editPolicies() public function editPolicies()
{ {
$this->myLogger->logme('error','edit Policy general info function called'); $this->myLogger->logme('error','edit Policy general info function called');
@ -868,7 +842,8 @@ class MasterController extends AdminController
$data['updated_by'] = get_session_userid(); $data['updated_by'] = get_session_userid();
$update = $this->policesModel->update($id,$data); $update = $this->policesModel->update($id,$data);
if($update){ if($update){
echo json_encode(array("status" => true , 'data' => $data)); $policyData = $this->policesModel->where(['id' => $id, 'is_active' => 1])->findAll();
echo json_encode(array("status" => true , 'data' => $policyData));
}else{ }else{
echo json_encode(array("status" => false)); echo json_encode(array("status" => false));
} }

View File

@ -87,7 +87,9 @@ if (!function_exists('generate_excel')) {
try { try {
// Save Excel file to the specified path // Save Excel file to the specified path
$writer->save($filename); // $writer->save($filename);
$filePath = WRITEPATH."/uploads/import_excel/" . $filename;
$writer->save($filePath);
return true; // Return true if file was successfully saved return true; // Return true if file was successfully saved
} catch (\Exception $e) { } catch (\Exception $e) {
// Log or handle the exception // Log or handle the exception
@ -352,8 +354,6 @@ if (!function_exists('read_excel_file_to_array')) {
} }
// app/Helpers/filename_helper.php
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) {
@ -366,6 +366,10 @@ if (! function_exists('generate_filename')) {
$evenTypeLabel = 'C'; $evenTypeLabel = 'C';
}else if($event_type == 'si_enhancement'){ }else if($event_type == 'si_enhancement'){
$evenTypeLabel = 'SI'; $evenTypeLabel = 'SI';
}else if($event_type == 'addition'){
$evenTypeLabel = 'A';
}else if($event_type == 'dependent_addition'){
$evenTypeLabel = 'DA';
} }
$insurer_or_tpa_lable = ""; $insurer_or_tpa_lable = "";
@ -385,3 +389,12 @@ if (! function_exists('generate_filename')) {
return $file_name; return $file_name;
} }
} }
if (!function_exists('remove_underscore_capitalize_first_letter')) {
function remove_underscore_capitalize_first_letter($word) {
// Remove underscore and capitalize first letter of each word
$formattedEvent = ucwords(str_replace('_', ' ', $word));
return $formattedEvent;
}
}

View File

@ -44,37 +44,29 @@ if (!function_exists('change_date_format')) {
} }
if (!function_exists('file_Upload')) { if (!function_exists('file_Upload')) {
function file_Upload($fileToUpload, $imageDetails = null) function file_Upload($fileToUpload, $filepath)
{ {
// Retrieve the name of the file if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
$fileName = $fileToUpload->getName(); $fileName = $fileToUpload->getName();
$fileToUpload->move($filepath, $fileName);
// Check if the file is not null and has a name return $fileName;
if ($fileToUpload !== null && $fileName !== "") {
// Check if the file is valid and has not been moved already
if ($fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
// Construct the path where the image should exist
$existingImagePath = ROOTPATH . 'public/uploads/logo/' . $imageDetails;
// Check if imageDetails is not null and if the image exists in the upload folder
if ($imageDetails !== null && file_exists($existingImagePath)) {
// If the image exists, delete it
unlink($existingImagePath);
}
// Move the new image to the upload folder
$fileToUpload->move(ROOTPATH . 'public/uploads/logo', $fileName);
}
} else { } else {
// Set fileName to empty string if file is null or doesn't have a name return "";
$fileName = "";
} }
// Return the file name
return $fileName;
} }
} }
if (!function_exists('file_unlink')) {
function file_unlink($filepath)
{
if (is_file($filepath) && file_exists($filepath)) {
unlink($filepath);
}
}
}
if (!function_exists('compressImage')) { if (!function_exists('compressImage')) {
function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100) function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100)
{ {

View File

@ -22,4 +22,38 @@ class BatchFileModel extends Model
"updated_by", "updated_by",
"is_active", "is_active",
]; ];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
} }

View File

@ -33,9 +33,41 @@ class EmployeeModel extends Model
"is_active", "is_active",
]; ];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
// ------------------------------------------------------------------------------------------------
public function getEmployeePolicy($id) public function getEmployeePolicy($id)
{ {

View File

@ -33,7 +33,40 @@ class EmployeePolicyModel extends Model
"is_active", "is_active",
]; ];
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = ["checkAndADDCreatedByValue"];
protected $afterInsert = [];
protected $beforeUpdate = ["checkAndUpdateUpdatedByValue"];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
protected function checkAndADDCreatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['created_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['created_by'] = get_session_userid();
}
return $data;
}
protected function checkAndUpdateUpdatedByValue(array $data)
{
// Check if 'updated_by' value is null or empty
if (empty($data['data']['updated_by'])) {
// Set 'updated_by' value to the current session user ID
$data['data']['updated_by'] = get_session_userid();
}
return $data;
}
// -----------------------------------------------------------------------------------------------------
public function getEmployeePolicy($client_id,$policy_id) public function getEmployeePolicy($client_id,$policy_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']) $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'])
@ -51,36 +84,41 @@ class EmployeePolicyModel extends Model
return ($result); return ($result);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------
public function getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type) public function getInceptionEmployeeDataForExportExcel($ref_data)
{ {
return $this->db->table('employee_polices') $client_policy_id = $ref_data['client_policy_id'];
->select('employees.name AS emp_name, $insurer_or_tpa = $ref_data['insurer_or_tpa'];
employees.emp_code AS emp_code,
employees.dob AS emp_dob,
employees.gender AS emp_gender,
employees.change_event AS change_event,
employees.relationship AS emp_relationship,
employees.relationship_code AS emp_relationship_code,
TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
"Has Define" as emp_type,
employee_polices.id as primaryKey, $sql = "
employee_polices.pre_existing_alignments, SELECT
employee_polices.basic_cover_si, employees.name AS emp_name,
employee_polices.date_coverage, employees.emp_code AS emp_code,
employee_polices.policy_end_date, employees.dob AS emp_dob,
employee_polices.days, employees.gender AS emp_gender,
employee_polices.premium, employees.change_event AS change_event,
employee_polices.rata_premimum, employees.relationship AS emp_relationship,
employee_polices.gst, employees.relationship_code AS emp_relationship_code,
(employee_polices.rata_premimum + employee_polices.gst) AS total, TIMESTAMPDIFF(YEAR, employees.dob, CURDATE()) AS emp_age,
batch_data.emp_policy_id, 'Has Define' as emp_type,
batch_data.bl AS batch_list_batch_code,
batch_data.bf AS batch_files_batch_code') employee_polices.id as primaryKey,
->join('employees', 'employees.id = employee_polices.employee_id', 'left') employee_polices.pre_existing_alignments,
->join("( 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.rata_premimum + employee_polices.gst) AS total,
batch_data.emp_policy_id,
batch_data.bl AS batch_list_batch_code,
batch_data.bf AS batch_files_batch_code
FROM employee_polices
LEFT JOIN employees ON employees.id = employee_polices.employee_id
LEFT JOIN (
SELECT SELECT
batch_list.emp_policy_id, batch_list.emp_policy_id,
batch_list.batch_code as bl, batch_list.batch_code as bl,
@ -89,19 +127,29 @@ class EmployeePolicyModel extends Model
LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code LEFT JOIN batch_list ON batch_files.batch_code = batch_list.batch_code
WHERE batch_files.event_type = 'inception' WHERE batch_files.event_type = 'inception'
AND batch_files.actions = 'export' AND batch_files.actions = 'export'
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}') as batch_data", 'employee_polices.id = batch_data.emp_policy_id', 'left') AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
->where('batch_data.bf', null) ) as batch_data ON employee_polices.id = batch_data.emp_policy_id
->where('batch_data.bl', null) WHERE batch_data.bf IS NULL
->where('employee_polices.client_policy_id', $client_policy_id) AND batch_data.bl IS NULL
->where('employee_polices.is_active', 1) AND employee_polices.client_policy_id = '{$client_policy_id}'
->get() AND (employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = '')
->getResult(); AND (employee_polices.uhid IS NULL OR employee_polices.uhid = '')
AND employee_polices.is_active = 1";
// Get the result set
$query = $this->db->query($sql);
$results = $query->getResult();
return $results;
} }
public function getCorrectionEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa) public function getCorrectionEmployeesDataForExportExcel($ref_data)
{ {
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$sql = " $sql = "
SELECT DISTINCT SELECT DISTINCT
emp_endorsement.id, emp_endorsement.id,
@ -162,7 +210,12 @@ class EmployeePolicyModel extends Model
} }
public function getSIEnhancementEmployeesDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){ public function getSIEnhancementEmployeesDataForExportExcel($ref_data)
{
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query(" $query = $this->db->query("
SELECT SELECT
@ -177,7 +230,7 @@ class EmployeePolicyModel extends Model
employee_polices.pre_existing_alignments, employee_polices.pre_existing_alignments,
employee_polices.policy_end_date, employee_polices.policy_end_date,
employee_polices.basic_cover_si as old_basic_cover_si, employee_polices.basic_cover_si as old_basic_cover_si,
employee_polices.premium as old_si_premium, employee_polices.rata_premimum as old_si_premium,
batch_data.emp_policy_id, batch_data.emp_policy_id,
batch_data.bl AS batch_list_batch_code, batch_data.bl AS batch_list_batch_code,
batch_data.bf AS batch_files_batch_code, batch_data.bf AS batch_files_batch_code,
@ -185,10 +238,10 @@ class EmployeePolicyModel extends Model
sidata.new_si_premium, sidata.new_si_premium,
sidata.date_of_coverage, sidata.date_of_coverage,
DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days, DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1 AS no_of_days,
sidata.new_si_premium - employee_polices.premium AS difference_premium, sidata.new_si_premium - employee_polices.rata_premimum AS difference_premium,
ROUND((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum, ROUND((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365, 2) AS pro_rata_premimum,
ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst, ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS gst,
((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.premium) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total ((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) + ROUND(((sidata.new_si_premium - employee_polices.rata_premimum) * (DATEDIFF(employee_polices.policy_end_date, sidata.date_of_coverage) + 1) / 365) * 0.18, 2) AS total
FROM FROM
emp_endorsement a emp_endorsement a
@ -263,7 +316,12 @@ class EmployeePolicyModel extends Model
} }
public function getDeletionEmployeeDataForExportExcel($client_id, $client_policy_id, $insurer_or_tpa){ public function getDeletionEmployeeDataForExportExcel($ref_data)
{
$client_id = $ref_data['client_id'];
$client_policy_id = $ref_data['client_policy_id'];
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
$query = $this->db->query(" $query = $this->db->query("
SELECT SELECT
@ -278,7 +336,7 @@ class EmployeePolicyModel extends Model
employee_polices.basic_cover_si, employee_polices.basic_cover_si,
employee_polices.uhid as risk_id, employee_polices.uhid as risk_id,
employee_polices.policy_end_date, employee_polices.policy_end_date,
employee_polices.premium, employee_polices.rata_premimum as premium,
batch_data.emp_policy_id AS emp_policy_id, batch_data.emp_policy_id AS emp_policy_id,
batch_data.bl AS batch_list_batch_code, batch_data.bl AS batch_list_batch_code,
@ -291,9 +349,9 @@ class EmployeePolicyModel extends Model
deletiondata.status, deletiondata.status,
DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days, DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit) AS no_of_days,
ROUND((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium, ROUND((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365, 2) AS pro_rata_premium,
ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst, ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18, 2) AS gst,
ROUND(((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.premium * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total ROUND(((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
FROM FROM
emp_endorsement a emp_endorsement a
LEFT JOIN LEFT JOIN
@ -330,12 +388,12 @@ class EmployeePolicyModel extends Model
WHERE WHERE
batch_files.event_type = 'deletion' batch_files.event_type = 'deletion'
AND batch_files.actions = 'export' AND batch_files.actions = 'export'
AND batch_files.insurer_or_tpa = 'insurer' AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
) 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 WHERE
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 = 12 AND employee_polices.client_policy_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.field_name = 'status' AND (a.endorsement_id IS NULL OR a.endorsement_id = '') AND a.field_name = 'status'
"); ");
@ -346,35 +404,37 @@ class EmployeePolicyModel extends Model
} }
public function updateTPAIDorUHID( $client_policy_id, $client_id, $name, $emp_code, $uhid, $tpa_id) public function updateTPAIDorUHID($update_data)
{ {
$client_id = $update_data['client_id'];
$client_policy_id = $update_data['client_policy_id'];
$name = $update_data['name'];
$emp_code = $update_data['emp_code'];
$uhid = $update_data['uhid'];
$tpa_id = $update_data['tpa_id'];
// $this->table('employee_polices') $query = "
// ->join('employees', 'employees.id = employee_polices.employee_id') UPDATE employee_polices
// ->set('employee_polices.tpa_id', $tpa_id)
// ->set('employee_polices.uhid', $uhid)
// ->where('employees.emp_code', $emp_code)
// ->where('employees.name', $name)
// ->where('employees.client_id', $client_id)
// ->where('employee_polices.client_policy_id', $client_policy_id)
// ->update();
$query = "UPDATE employee_polices
JOIN employees ON employees.id = employee_polices.employee_id JOIN employees ON employees.id = employee_polices.employee_id
SET employee_polices.tpa_id = '{$tpa_id}', SET employee_polices.tpa_id = '{$tpa_id}',
employee_polices.uhid = '{$uhid}' employee_polices.uhid = '{$uhid}'
WHERE employees.emp_code = '{$emp_code}' WHERE employees.emp_code = '{$emp_code}'
AND employees.name = '{$name}' AND employees.name = '{$name}'
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}'
";
$this->query($query); $this->query($query);
} }
public function updateCorrectionData($emp_code, $uhid, $endorsement_id){ public function updateCorrectionData($update_data)
{
$emp_code = $update_data['emp_code'];
$uhid = $update_data['uhid'];
$endorsement_id = $update_data['tpa_id'];
$sql = " $sql = "
UPDATE emp_endorsement UPDATE emp_endorsement
@ -388,8 +448,38 @@ class EmployeePolicyModel extends Model
} }
public function updateEndoresmentIdForSIEnhancement($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){ public function updateEndoresmentIdForSIEnhancement($update_data){
$client_id = $update_data['client_id'];
$client_policy_id = $update_data['client_policy_id'];
$emp_name = $update_data['name'];
$emp_code = $update_data['emp_code'];
$endorsement_id = $update_data['uhid'];
$sql = "
UPDATE emp_endorsement
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
JOIN employees ON employee_polices.employee_id = employees.id
SET emp_endorsement.endorsement_id = '$endorsement_id'
WHERE emp_endorsement.emp_code = '$emp_code'
AND employees.client_id = '$client_id'
AND employee_polices.client_policy_id = '$client_policy_id'
AND emp_endorsement.actions = 'si'
AND emp_endorsement.name = '$emp_name'
";
$query = $this->query($sql);
}
public function updateEndoresmentIdForDeletion($update_data){
$client_id = $update_data['client_id'];
$client_policy_id = $update_data['client_policy_id'];
$emp_name = $update_data['name'];
$emp_code = $update_data['emp_code'];
$endorsement_id = $update_data['uhid'];
$sql = " $sql = "
UPDATE emp_endorsement UPDATE emp_endorsement
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
@ -404,24 +494,12 @@ class EmployeePolicyModel extends Model
} }
public function updateEndoresmentIdForDeletion($emp_code, $client_id, $client_policy_id, $emp_name, $endorsement_id){ public function fetchEmpEndorsementData($fetch_data)
$sql = "
UPDATE emp_endorsement
JOIN employee_polices ON employee_polices.id = emp_endorsement.pk
JOIN employees ON employee_polices.employee_id = employees.id
SET emp_endorsement.endorsement_id = '$endorsement_id'
WHERE employees.emp_code = '$emp_code'
AND employees.client_id = '$client_id'
AND employee_polices.client_policy_id = '$client_policy_id'
AND employees.name = '$emp_name'
";
$query = $this->query($sql);
}
public function fetchEmpEndorsementData($emp_code, $client_policy_id, $emp_name)
{ {
$client_policy_id = $fetch_data['client_policy_id'];
$emp_name = $fetch_data['name'];
$emp_code = $fetch_data['emp_code'];
// Your raw SQL query // Your raw SQL query
$sql = " $sql = "
SELECT SELECT

47
app/Views/batch_list.php Normal file
View File

@ -0,0 +1,47 @@
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row" style="padding-bottom: 10px;">
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Batch List</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">Batch Code</th>
<th class="font-weight-medium">Client</th>
<th class="font-weight-medium">Client Policy</th>
<th class="font-weight-medium">Event Type</th>
<th class="font-weight-medium">Insurer/TPA</th>
<th class="font-weight-medium">Action</th>
<th class="font-weight-medium">Count</th>
</tr>
</thead>
<tbody class="font-12">
<?php
if(isset($batch_list))
{
foreach ($batch_list as $key => $file) {
?>
<tr>
<td><b><?php echo ($key + 1)?></b></td>
<td><?php echo $file['batch_code']?></td>
<td><?php echo $file['client_short_name']?></td>
<td><?php echo $file['policy_name']?></td>
<td><?php echo $file['event_type']?></td>
<td><?php echo $file['insurer_or_tpa']?></td>
<td><?php echo $file['actions']?></td>
<td><?php echo $file['count']?></td>
</tr>
<?php }}?>
</tbody>
</table>
</div>
</div>
</div><!-- end col -->

View File

@ -107,7 +107,7 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="gst">Logo</label> <label for="gst">Logo</label>
<input type="file" name="client_logo" id="client_logo" onchange="PreviewImage();"><br> <input type="file" name="client_logo" id="client_logo" onchange="PreviewImage();"><br>
<span class="text-danger"> Image dimensions 100 x 100 pixels and size of 200KB. </span> <i class="text">( Image dimensions 100 x 100 pixels and size of 200KB. )</i>
</div> </div>
<div class="form-group col-md-6 float-right" style="position: relative;top: 20px;"> <div class="form-group col-md-6 float-right" style="position: relative;top: 20px;">
<img src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : 'http://ssl.gstatic.com/accounts/ui/avatar_2x.png' ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/> <img src="<?= isset($client['client_logo']) && !empty($client['client_logo']) ? base_url() . "public/uploads/logo/" . $client['client_logo'] : 'http://ssl.gstatic.com/accounts/ui/avatar_2x.png' ?>" width="100" height="100" id="uploadPreview" class="avatar img-circle img-thumbnail" alt="avatar"/>
@ -198,7 +198,7 @@ $(document).ready(function () {
$('#client_id_relation').val(res.data.id); $('#client_id_relation').val(res.data.id);
$('#relation_PrimaryKey').val(res.data.id); $('#relation_PrimaryKey').val(res.data.id);
$('#client_id_branch').val(res.data.id); $('#client_id_branch').val(res.data.id);
$('#branch_PrimaryKey').val(res.data.id); $('#client_id_for_client_branch').val(res.data.id);
$('#client_id_policy').val(res.data.id); $('#client_id_policy').val(res.data.id);
$('#policy_PrimaryKey').val(res.data.id); $('#policy_PrimaryKey').val(res.data.id);
$('#client_id_kyc').val(res.data.id); $('#client_id_kyc').val(res.data.id);
@ -229,7 +229,7 @@ $(document).ready(function () {
<td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name"> <td id="form_${item.id}" style=""><form class="ajax" ><input class="file-input__input" type="file" name="file_name">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" /> <input type="hidden" class="form-control" value="${item.id}" name="kyc_doc_type_id" />
<input type="hidden" name="client_id" value="${client_id_for_file}"/> <input type="hidden" name="client_id" id="id_for_kyc_file" value="${client_id_for_file}"/>
<button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td> <button class="btn btn-sm btn-primary submit" style="position: relative;right: 80px;">Submit</button></form></td>
<td id="name_${item.id}" style="display:none;"></td> <td id="name_${item.id}" style="display:none;"></td>
<td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td> <td><i data-id="${item.id}" class="mdi mdi-delete btnKycDelete" style="font-size:18px;"></i></td>

View File

@ -1,5 +1,5 @@
<div class="tab-pane fade" id="branch-tab"> <div class="tab-pane fade" id="branch-tab">
<input type="hidden" id="client_id_for_client_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;"> <div class="row float-right" style="padding-bottom: 10px;position: relative;right: 13px;">
<button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button> <button type="button" id="btnBranchAdd" class="btn btn-primary waves-effect waves-light btn-sm"><span class="fa fa-plus-square" aria-hidden="true" style="padding: 5px 10px;"></span>Add Branch</button>
</div> </div>
@ -31,8 +31,8 @@
<form role="form" class="parsley-examples" method="post" id="branch_form" <form role="form" class="parsley-examples" method="post" id="branch_form"
enctype="multipart/form-data"> enctype="multipart/form-data">
<input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" /> <input type="hidden" class="form-control" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
<input type="hidden" name="PrimaryKey" id="branch_PrimaryKey" />
<input type="hidden" name="client_id" id="client_id_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/> <input type="hidden" name="client_id" id="client_id_branch" value="<?= isset($client['id']) ? $client['id'] : '' ?>"/>
<input type="hidden" name="branch_id_primarykey" id="branch_id_primarykey"/>
<div class="form-group"> <div class="form-group">
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
@ -65,7 +65,8 @@
placeholder="Enter District" name="district" required> placeholder="Enter District" name="district" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="city">City</label> <label for="city">City<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city" <input type="text" class="form-control" id="branch_city"
placeholder="Enter City" name="city" required> placeholder="Enter City" name="city" required>
</div> </div>
@ -116,17 +117,16 @@
</div> </div>
<!-- end --> <!-- end -->
<script> <script>
var branch_form_action = ''; var branch_form_action = '';
var contactCount = 1; var contactCount = 1;
var branch_PrimaryKey = $('#client_id_branch').val(); var branch_PrimaryKey = $('#client_id_for_client_branch').val();
var branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
$(document).ready(function () { $(document).ready(function () {
branch_PrimaryKey = $('#client_id_branch').val(); branch_PrimaryKey = $('#client_id_branch').val();
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
$('#add_branch').hide(); $('#add_branch').hide();
$('.btnBack').hide(); $('.btnBack').hide();
@ -200,6 +200,7 @@ $(document).ready(function () {
$('#branch_city').val(''); $('#branch_city').val('');
$('#branch_form')[0].reset(); $('#branch_form')[0].reset();
$('.ac').css('display', 'block'); $('.ac').css('display', 'block');
contactCount = 1
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || []; var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) { for (var i = 0; i < buttonIds.length; i++) {
@ -220,12 +221,13 @@ $(document).ready(function () {
$("#branch_form").submit(function(event) { $("#branch_form").submit(function(event) {
event.preventDefault();
branch_PrimaryKey = $('#client_id_branch').val(); event.preventDefault();
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val(); branch_PrimaryKey = $('#client_id_for_client_branch').val();
console.log('branch_PrimaryKey', branch_PrimaryKey)
if (branch_PrimaryKey === '' || branch_PrimaryKey_2 === '') { if (branch_PrimaryKey === '') {
toastr.error('Client is required', 'Error'); toastr.error('Client is required', 'Error');
$('#insurer').val(''); $('#insurer').val('');
$('#tpa').val(''); $('#tpa').val('');
@ -277,7 +279,6 @@ $(document).ready(function () {
`; `;
}); });
$('#branch_list').append(branchTableInsert); $('#branch_list').append(branchTableInsert);
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -290,17 +291,19 @@ $(document).ready(function () {
} }
}); });
} }
contactCount = 1
}); });
$('body').on('click', '.btnBranchEdit', function () { $('body').on('click', '.btnBranchEdit', function () {
console.log(branch_form_action); contactCount = 1
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
var branch_id = $(this).attr('data-id'); var branch_id = $(this).attr('data-id');
$('#branch_id_primarykey').val(branch_id);
branch_form_action = '<?= base_url("client/branch/edit"); ?>'; branch_form_action = '<?= base_url("client/branch/edit"); ?>';
$.ajax({ $.ajax({
url: '<?php echo base_url('client/branch/list/');?>'+branch_id, url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
@ -311,8 +314,10 @@ $(document).ready(function () {
setTimeout(function() { setTimeout(function() {
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 500);
console.log(res)
console.log('branch contact : ',res.contact)
$('#add_branch').show(); $('#add_branch').show();
$('#branch_table').hide(); $('#branch_table').hide();
$('.btnBack').show(); $('.btnBack').show();
@ -330,11 +335,14 @@ $(document).ready(function () {
$('#designation').val(res.contact[0].designation); $('#designation').val(res.contact[0].designation);
res.contact.shift(); res.contact.shift();
$.each(res.contact, function(index, contact) { console.log(res.contact.length)
for (let index = 0; index < res.contact.length; index++) {
const contact = res.contact[index];
if (contact !== undefined) { if (contact !== undefined) {
appendContactHtml(contact); appendContactHtml(contact);
} }
}); }
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {

View File

@ -105,9 +105,7 @@
$(document).on('click', '.submit', function(e) { $(document).on('click', '.submit', function(e) {
e.preventDefault(); e.preventDefault();
// kycPrimaryKey = $('#kyc_PrimaryKey').val(); kycPrimaryKey = $('#id_for_kyc_file').val();
kycPrimaryKey = $('#client_id_kyc').val();
var form = $(this).closest('form'); var form = $(this).closest('form');
var formData = new FormData(form[0]); var formData = new FormData(form[0]);

View File

@ -7,36 +7,46 @@
<div class="tab-pane fade active show" id="general-q-tab"> <div class="tab-pane fade active show" id="general-q-tab">
<div class="row" > <div class="row">
<div class="col-12"> <div class="col-xl-6">
<div class="card"> <div id="accordion1" class="mb-3">
<div class="card-body"> <div class="card mb-1">
<!-- <div class="text-center"> --> <h5 class="m-1">
<form id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post"> <a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token"> aria-expanded="true">
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
<div class="form-group"> </a>
</h5>
<div id="collapseTwo" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion1">
<div class="card-body">
<!-- <div class="text-center"> -->
<form id="emp-upload-form" action="<?php echo base_url().'employee/upload'?>" method="post">
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
id="csrf_token">
<div class="form-row"> <div class="form-group">
<div class="form-group col-md-4"> <div class="form-row">
<label>Client</label> <br />
<select name="client_id" class="form-control" id="client_id" required>
<option value="">Select</option>
</select>
</div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Policy</label> <br/> <label>Client</label> <br />
<select name="policy_id" class="form-control" id="policy_id"> <select name="client_id" class="form-control" id="client_id" required>
<option value="">Select</option> <option value="">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Event</label> <br /> <label>Policy</label> <br />
<select name="upload-action-type" class="form-control" id="upload-action-type" required> <select name="policy_id" class="form-control" id="policy_id">
<option value="">Select</option> <option value="">Select</option>
</select>
</div>
<div class="form-group col-md-4">
<label>Event</label> <br />
<select name="upload-action-type" class="form-control"
id="upload-action-type" required>
<option value="">Select</option>
<?php <?php
if(isset($actions) && count($actions)) if(isset($actions) && count($actions))
{ {
@ -46,35 +56,43 @@
} }
} }
?> ?>
</select> </select>
</div>
</div>
<hr>
<div class="form-row" id="file_upload">
<div class="form-group col-md-4">
<label>Upload file</label> &nbsp;[ <a id="excel_download" data-toggle="tooltip" data-placement="top" title="Download Sample Excel">Sample Excel</a> ]
<input type="file" name="emplist" id="emplist" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet"
required>
</div>
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
<div class="form-group col-md-11"> <!-- Adjusted the width to 11 columns -->
<div class="col-md-3">
<button id="emp_form_submit_button" type="submit" class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div> </div>
</div> </div>
<hr>
<div class="form-row" id="file_upload">
<div class="form-group col-md-4">
<label>Upload file</label> &nbsp;[ <a id="excel_download"
data-toggle="tooltip" data-placement="top"
title="Download Sample Excel">Sample Excel</a> ]
<input type="file" name="emplist" id="emplist"
accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet"
required>
</div>
<div class="d-flex align-items-center justify-content-start"
style="margin-top: 18px;">
<div class="form-group col-md-11">
<!-- Adjusted the width to 11 columns -->
<div class="col-md-3">
<button id="emp_form_submit_button" type="submit"
class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div>
</div>
</div>
</div>
</div> </div>
</form>
</div> <!-- </div> -->
</div> </div>
</div>
</form>
<!-- </div> -->
</div> </div>
</div> </div>
</div> </div>
@ -107,14 +125,13 @@
<script> <script>
$('#file_upload').hide();
$('#file_upload').hide();
// Declare a global variable to store API response data // Declare a global variable to store API response data
var clientPolicies = []; var clientPolicies = [];
$(document).ready(function() { $(document).ready(function() {
console.log("document loaded"); console.log("document loaded");
//fetchClientPolicies(); //fetchClientPolicies();
//for modal pop up //for modal pop up
@ -162,7 +179,7 @@ $(document).ready(function() {
$('#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...'
); );
// return false; // return false;
$.ajax({ $.ajax({
url: $(this).attr("action"), url: $(this).attr("action"),
@ -180,7 +197,8 @@ $(document).ready(function() {
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('File upload successs, Data validation is in-progress', toastr.success(
'File upload successs, Data validation is in-progress',
'success'); 'success');
window.location.reload(true); window.location.reload(true);
} else if (response.code === 404 && response.dataStatus === false) { } else if (response.code === 404 && response.dataStatus === false) {
@ -295,7 +313,8 @@ function fetchFileError(file_id) {
err_count + "</span>" : (err_id == 4 ? err_count + "</span>" : (err_id == 4 ?
"<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" + "<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
err_count + "</span>" : (err_id == 5 ? "<strong>" + err_count + "</span>" : (err_id == 5 ? "<strong>" +
file_error_data['error_data'] + "</strong>" : (err_id == 6 ? file_error_data['error_data'] + "</strong>" : (err_id ==
6 ?
"<strong>" + file_error_data['error_data'] + "<strong>" + file_error_data['error_data'] +
"</strong>" : "")))))); "</strong>" : ""))))));
file_error_html += '<br/>'; file_error_html += '<br/>';
@ -303,7 +322,8 @@ function fetchFileError(file_id) {
} }
if (err_id != 5 && err_id != 6) { if (err_id != 5 && err_id != 6) {
file_error_html += (file_error_html != "" ? "<a href ='<?php echo base_url()?>" + file_error_html += (file_error_html != "" ?
"<a href ='<?php echo base_url()?>" +
"employee/excel_error/" + file_id + "employee/excel_error/" + file_id +
"' target=_blank>click here to more details...</a>" : ""); "' target=_blank>click here to more details...</a>" : "");
} }
@ -412,34 +432,39 @@ function fetchEmpolyeeList(event) {
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
/**This function updates the download link based on the selected option in the dropdown menu. **/ /**This function updates the download link based on the selected option in the dropdown menu. **/
$('#upload-action-type').change(function() { $('#upload-action-type').change(function() {
var selectedValue = $(this).val(); var selectedValue = $(this).val();
if(selectedValue !== ''){ if (selectedValue !== '') {
$('#file_upload').show(); $('#file_upload').show();
var fullURL = '<?= base_url("util/download-excel/"); ?>' + selectedValue; var fullURL = '<?= base_url("util/download-excel/"); ?>' + selectedValue;
$('#excel_download').attr('href', fullURL); $('#excel_download').attr('href', fullURL);
}else{ } else {
$('#file_upload').hide(); $('#file_upload').hide();
$('#excel_download').removeAttr('href'); $('#excel_download').removeAttr('href');
} }
}); });
/** This function verifies if the download link (#excel_download) has its href attribute set, /** This function verifies if the download link (#excel_download) has its href attribute set,
** ensuring proper link configuration. **/ ** ensuring proper link configuration. **/
$('#excel_download').click(function() { $('#excel_download').click(function() {
// Check if the element with ID "excel_download" has the href attribute set // Check if the element with ID "excel_download" has the href attribute set
if (!$(this).attr('href')) { if (!$(this).attr('href')) {
// 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.');
} }
}); });
document.getElementById('toggleIcon1').addEventListener('click', function() {
var icon = document.getElementById('icon1');
icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up');
});
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
</script> </script>

View File

@ -22,7 +22,7 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="insurer_name">Insurer Name<span <label for="insurer_name">Insurer Name<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input type="text" class="form-control" id="name" <input type="text" class="form-control" id="insurer_name"
placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required> placeholder="Enter Insurer Name" value="<?= isset($insurer['name']) ? $insurer['name'] : '' ?>" name="name" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">

View File

@ -67,7 +67,8 @@
placeholder="Enter District" name="district" required> placeholder="Enter District" name="district" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="city">City</label> <label for="city">City<span
class="text-danger">*</span></label>
<input type="text" class="form-control" id="branch_city" <input type="text" class="form-control" id="branch_city"
placeholder="Enter City" name="city" required> placeholder="Enter City" name="city" required>
</div> </div>
@ -123,99 +124,101 @@
<script> <script>
var contactCount = 1; var contactCount = 1;
var insurer_branch_form_action = '';
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
$(document).ready(function () { $(document).ready(function () {
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
var insurer_branch_form_action = '';
$('#add_branch').hide();
$('.btnBack').hide();
loadBranchList();
$('#btnBranchAdd').click(function(){
insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
contactCount = 1
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
// Find the element by its ID
var elementToRemove = document.getElementById(firstElement);
console.log(elementToRemove);
if (elementToRemove) {
console.log(elementToRemove);
elementToRemove.parentNode.removeChild(elementToRemove);
}
localStorage.removeItem('buttonIds')
}
})
$('.btnBack').click(function(){
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
$('#add_branch').hide(); $('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide(); $('.btnBack').hide();
$('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val(''); $('#btnBranchAdd').click(function(){
$('#mobile').val('');
$('#designation').val(''); insurer_branch_form_action = '<?= base_url("master/insurer/branch/create"); ?>';
$('#add_branch').show();
$('#branch_table').hide();
$('.btnBack').show();
$('#btnBranchAdd').hide();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
}) contactCount = 1
if(insurer_Branch_PrimaryKey !== ''){ var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
for (var i = 0; i < buttonIds.length; i++) {
var firstElement = buttonIds[i].split('_')[0];
console.log(firstElement);
var branchTable = ''; // Find the element by its ID
var data = <?= isset($insurer_branch) ? json_encode($insurer_branch) : '[]' ?>; var elementToRemove = document.getElementById(firstElement);
$.each(data, function(index, item) { console.log(elementToRemove);
branchTable += `
<tr> if (elementToRemove) {
<td>${item.branch_name}</td> console.log(elementToRemove);
<td>${item.branch_code}</td> elementToRemove.parentNode.removeChild(elementToRemove);
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td> }
</tr> localStorage.removeItem('buttonIds')
`; }
}); })
$('#insurer_branch_list').append(branchTable);
} $('.btnBack').click(function(){
$('#add_branch').hide();
$('#branch_table').show();
$('.btnBack').hide();
$('#btnBranchAdd').show();
$('#branch_name').val('');
$('#branch_code').val('');
$('#state').val('');
$('#district').val('');
$('#branch_city').val('');
$('#name').val('');
$('#email').val('');
$('#mobile').val('');
$('#designation').val('');
})
if(insurer_Branch_PrimaryKey !== ''){
var branchTable = '';
var data = <?= isset($insuer_branch) ? json_encode($insuer_branch) : '[]' ?>;
$.each(data, function(index, item) {
branchTable += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td><a class="btnBranchEdit" data-id="${item.id}" href="#"><i data-id="${item.id}" class="mdi mdi-lead-pencil btnBranchEdit" style="font-size:18px;"></i></a></td>
</tr>
`;
});
$('#insurer_branch_list').append(branchTable);
}
});
$("#insurer_branch_form").submit(function(events) { $("#insurer_branch_form").submit(function(events) {
console.log(1, insurer_branch_form_action);
events.preventDefault(); events.preventDefault();
var isValid = $('#insurer_branch_form').parsley().validate(); var isValid = $('#insurer_branch_form').parsley().validate();
if (isValid) { if (isValid) {
@ -237,7 +240,7 @@ $(document).ready(function () {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
console.log(res); console.log(res);
// $('#insurer_branch_list tr').remove(); $('#insurer_branch_list tr').remove();
var insurerBranchTableInsert = '' var insurerBranchTableInsert = ''
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
insurerBranchTableInsert += ` insurerBranchTableInsert += `
@ -270,17 +273,22 @@ $(document).ready(function () {
}); });
} }
}); });
$('body').on('click', '.btnBranchEdit', function () { $('body').on('click', '.btnBranchEdit', function () {
$('#container').html(""); $('#container').html("");
contactCount =1; contactCount =1;
var branch_id = $(this).attr('data-id'); var branch_id = $(this).attr('data-id');
$('#insurer_Branch_PrimaryKey').val(branch_id);
insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>'; insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>';
console.log(insurer_branch_form_action)
$('.loader').fadeIn(); $('.loader').fadeIn();
$('.loader-mask').fadeIn(); $('.loader-mask').fadeIn();
$.ajax({ $.ajax({
url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id, url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id,
type: "GET", type: "GET",
@ -300,7 +308,6 @@ $(document).ready(function () {
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true); $('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
$('#district').val(res.insurerbranch.district); $('#district').val(res.insurerbranch.district);
$('#branch_city').val(res.insurerbranch.city); $('#branch_city').val(res.insurerbranch.city);
$('#insurer_Branch_PrimaryKey').val(res.insurerbranch.id);
$('#contact_id_1').val(res.levelcontact[0].id); $('#contact_id_1').val(res.levelcontact[0].id);
$('.form-row').find('#name').val(res.levelcontact[0].name); $('.form-row').find('#name').val(res.levelcontact[0].name);
@ -330,185 +337,129 @@ $(document).ready(function () {
}); });
$('body').on('click', '#btnSubmit', function(){
$('#insurer_branch_list').html(" ");
loadBranchList();
})
function loadBranchList()
{
var base_url = '<?= base_url("master/insurer/branch/list/"); ?>';
var insurer_branch_action = base_url + insurer_Branch_PrimaryKey; function appendContactHtml(contact = false, reset = false) {
if ($('#insurer_id_branch').val() != '') {
$('.loader').fadeIn(); console.log('appendContactHtml function called ')
$('.loader-mask').fadeIn(); contactCount++;
$.ajax({
url: insurer_branch_action,
type: 'GET',
success: function(response) {
setTimeout(function() {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}, 1000);
var branchTable = '';
$.each(response.insuer_branch, function(index, item) {
branchTable += `
<tr>
<td>${item.branch_name}</td>
<td>${item.branch_code}</td>
<td><a class="mdi mdi-lead-pencil btnBranchEdit" href="#" data-id="${item.id}" style="font-size:18px;"></a></td>
</tr>
`;
});
$('#insurer_branch_list').html(branchTable);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
setTimeout(function() { var container = document.getElementById('container');
$('.loader').fadeOut(); var uniqueId = Date.now().toString();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.warning('Something Wrong!', 'warning'); var html = `
}, 1000); <div id="${uniqueId}">
<hr>
<h6 class="header-title">Contact ${contactCount}</h6>
<br>
<div class="form-row">
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
<div class="form-group col-md-6">
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
</div>
</div>
`;
if(reset == false){
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (contactCount >= 3) {
hideStoredAddButtons();
}
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'block';
} }
});
}
}
});
function appendContactHtml(contact = false, reset = false) {
console.log('appendContactHtml function called ')
contactCount++;
var container = document.getElementById('container');
var uniqueId = Date.now().toString();
var html = `
<div id="${uniqueId}">
<hr>
<h6 class="header-title">Contact ${contactCount}</h6>
<br>
<div class="form-row">
<input type="hidden" name="primarykey[]" id="contact_id_1" value="${contact !== undefined && contact !== false ? contact.id : ''}"/>
<div class="form-group col-md-6">
<label for="${uniqueId}_first_name">Name<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.name : ''}" type="text" class="form-control" placeholder="Enter Contact Name" name="name[]" id="${uniqueId}_name" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_last_name">Email<span class="text-danger">*</span></label>
<input data-parsley-type="email" value="${contact !== undefined && contact !== false ? contact.email : ''}" type="email" class="form-control" placeholder="Enter Contact Email" name="email[]" id="${uniqueId}_email" required>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="${uniqueId}_mobile">Mobile<span class="text-danger">*</span></label>
<input data-parsley-type="number" data-parsley-length="[10,10]" pattern="[0-9]{10}" value="${contact !== undefined && contact !== false ? contact.mobile : ''}" type="tel" class="form-control" placeholder="Enter Contact Mobile" name="mobile[]" id="${uniqueId}_mobile" required>
</div>
<div class="form-group col-md-6">
<label for="${uniqueId}_designation">Designation<span class="text-danger">*</span></label>
<input value="${contact !== undefined && contact !== false ? contact.designation : ''}" type="text" class="form-control" placeholder="Enter Designation Name" name="designation[]" id="${uniqueId}_designation" required>
</div>
</div>
<div class="form-group" style="display: flex;">
<button style="margin-right: 10px;" type="button" class="btn btn-primary btn-sm ac" onclick="appendContactHtml()" id="${uniqueId}_add">Add Contact</button>
<button type="button" class="btn btn-danger btn-sm" onclick="removeContact(this)" id="${uniqueId}_remove">Remove</button>
</div>
</div>
`;
if(reset == false){
container.insertAdjacentHTML('beforeend', html);
storeButtonId(uniqueId + '_add');
if (contactCount >= 3) {
hideStoredAddButtons();
}
}
}
function removeContact(button) {
var uniqueId = button.id.split("_")[0];
var contactSection = document.getElementById(uniqueId);
if (contactSection) {
contactSection.parentNode.removeChild(contactSection);
contactCount --;
if (contactCount < 3) {
var addButton = document.querySelector('.ac');
if (addButton) {
addButton.style.display = 'block';
} }
} }
} }
}
function storeButtonId(id) { function storeButtonId(id) {
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || []; var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
buttonIds.push(id); buttonIds.push(id);
localStorage.setItem('buttonIds', JSON.stringify(buttonIds)); localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
} }
function hideStoredAddButtons() { function hideStoredAddButtons() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || []; var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
storedIds.forEach(function(id) { storedIds.forEach(function(id) {
var addButton = document.getElementById(id);
var first_addButton = document.querySelector('.ac')
if (addButton) {
addButton.style.display = 'none';
first_addButton.style.display = 'none';
}
});
}
function showNextAddButton() {
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;
// Iterate through the stored IDs to find the next "Add" button to show
storedIds.forEach(function(id) {
if (!addButtonShown) {
var addButton = document.getElementById(id); var addButton = document.getElementById(id);
if (addButton && addButton.style.display === 'none') { var first_addButton = document.querySelector('.ac')
addButton.style.display = 'block'; if (addButton) {
addButtonShown = true; // Set to true once an "Add" button is shown addButton.style.display = 'none';
first_addButton.style.display = 'none';
} }
} });
}); }
}
function validateForm() { function showNextAddButton() {
var isValid = true; var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
var addButtonShown = false;
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) { // Iterate through the stored IDs to find the next "Add" button to show
if ($.trim($(this).val()) == '') { storedIds.forEach(function(id) {
isValid = false; if (!addButtonShown) {
return false; var addButton = document.getElementById(id);
if (addButton && addButton.style.display === 'none') {
addButton.style.display = 'block';
addButtonShown = true; // Set to true once an "Add" button is shown
}
} }
} });
}
}); function validateForm() {
var isValid = true;
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
return isValid; if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) {
} if ($.trim($(this).val()) == '') {
isValid = false;
return false;
}
}
});
return isValid;
}
</script> </script>

View File

@ -1,111 +1,135 @@
<div class="tab-pane fade" id="KYC-DOC-tab"> <div class="tab-pane fade" id="KYC-DOC-tab">
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-xl-6">
<div class="card"> <div id="accordion" class="mb-3">
<div class="card-body"> <div class="card mb-1">
<!-- <div class="text-center"> --> <h5 class="m-1">
<form class="parsley-examples" id="import_export_excel_form" action = "<?php echo base_url().'util/import-export'?>" method="post" <a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
enctype="multipart/form-data"> <i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
<input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>" id="csrf_token"> </a>
<div class="form-group"> </h5>
<div class="form-row"> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="form-group col-md-4"> <div class="card-body">
<label>Client</label> <br /> <!-- <div class="text-center"> -->
<select name="client_id" class="form-control" id="client" required> <form class="parsley-examples" id="import_export_excel_form"
<option value="">Select</option> action="<?php echo base_url().'util/import-export'?>" method="post"
</select> enctype="multipart/form-data">
</div> <input type="hidden" name="<?= csrf_token() ?>" value="<?= csrf_hash() ?>"
id="csrf_token">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-4">
<label>Client</label> <br />
<select name="client_id" class="form-control" id="client" required>
<option value="">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="client_policy_id" class="form-control" id="policy" required> <select name="client_policy_id" class="form-control" id="policy" required>
<option value="">Select</option> <option value="">Select</option>
</select> </select>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label>Insurer/TPA Data</label> <br /> <label>Insurer/TPA Data</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"
<option value="">Select</option> required>
<?php <option value="">Select</option>
if(isset($insurer_or_tpa) && count($insurer_or_tpa)) <?php
if(isset($insurer_or_tpa) && count($insurer_or_tpa))
{
foreach($insurer_or_tpa as $key => $action)
{
echo "<option value=".$key.">".$action."</option>";
}
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label>Action</label> <br />
<select name="action_type" class="form-control" id="action_type" required>
<option value="">Select</option>
<?php
if(isset($import_or_export) && count($import_or_export))
{
foreach($import_or_export as $key => $action)
{
echo "<option value=".$key.">".$action."</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-4">
<label>Event</label> <br />
<select name="event_type" class="form-control" id="upload-action-type"
required>
<option value="">Select</option>
<?php
if(isset($events) && count($events))
{ {
foreach($insurer_or_tpa as $key => $action) foreach($events as $key => $action)
{ {
echo "<option value=".$key.">".$action."</option>"; echo "<option value=".$key.">".$action."</option>";
} }
} }
?> ?>
</select> </select>
</div> </div>
</div>
<div class="form-row"> </div>
<div class="form-group col-md-4"> <br>
<label>Action</label> <br />
<select name="action_type" class="form-control" id="action_type" required>
<option value="">Select</option>
<?php
if(isset($import_or_export) && count($import_or_export))
{
foreach($import_or_export as $key => $action)
{
echo "<option value=".$key.">".$action."</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-4"> <div class="form-row" id="import_excel_btn">
<label>Event</label> <br /> <div class="form-group col-md-3">
<select name="event_type" class="form-control" id="upload-action-type" required> <label>Upload file</label>
<option value="">Select</option> <input type="file" name="import_file_data" id="import_file"
<?php accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet"
if(isset($events) && count($events)) required>
{ </div>
foreach($events as $key => $action) <div class="d-flex align-items-center justify-content-start"
{ style="margin-top: 18px;">
echo "<option value=".$key.">".$action."</option>"; <div class="form-group col-md-3">
} <button id="emp_form_submit_button" type="submit"
} class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
?> </div>
</select> </div>
</div> </div>
</div> <div class="form-row" id="export_excel_btn">
<div class="d-flex align-items-center justify-content-start"
<br> style="margin-top: 18px;">
<div class="form-group col-md-3">
<div class="form-row" id="import_excel_btn"> <button id="emp_form_submit_button_2" type="submit"
<div class="form-group col-md-3"> class="btn btn-primary waves-effect waves-light justify-content-end">Download</button>
<label>Upload file</label> </div>
<input type="file" name="import_file_data" id="import_file" accept=" application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel,application/vnd.oasis.opendocument.spreadsheet" required> </div>
</div>
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
<div class="form-group col-md-3">
<button id="emp_form_submit_button" type="submit"
class="btn btn-primary waves-effect waves-light justify-content-end">Upload</button>
</div> </div>
</div> </div>
</div> </form>
<div class="form-row" id="export_excel_btn">
<div class="d-flex align-items-center justify-content-start" style="margin-top: 18px;">
<div class="form-group col-md-3">
<button id="emp_form_submit_button_2" type="submit"
class="btn btn-primary waves-effect waves-light justify-content-end">Download</button>
</div>
</div>
</div>
</div> </div>
</form> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- end page title -->
<div class="row" id="file_list">
<?php include('batch_list.php');?>
</div>
<!-- end row -->
</div> </div>
@ -116,11 +140,11 @@ var clientPolicies = [];
$(document).ready(function() { $(document).ready(function() {
<?php if (session()->has('error')): ?> <?php if (session()->has('error')): ?>
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed'); toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
<?php endif; ?> <?php endif; ?>
<?php if (session()->has('success')): ?> <?php if (session()->has('success')): ?>
toastr.success('<?= session()->getFlashdata('success') ?>', 'success'); toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
<?php endif; ?> <?php endif; ?>
$('#import_excel_btn').hide(); $('#import_excel_btn').hide();
@ -165,7 +189,7 @@ $(document).ready(function() {
$('.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.success('File Download successs', 'success'); toastr.success('File Download successs', 'success');
} else if (response.code === 404 && response.status === false) { } else if (response.code === 404 && response.status === false) {
console.error('no data found', response); console.error('no data found', response);
@ -330,5 +354,12 @@ $('#action_type').change(function() {
} }
}); });
document.getElementById('toggleIcon').addEventListener('click', function() {
var icon = document.getElementById('icon');
icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up');
});
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
</script> </script>

View File

@ -37,7 +37,7 @@
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label for="insurer_id">Insurer<span class="text-danger">*</span></label> <label for="insurer_id">Insurer<span class="text-danger">*</span></label>
<select class="form-control" id="insurer_id" name="insurer_id" required> <select class="form-control" id="insurer_id" name="insurer_id" required>
<option value="0">Select Insurer</option> <option value="">Select Insurer</option>
<?php if (!empty($insurer)) { foreach ($insurer as $insurer) : ?> <?php if (!empty($insurer)) { foreach ($insurer as $insurer) : ?>
<option value="<?= $insurer['id'] ?>"><?= $insurer['name'] ?></option> <option value="<?= $insurer['id'] ?>"><?= $insurer['name'] ?></option>
<?php endforeach; } ?> <?php endforeach; } ?>
@ -181,7 +181,7 @@ $(document).ready(function () {
if(policy_type_PrimaryKey !== ''){ if(policy_type_PrimaryKey !== ''){
var branchTable = ''; var branchTable = '';
var data = <?= isset($tpa_branch) ? json_encode($tpa_branch) : '[]' ?>; var data = <?= isset($policies) ? json_encode($policies) : '[]' ?>;
$.each(data, function(index, item) { $.each(data, function(index, item) {
branchTable += ` branchTable += `
<tr> <tr>
@ -200,7 +200,6 @@ $(document).ready(function () {
var isValid = $('#tpa_branch_form').parsley().validate(); var isValid = $('#tpa_branch_form').parsley().validate();
if (isValid) { if (isValid) {
var formData = new FormData($('#tpa_branch_form')[0]); var formData = new FormData($('#tpa_branch_form')[0]);
@ -219,7 +218,7 @@ $(document).ready(function () {
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
}, 1000); }, 1000);
// console.log(res); // console.log(res);
// $('#policies_list tr').remove();s // $('#policies_list tr').remove();
var tpaBranchTableInsert = '' var tpaBranchTableInsert = ''
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
tpaBranchTableInsert += ` tpaBranchTableInsert += `

View File

@ -12,7 +12,7 @@
<label for="kyc_name">Policy Type Name<span <label for="kyc_name">Policy Type Name<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input type="text" class="form-control" id="policy_type" <input type="text" class="form-control" id="policy_type"
placeholder="Enter Kyc Entity Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required> placeholder="Enter Policy Type Name" value="<?= isset($policytype['policy_type']) ? $policytype['policy_type'] : '' ?>" name="policy_type" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="bap">Bap<span <label for="bap">Bap<span
@ -24,7 +24,7 @@
<label for="allocg">Allocg<span <label for="allocg">Allocg<span
class="text-danger">*</span></label> class="text-danger">*</span></label>
<input type="text" class="form-control" id="allocg" <input type="text" class="form-control" id="allocg"
placeholder="Enter Short Name" value="<?= isset($policytype['allocg']) ? $policytype['allocg'] : '' ?>" name="allocg" required> placeholder="Enter Allocg" value="<?= isset($policytype['allocg']) ? $policytype['allocg'] : '' ?>" name="allocg" required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="alloci">Alloci<span <label for="alloci">Alloci<span

View File

@ -17,7 +17,7 @@
<th class="font-weight-medium">Policy Type</th> <th class="font-weight-medium">Policy Type</th>
<th class="font-weight-medium">Bap</th> <th class="font-weight-medium">Bap</th>
<th class="font-weight-medium">Allocg</th> <th class="font-weight-medium">Allocg</th>
<th class="font-weight-medium">alloci</th> <th class="font-weight-medium">Alloci</th>
<th class="font-weight-medium">Action</th> <th class="font-weight-medium">Action</th>
</tr> </tr>
</thead> </thead>