FIX_MASTER_BRANCH_ISSUE_RESOLVED : RV
This commit is contained in:
parent
2e79864c40
commit
934823b6de
@ -230,7 +230,8 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$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['created_by'] = get_session_userid();
|
||||
$data['client_logo'] = $file_name;
|
||||
@ -248,7 +249,8 @@ class ClientController extends AdminController
|
||||
public function editClientGeneralInfo()
|
||||
{
|
||||
$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');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
@ -268,7 +270,8 @@ class ClientController extends AdminController
|
||||
$this->myLogger->logme('error','create Client kyc function called');
|
||||
$data = $this->request->getPost();
|
||||
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)){
|
||||
$data['file_name'] = $File;
|
||||
}
|
||||
@ -288,7 +291,8 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$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)){
|
||||
$data['file_name'] = $File;
|
||||
}
|
||||
@ -452,7 +456,7 @@ class ClientController extends AdminController
|
||||
{
|
||||
|
||||
$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');
|
||||
$data = $this->request->getPost();
|
||||
$data['updated_by'] = get_session_userid();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -191,7 +191,7 @@ class EmployeeController extends AdminController
|
||||
}
|
||||
|
||||
$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['insurer_or_tpa'] = ['insurer' => 'Insurer','tpa' =>'TPA'];
|
||||
$data['fileList'] = $this->fileModel
|
||||
@ -200,6 +200,14 @@ class EmployeeController extends AdminController
|
||||
->join('policies pm','files.policy_id = pm.id')
|
||||
->join('clients c','files.client_id = c.id')
|
||||
->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();
|
||||
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)
|
||||
{
|
||||
// $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()
|
||||
{
|
||||
|
||||
@ -279,16 +307,18 @@ class EmployeeController extends AdminController
|
||||
'file_name' => $file_name,
|
||||
];
|
||||
|
||||
// $event_type = 'si_enhancement';
|
||||
|
||||
if($actions == 'export'){
|
||||
|
||||
if($event_type == 'inception'){
|
||||
if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition' ){
|
||||
|
||||
$return = $empDataServiceController->generateExcelForAdditionandInception($batch_data);
|
||||
if(!$return){
|
||||
session()->setFlashdata('error', 'No data found about this action');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} 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'){
|
||||
@ -325,379 +355,72 @@ class EmployeeController extends AdminController
|
||||
|
||||
}else if($actions == 'import'){
|
||||
|
||||
if($event_type == 'inception'){
|
||||
$batch_data['file'] = $this->request->getFile('import_file_data');
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
if($event_type == 'inception' || $event_type == 'addition' || $event_type == 'dependent_addition'){
|
||||
|
||||
$this->myLogger->logme('error','Inception Import file name : {data}', ['data'=> $filename ]);
|
||||
$random_number_count = 4;
|
||||
$batch_code = generate_random_string($random_number_count);
|
||||
|
||||
$this->myLogger->logme('error','Inception Import BATCH CODE : {data}', ['data'=> $batch_code ]);
|
||||
$return = $empDataServiceController->importExcelDataForInception($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$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', 2)->first();
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$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'];
|
||||
|
||||
//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'));
|
||||
}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();
|
||||
// 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'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$return = $empDataServiceController->importExcelDataForCorrection($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$this->myLogger->logme('error','Correction Import file name : {data}', ['data'=> $filename ]);
|
||||
$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))
|
||||
{
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
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'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$return = $empDataServiceController->importExcelDataForSIEnhancement($batch_data);
|
||||
if($return == 1){
|
||||
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 ]);
|
||||
$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))
|
||||
{
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
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'){
|
||||
|
||||
$file = $this->request->getFile('import_file_data');
|
||||
$is_moved = $file->move(WRITEPATH . 'uploads/import_excel');
|
||||
$filename = $file->getName();
|
||||
$return = $empDataServiceController->importExcelDataForDeletion($batch_data);
|
||||
if($return == 1){
|
||||
session()->setFlashdata('success', 'Data updated successfully');
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
|
||||
$this->myLogger->logme('error','Deletion Import file name : {data}', ['data'=> $filename ]);
|
||||
$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))
|
||||
{
|
||||
}else if($return == 2){
|
||||
session()->setFlashdata('error', 'File not found');
|
||||
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'));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Edit Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Edit Insurer Onboarding';
|
||||
$headerData['page_name'] = 'Edit Insurer Master';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
@ -122,7 +122,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$this->myLogger->logme('error','Insurer Onboarding function called');
|
||||
$headerData['page_name'] = 'Insurer Onboarding';
|
||||
$headerData['page_name'] = 'Insurer Master';
|
||||
|
||||
$types = array(
|
||||
(object) array('id' => 'pvt', 'name' => 'PVT'),
|
||||
@ -228,12 +228,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit TPA Onboarding function called');
|
||||
@ -248,10 +242,6 @@ class MasterController extends AdminController
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editInsurerBranch()
|
||||
{
|
||||
$this->myLogger->logme('error','Insurer branch CREATE function called');
|
||||
@ -259,11 +249,6 @@ class MasterController extends AdminController
|
||||
$data = $this->request->getPost();
|
||||
$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){
|
||||
$contactsToDelete = $this->levelContactModel->where(['ref_id' => $id,'contact_type' => 'insurer', 'is_active' => 1])->get()->getResult();
|
||||
foreach ($contactsToDelete as $contact) {
|
||||
@ -285,10 +270,10 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
if($update){
|
||||
$branchData = $this->tpaBranchModel->where('tpa_id', $this->request->getPost('tpa_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData));
|
||||
$branchData = $this->insurerBranchModel->where('insurer_id', $this->request->getPost('insurer_id'))->findAll();
|
||||
echo json_encode(array("status" => true , 'data' => $branchData, 'edit'));
|
||||
}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');
|
||||
$headerData['page_name'] = 'TPA Onboarding';
|
||||
$headerData['page_name'] = 'TPA Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -408,7 +393,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$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_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');
|
||||
$headerData['page_name'] = 'KYC Onboarding';
|
||||
$headerData['page_name'] = 'KYC Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -610,7 +595,7 @@ class MasterController extends AdminController
|
||||
{
|
||||
|
||||
$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_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');
|
||||
$headerData['page_name'] = 'Policy Type Onboarding';
|
||||
$headerData['page_name'] = 'Policy Type Master';
|
||||
|
||||
|
||||
// print_r($data['types']);die();
|
||||
@ -776,13 +761,11 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyTypeOnboarding($id = null)
|
||||
{
|
||||
|
||||
$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['policies'] = $this->policesModel->where(['policy_type_id' => $id, 'is_active' => 1])->findAll();
|
||||
@ -794,9 +777,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicyType()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
@ -812,15 +792,13 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function policesList($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
|
||||
// $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();
|
||||
|
||||
foreach ($policies as $policy) {
|
||||
@ -848,9 +826,7 @@ class MasterController extends AdminController
|
||||
public function editPoliciesGet($id = null)
|
||||
{
|
||||
$this->myLogger->logme('error','Edit Policies Onboarding function called');
|
||||
|
||||
$editData['policies'] = $this->policesModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
|
||||
// Return JSON response
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($editData);
|
||||
@ -858,8 +834,6 @@ class MasterController extends AdminController
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function editPolicies()
|
||||
{
|
||||
$this->myLogger->logme('error','edit Policy general info function called');
|
||||
@ -868,7 +842,8 @@ class MasterController extends AdminController
|
||||
$data['updated_by'] = get_session_userid();
|
||||
$update = $this->policesModel->update($id,$data);
|
||||
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{
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
|
||||
@ -87,7 +87,9 @@ if (!function_exists('generate_excel')) {
|
||||
|
||||
try {
|
||||
// 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
|
||||
} catch (\Exception $e) {
|
||||
// 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')) {
|
||||
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';
|
||||
}else if($event_type == 'si_enhancement'){
|
||||
$evenTypeLabel = 'SI';
|
||||
}else if($event_type == 'addition'){
|
||||
$evenTypeLabel = 'A';
|
||||
}else if($event_type == 'dependent_addition'){
|
||||
$evenTypeLabel = 'DA';
|
||||
}
|
||||
|
||||
$insurer_or_tpa_lable = "";
|
||||
@ -385,3 +389,12 @@ if (! function_exists('generate_filename')) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -44,37 +44,29 @@ if (!function_exists('change_date_format')) {
|
||||
}
|
||||
|
||||
if (!function_exists('file_Upload')) {
|
||||
function file_Upload($fileToUpload, $imageDetails = null)
|
||||
function file_Upload($fileToUpload, $filepath)
|
||||
{
|
||||
// Retrieve the name of the file
|
||||
$fileName = $fileToUpload->getName();
|
||||
|
||||
// Check if the file is not null and has a name
|
||||
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);
|
||||
}
|
||||
if ($fileToUpload !== null && $fileToUpload->isValid() && !$fileToUpload->hasMoved()) {
|
||||
$fileName = $fileToUpload->getName();
|
||||
$fileToUpload->move($filepath, $fileName);
|
||||
return $fileName;
|
||||
} else {
|
||||
// Set fileName to empty string if file is null or doesn't have a name
|
||||
$fileName = "";
|
||||
return "";
|
||||
}
|
||||
|
||||
// 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')) {
|
||||
function compressImage($file, $destinationPath, $newWidth = 100, $newHeight = 100)
|
||||
{
|
||||
|
||||
@ -22,4 +22,38 @@ class BatchFileModel extends Model
|
||||
"updated_by",
|
||||
"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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,9 +33,41 @@ class EmployeeModel extends Model
|
||||
"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)
|
||||
{
|
||||
|
||||
|
||||
@ -33,7 +33,40 @@ class EmployeePolicyModel extends Model
|
||||
"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)
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
|
||||
public function getInceptionEmployeeDataForExportExcel($client_policy_id, $insurer_or_tpa, $event_type)
|
||||
{
|
||||
return $this->db->table('employee_polices')
|
||||
->select('employees.name AS emp_name,
|
||||
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,
|
||||
public function getInceptionEmployeeDataForExportExcel($ref_data)
|
||||
{
|
||||
$client_policy_id = $ref_data['client_policy_id'];
|
||||
$insurer_or_tpa = $ref_data['insurer_or_tpa'];
|
||||
|
||||
employee_polices.id as primaryKey,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.date_coverage,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.days,
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum,
|
||||
employee_polices.gst,
|
||||
(employee_polices.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')
|
||||
->join('employees', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->join("(
|
||||
$sql = "
|
||||
SELECT
|
||||
employees.name AS emp_name,
|
||||
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,
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.date_coverage,
|
||||
employee_polices.policy_end_date,
|
||||
employee_polices.days,
|
||||
employee_polices.premium,
|
||||
employee_polices.rata_premimum,
|
||||
employee_polices.gst,
|
||||
(employee_polices.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
|
||||
batch_list.emp_policy_id,
|
||||
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
|
||||
WHERE batch_files.event_type = 'inception'
|
||||
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')
|
||||
->where('batch_data.bf', null)
|
||||
->where('batch_data.bl', null)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->get()
|
||||
->getResult();
|
||||
AND batch_files.insurer_or_tpa = '{$insurer_or_tpa}'
|
||||
) as batch_data ON employee_polices.id = batch_data.emp_policy_id
|
||||
WHERE batch_data.bf IS NULL
|
||||
AND batch_data.bl IS NULL
|
||||
AND employee_polices.client_policy_id = '{$client_policy_id}'
|
||||
AND (employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = '')
|
||||
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 = "
|
||||
SELECT DISTINCT
|
||||
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("
|
||||
SELECT
|
||||
@ -177,7 +230,7 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.pre_existing_alignments,
|
||||
employee_polices.policy_end_date,
|
||||
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.bl AS batch_list_batch_code,
|
||||
batch_data.bf AS batch_files_batch_code,
|
||||
@ -185,10 +238,10 @@ class EmployeePolicyModel extends Model
|
||||
sidata.new_si_premium,
|
||||
sidata.date_of_coverage,
|
||||
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,
|
||||
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.premium) * (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 AS difference_premium,
|
||||
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.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.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
|
||||
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("
|
||||
SELECT
|
||||
@ -278,7 +336,7 @@ class EmployeePolicyModel extends Model
|
||||
employee_polices.basic_cover_si,
|
||||
employee_polices.uhid as risk_id,
|
||||
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.bl AS batch_list_batch_code,
|
||||
@ -291,9 +349,9 @@ class EmployeePolicyModel extends Model
|
||||
deletiondata.status,
|
||||
|
||||
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.premium * 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, 2) AS pro_rata_premium,
|
||||
ROUND(((employee_polices.rata_premimum * 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) + (((employee_polices.rata_premimum * DATEDIFF(employee_polices.policy_end_date, deletiondata.dateofexit)) / 365) * 0.18), 2) AS total
|
||||
FROM
|
||||
emp_endorsement a
|
||||
LEFT JOIN
|
||||
@ -330,12 +388,12 @@ class EmployeePolicyModel extends Model
|
||||
WHERE
|
||||
batch_files.event_type = 'deletion'
|
||||
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
|
||||
WHERE
|
||||
batch_data.bf 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 (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')
|
||||
// ->join('employees', 'employees.id = employee_polices.employee_id')
|
||||
// ->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
|
||||
$query = "
|
||||
UPDATE employee_polices
|
||||
JOIN employees ON employees.id = employee_polices.employee_id
|
||||
SET employee_polices.tpa_id = '{$tpa_id}',
|
||||
employee_polices.uhid = '{$uhid}'
|
||||
WHERE employees.emp_code = '{$emp_code}'
|
||||
AND employees.name = '{$name}'
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
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 = "
|
||||
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 = "
|
||||
UPDATE emp_endorsement
|
||||
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){
|
||||
|
||||
$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)
|
||||
public function fetchEmpEndorsementData($fetch_data)
|
||||
{
|
||||
$client_policy_id = $fetch_data['client_policy_id'];
|
||||
$emp_name = $fetch_data['name'];
|
||||
$emp_code = $fetch_data['emp_code'];
|
||||
|
||||
// Your raw SQL query
|
||||
$sql = "
|
||||
SELECT
|
||||
|
||||
47
app/Views/batch_list.php
Normal file
47
app/Views/batch_list.php
Normal 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 -->
|
||||
@ -107,7 +107,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="gst">Logo</label>
|
||||
<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 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"/>
|
||||
@ -198,7 +198,7 @@ $(document).ready(function () {
|
||||
$('#client_id_relation').val(res.data.id);
|
||||
$('#relation_PrimaryKey').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);
|
||||
$('#policy_PrimaryKey').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">
|
||||
<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" 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>
|
||||
<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>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<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;">
|
||||
<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>
|
||||
@ -31,8 +31,8 @@
|
||||
<form role="form" class="parsley-examples" method="post" id="branch_form"
|
||||
enctype="multipart/form-data">
|
||||
<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="branch_id_primarykey" id="branch_id_primarykey"/>
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-6">
|
||||
@ -65,7 +65,8 @@
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<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"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
@ -116,17 +117,16 @@
|
||||
</div>
|
||||
<!-- end -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var branch_form_action = '';
|
||||
var contactCount = 1;
|
||||
var branch_PrimaryKey = $('#client_id_branch').val();
|
||||
var branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
var branch_PrimaryKey = $('#client_id_for_client_branch').val();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
|
||||
$('#add_branch').hide();
|
||||
$('.btnBack').hide();
|
||||
@ -200,6 +200,7 @@ $(document).ready(function () {
|
||||
$('#branch_city').val('');
|
||||
$('#branch_form')[0].reset();
|
||||
$('.ac').css('display', 'block');
|
||||
contactCount = 1
|
||||
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
for (var i = 0; i < buttonIds.length; i++) {
|
||||
@ -220,12 +221,13 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
$("#branch_form").submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
branch_PrimaryKey = $('#client_id_branch').val();
|
||||
branch_PrimaryKey_2 = $('#branch_PrimaryKey').val();
|
||||
event.preventDefault();
|
||||
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');
|
||||
$('#insurer').val('');
|
||||
$('#tpa').val('');
|
||||
@ -277,7 +279,6 @@ $(document).ready(function () {
|
||||
`;
|
||||
});
|
||||
$('#branch_list').append(branchTableInsert);
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -290,17 +291,19 @@ $(document).ready(function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
contactCount = 1
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
|
||||
console.log(branch_form_action);
|
||||
|
||||
contactCount = 1
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#branch_id_primarykey').val(branch_id);
|
||||
|
||||
branch_form_action = '<?= base_url("client/branch/edit"); ?>';
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('client/branch/list/');?>'+branch_id,
|
||||
@ -311,8 +314,10 @@ $(document).ready(function () {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res)
|
||||
}, 500);
|
||||
|
||||
console.log('branch contact : ',res.contact)
|
||||
|
||||
$('#add_branch').show();
|
||||
$('#branch_table').hide();
|
||||
$('.btnBack').show();
|
||||
@ -330,11 +335,14 @@ $(document).ready(function () {
|
||||
$('#designation').val(res.contact[0].designation);
|
||||
|
||||
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) {
|
||||
appendContactHtml(contact);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
|
||||
@ -105,9 +105,7 @@
|
||||
$(document).on('click', '.submit', function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
// kycPrimaryKey = $('#kyc_PrimaryKey').val();
|
||||
kycPrimaryKey = $('#client_id_kyc').val();
|
||||
|
||||
kycPrimaryKey = $('#id_for_kyc_file').val();
|
||||
|
||||
var form = $(this).closest('form');
|
||||
var formData = new FormData(form[0]);
|
||||
|
||||
@ -7,36 +7,46 @@
|
||||
|
||||
|
||||
<div class="tab-pane fade active show" id="general-q-tab">
|
||||
<div class="row" >
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<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-group">
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div id="accordion1" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon1" class="text-dark float-right" data-toggle="collapse" href="#collapseTwo"
|
||||
aria-expanded="true">
|
||||
<i id="icon1" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</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">
|
||||
<label>Client</label> <br />
|
||||
<select name="client_id" class="form-control" id="client_id" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br/>
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<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">
|
||||
<label>Event</label> <br />
|
||||
<select name="upload-action-type" class="form-control" id="upload-action-type" required>
|
||||
<option value="">Select</option>
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="policy_id" class="form-control" id="policy_id">
|
||||
<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
|
||||
if(isset($actions) && count($actions))
|
||||
{
|
||||
@ -46,35 +56,43 @@
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row" id="file_upload">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Upload file</label> [ <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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-row" id="file_upload">
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Upload file</label> [ <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>
|
||||
|
||||
</form>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -107,14 +125,13 @@
|
||||
|
||||
|
||||
<script>
|
||||
$('#file_upload').hide();
|
||||
|
||||
$('#file_upload').hide();
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
//for modal pop up
|
||||
@ -162,7 +179,7 @@ $(document).ready(function() {
|
||||
$('#emp_form_submit_button').prop('disabled', true);
|
||||
$('#emp_form_submit_button').html(
|
||||
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
|
||||
);
|
||||
);
|
||||
// return false;
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
@ -180,7 +197,8 @@ $(document).ready(function() {
|
||||
console.log(response);
|
||||
if (response.code === 200 && response.dataStatus === true && response
|
||||
.data !== "") {
|
||||
toastr.success('File upload successs, Data validation is in-progress',
|
||||
toastr.success(
|
||||
'File upload successs, Data validation is in-progress',
|
||||
'success');
|
||||
window.location.reload(true);
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
@ -295,7 +313,8 @@ function fetchFileError(file_id) {
|
||||
err_count + "</span>" : (err_id == 4 ?
|
||||
"<strong>Rule Conflict</strong> <span class='badge badge-danger float-right'>" +
|
||||
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_html += '<br/>';
|
||||
@ -303,7 +322,8 @@ function fetchFileError(file_id) {
|
||||
|
||||
}
|
||||
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 +
|
||||
"' 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. **/
|
||||
$('#upload-action-type').change(function() {
|
||||
/**This function updates the download link based on the selected option in the dropdown menu. **/
|
||||
$('#upload-action-type').change(function() {
|
||||
|
||||
var selectedValue = $(this).val();
|
||||
if(selectedValue !== ''){
|
||||
$('#file_upload').show();
|
||||
var fullURL = '<?= base_url("util/download-excel/"); ?>' + selectedValue;
|
||||
$('#excel_download').attr('href', fullURL);
|
||||
}else{
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
var selectedValue = $(this).val();
|
||||
if (selectedValue !== '') {
|
||||
$('#file_upload').show();
|
||||
var fullURL = '<?= base_url("util/download-excel/"); ?>' + selectedValue;
|
||||
$('#excel_download').attr('href', fullURL);
|
||||
} else {
|
||||
$('#file_upload').hide();
|
||||
$('#excel_download').removeAttr('href');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/** This function verifies if the download link (#excel_download) has its href attribute set,
|
||||
** ensuring proper link configuration. **/
|
||||
/** This function verifies if the download link (#excel_download) has its href attribute set,
|
||||
** 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
|
||||
if (!$(this).attr('href')) {
|
||||
// If href attribute is not set, show an error message
|
||||
toastr.warning('Please select an Action to download a sample Excel.', 'Warning');
|
||||
} else {
|
||||
console.log('Download action triggered.');
|
||||
}
|
||||
});
|
||||
// Check if the element with ID "excel_download" has the href attribute set
|
||||
if (!$(this).attr('href')) {
|
||||
// If href attribute is not set, show an error message
|
||||
toastr.warning('Please select an Action to download a sample Excel.', 'Warning');
|
||||
} else {
|
||||
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>
|
||||
@ -22,7 +22,7 @@
|
||||
<div class="form-group col-md-4">
|
||||
<label for="insurer_name">Insurer Name<span
|
||||
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>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
|
||||
@ -67,7 +67,8 @@
|
||||
placeholder="Enter District" name="district" required>
|
||||
</div>
|
||||
<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"
|
||||
placeholder="Enter City" name="city" required>
|
||||
</div>
|
||||
@ -123,99 +124,101 @@
|
||||
<script>
|
||||
|
||||
var contactCount = 1;
|
||||
var insurer_branch_form_action = '';
|
||||
var insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
|
||||
$(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(){
|
||||
$(document).ready(function () {
|
||||
|
||||
insurer_Branch_PrimaryKey = $('#insurer_id_branch').val();
|
||||
|
||||
$('#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('');
|
||||
|
||||
$('#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
|
||||
|
||||
|
||||
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 = '';
|
||||
var data = <?= isset($insurer_branch) ? json_encode($insurer_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);
|
||||
}
|
||||
// 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(){
|
||||
|
||||
$('#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) {
|
||||
console.log(1, insurer_branch_form_action);
|
||||
events.preventDefault();
|
||||
var isValid = $('#insurer_branch_form').parsley().validate();
|
||||
if (isValid) {
|
||||
@ -237,7 +240,7 @@ $(document).ready(function () {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
console.log(res);
|
||||
// $('#insurer_branch_list tr').remove();
|
||||
$('#insurer_branch_list tr').remove();
|
||||
var insurerBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
insurerBranchTableInsert += `
|
||||
@ -270,17 +273,22 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '.btnBranchEdit', function () {
|
||||
$('#container').html("");
|
||||
contactCount =1;
|
||||
var branch_id = $(this).attr('data-id');
|
||||
$('#insurer_Branch_PrimaryKey').val(branch_id);
|
||||
|
||||
insurer_branch_form_action = '<?= base_url("master/insurer/branch/edit"); ?>';
|
||||
|
||||
console.log(insurer_branch_form_action)
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('master/insurer/branch/editget/');?>'+branch_id,
|
||||
type: "GET",
|
||||
@ -300,7 +308,6 @@ $(document).ready(function () {
|
||||
$('#state option[value="' + res.insurerbranch.state + '"]').prop('selected', true);
|
||||
$('#district').val(res.insurerbranch.district);
|
||||
$('#branch_city').val(res.insurerbranch.city);
|
||||
$('#insurer_Branch_PrimaryKey').val(res.insurerbranch.id);
|
||||
|
||||
$('#contact_id_1').val(res.levelcontact[0].id);
|
||||
$('.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;
|
||||
if ($('#insurer_id_branch').val() != '') {
|
||||
function appendContactHtml(contact = false, reset = false) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
$.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);
|
||||
console.log('appendContactHtml function called ')
|
||||
contactCount++;
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
toastr.warning('Something Wrong!', 'warning');
|
||||
}, 1000);
|
||||
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 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')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
var buttonIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
buttonIds.push(id);
|
||||
localStorage.setItem('buttonIds', JSON.stringify(buttonIds));
|
||||
}
|
||||
|
||||
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
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) {
|
||||
function hideStoredAddButtons() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
storedIds.forEach(function(id) {
|
||||
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
|
||||
var first_addButton = document.querySelector('.ac')
|
||||
if (addButton) {
|
||||
addButton.style.display = 'none';
|
||||
first_addButton.style.display = 'none';
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var isValid = true;
|
||||
|
||||
$('#insurer_branch_form input, #insurer_branch_form select').each(function() {
|
||||
function showNextAddButton() {
|
||||
var storedIds = JSON.parse(localStorage.getItem('buttonIds')) || [];
|
||||
var addButtonShown = false;
|
||||
|
||||
if ($(this).is('input[name="emial[]"]') || $(this).is('input[type="text"]') || $(this).is('select') ) {
|
||||
if ($.trim($(this).val()) == '') {
|
||||
isValid = false;
|
||||
return 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);
|
||||
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>
|
||||
@ -1,111 +1,135 @@
|
||||
<div class="tab-pane fade" id="KYC-DOC-tab">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="import_export_excel_form" action = "<?php echo base_url().'util/import-export'?>" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<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="col-xl-6">
|
||||
<div id="accordion" class="mb-3">
|
||||
<div class="card mb-1">
|
||||
<h5 class="m-1">
|
||||
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne" aria-expanded="true">
|
||||
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
|
||||
</a>
|
||||
</h5>
|
||||
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
|
||||
<div class="card-body">
|
||||
<!-- <div class="text-center"> -->
|
||||
<form class="parsley-examples" id="import_export_excel_form"
|
||||
action="<?php echo base_url().'util/import-export'?>" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<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">
|
||||
<label>Policy</label> <br />
|
||||
<select name="client_policy_id" class="form-control" id="policy" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label>Policy</label> <br />
|
||||
<select name="client_policy_id" class="form-control" id="policy" required>
|
||||
<option value="">Select</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4">
|
||||
<label>Insurer/TPA Data</label> <br />
|
||||
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa" required>
|
||||
<option value="">Select</option>
|
||||
<?php
|
||||
if(isset($insurer_or_tpa) && count($insurer_or_tpa))
|
||||
<div class="form-group col-md-4">
|
||||
<label>Insurer/TPA Data</label> <br />
|
||||
<select name="insurer_or_tpa" class="form-control" id="insurer_or_tpa"
|
||||
required>
|
||||
<option value="">Select</option>
|
||||
<?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>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<br>
|
||||
|
||||
<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($events as $key => $action)
|
||||
{
|
||||
echo "<option value=".$key.">".$action."</option>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row" id="import_excel_btn">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Upload file</label>
|
||||
<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 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>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-row" id="import_excel_btn">
|
||||
<div class="form-group col-md-3">
|
||||
<label>Upload file</label>
|
||||
<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 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 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>
|
||||
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- end page title -->
|
||||
<div class="row" id="file_list">
|
||||
<?php include('batch_list.php');?>
|
||||
</div>
|
||||
<!-- end row -->
|
||||
</div>
|
||||
|
||||
|
||||
@ -116,11 +140,11 @@ var clientPolicies = [];
|
||||
$(document).ready(function() {
|
||||
|
||||
<?php if (session()->has('error')): ?>
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
toastr.error('<?= session()->getFlashdata('error') ?>', 'Failed');
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (session()->has('success')): ?>
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
toastr.success('<?= session()->getFlashdata('success') ?>', 'success');
|
||||
<?php endif; ?>
|
||||
|
||||
$('#import_excel_btn').hide();
|
||||
@ -165,7 +189,7 @@ $(document).ready(function() {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
$$("#import_export_excel_form")[0].reset()
|
||||
toastr.success('File Download successs', 'success');
|
||||
|
||||
|
||||
} else if (response.code === 404 && response.status === false) {
|
||||
|
||||
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>
|
||||
@ -37,7 +37,7 @@
|
||||
<div class="form-group col-md-6">
|
||||
<label for="insurer_id">Insurer<span class="text-danger">*</span></label>
|
||||
<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) : ?>
|
||||
<option value="<?= $insurer['id'] ?>"><?= $insurer['name'] ?></option>
|
||||
<?php endforeach; } ?>
|
||||
@ -181,7 +181,7 @@ $(document).ready(function () {
|
||||
if(policy_type_PrimaryKey !== ''){
|
||||
|
||||
var branchTable = '';
|
||||
var data = <?= isset($tpa_branch) ? json_encode($tpa_branch) : '[]' ?>;
|
||||
var data = <?= isset($policies) ? json_encode($policies) : '[]' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
branchTable += `
|
||||
<tr>
|
||||
@ -200,7 +200,6 @@ $(document).ready(function () {
|
||||
|
||||
var isValid = $('#tpa_branch_form').parsley().validate();
|
||||
|
||||
|
||||
if (isValid) {
|
||||
|
||||
var formData = new FormData($('#tpa_branch_form')[0]);
|
||||
@ -219,7 +218,7 @@ $(document).ready(function () {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 1000);
|
||||
// console.log(res);
|
||||
// $('#policies_list tr').remove();s
|
||||
// $('#policies_list tr').remove();
|
||||
var tpaBranchTableInsert = ''
|
||||
$.each(res.data, function(index, item) {
|
||||
tpaBranchTableInsert += `
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<label for="kyc_name">Policy Type Name<span
|
||||
class="text-danger">*</span></label>
|
||||
<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 class="form-group col-md-4">
|
||||
<label for="bap">Bap<span
|
||||
@ -24,7 +24,7 @@
|
||||
<label for="allocg">Allocg<span
|
||||
class="text-danger">*</span></label>
|
||||
<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 class="form-group col-md-4">
|
||||
<label for="alloci">Alloci<span
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<th class="font-weight-medium">Policy Type</th>
|
||||
<th class="font-weight-medium">Bap</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>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user