FIX_TPA_EXPORT_ISSUE : RV
This commit is contained in:
parent
2e6dc18b7a
commit
fd3b332221
@ -331,7 +331,7 @@ class EmpDataServiceController extends BaseController
|
||||
[
|
||||
'column_index' => 0,
|
||||
'column_name' => 'S.No',
|
||||
'header_name' => 'index'
|
||||
'db_column_name' => 'index'
|
||||
],
|
||||
[
|
||||
'column_index' => 1,
|
||||
@ -1549,7 +1549,6 @@ class EmpDataServiceController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$batch_list_id[] = $emp_value['emp_policy_id'];
|
||||
}
|
||||
|
||||
@ -1696,7 +1695,7 @@ class EmpDataServiceController extends BaseController
|
||||
$file_name_with_path = WRITEPATH . "/uploads/import_excel/" . $file['file_name'];
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
unset($excel_data[0]); // Remove header row
|
||||
array_pop($excel_data); // Remove footer row
|
||||
// array_pop($excel_data);
|
||||
|
||||
$totals = 0;
|
||||
$emp_policy_ids = [];
|
||||
@ -1707,7 +1706,6 @@ class EmpDataServiceController extends BaseController
|
||||
$emp_count = count($excel_data);
|
||||
$db = \Config\Database::connect();
|
||||
|
||||
|
||||
foreach ($excel_data as $key => $value) {
|
||||
|
||||
$name = $value[1];
|
||||
@ -1716,33 +1714,37 @@ class EmpDataServiceController extends BaseController
|
||||
$uhid[] = $value[16];
|
||||
$amount = $value[20];
|
||||
|
||||
$totals = $totals + $amount;
|
||||
if(!empty($name) && !empty($emp_code)){
|
||||
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
$query->where('employees.client_branch_id', $client_branch_id);
|
||||
$query->where('employees.name', $name);
|
||||
$query->where('employees.emp_code', $emp_code);
|
||||
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||
$totals = $totals + $amount;
|
||||
|
||||
$query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
|
||||
} else if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
$query = $db->table('employee_polices');
|
||||
$query->select('employee_polices.id');
|
||||
$query->join('employees', 'employees.id = employee_polices.employee_id');
|
||||
$query->where('employee_polices.client_policy_id', $client_policy_id);
|
||||
$query->where('employees.client_id', $client_id);
|
||||
$query->where('employees.client_branch_id', $client_branch_id);
|
||||
$query->where('employees.name', $name);
|
||||
$query->where('employees.emp_code', $emp_code);
|
||||
if ($file['insurer_or_tpa'] == 'tpa') {
|
||||
|
||||
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
|
||||
}
|
||||
$query->where('employee_polices.is_active', 1);
|
||||
$query->where('employee_polices.status', 'active');
|
||||
$query->where('employees.is_active', 1);
|
||||
$query->where('employees.emp_status', 'active');
|
||||
$query->limit(1);
|
||||
$query->where('(employee_polices.tpa_id IS NULL OR employee_polices.tpa_id = "")');
|
||||
} else if ($file['insurer_or_tpa'] == 'insurer') {
|
||||
|
||||
$query->where('(employee_polices.uhid IS NULL OR employee_polices.uhid = "")');
|
||||
}
|
||||
$query->where('employee_polices.is_active', 1);
|
||||
$query->where('employee_polices.status', 'active');
|
||||
$query->where('employees.is_active', 1);
|
||||
$query->where('employees.emp_status', 'active');
|
||||
$query->limit(1);
|
||||
|
||||
$result = $query->get()->getRowArray();
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
$emp_policy_ids[] = $result['id']; //for cash deposite
|
||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[15], 'uhid' => $value[16]);
|
||||
}
|
||||
|
||||
$result = $query->get()->getRowArray();
|
||||
if (isset($result['id']) && $result['id'] !== null) {
|
||||
$emp_policy_ids[] = $result['id']; //for cash deposite
|
||||
$emp_details[] = array('id' => $result['id'], 'tpa_id' => $value[15], 'uhid' => $value[16]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1766,18 +1768,17 @@ class EmpDataServiceController extends BaseController
|
||||
$this->myLogger->logme('error', 'Inception Update TPA and UHID -- set cashDepositCalculationForInception and sendMailForDownloadingECard in JOB QUEUE');
|
||||
|
||||
$policy_name = $this->getPolicyNameUsingClientPolicyId($client_policy_id);
|
||||
$depositeData = [
|
||||
'employeeIds' => $emp_policy_ids,
|
||||
'client_id' => $client_id,
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'count' => $emp_count,
|
||||
'event' => $file['event_type'],
|
||||
'policy_name' => $policy_name['policy_name'],
|
||||
'user_id' => $user_id,
|
||||
];
|
||||
|
||||
|
||||
// $depositeData = [
|
||||
// 'employeeIds' => $emp_policy_ids,
|
||||
// 'client_id' => $client_id,
|
||||
// 'client_policy_id' => $client_policy_id,
|
||||
// 'client_branch_id' => $client_branch_id,
|
||||
// 'count' => $emp_count,
|
||||
// 'event' => $file['event_type'],
|
||||
// 'policy_name' => $policy_name['policy_name'],
|
||||
// 'user_id' => $user_id,
|
||||
// ];
|
||||
|
||||
$job_details = new Jobs();
|
||||
$r = Jobs::addJob(['job_name' => 'cashDepositCalculationForInception', 'payload' => [
|
||||
@ -1813,8 +1814,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Endorsement Correction
|
||||
public function importCorrectionValidation($params)
|
||||
{
|
||||
@ -2229,7 +2228,6 @@ class EmpDataServiceController extends BaseController
|
||||
|
||||
|
||||
|
||||
|
||||
//Endorsement SIEnhancement
|
||||
public function importSIEnhancementValidation($params)
|
||||
{
|
||||
@ -2866,7 +2864,7 @@ class EmpDataServiceController extends BaseController
|
||||
$excel_data = $this->readExcelFileToArray($file_name_with_path);
|
||||
$excel_header = $excel_data[0];
|
||||
unset($excel_data[0]);
|
||||
array_pop($excel_data);
|
||||
// array_pop($excel_data);
|
||||
|
||||
$headers = ['S.No','EMP ID','EMP NAME','DOB','GENDER','RELATIONSHIP','SUM INSURED','Date of Leaving','Policy End Date','No Of Days','Premium','Pro Rata Premium','GST','Total','Claim Status','ENDORSEMENT_ID'];
|
||||
|
||||
@ -3276,24 +3274,25 @@ class EmpDataServiceController extends BaseController
|
||||
$totals = $totals + $value[13];
|
||||
$endorsement_id = $value[15];
|
||||
|
||||
if(!empty($emp_code) && !empty($emp_name)){
|
||||
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
||||
$fetch_data = [
|
||||
'client_policy_id' => $client_policy_id,
|
||||
'client_branch_id' => $client_branch_id,
|
||||
'client_id' => $client_id,
|
||||
'emp_name' => $emp_name,
|
||||
'emp_code' => $emp_code
|
||||
];
|
||||
$result = $this->employeePolicyModel->fetchEmpEndorsementData($fetch_data);
|
||||
|
||||
// dd($result['emp_endorsement_primarykey']);
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
|
||||
if (isset($result['emp_endorsement_primarykey']) && $result['emp_endorsement_primarykey'] !== null) {
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
$employee_policy_table_primaryKey[] = $result['emp_policy_primarykey']; //for cash deposite
|
||||
$employee_policy_table_data[] = array('id' => $result['emp_policy_primarykey'], 'date_of_exit' => $result['date_of_exit'], 'reason_for_exit' => $result['reason_for_exit'], 'status' => $result['status']);
|
||||
$employees_table_data[] = array('id' => $result['employees_id'], 'emp_status' => $result['status']);
|
||||
$emp_endorsement_table_data[] = array('id' => $result['emp_endorsement_primarykey'], 'group_key' => $result['group_key'], 'endorsement_id' => $value[15], 'status' => 'complete');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -463,10 +463,10 @@ class EmployeeController extends AdminController
|
||||
if (!$return) {
|
||||
|
||||
if ($insurer_or_tpa == 'tpa') {
|
||||
session()->setFlashdata('error', "No data was found for this action. The TPA ID has already been updated.");
|
||||
session()->setFlashdata('error', "No data was found for this action.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
} else if ($insurer_or_tpa == 'insurer') {
|
||||
session()->setFlashdata('error', "No data was found for this action. The UHID has already been updated.");
|
||||
session()->setFlashdata('error', "No data was found for this action.");
|
||||
return redirect()->to(base_url('employee/upload'));
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -152,8 +152,17 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
$editData['insurer'] = $this->insurerModel->where(['id' => $id, 'is_active' => 1])->first();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insuer_branch'] = $this->insurerBranchModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll();
|
||||
$editData['insurer_templete_count'] = $this->insurerTemplateModel->where(['insurer_id' => $id, 'is_active' => 1])->countAllResults();
|
||||
$editData['insurer_templete_list'] = $this->insurerModel->getInsurerTemplateByInsurerID($id);
|
||||
|
||||
|
||||
$editData['policy_type'] = $this->policyTypeModel->whereIn('id', [1,2,6,7])->findAll();
|
||||
$editData['events'] = ['inception' => 'Inception', 'addition' => 'Addition', 'dependent_addition' => 'Dependent Addition', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement', 'all' => 'All'];
|
||||
$editData['action'] = ['import' => 'Import', 'export' => 'Export'];
|
||||
$editData['db_column_name'] = ['Employee Name' => 'emp_name', 'Employee ID' => 'emp_code'];
|
||||
|
||||
|
||||
|
||||
|
||||
// echo "<pre>";
|
||||
@ -377,8 +386,6 @@ class MasterController extends AdminController
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to add template', $insurer_templete_data]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// Insurer Ends
|
||||
|
||||
@ -386,7 +393,6 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
// TPA Start
|
||||
|
||||
public function tpaList()
|
||||
{
|
||||
$this->myLogger->logme('error','TPA list function called');
|
||||
@ -709,10 +715,11 @@ class MasterController extends AdminController
|
||||
echo json_encode($editData);
|
||||
exit();
|
||||
}
|
||||
|
||||
//Ends TPA Models
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Start KYC
|
||||
public function kycList()
|
||||
@ -901,8 +908,9 @@ class MasterController extends AdminController
|
||||
|
||||
|
||||
|
||||
//Start Policy
|
||||
|
||||
|
||||
//Start Policy
|
||||
public function policyTypeList()
|
||||
{
|
||||
$this->myLogger->logme('error','Policy Type list function called');
|
||||
@ -1098,10 +1106,11 @@ class MasterController extends AdminController
|
||||
echo json_encode(array("status" => false));
|
||||
}
|
||||
}
|
||||
|
||||
//end policies
|
||||
|
||||
|
||||
|
||||
|
||||
//start CD Master list
|
||||
public function CDMasterList()
|
||||
{
|
||||
@ -1254,4 +1263,25 @@ class MasterController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function createExcelTemplate()
|
||||
{
|
||||
$data = [
|
||||
'insurer_id' => $this->request->getPost('insurer_id'),
|
||||
'policy_type_id' => $this->request->getPost('policy_type'),
|
||||
'event_name' => $this->request->getPost('event'),
|
||||
'type_name' => $this->request->getPost('import_or_export'),
|
||||
'jsoncolumns' => $this->request->getPost('json_data'),
|
||||
];
|
||||
|
||||
$insert = $this->insurerTemplateModel->insert($data);
|
||||
|
||||
if($insert){
|
||||
return $this->respond(['status' => true, 'message' => 'Template created successfully', $data]);
|
||||
}else{
|
||||
return $this->respond(['status' => true, 'message' => 'Failed to create template', $data]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -45,14 +45,14 @@ class ClientModel extends Model
|
||||
->where('is_active',1)
|
||||
->findAll();
|
||||
|
||||
// if($role_id == 2 || $role_id == 3){
|
||||
if($role_id == 2 || $role_id == 3){
|
||||
|
||||
// $clients = $this->select($columns)
|
||||
// ->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
// ->where('client_rm.user_id', $user_id)
|
||||
// ->where('clients.is_active',1)
|
||||
// ->findAll();
|
||||
// }
|
||||
$clients = $this->select($columns)
|
||||
->join('client_rm', 'client_rm.client_id = clients.id')
|
||||
->where('client_rm.user_id', $user_id)
|
||||
->where('clients.is_active',1)
|
||||
->findAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ class InsurerModel extends Model
|
||||
->get()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function getInsurerName($insurerId)
|
||||
{
|
||||
// Fetch the insurer name based on the insurer ID
|
||||
@ -50,6 +51,21 @@ class InsurerModel extends Model
|
||||
|
||||
return null; // or handle accordingly if the insurer is not found
|
||||
}
|
||||
|
||||
public function getInsurerTemplateByInsurerID($insurer_id)
|
||||
{
|
||||
$insurer_data = $this->db->table('insurer_excel_export_template')
|
||||
->select('insurers.name as insurer_name, insurers.id, insurers.is_multi_event')
|
||||
->select('CASE WHEN insurers.is_multi_event = 1 THEN "multiple" ELSE insurer_excel_export_template.event_name END as event_name', false)
|
||||
->select('insurer_excel_export_template.type_name, insurer_excel_export_template.jsoncolumns, policy_type.policy_type')
|
||||
->join('insurers', 'insurers.id = insurer_excel_export_template.insurer_id')
|
||||
->join('policy_type', 'policy_type.id = insurer_excel_export_template.policy_type_id')
|
||||
->where('insurers.id', $insurer_id)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $insurer_data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -193,7 +193,7 @@
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Upload Enrollment File</h4>
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Upload Enrolment File</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -408,25 +408,25 @@
|
||||
extend: 'copy',
|
||||
text: '<i class="fa fa-copy"></i>',
|
||||
titleAttr: 'Copy',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'print',
|
||||
text: '<i class="fa fa-print"></i>',
|
||||
titleAttr: 'Print',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'pdf',
|
||||
text: '<i class="fa fa-file-pdf"></i>',
|
||||
titleAttr: 'PDF',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
},
|
||||
{
|
||||
extend: 'csv',
|
||||
text: '<i class="fa fa-file-csv"></i>',
|
||||
titleAttr: 'CSV',
|
||||
filename: 'Enrollment List'
|
||||
filename: 'Enrolment List'
|
||||
}
|
||||
],
|
||||
initComplete: function() {
|
||||
|
||||
@ -9,14 +9,130 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3" style="position: relative;top: 28px;">
|
||||
<div class="form-group col-md-6" style="position: relative;top: 28px;">
|
||||
<label for="email"><span class="text-danger"></span></label>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="checkInsurerTemplete(this)">Copy</a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-2" style="position: relative;top: 28px;left: 80px;">
|
||||
<label for="email"><span class="text-danger"></span></label>
|
||||
<a href="#" class="btn btn-primary waves-effect waves-light" onclick="addNewJsonExportTemplate(this)">Add New</a>
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="table-responsive" id="branch_table" >
|
||||
|
||||
<table class="table table-borderless table-nowrap mb-0">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>S.NO</th>
|
||||
<th>Policy Type</th>
|
||||
<th>Event Type</th>
|
||||
<th>Import/Export</th>
|
||||
<th>Template</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($insurer_templete_list)){ ?>
|
||||
<?php foreach($insurer_templete_list as $key => $value ){ ?>
|
||||
<tr>
|
||||
<th><?= $key+1; ?></th>
|
||||
<th><?= $value['policy_type']; ?></th>
|
||||
<th><?= $value['event_name']; ?></th>
|
||||
<th><?= $value['type_name']; ?></th>
|
||||
<th><?= $value['jsoncolumns']; ?></th>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="template_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||
aria-hidden="true" aria-modal="true" data-backdrop="static" style="padding-right: 15px">
|
||||
<div class="modal-dialog modal-full-width">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">New Template</h4>
|
||||
<button type="button" id="close_btn" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form class="parsley-examples" method="post" id="templateForm" enctype="multipart/form-data">
|
||||
<input type="hidden" name="insurer_id" value="<?= $insurer['id'] ?>">
|
||||
<div class="form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-4">
|
||||
<label for="policy_type">Policy Type<span class="text-danger">*</span></label>
|
||||
<select name="policy_type" class="form-control" id="policy_type" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($policy_type)){ ?>
|
||||
<?php foreach ($policy_type as $key => $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['policy_type']?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="event_name">Event<span class="text-danger">*</span></label>
|
||||
<select name="event" class="form-control" id="event" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($events)){ ?>
|
||||
<?php foreach ($events as $key => $event) { ?>
|
||||
<option value="<?= $key ?>"><?= $event?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-4">
|
||||
<label for="action">Action<span class="text-danger">*</span></label>
|
||||
<select name="import_or_export" class="form-control" id="import_or_export" required>
|
||||
<option value="">Select</option>
|
||||
<?php if (!empty($action)){ ?>
|
||||
<?php foreach ($action as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"><?= $value?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="dynamic-form-container">
|
||||
<div class="form-row dynamic-form-row">
|
||||
<div class="form-group col-md-5">
|
||||
<label for="header_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input class="form-control" type="text" name="header_name[]">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="policy_id">DataBase Column Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="policy_id[]" required>
|
||||
<option selected>Select Client Policy</option>
|
||||
<?php if (!empty($db_column_name)){ ?>
|
||||
<?php foreach ($db_column_name as $key => $value) { ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary waves-effect waves-light mr-1">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
@ -25,6 +141,44 @@
|
||||
featchInsurerList()
|
||||
})
|
||||
|
||||
$('#templateForm').submit(function(){
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
url: $(this).attr("action"),
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
beforeSend: function() {
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
},
|
||||
success: function(response) {
|
||||
|
||||
console.log('Expoer template list:', response);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
// Request failed, handle error
|
||||
console.error("Request failed:", status, error);
|
||||
console.error('Response:', xhr.responseText);
|
||||
},
|
||||
complete: function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function featchInsurerList()
|
||||
{
|
||||
|
||||
@ -139,6 +293,7 @@
|
||||
toastr.success(res.message, 'SUCCESS');
|
||||
}
|
||||
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
@ -149,4 +304,45 @@
|
||||
});
|
||||
}
|
||||
|
||||
function addNewJsonExportTemplate(input)
|
||||
{
|
||||
var myModal = new bootstrap.Modal(document.getElementById('template_modal'));
|
||||
myModal.show();
|
||||
}
|
||||
|
||||
function addHTMLInput(element)
|
||||
{
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const newRow = document.createElement('div');
|
||||
newRow.className = 'form-row dynamic-form-row';
|
||||
newRow.innerHTML = `
|
||||
<div class="form-group col-md-5">
|
||||
<label for="header_name">Header Name<span class="text-danger">*</span></label>
|
||||
<input class="form-control" type="text" name="header_name[]">
|
||||
</div>
|
||||
<div class="form-group col-md-5">
|
||||
<label for="policy_id">DataBase Column Name<span class="text-danger">*</span></label>
|
||||
<select class="form-control" name="db_column_name[]" required>
|
||||
<option selected>Select Client Policy</option>
|
||||
<?php if (!empty($db_column_name)){ ?>
|
||||
<?php foreach ($db_column_name as $key => $value) { ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-md-2" style="position: relative;top: 28px;">
|
||||
<a class="btn btn-primary waves-effect waves-light mr-1" onclick="addHTMLInput(this)">+</a>
|
||||
<a class="btn btn-danger waves-effect waves-light" onclick="removeHTMLInput(this)">x</a>
|
||||
</div>
|
||||
`;
|
||||
container.appendChild(newRow);
|
||||
}
|
||||
|
||||
function removeHTMLInput(element)
|
||||
{
|
||||
const row = element.closest('.dynamic-form-row');
|
||||
row.remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user