FIX_TPA_API_INTEGRATION_RELATED_ISSUEs
This commit is contained in:
parent
e847af6bcb
commit
6e8b64b543
@ -4055,12 +4055,50 @@ class EmployeeController extends AdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tab = $this->request->getGet('tab');
|
||||||
|
|
||||||
|
// If the user is proceeding from the "Not in Nhance" tab,
|
||||||
|
// generate an Employee Upload with Events compatible Excel file
|
||||||
|
// and trigger the usual upload pipeline.
|
||||||
|
if ($tab === 'not_in_nhance') {
|
||||||
|
$generationResult = $this->generateEmployeeUploadFromNotInNhance((int) $file_id, $file);
|
||||||
|
|
||||||
|
if (!$generationResult['status']) {
|
||||||
|
return $this->respond(
|
||||||
|
[
|
||||||
|
'status' => false,
|
||||||
|
'code' => 422,
|
||||||
|
'message' => $generationResult['message'] ?? 'Unable to generate employee upload file from Not in Nhance data.',
|
||||||
|
'data' => $generationResult['data'] ?? [],
|
||||||
|
],
|
||||||
|
200
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} elseif ($tab === 'need_to_review') {
|
||||||
|
// For the "Need to Review" tab, generate a Correction Excel
|
||||||
|
// using the same overall pipeline as the Not in Nhance implementation.
|
||||||
|
$generationResult = $this->generateCorrectionUploadFromNeedToReview((int) $file_id, $file);
|
||||||
|
|
||||||
|
if (!$generationResult['status']) {
|
||||||
|
return $this->respond(
|
||||||
|
[
|
||||||
|
'status' => false,
|
||||||
|
'code' => 422,
|
||||||
|
'message' => $generationResult['message'] ?? 'Unable to generate correction upload file from Need to Review data.',
|
||||||
|
'data' => $generationResult['data'] ?? [],
|
||||||
|
],
|
||||||
|
200
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->myLogger->logme(
|
$this->myLogger->logme(
|
||||||
'error',
|
'error',
|
||||||
'TPA variation review completed and proceed to next clicked',
|
'TPA variation review completed and proceed to next clicked',
|
||||||
[
|
[
|
||||||
'file_id' => $file_id,
|
'file_id' => $file_id,
|
||||||
'user_id' => get_session_userid(),
|
'user_id' => get_session_userid(),
|
||||||
|
'tab' => $tab,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -4068,7 +4106,11 @@ class EmployeeController extends AdminController
|
|||||||
[
|
[
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'message' => 'Proceed to next step recorded successfully.',
|
'message' => $tab === 'not_in_nhance'
|
||||||
|
? 'Employee upload file generated from Not in Nhance data and queued for processing.'
|
||||||
|
: ($tab === 'need_to_review'
|
||||||
|
? 'Correction upload file generated from Need to Review data and queued for processing.'
|
||||||
|
: 'Proceed to next step recorded successfully.'),
|
||||||
'data' => [],
|
'data' => [],
|
||||||
],
|
],
|
||||||
200
|
200
|
||||||
@ -4092,6 +4134,551 @@ class EmployeeController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate an Employee Upload with Events compatible Excel file
|
||||||
|
* from the Not in Nhance TPA variation data and push it into the
|
||||||
|
* existing employee upload pipeline.
|
||||||
|
*
|
||||||
|
* @param int $batchFileId Batch file id used for TPA variation report.
|
||||||
|
* @param array $batchFile Batch file row from DB.
|
||||||
|
*
|
||||||
|
* @return array ['status' => bool, 'message' => string, 'data' => array]
|
||||||
|
*/
|
||||||
|
protected function generateEmployeeUploadFromNotInNhance(int $batchFileId, array $batchFile): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$clientId = (int) ($batchFile['client_id'] ?? 0);
|
||||||
|
$clientPolicyId = (int) ($batchFile['client_policy_id'] ?? 0);
|
||||||
|
$clientBranchId = (int) ($batchFile['client_branch_id'] ?? 0);
|
||||||
|
|
||||||
|
if (!$clientId || !$clientPolicyId || !$clientBranchId) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Incomplete batch file information. Client / policy / branch missing.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$TpaApiDataModel = new TpaApiDataModel();
|
||||||
|
|
||||||
|
// Get master emp codes from Nhance for this client & policy
|
||||||
|
$masterEmpRows = $this->employeePolicyModel->getTPADataVariationReport(
|
||||||
|
$clientId,
|
||||||
|
$clientPolicyId,
|
||||||
|
$batchFileId,
|
||||||
|
[],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if (!is_array($masterEmpRows)) {
|
||||||
|
$masterEmpRows = [];
|
||||||
|
}
|
||||||
|
$masterEmpCodes = array_column($masterEmpRows, 'emp_code');
|
||||||
|
|
||||||
|
// Fetch Not in Nhance rows for this batch file
|
||||||
|
$notInNhance = $TpaApiDataModel->select('*')
|
||||||
|
->where('is_active', 1)
|
||||||
|
->where('file_id', $batchFileId)
|
||||||
|
->whereNotIn('emp_code', $masterEmpCodes)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
if (empty($notInNhance)) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'No "Not in Nhance" records found for this file.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$empServiceController = new EmployeeServiceController();
|
||||||
|
$inceptionColumns = $empServiceController->getInceptionExcelColumns();
|
||||||
|
|
||||||
|
if (empty($inceptionColumns)) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unable to load inception Excel column configuration.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
$sheet->setTitle('Employees');
|
||||||
|
|
||||||
|
// Header row from EmployeeServiceController column definitions
|
||||||
|
$colIndex = 1;
|
||||||
|
foreach ($inceptionColumns as $columnDef) {
|
||||||
|
$headerText = $columnDef['col_name'] ?? '';
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$sheet->setCellValue($columnLetter . '1', $headerText);
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to safely format dates as d-M-Y when possible
|
||||||
|
$formatDate = static function ($value): string {
|
||||||
|
if (empty($value)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ts = strtotime($value);
|
||||||
|
if ($ts === false) {
|
||||||
|
return (string) $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return date('d-M-Y', $ts);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Map Not in Nhance TPA rows into the inception Excel structure
|
||||||
|
$rowIndex = 2;
|
||||||
|
$sno = 1;
|
||||||
|
|
||||||
|
foreach ($notInNhance as $tpaRow) {
|
||||||
|
$colIndex = 1;
|
||||||
|
|
||||||
|
foreach ($inceptionColumns as $key => $columnDef) {
|
||||||
|
$value = '';
|
||||||
|
|
||||||
|
switch ($key) {
|
||||||
|
case 'sno':
|
||||||
|
$value = $sno;
|
||||||
|
break;
|
||||||
|
case 'emp_id':
|
||||||
|
$value = $tpaRow['emp_code'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'name_of_emp_dep':
|
||||||
|
$value = $tpaRow['name'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'dob':
|
||||||
|
$value = $formatDate($tpaRow['dob'] ?? '');
|
||||||
|
break;
|
||||||
|
case 'gender':
|
||||||
|
$value = $tpaRow['gender'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'relationship':
|
||||||
|
// Normalize relation text to match allowed values
|
||||||
|
$relation = (string) ($tpaRow['relation'] ?? '');
|
||||||
|
$relation = trim(strtolower($relation));
|
||||||
|
$map = [
|
||||||
|
'self' => 'Self',
|
||||||
|
'employee' => 'Self',
|
||||||
|
'spouse' => 'Spouse',
|
||||||
|
'wife' => 'Spouse',
|
||||||
|
'husband' => 'Spouse',
|
||||||
|
'son' => 'Son',
|
||||||
|
'daughter' => 'Daughter',
|
||||||
|
'father' => 'Father',
|
||||||
|
'mother' => 'Mother',
|
||||||
|
'father-in-law' => 'Father in Law',
|
||||||
|
'father in law' => 'Father in Law',
|
||||||
|
'mother-in-law' => 'Mother in Law',
|
||||||
|
'mother in law' => 'Mother in Law',
|
||||||
|
];
|
||||||
|
$value = $map[$relation] ?? ($tpaRow['relation'] ?? '');
|
||||||
|
break;
|
||||||
|
case 'basic_cover_si':
|
||||||
|
$value = $tpaRow['si'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'doc':
|
||||||
|
// Use DOJ from TPA data as Date of Coverage best-effort
|
||||||
|
$value = $formatDate($tpaRow['doj'] ?? '');
|
||||||
|
break;
|
||||||
|
case 'doj':
|
||||||
|
$value = $formatDate($tpaRow['doj'] ?? '');
|
||||||
|
break;
|
||||||
|
case 'pre_existing_ailments':
|
||||||
|
// Default to "0" (No) so validation passes for mandatory field
|
||||||
|
$value = '0';
|
||||||
|
break;
|
||||||
|
case 'change_event':
|
||||||
|
// For addition / dependent_addition, this is mandatory.
|
||||||
|
$value = 'addition';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// Non-mapped columns (phone, email, etc.) left blank by default.
|
||||||
|
$value = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$sheet->setCellValue($columnLetter . $rowIndex, $value);
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowIndex++;
|
||||||
|
$sno++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-size columns
|
||||||
|
$totalColumns = count($inceptionColumns);
|
||||||
|
for ($c = 1; $c <= $totalColumns; $c++) {
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($c);
|
||||||
|
$sheet->getColumnDimension($columnLetter)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist the Excel file to the same folder used by manual uploads
|
||||||
|
$fileName = sprintf(
|
||||||
|
'not_in_nhance_employee_upload_%d_%s.xlsx',
|
||||||
|
$batchFileId,
|
||||||
|
date('Ymd_His')
|
||||||
|
);
|
||||||
|
$filePath = WRITEPATH . 'uploads/excel/' . $fileName;
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($filePath);
|
||||||
|
|
||||||
|
// Create a new entry in the files table so that the
|
||||||
|
// existing Employee Upload with Events pipeline can process it.
|
||||||
|
$loggedInUserId = $batchFile['created_by'] ?? get_session_userid();
|
||||||
|
$action = 'addition';
|
||||||
|
|
||||||
|
$newFileId = $this->fileModel->insert([
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'client_id' => $clientId,
|
||||||
|
'policy_id' => $clientPolicyId,
|
||||||
|
'created_by' => $loggedInUserId,
|
||||||
|
'status' => 'inprogress',
|
||||||
|
'action' => $action,
|
||||||
|
'client_branch_id'=> $clientBranchId,
|
||||||
|
'uploaded_by' => 1,
|
||||||
|
'hr_file_id' => null,
|
||||||
|
'hr_id' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$newFileId || !is_numeric($newFileId)) {
|
||||||
|
$this->myLogger->logme(
|
||||||
|
'error',
|
||||||
|
'Failed to insert generated Not in Nhance employee upload file into files table',
|
||||||
|
[
|
||||||
|
'batch_file_id' => $batchFileId,
|
||||||
|
'client_id' => $clientId,
|
||||||
|
'client_policy_id' => $clientPolicyId,
|
||||||
|
'client_branch_id' => $clientBranchId,
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'insert_result' => $newFileId,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unable to create file record for generated employee upload.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Run the same format validation used for manual uploads.
|
||||||
|
$validationResult = $empServiceController->excelFileFormatValidation(['file_id' => $newFileId]);
|
||||||
|
|
||||||
|
if (isset($validationResult['error_summary']) && count($validationResult['error_summary'])) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'File upload was successful, but file format validation failed. Please review the error report.',
|
||||||
|
'data' => ['file_id' => $newFileId],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Employee upload file generated from Not in Nhance data and queued for processing.',
|
||||||
|
'data' => ['file_id' => $newFileId],
|
||||||
|
];
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->myLogger->logme(
|
||||||
|
'error',
|
||||||
|
'Error while generating employee upload from Not in Nhance'.
|
||||||
|
json_encode( [
|
||||||
|
'batch_file_id' => $batchFileId,
|
||||||
|
'exception_message' => $e->getMessage(),
|
||||||
|
'exception_file' => $e->getFile(),
|
||||||
|
'exception_line' => $e->getLine(),
|
||||||
|
'exception_trace' => $e->getTraceAsString(),
|
||||||
|
'client_id' => $batchFile['client_id'] ?? null,
|
||||||
|
'client_policy_id' => $batchFile['client_policy_id'] ?? null,
|
||||||
|
'client_branch_id' => $batchFile['client_branch_id'] ?? null,
|
||||||
|
], JSON_PRETTY_PRINT)
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unexpected error while generating employee upload file.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a Correction Excel file from the Need to Review
|
||||||
|
* TPA variation data and push it into the existing correction
|
||||||
|
* upload pipeline.
|
||||||
|
*
|
||||||
|
* Each mismatched field (name, dob, relationship, email_corporate)
|
||||||
|
* becomes a separate row in the Excel, using the correction
|
||||||
|
* headers defined in EmployeeServiceController::$correction_excel_columns.
|
||||||
|
*
|
||||||
|
* @param int $batchFileId Batch file id used for TPA variation report.
|
||||||
|
* @param array $batchFile Batch file row from DB.
|
||||||
|
*
|
||||||
|
* @return array ['status' => bool, 'message' => string, 'data' => array]
|
||||||
|
*/
|
||||||
|
protected function generateCorrectionUploadFromNeedToReview(int $batchFileId, array $batchFile): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$clientId = (int) ($batchFile['client_id'] ?? 0);
|
||||||
|
$clientPolicyId = (int) ($batchFile['client_policy_id'] ?? 0);
|
||||||
|
$clientBranchId = (int) ($batchFile['client_branch_id'] ?? 0);
|
||||||
|
|
||||||
|
if (!$clientId || !$clientPolicyId || !$clientBranchId) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Incomplete batch file information. Client / policy / branch missing.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$TpaApiDataModel = new TpaApiDataModel();
|
||||||
|
|
||||||
|
// Reuse the same DB + TPA reconciliation used in getTPADataVariationReport
|
||||||
|
$dbRows = $this->employeePolicyModel->getTPADataVariationReport(
|
||||||
|
$clientId,
|
||||||
|
$clientPolicyId,
|
||||||
|
$batchFileId
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!is_array($dbRows) || !count($dbRows)) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'No employee data found for Need to Review.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$mismatchRows = [];
|
||||||
|
|
||||||
|
foreach ($dbRows as $dbRow) {
|
||||||
|
$tpaRows = $TpaApiDataModel->select('*')
|
||||||
|
->where('emp_code', $dbRow['emp_code'])
|
||||||
|
->where('file_id', $batchFileId)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->findAll();
|
||||||
|
|
||||||
|
if (!count($tpaRows)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$match = $this->reconcileDbWithTpa($dbRow, $tpaRows);
|
||||||
|
|
||||||
|
if (($match['status'] ?? '') !== 'matched') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tpaRecord = $match['tpa_record'] ?? [];
|
||||||
|
$notMatching = $match['not_matching'] ?? [];
|
||||||
|
|
||||||
|
if (!is_array($notMatching) || !count($notMatching)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only consider fields that are supported by the correction Excel headers
|
||||||
|
$allowedFields = ['name', 'dob', 'relationship', 'email_corporate'];
|
||||||
|
|
||||||
|
foreach ($notMatching as $field) {
|
||||||
|
if (!in_array($field, $allowedFields, true)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$mismatchRows[] = [
|
||||||
|
'emp_code' => $dbRow['emp_code'] ?? '',
|
||||||
|
'name' => $dbRow['name'] ?? '',
|
||||||
|
'field' => $field,
|
||||||
|
// Use TPA value as the corrected value to be applied in Nhance
|
||||||
|
'value' => $tpaRecord[$field] ?? '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!count($mismatchRows)) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'No mismatched records found to generate correction upload.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$empServiceController = new EmployeeServiceController();
|
||||||
|
$correctionColumns = $empServiceController->getCorrectionExcelColumns();
|
||||||
|
|
||||||
|
if (empty($correctionColumns)) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unable to load correction Excel column configuration.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$sheet = $spreadsheet->getActiveSheet();
|
||||||
|
$sheet->setTitle('Correction');
|
||||||
|
|
||||||
|
// Header row from EmployeeServiceController column definitions
|
||||||
|
$colIndex = 1;
|
||||||
|
foreach ($correctionColumns as $columnDef) {
|
||||||
|
$headerText = $columnDef['col_name'] ?? '';
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$sheet->setCellValue($columnLetter . '1', $headerText);
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$todayDisplay = date('d-M-Y');
|
||||||
|
|
||||||
|
$rowIndex = 2;
|
||||||
|
$sno = 1;
|
||||||
|
|
||||||
|
foreach ($mismatchRows as $row) {
|
||||||
|
$colIndex = 1;
|
||||||
|
|
||||||
|
$field_name = $row['field'] ?? '';
|
||||||
|
$field_value = ($field_name == 'dob' ? change_date_format($row['value'] ?? '', 'Y-m-d', 'd-M-Y') : $row['value'] ?? '' );
|
||||||
|
|
||||||
|
foreach ($correctionColumns as $key => $columnDef) {
|
||||||
|
$value = '';
|
||||||
|
|
||||||
|
switch ($key) {
|
||||||
|
case 'sno':
|
||||||
|
$value = $sno;
|
||||||
|
break;
|
||||||
|
case 'emp_id':
|
||||||
|
$value = $row['emp_code'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'name_of_emp_dep':
|
||||||
|
$value = $row['name'] ?? '';
|
||||||
|
break;
|
||||||
|
case 'field':
|
||||||
|
$value = $field_name;
|
||||||
|
break;
|
||||||
|
case 'value':
|
||||||
|
$value = $field_value ?? '';
|
||||||
|
break;
|
||||||
|
case 'date_of_correction':
|
||||||
|
$value = $todayDisplay;
|
||||||
|
break;
|
||||||
|
case 'change_event':
|
||||||
|
$value = 'correction';
|
||||||
|
break;
|
||||||
|
case 'remarks':
|
||||||
|
$value = '';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$value = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($colIndex);
|
||||||
|
$sheet->setCellValue($columnLetter . $rowIndex, $value);
|
||||||
|
$colIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowIndex++;
|
||||||
|
$sno++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Auto-size columns
|
||||||
|
$totalColumns = count($correctionColumns);
|
||||||
|
for ($c = 1; $c <= $totalColumns; $c++) {
|
||||||
|
$columnLetter = Coordinate::stringFromColumnIndex($c);
|
||||||
|
$sheet->getColumnDimension($columnLetter)->setAutoSize(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Persist the Excel file to the same folder used by manual uploads
|
||||||
|
$fileName = sprintf(
|
||||||
|
'need_to_review_correction_upload_%d_%s.xlsx',
|
||||||
|
$batchFileId,
|
||||||
|
date('Ymd_His')
|
||||||
|
);
|
||||||
|
$filePath = WRITEPATH . 'uploads/excel/' . $fileName;
|
||||||
|
|
||||||
|
$writer = new Xlsx($spreadsheet);
|
||||||
|
$writer->save($filePath);
|
||||||
|
|
||||||
|
// Insert into files table so the existing correction pipeline can process it.
|
||||||
|
$loggedInUserId = $batchFile['created_by'] ?? get_session_userid();
|
||||||
|
|
||||||
|
$newFileId = $this->fileModel->insert([
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'client_id' => $clientId,
|
||||||
|
'policy_id' => $clientPolicyId,
|
||||||
|
'created_by' => $loggedInUserId,
|
||||||
|
'status' => 'inprogress',
|
||||||
|
'action' => 'correction',
|
||||||
|
'client_branch_id'=> $clientBranchId,
|
||||||
|
'uploaded_by' => 1,
|
||||||
|
'hr_file_id' => null,
|
||||||
|
'hr_id' => null,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (!$newFileId || !is_numeric($newFileId)) {
|
||||||
|
$this->myLogger->logme(
|
||||||
|
'error',
|
||||||
|
'Failed to insert generated Need to Review correction upload file into files table',
|
||||||
|
[
|
||||||
|
'batch_file_id' => $batchFileId,
|
||||||
|
'client_id' => $clientId,
|
||||||
|
'client_policy_id' => $clientPolicyId,
|
||||||
|
'client_branch_id' => $clientBranchId,
|
||||||
|
'file_name' => $fileName,
|
||||||
|
'insert_result' => $newFileId,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unable to create file record for generated correction upload.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the same format validation used for manual uploads so that
|
||||||
|
// the correction file enters the normal processing pipeline.
|
||||||
|
$validationResult = $empServiceController->excelFileFormatValidation(['file_id' => $newFileId]);
|
||||||
|
|
||||||
|
if (isset($validationResult['error_summary']) && count($validationResult['error_summary'])) {
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'File upload was successful, but correction file format validation failed. Please review the error report.',
|
||||||
|
'data' => ['file_id' => $newFileId],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => true,
|
||||||
|
'message' => 'Correction upload file generated from Need to Review data and queued for processing.',
|
||||||
|
'data' => ['file_id' => $newFileId],
|
||||||
|
];
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
$this->myLogger->logme(
|
||||||
|
'error',
|
||||||
|
'Error while generating correction upload from Need to Review'.
|
||||||
|
json_encode(
|
||||||
|
[
|
||||||
|
'batch_file_id' => $batchFileId,
|
||||||
|
'exception_message' => $e->getMessage(),
|
||||||
|
'exception_file' => $e->getFile(),
|
||||||
|
'exception_line' => $e->getLine(),
|
||||||
|
'exception_trace' => $e->getTraceAsString(),
|
||||||
|
'client_id' => $batchFile['client_id'] ?? null,
|
||||||
|
'client_policy_id' => $batchFile['client_policy_id'] ?? null,
|
||||||
|
'client_branch_id' => $batchFile['client_branch_id'] ?? null,
|
||||||
|
],
|
||||||
|
JSON_PRETTY_PRINT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'status' => false,
|
||||||
|
'message' => 'Unexpected error while generating correction upload file.',
|
||||||
|
'data' => [],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// not in use once all functionality workes well in this funciton then remvoe this function
|
// not in use once all functionality workes well in this funciton then remvoe this function
|
||||||
function compareDbWithTpa(array $db, array $tpaRows): array
|
function compareDbWithTpa(array $db, array $tpaRows): array
|
||||||
|
|||||||
@ -240,42 +240,57 @@ class FhplApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract claim status
|
// Extract claim status
|
||||||
$claimData = $response['data'][0];
|
// $claimData = $response['data'][0];
|
||||||
$tpa_claim_no = $claimData['CLAIM_ID'] ?? '';
|
$allClaimData = $response['data'];
|
||||||
$currentStatus = $claimData['CLAIM_STATUS'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['CLAIM_TYPE'] ?? '';
|
|
||||||
$tpa_ailments = $claimData['AILMENT'] ?? '';
|
|
||||||
|
|
||||||
$validStatuses = [
|
$currentStatus = "";
|
||||||
"In-Progress" => 5,
|
foreach ($allClaimData as $claimData) {
|
||||||
"Under Process" => 5,
|
|
||||||
"Query" => 4,
|
|
||||||
"Paid" => 11,
|
|
||||||
"Rejected" => 8,
|
|
||||||
"Approved" => 8,
|
|
||||||
"Required Information" => 4,
|
|
||||||
];
|
|
||||||
|
|
||||||
$updateArray = [
|
$tpa_claim_no = $claimData['CLAIM_ID'] ?? '';
|
||||||
'tpa_claim_status' => $currentStatus,
|
$currentStatus = $claimData['CLAIM_STATUS'] ?? '';
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
$tpa_claim_type = $claimData['CLAIM_TYPE'] ?? '';
|
||||||
];
|
$tpa_ailments = $claimData['AILMENT'] ?? '';
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
$doa = !empty($claimData['DATE_OF_ADMISSION'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $claimData['DATE_OF_ADMISSION']))) : null;
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
|
||||||
|
|
||||||
|
$validStatuses = [
|
||||||
|
"In-Progress" => 5,
|
||||||
|
"Under Process" => 5,
|
||||||
|
"Query" => 4,
|
||||||
|
"Paid" => 11,
|
||||||
|
"Rejected" => 8,
|
||||||
|
"Approved" => 8,
|
||||||
|
"Required Information" => 4,
|
||||||
|
];
|
||||||
|
|
||||||
|
$updateArray = [
|
||||||
|
'tpa_claim_status' => $currentStatus,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'last_updated_by' => 'API',
|
||||||
|
];
|
||||||
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_ailments)) {
|
||||||
|
$updateArray['tpa_ailments'] = $tpa_ailments;
|
||||||
|
}
|
||||||
|
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
||||||
|
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
||||||
|
$updateArray['claim_number'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ticket['doa'] == $doa || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
$this->db->table('ticket_master')->where('id',$claimId)->update($updateArray);
|
||||||
|
log_message('error', "FHPL - Claim status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||||
|
}else{
|
||||||
|
log_message('error', "FHPL - Claim status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$doa} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
if (!empty($tpa_ailments)) {
|
|
||||||
$updateArray['tpa_ailments'] = $tpa_ailments;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->db->table('ticket_master')->where('id',$claimId)->update($updateArray);
|
|
||||||
log_message('error', "FHPL - Claim status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
||||||
|
|
||||||
@ -1022,6 +1037,10 @@ class FhplApiController extends BaseController
|
|||||||
'tpa_id' => trim($row['TPA_TPADETAIL_ID'] ?? null),
|
'tpa_id' => trim($row['TPA_TPADETAIL_ID'] ?? null),
|
||||||
'age' => is_numeric($row['AGE'] ?? null) ? (int) $row['AGE'] : null,
|
'age' => is_numeric($row['AGE'] ?? null) ? (int) $row['AGE'] : null,
|
||||||
|
|
||||||
|
'si' => $row['BASE_SUMINSURED'] ?? null,
|
||||||
|
'doj' => !empty($row['DATE_OF_JOINING'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $row['DATE_OF_JOINING']))) : null,
|
||||||
|
|
||||||
|
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'created_by' => $file_info[0]['created_by'] ?? null,
|
'created_by' => $file_info[0]['created_by'] ?? null,
|
||||||
];
|
];
|
||||||
|
|||||||
@ -300,45 +300,59 @@ class HealthIndiaApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract claim status
|
// Extract claim status
|
||||||
$claimData = $response['data']['result'][0];
|
// $claimData = $response['data']['result'][0];
|
||||||
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
$allClaimData = $response['data']['result'];
|
||||||
$currentStatus = $claimData['claiM_STATUS'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
|
||||||
$tpa_ailments = $claimData['ailment'] ?? '';
|
|
||||||
|
|
||||||
$validStatuses = [
|
$currentStatus = "";
|
||||||
"In-Progress" => 5,
|
foreach ($allClaimData as $claimData) {
|
||||||
"Under Process" => 5,
|
|
||||||
"Query" => 4,
|
|
||||||
"Paid" => 11,
|
|
||||||
"Rejected" => 8,
|
|
||||||
"Approved" => 8,
|
|
||||||
"Required Information" => 4,
|
|
||||||
"Intimated and File NOT received" => 4,
|
|
||||||
];
|
|
||||||
|
|
||||||
$updateArray = [
|
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
||||||
'tpa_claim_status' => $currentStatus,
|
$currentStatus = $claimData['claiM_STATUS'] ?? '';
|
||||||
'tpa_claim_id' => $tpa_claim_no,
|
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
||||||
'claim_number' => $tpa_claim_no,
|
$tpa_ailments = $claimData['ailment'] ?? '';
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
$doa = !empty($claimData['datE_OF_ADMISSION'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $claimData['datE_OF_ADMISSION']))) : null;
|
||||||
];
|
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
$validStatuses = [
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
"In-Progress" => 5,
|
||||||
|
"Under Process" => 5,
|
||||||
|
"Query" => 4,
|
||||||
|
"Paid" => 11,
|
||||||
|
"Rejected" => 8,
|
||||||
|
"Approved" => 8,
|
||||||
|
"Required Information" => 4,
|
||||||
|
"Intimated and File NOT received" => 4,
|
||||||
|
];
|
||||||
|
|
||||||
|
$updateArray = [
|
||||||
|
'tpa_claim_status' => $currentStatus,
|
||||||
|
// 'tpa_claim_id' => $tpa_claim_no,
|
||||||
|
// 'claim_number' => $tpa_claim_no,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'last_updated_by' => 'API',
|
||||||
|
];
|
||||||
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_ailments)) {
|
||||||
|
$updateArray['tpa_ailments'] = $tpa_ailments;
|
||||||
|
}
|
||||||
|
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
||||||
|
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
||||||
|
$updateArray['claim_number'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ticket['doa'] == $doa || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
$this->db->table('ticket_master')->where('id',$claimId)->update($updateArray);
|
||||||
|
log_message('error', "HEALTH_INDIA - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||||
|
}else{
|
||||||
|
log_message('error', "HEALTH_INDIA - Claim status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$doa} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
if (!empty($tpa_ailments)) {
|
|
||||||
$updateArray['tpa_ailments'] = $tpa_ailments;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->db->table('ticket_master')->where('id',$claimId)->update($updateArray);
|
|
||||||
|
|
||||||
log_message('error', "HEALTH_INDIA - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'message' => 'Claim status updated.',
|
'message' => 'Claim status updated.',
|
||||||
@ -1067,6 +1081,9 @@ class HealthIndiaApiController extends BaseController
|
|||||||
'tpa_id' => trim($row['memberId'] ?? null),
|
'tpa_id' => trim($row['memberId'] ?? null),
|
||||||
'age' => is_numeric($row['age'] ?? null) ? (int) $row['age'] : null,
|
'age' => is_numeric($row['age'] ?? null) ? (int) $row['age'] : null,
|
||||||
|
|
||||||
|
'si' => $row['baseSumInsured'] ?? null,
|
||||||
|
'doj' => !empty($row['dateofPolicyJoining'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $row['dateofPolicyJoining']))) : null,
|
||||||
|
|
||||||
'is_active' => 1,
|
'is_active' => 1,
|
||||||
'created_by' => $file_info[0]['created_by'] ?? null,
|
'created_by' => $file_info[0]['created_by'] ?? null,
|
||||||
];
|
];
|
||||||
|
|||||||
@ -573,78 +573,89 @@ class MediAssistApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract Claim Status
|
// Extract Claim Status
|
||||||
$claimData = $response['data']['claimsData'][0];
|
$allClaimData = $response['data']['claimsData'];
|
||||||
$currentStatus = $claimData['claim_Current_Status'] ?? '';
|
|
||||||
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
|
||||||
$tpa_ailments = ($claimData['ailment'] ?? '') . ' - ' . ($claimData['ailmenT_DESC'] ?? '');
|
|
||||||
|
|
||||||
// VALID STATUS LIST
|
$currentStatus = "";
|
||||||
$validStatuses = [
|
foreach ($allClaimData as $claimData) {
|
||||||
"Claim Received" => 1,
|
|
||||||
"In Progress" => 5,
|
|
||||||
"Processed" => 11,
|
|
||||||
"Claim Paid" => 11,
|
|
||||||
"Denied" => 13,
|
|
||||||
"Cancelled" => 13,
|
|
||||||
|
|
||||||
"Information Awaited" => 4,
|
|
||||||
"Confirmation Awaited" => 4,
|
|
||||||
"Information Awaited Reminder" => 4,
|
|
||||||
"Information Awaited Final Reminder" => 4,
|
|
||||||
"Insurer Concurrence Awaited" => 6,
|
|
||||||
"Closed" => 12,
|
|
||||||
|
|
||||||
"Physical Documents Awaited" => 9,
|
|
||||||
"Processed - Payment Initiated" => 10,
|
|
||||||
"Processed - Transaction Failed" => 10,
|
|
||||||
"Processed - Account Details Updated" => 10,
|
|
||||||
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
|
||||||
"Processed - Payment Initiated by Insurer" => 10,
|
|
||||||
"Payment - Refunded to Insurer" => 14,
|
|
||||||
"Processed - Processing Payment" => 10,
|
|
||||||
"Processed - Physical Documents Awaited" => 9,
|
|
||||||
|
|
||||||
// Extra Mappings (based on your DB list)
|
|
||||||
"NON ID" => 1,
|
|
||||||
"ID NOT GENERATED" => 2,
|
|
||||||
"CDA" => 3,
|
|
||||||
"REJECTED" => 8,
|
|
||||||
"APPROVED" => 9,
|
|
||||||
"PAYMENT INITIATED" => 10,
|
|
||||||
"SETTLED" => 11,
|
|
||||||
"RETURNED" => 14,
|
|
||||||
"UNDER PROCESS - TPA" => 61,
|
|
||||||
"DENIAL REVIEW AWAITED" => 66,
|
|
||||||
];
|
|
||||||
|
|
||||||
$updateArray = [
|
$currentStatus = $claimData['claim_Current_Status'] ?? '';
|
||||||
'tpa_claim_status' => $currentStatus,
|
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
||||||
];
|
$tpa_ailments = ($claimData['ailment'] ?? '') . ' - ' . ($claimData['ailmenT_DESC'] ?? '');
|
||||||
|
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
// VALID STATUS LIST
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
$validStatuses = [
|
||||||
|
"Claim Received" => 1,
|
||||||
|
"In Progress" => 5,
|
||||||
|
"Processed" => 11,
|
||||||
|
"Claim Paid" => 11,
|
||||||
|
"Denied" => 13,
|
||||||
|
"Cancelled" => 13,
|
||||||
|
|
||||||
|
"Information Awaited" => 4,
|
||||||
|
"Confirmation Awaited" => 4,
|
||||||
|
"Information Awaited Reminder" => 4,
|
||||||
|
"Information Awaited Final Reminder" => 4,
|
||||||
|
"Insurer Concurrence Awaited" => 6,
|
||||||
|
"Closed" => 12,
|
||||||
|
|
||||||
|
"Physical Documents Awaited" => 9,
|
||||||
|
"Processed - Payment Initiated" => 10,
|
||||||
|
"Processed - Transaction Failed" => 10,
|
||||||
|
"Processed - Account Details Updated" => 10,
|
||||||
|
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||||
|
"Processed - Payment Initiated by Insurer" => 10,
|
||||||
|
"Payment - Refunded to Insurer" => 14,
|
||||||
|
"Processed - Processing Payment" => 10,
|
||||||
|
"Processed - Physical Documents Awaited" => 9,
|
||||||
|
|
||||||
|
// Extra Mappings (based on your DB list)
|
||||||
|
"NON ID" => 1,
|
||||||
|
"ID NOT GENERATED" => 2,
|
||||||
|
"CDA" => 3,
|
||||||
|
"REJECTED" => 8,
|
||||||
|
"APPROVED" => 9,
|
||||||
|
"PAYMENT INITIATED" => 10,
|
||||||
|
"SETTLED" => 11,
|
||||||
|
"RETURNED" => 14,
|
||||||
|
"UNDER PROCESS - TPA" => 61,
|
||||||
|
"DENIAL REVIEW AWAITED" => 66,
|
||||||
|
];
|
||||||
|
|
||||||
|
$updateArray = [
|
||||||
|
'tpa_claim_status' => $currentStatus,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'last_updated_by' => 'API',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
||||||
|
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
||||||
|
$updateArray['claim_number'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_ailments)) {
|
||||||
|
$updateArray['tpa_ailments'] = $tpa_ailments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if($ticket['doa'] == $this->mediDate($claimData['datE_OF_ADMISSION'] ?? null) || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
// UPDATE ticket_master
|
||||||
|
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||||
|
|
||||||
|
// LOG UPDATE
|
||||||
|
log_message('error',"MEDI_ASSIST - Claim Status SUCCESS | Updated ticket ID $claimId with Claim Status: $currentStatus");
|
||||||
|
}else{
|
||||||
|
log_message('error', "MEDI_ASSIST | Fetch Claim Status | Claim Status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$claimData['datE_OF_ADMISSION']} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
|
||||||
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
|
||||||
}
|
|
||||||
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
|
||||||
$updateArray['claim_number'] = $tpa_claim_no;
|
|
||||||
}
|
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
if (!empty($tpa_ailments)) {
|
|
||||||
$updateArray['tpa_ailments'] = $tpa_ailments;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// UPDATE ticket_master
|
|
||||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
|
||||||
|
|
||||||
// LOG UPDATE
|
|
||||||
log_message('error',"MEDI_ASSIST - Claim Status SUCCESS | Updated ticket ID $claimId with Claim Status: $currentStatus");
|
|
||||||
|
|
||||||
return ['status' => true,'message' => 'Claim Status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
return ['status' => true,'message' => 'Claim Status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
||||||
}
|
}
|
||||||
@ -796,6 +807,10 @@ class MediAssistApiController extends BaseController
|
|||||||
'gender' => strtoupper($row['benefSex'] ?? null),
|
'gender' => strtoupper($row['benefSex'] ?? null),
|
||||||
'self' => strtolower($row['relName'] ?? '') === 'self' ? 1 : 0,
|
'self' => strtolower($row['relName'] ?? '') === 'self' ? 1 : 0,
|
||||||
|
|
||||||
|
'si' => $row['sum_insured'] ?? null,
|
||||||
|
'doj' => $this->mediDate($row['benefWEF'] ?? null),
|
||||||
|
|
||||||
|
|
||||||
'tpa_id' => trim($row['benefMediAssistID'] ?? null),
|
'tpa_id' => trim($row['benefMediAssistID'] ?? null),
|
||||||
'age' => is_numeric($row['benefAge'] ?? null)
|
'age' => is_numeric($row['benefAge'] ?? null)
|
||||||
? (int) $row['benefAge']
|
? (int) $row['benefAge']
|
||||||
@ -890,6 +905,9 @@ class MediAssistApiController extends BaseController
|
|||||||
// CALL API
|
// CALL API
|
||||||
$response = call_third_party_api($url, $method, $headers, $body);
|
$response = call_third_party_api($url, $method, $headers, $body);
|
||||||
|
|
||||||
|
log_message('error','MEDI_ASSIST - 2 hours Claim Status API Response: ' . json_encode($response));
|
||||||
|
|
||||||
|
|
||||||
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
if ($response['status'] != true || empty($response['data']['claimsData'][0])) {
|
||||||
log_message('error','MEDI_ASSIST - Claim Status FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
log_message('error','MEDI_ASSIST - Claim Status FAILED | for ticket ID: ' . $claimId.' | response: '.json_encode($response));
|
||||||
$error_data[$claimId] = [
|
$error_data[$claimId] = [
|
||||||
@ -900,77 +918,94 @@ class MediAssistApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract Claim Status
|
// Extract Claim Status
|
||||||
$claimData = $response['data']['claimsData'][0];
|
// $allClaimData = $response['data']['claimsData'][0];
|
||||||
$currentStatus = $claimData['claim_Current_Status'] ?? '';
|
$allClaimData = $response['data']['claimsData'];
|
||||||
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
|
||||||
$tpa_ailments = ($claimData['ailment'] ?? '') . ' - ' . ($claimData['ailmenT_DESC'] ?? '');
|
|
||||||
|
|
||||||
// VALID STATUS LIST
|
|
||||||
$validStatuses = [
|
|
||||||
|
|
||||||
"Claim Received" => 1,
|
foreach ($allClaimData as $claimData) {
|
||||||
"In Progress" => 5,
|
|
||||||
"Processed" => 11,
|
$currentStatus = $claimData['claim_Current_Status'] ?? '';
|
||||||
"Claim Paid" => 11,
|
$tpa_claim_no = $claimData['tpA_CLAIM_NO'] ?? '';
|
||||||
"Denied" => 13,
|
$tpa_claim_type = $claimData['typE_OF_CLAIM'] ?? '';
|
||||||
"Cancelled" => 13,
|
$tpa_ailments = ($claimData['ailment'] ?? '') . ' - ' . ($claimData['ailmenT_DESC'] ?? '');
|
||||||
|
|
||||||
"Information Awaited" => 4,
|
|
||||||
"Confirmation Awaited" => 4,
|
|
||||||
"Information Awaited Reminder" => 4,
|
|
||||||
"Information Awaited Final Reminder" => 4,
|
|
||||||
"Insurer Concurrence Awaited" => 6,
|
|
||||||
"Closed" => 12,
|
|
||||||
|
|
||||||
"Physical Documents Awaited" => 9,
|
|
||||||
"Processed - Payment Initiated" => 10,
|
|
||||||
"Processed - Transaction Failed" => 10,
|
|
||||||
"Processed - Account Details Updated" => 10,
|
|
||||||
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
|
||||||
"Processed - Payment Initiated by Insurer" => 10,
|
|
||||||
"Payment - Refunded to Insurer" => 14,
|
|
||||||
"Processed - Processing Payment" => 10,
|
|
||||||
"Processed - Physical Documents Awaited" => 9,
|
|
||||||
|
|
||||||
// Extra Mappings (based on your DB list)
|
|
||||||
"NON ID" => 1,
|
|
||||||
"ID NOT GENERATED" => 2,
|
|
||||||
"CDA" => 3,
|
|
||||||
"REJECTED" => 8,
|
|
||||||
"APPROVED" => 9,
|
|
||||||
"PAYMENT INITIATED" => 10,
|
|
||||||
"SETTLED" => 11,
|
|
||||||
"RETURNED" => 14,
|
|
||||||
"UNDER PROCESS - TPA" => 61,
|
|
||||||
"DENIAL REVIEW AWAITED" => 66,
|
|
||||||
];
|
|
||||||
|
|
||||||
$updateArray = [
|
// VALID STATUS LIST
|
||||||
'tpa_claim_status' => $currentStatus,
|
$validStatuses = [
|
||||||
'tpa_claim_id' => $tpa_claim_no,
|
|
||||||
'claim_number' => $tpa_claim_no,
|
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
|
||||||
];
|
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
|
||||||
}
|
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
if (!empty($tpa_ailments)) {
|
|
||||||
$updateArray['tpa_ailments'] = $tpa_ailments;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UPDATE ticket_master
|
"Claim Received" => 1,
|
||||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
"In Progress" => 5,
|
||||||
$status_updated_count ++;
|
"Processed" => 11,
|
||||||
|
"Claim Paid" => 11,
|
||||||
// LOG UPDATE
|
"Denied" => 13,
|
||||||
log_message('error',"MEDI_ASSIST - Claim Status SUCCESS | Updated ticket ID $claimId with Claim Status: $currentStatus");
|
"Cancelled" => 13,
|
||||||
|
|
||||||
|
"Information Awaited" => 4,
|
||||||
|
"Confirmation Awaited" => 4,
|
||||||
|
"Information Awaited Reminder" => 4,
|
||||||
|
"Information Awaited Final Reminder" => 4,
|
||||||
|
"Insurer Concurrence Awaited" => 6,
|
||||||
|
"Closed" => 12,
|
||||||
|
|
||||||
|
"Physical Documents Awaited" => 9,
|
||||||
|
"Processed - Payment Initiated" => 10,
|
||||||
|
"Processed - Transaction Failed" => 10,
|
||||||
|
"Processed - Account Details Updated" => 10,
|
||||||
|
"Processed - Debit Note Raised With Insurer for Payment"=> 10,
|
||||||
|
"Processed - Payment Initiated by Insurer" => 10,
|
||||||
|
"Payment - Refunded to Insurer" => 14,
|
||||||
|
"Processed - Processing Payment" => 10,
|
||||||
|
"Processed - Physical Documents Awaited" => 9,
|
||||||
|
|
||||||
|
// Extra Mappings (based on your DB list)
|
||||||
|
"NON ID" => 1,
|
||||||
|
"ID NOT GENERATED" => 2,
|
||||||
|
"CDA" => 3,
|
||||||
|
"REJECTED" => 8,
|
||||||
|
"APPROVED" => 9,
|
||||||
|
"PAYMENT INITIATED" => 10,
|
||||||
|
"SETTLED" => 11,
|
||||||
|
"RETURNED" => 14,
|
||||||
|
"UNDER PROCESS - TPA" => 61,
|
||||||
|
"DENIAL REVIEW AWAITED" => 66,
|
||||||
|
];
|
||||||
|
|
||||||
|
$updateArray = [
|
||||||
|
'tpa_claim_status' => $currentStatus,
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'last_updated_by' => 'API',
|
||||||
|
];
|
||||||
|
|
||||||
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
||||||
|
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
||||||
|
$updateArray['claim_number'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
if (!empty($tpa_ailments)) {
|
||||||
|
$updateArray['tpa_ailments'] = $tpa_ailments;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ticket['doa'] == $this->mediDate($claimData['datE_OF_ADMISSION'] ?? null) || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
// UPDATE ticket_master
|
||||||
|
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||||
|
$status_updated_count ++;
|
||||||
|
|
||||||
|
// LOG UPDATE
|
||||||
|
log_message('error',"MEDI_ASSIST - Claim Status SUCCESS | Updated ticket ID $claimId with Claim Status: $currentStatus");
|
||||||
|
}else{
|
||||||
|
log_message('error', "MEDI_ASSIST | 2 hours | Claim Status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$claimData['datE_OF_ADMISSION']} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_message('error',"MEDI_ASSIST - Claim Status ENDED | 2 hours | Total Tickets={".count($TicketData)."} | Status Updated={$status_updated_count} | Errors={".count($error_data)."}");
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'message' => 'Claim Status updated.',
|
'message' => 'Claim Status updated.',
|
||||||
|
|||||||
@ -495,40 +495,52 @@ class VidalApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract claim status
|
// Extract claim status
|
||||||
$claimData = $response['data']['data']['claims'][0];
|
// $claimData = $response['data']['data']['claims'][0];
|
||||||
$tpa_claim_no = $claimData['claimNumber'] ?? '';
|
$allClaimData = $response['data']['data']['claims'];
|
||||||
$currentStatus = $claimData['status'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['claimType'] ?? '';
|
$currentStatus = "";
|
||||||
|
foreach ($allClaimData as $claimData) {
|
||||||
|
|
||||||
|
$tpa_claim_no = $claimData['claimNumber'] ?? '';
|
||||||
|
$currentStatus = $claimData['status'] ?? '';
|
||||||
|
$tpa_claim_type = $claimData['claimType'] ?? '';
|
||||||
|
$doa = !empty($claimData['doa'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $claimData['doa']))) : null;
|
||||||
|
|
||||||
|
|
||||||
// VALID STATUS LIST
|
|
||||||
$validStatuses = [
|
|
||||||
"In-Progress" => 5,
|
|
||||||
"Required Information" => 4,
|
|
||||||
"Paid" => 11,
|
|
||||||
"Rejected" => 8,
|
|
||||||
"Approved" => 8,
|
|
||||||
];
|
|
||||||
|
|
||||||
$updateArray = [
|
// VALID STATUS LIST
|
||||||
'tpa_claim_status' => $currentStatus,
|
$validStatuses = [
|
||||||
'tpa_claim_id' => $tpa_claim_no,
|
"In-Progress" => 5,
|
||||||
// 'claim_number' => $tpa_claim_no, // already updated
|
"Required Information" => 4,
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
"Paid" => 11,
|
||||||
];
|
"Rejected" => 8,
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
"Approved" => 8,
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
];
|
||||||
|
|
||||||
|
$updateArray = [
|
||||||
|
'tpa_claim_status' => $currentStatus,
|
||||||
|
'tpa_claim_id' => $tpa_claim_no,
|
||||||
|
// 'claim_number' => $tpa_claim_no, // already updated
|
||||||
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
|
'last_updated_by' => 'API',
|
||||||
|
];
|
||||||
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($ticket['doa'] == $doa || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
// UPDATE ticket_master
|
||||||
|
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||||
|
|
||||||
|
// LOG UPDATE
|
||||||
|
log_message('error', "VIDAL - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||||
|
}else{
|
||||||
|
log_message('error', "VIDAL - Claim Status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$doa} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// UPDATE ticket_master
|
|
||||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
|
||||||
|
|
||||||
// LOG UPDATE
|
|
||||||
log_message('error', "VIDAL - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
|
||||||
|
|
||||||
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
return ['status' => true,'message' => 'Claim status updated.','updated_status' => $currentStatus,'api_response' => $response];
|
||||||
}
|
}
|
||||||
@ -611,44 +623,62 @@ class VidalApiController extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Extract claim status
|
// Extract claim status
|
||||||
$claimData = $response['data']['data']['claims'][0];
|
// $claimData = $response['data']['data']['claims'][0];
|
||||||
$tpa_claim_no = $claimData['claimNumber'] ?? '';
|
$allClaimData = $response['data']['data']['claims'];
|
||||||
$currentStatus = $claimData['status'] ?? '';
|
|
||||||
$tpa_claim_type = $claimData['claimType'] ?? '';
|
foreach ($allClaimData as $claimData) {
|
||||||
|
|
||||||
|
$tpa_claim_no = $claimData['claimNumber'] ?? '';
|
||||||
|
$currentStatus = $claimData['status'] ?? '';
|
||||||
|
$tpa_claim_type = $claimData['claimType'] ?? '';
|
||||||
|
$doa = !empty($claimData['doa'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $claimData['doa']))) : null;
|
||||||
|
|
||||||
|
|
||||||
// VALID STATUS LIST
|
// VALID STATUS LIST
|
||||||
$validStatuses = [
|
$validStatuses = [
|
||||||
"In-Progress" => 5,
|
"In-Progress" => 5,
|
||||||
"Required Information" => 4,
|
"Required Information" => 4,
|
||||||
"Paid" => 11,
|
"Paid" => 11,
|
||||||
"Rejected" => 8,
|
"Rejected" => 8,
|
||||||
"Approved" => 8,
|
"Approved" => 8,
|
||||||
];
|
];
|
||||||
|
|
||||||
$updateArray = [
|
$updateArray = [
|
||||||
'tpa_claim_status' => $currentStatus,
|
'tpa_claim_status' => $currentStatus,
|
||||||
'tpa_claim_id' => $tpa_claim_no,
|
// 'claim_number' => $tpa_claim_no, // already updated
|
||||||
// 'claim_number' => $tpa_claim_no, // already updated
|
'updated_at' => date('Y-m-d H:i:s'),
|
||||||
'updated_at' => date('Y-m-d H:i:s'),
|
'last_updated_by' => 'API',
|
||||||
];
|
];
|
||||||
if (isset($validStatuses[$currentStatus])) {
|
|
||||||
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
if (isset($validStatuses[$currentStatus])) {
|
||||||
|
$updateArray['claim_status_id'] = $validStatuses[$currentStatus];
|
||||||
|
}
|
||||||
|
if (!empty($tpa_claim_type)) {
|
||||||
|
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
||||||
|
}
|
||||||
|
if (empty($ticket['tpa_claim_id']) || $ticket['tpa_claim_id'] === null) {
|
||||||
|
$updateArray['tpa_claim_id'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
if (empty($ticket['claim_number']) || $ticket['claim_number'] === null) {
|
||||||
|
$updateArray['claim_number'] = $tpa_claim_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UPDATE ticket_master
|
||||||
|
if($ticket['doa'] == $doa || $ticket['claim_number'] == $tpa_claim_no){
|
||||||
|
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
||||||
|
|
||||||
|
// LOG UPDATE
|
||||||
|
log_message('error', "VIDAL - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
||||||
|
$status_updated_count ++;
|
||||||
|
}else{
|
||||||
|
log_message('error', "VIDAL - Claim Status NOT UPDATED | TicketID={$claimId} | TicketDOA={$ticket['doa']} | ClaimDOA={$doa} | Status={$currentStatus}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!empty($tpa_claim_type)) {
|
|
||||||
$updateArray['tpa_claim_type'] = $tpa_claim_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UPDATE ticket_master
|
|
||||||
$this->db->table('ticket_master')->where('id', $claimId)->update($updateArray);
|
|
||||||
|
|
||||||
// LOG UPDATE
|
|
||||||
log_message('error', "VIDAL - Claim Status SUCCESS | Updated ticket ID $claimId with claim status: $currentStatus");
|
|
||||||
|
|
||||||
$status_updated_count ++;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_message('error', "VIDAL - Claim Status ENDED | Total Tickets={".count($TicketData)."} | Status Updated={$status_updated_count} | Errors={".count($error_data)."}");
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'status' => true,
|
'status' => true,
|
||||||
'message' => 'Claim status updated.',
|
'message' => 'Claim status updated.',
|
||||||
|
|||||||
@ -13,7 +13,67 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
.dataTables_length label {height: 21px !important;}
|
|
||||||
|
.dataTables_length label {
|
||||||
|
height: 21px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TPA variation modal layout */
|
||||||
|
#tpa_variation_modal .modal-dialog {
|
||||||
|
max-width: 95%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .modal-content {
|
||||||
|
max-height: 90vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .modal-body {
|
||||||
|
max-height: calc(85vh - 50px);
|
||||||
|
overflow-y: auto;
|
||||||
|
direction: ltr;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .table-responsive {
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal table {
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal table thead th,
|
||||||
|
#tpa_variation_modal table tbody td {
|
||||||
|
padding: 2px 6px;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tabs spacing & styling */
|
||||||
|
#tpa_variation_modal .nav-tabs {
|
||||||
|
border-bottom: 1px solid #dee2e6;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .nav-tabs .nav-item {
|
||||||
|
margin-right: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .nav-tabs .nav-link {
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tpa_variation_modal .nav-tabs .nav-link.active {
|
||||||
|
background-color: #f8f9fa;
|
||||||
|
border-color: #dee2e6 #dee2e6 transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Modal footer buttons size */
|
||||||
|
#tpa_variation_modal .modal-footer .btn {
|
||||||
|
padding: 4px 12px;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="col-12" id="second_page">
|
<div class="col-12" id="second_page">
|
||||||
@ -72,6 +132,7 @@
|
|||||||
<?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') ?> by <?php echo get_username($file['created_by']) ?>
|
<?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') ?> by <?php echo get_username($file['created_by']) ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php if ($file['status'] == 'failed') { ?>
|
<?php if ($file['status'] == 'failed') { ?>
|
||||||
<?php echo $file['status']; ?>
|
<?php echo $file['status']; ?>
|
||||||
@ -157,36 +218,39 @@
|
|||||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
|
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm"
|
||||||
data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||||
|
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<?php if($file['actions'] != 'export') { ?>
|
||||||
|
|
||||||
<?php if (str_starts_with($file['status'], 'failed')) { ?>
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
<a href="#"
|
|
||||||
data-id="<?= $file['id'] ?>"
|
|
||||||
data-client_id="<?= $file['client_id'] ?>"
|
|
||||||
data-client_policy_id="<?= $file['client_policy_id'] ?>"
|
|
||||||
data-insurer_or_tpa="<?= $file['insurer_or_tpa'] ?>"
|
|
||||||
data-event_type="<?= $file['event_type'] ?>"
|
|
||||||
data-actions="<?= $file['actions'] ?>"
|
|
||||||
data-client_branch_id="<?= $file['client_branch_id'] ?>"
|
|
||||||
data-issue_date="<?= $file['policy_issue_date'] ?>"
|
|
||||||
|
|
||||||
onclick="getBatchFileData(this)" class="dropdown-item upload_button" ><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
<?php if (str_starts_with($file['status'], 'failed')) { ?>
|
||||||
<?php } ?>
|
<a href="#"
|
||||||
|
data-id="<?= $file['id'] ?>"
|
||||||
|
data-client_id="<?= $file['client_id'] ?>"
|
||||||
|
data-client_policy_id="<?= $file['client_policy_id'] ?>"
|
||||||
|
data-insurer_or_tpa="<?= $file['insurer_or_tpa'] ?>"
|
||||||
|
data-event_type="<?= $file['event_type'] ?>"
|
||||||
|
data-actions="<?= $file['actions'] ?>"
|
||||||
|
data-client_branch_id="<?= $file['client_branch_id'] ?>"
|
||||||
|
data-issue_date="<?= $file['policy_issue_date'] ?>"
|
||||||
|
|
||||||
<?php if ($file['actions'] == "import") { ?>
|
onclick="getBatchFileData(this)" class="dropdown-item upload_button" ><i class="mdi mdi-upload mr-2 text-muted font-18 vertical-middle"></i>Re-Upload</a>
|
||||||
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
<?php } ?>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<?php if ($file['actions'] == "fetch" && $file['status'] == 'partially success') { ?>
|
<?php if ($file['actions'] == "import") { ?>
|
||||||
<a href="<?= base_url('employee/getTPADataVariationReport/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download TPA Variation report</a>
|
<a href="<?= base_url('/util/download_import_file/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($file['actions'] == "fetch" && $file['status'] == 'partially success') { ?>
|
||||||
<?php } ?>
|
<a href="<?= base_url('employee/getTPADataVariationReport/') . $file['id'] ?>" class="dropdown-item" style="color: #000;" aria-hidden="true" target="_blank" ><i class="mdi mdi-download mr-2 text-muted font-18 vertical-middle"></i>Download TPA Variation report</a>
|
||||||
|
<a href="#" class="dropdown-item" style="color: #000;" aria-hidden="true" onclick="getTPADataVariationReport(<?= $file['id'] ?>)"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View TPA Variation report</a>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<?php }
|
<?php }
|
||||||
} ?>
|
} ?>
|
||||||
@ -228,10 +292,252 @@
|
|||||||
</div><!-- /.modal-dialog -->
|
</div><!-- /.modal-dialog -->
|
||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
|
<!-- TPA Data Variation Modal -->
|
||||||
|
<div class="modal fade" id="tpa_variation_modal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-xl modal-dialog-centered">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h4 class="modal-title">TPA Data Variation Report</h4>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<ul class="nav nav-tabs" id="tpaVariationTabs" role="tablist">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link active" id="not-in-nhance-tab" data-toggle="tab" href="#not_in_nhance_tab" role="tab" aria-controls="not_in_nhance_tab" aria-selected="true">Not in Nhance</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="not-in-tpa-tab" data-toggle="tab" href="#not_in_tpa_tab" role="tab" aria-controls="not_in_tpa_tab" aria-selected="false">Not in TPA</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" id="need-to-review-tab" data-toggle="tab" href="#need_to_review_tab" role="tab" aria-controls="need_to_review_tab" aria-selected="false">Need to Review</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content pt-3" id="tpaVariationTabContent">
|
||||||
|
<div class="tab-pane fade show active" id="not_in_nhance_tab" role="tabpanel" aria-labelledby="not-in-nhance-tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-sm" id="not_in_nhance_table">
|
||||||
|
<thead></thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="not_in_tpa_tab" role="tabpanel" aria-labelledby="not-in-tpa-tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-sm" id="not_in_tpa_table">
|
||||||
|
<thead></thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="need_to_review_tab" role="tabpanel" aria-labelledby="need-to-review-tab">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-bordered table-sm" id="need_to_review_table">
|
||||||
|
<thead></thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" id="tpaProceedButton" class="btn btn-primary btn-sm" onclick="handleTPAProceed()">Proceed</button>
|
||||||
|
</div>
|
||||||
|
</div><!-- /.modal-content -->
|
||||||
|
</div><!-- /.modal-dialog -->
|
||||||
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
let currentTPAVariationFileId = null;
|
||||||
|
|
||||||
|
const tpaVariationColumns = {
|
||||||
|
not_in_nhance: [
|
||||||
|
{ key: 'emp_code', label: 'Employee Code' },
|
||||||
|
{ key: 'name', label: 'Employee Name' },
|
||||||
|
{ key: 'relation', label: 'Relation' },
|
||||||
|
{ key: 'dob', label: 'Date of Birth' },
|
||||||
|
{ key: 'gender', label: 'Gender' },
|
||||||
|
{ key: 'age', label: 'Age' },
|
||||||
|
{ key: 'tpa_id', label: 'TPA Member ID' },
|
||||||
|
],
|
||||||
|
not_in_tpa: [
|
||||||
|
{ key: 'emp_code', label: 'Employee Code' },
|
||||||
|
{ key: 'name', label: 'Employee Name' },
|
||||||
|
{ key: 'relationship', label: 'Relation' },
|
||||||
|
{ key: 'dob', label: 'Date of Birth' },
|
||||||
|
{ key: 'gender', label: 'Gender' },
|
||||||
|
{ key: 'mobile', label: 'Mobile No' },
|
||||||
|
{ key: 'email_corporate', label: 'Corporate Email' },
|
||||||
|
{ key: 'policy_no', label: 'Policy No' },
|
||||||
|
{ key: 'tpa_name', label: 'TPA Name' },
|
||||||
|
{ key: 'change_event', label: 'Change Event' },
|
||||||
|
],
|
||||||
|
need_to_review: [
|
||||||
|
// DB side
|
||||||
|
{ key: 'emp_code', label: 'Employee Code' },
|
||||||
|
{ key: 'name', label: 'Employee Name' },
|
||||||
|
{ key: 'relationship', label: 'Relation' },
|
||||||
|
{ key: 'dob', label: 'Date of Birth' },
|
||||||
|
{ key: 'gender', label: 'Gender' },
|
||||||
|
{ key: 'policy_no', label: 'Policy No' },
|
||||||
|
{ key: 'uhid', label: 'UHID' },
|
||||||
|
{ key: 'change_event', label: 'Change Event' },
|
||||||
|
// TPA side
|
||||||
|
{ key: 'tpa_emp_code', label: 'TPA Employee Code' },
|
||||||
|
{ key: 'tpa_name', label: 'TPA Name' },
|
||||||
|
{ key: 'tpa_relation', label: 'TPA Relation' },
|
||||||
|
{ key: 'tpa_dob', label: 'TPA Date of Birth' },
|
||||||
|
{ key: 'tpa_gender', label: 'TPA Gender' },
|
||||||
|
{ key: 'tpa_tpa_id', label: 'TPA Member ID' },
|
||||||
|
{ key: 'tpa_age', label: 'TPA Age' },
|
||||||
|
// Mismatch info
|
||||||
|
{ key: 'mismatch_fields', label: 'Mismatch Fields' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
function renderVariationTable(tableSelector, rows, columns) {
|
||||||
|
const $table = $(tableSelector);
|
||||||
|
const $thead = $table.find('thead');
|
||||||
|
const $tbody = $table.find('tbody');
|
||||||
|
|
||||||
|
$thead.empty();
|
||||||
|
$tbody.empty();
|
||||||
|
|
||||||
|
const headerRow = $('<tr></tr>');
|
||||||
|
columns.forEach(col => {
|
||||||
|
headerRow.append($('<th></th>').text(col.label));
|
||||||
|
});
|
||||||
|
$thead.append(headerRow);
|
||||||
|
|
||||||
|
if (!rows || !rows.length) {
|
||||||
|
const emptyRow = $('<tr></tr>');
|
||||||
|
columns.forEach((col, index) => {
|
||||||
|
const td = $('<td></td>');
|
||||||
|
if (index === 0) {
|
||||||
|
td.addClass('text-center text-muted').text('No data found');
|
||||||
|
}
|
||||||
|
emptyRow.append(td);
|
||||||
|
});
|
||||||
|
$tbody.append(emptyRow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
const tr = $('<tr></tr>');
|
||||||
|
columns.forEach(col => {
|
||||||
|
let value = row[col.key];
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
value = '';
|
||||||
|
}
|
||||||
|
tr.append($('<td></td>').text(value));
|
||||||
|
});
|
||||||
|
$tbody.append(tr);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateTPAVariationModal(data) {
|
||||||
|
const notInNhance = data.not_in_nhance || [];
|
||||||
|
const notInTpa = data.not_in_tpa || [];
|
||||||
|
const reviewData = (data.mismatch_data || []).map(row => {
|
||||||
|
let mismatchFields = '';
|
||||||
|
const match = row.match || {};
|
||||||
|
|
||||||
|
const notMatching = match.not_matching || [];
|
||||||
|
if (Array.isArray(notMatching) && notMatching.length) {
|
||||||
|
mismatchFields = notMatching.join(', ');
|
||||||
|
} else if (match.status && match.status !== 'matched') {
|
||||||
|
mismatchFields = match.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tpaRecord = match.tpa_record || {};
|
||||||
|
|
||||||
|
return Object.assign({}, row, {
|
||||||
|
mismatch_fields: mismatchFields,
|
||||||
|
tpa_emp_code: tpaRecord.emp_code || '',
|
||||||
|
tpa_name: tpaRecord.name || '',
|
||||||
|
tpa_relation: tpaRecord.relation || '',
|
||||||
|
tpa_dob: tpaRecord.dob || '',
|
||||||
|
tpa_gender: tpaRecord.gender || '',
|
||||||
|
tpa_tpa_id: tpaRecord.tpa_id || '',
|
||||||
|
tpa_age: tpaRecord.age || '',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
destroyVariationDataTable('#not_in_nhance_table');
|
||||||
|
destroyVariationDataTable('#not_in_tpa_table');
|
||||||
|
destroyVariationDataTable('#need_to_review_table');
|
||||||
|
|
||||||
|
renderVariationTable('#not_in_nhance_table', notInNhance, tpaVariationColumns.not_in_nhance);
|
||||||
|
renderVariationTable('#not_in_tpa_table', notInTpa, tpaVariationColumns.not_in_tpa);
|
||||||
|
renderVariationTable('#need_to_review_table', reviewData, tpaVariationColumns.need_to_review);
|
||||||
|
|
||||||
|
initVariationDataTable('#not_in_nhance_table');
|
||||||
|
initVariationDataTable('#not_in_tpa_table');
|
||||||
|
initVariationDataTable('#need_to_review_table');
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTPAVariationModal() {
|
||||||
|
const modalElement = document.getElementById('tpa_variation_modal');
|
||||||
|
if (!modalElement) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const modal = new bootstrap.Modal(modalElement);
|
||||||
|
modal.show();
|
||||||
|
// Ensure proceed button reflects the currently active tab when modal opens
|
||||||
|
const $activeTab = $('#tpaVariationTabs .nav-link.active');
|
||||||
|
updateTPAProceedButton($activeTab.attr('id'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function initVariationDataTable(tableSelector) {
|
||||||
|
const $table = $(tableSelector);
|
||||||
|
|
||||||
|
$table.DataTable({
|
||||||
|
pageLength: 20,
|
||||||
|
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
||||||
|
searching: true,
|
||||||
|
paging: true,
|
||||||
|
ordering: false,
|
||||||
|
info: true,
|
||||||
|
autoWidth: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function destroyVariationDataTable(tableSelector) {
|
||||||
|
const $table = $(tableSelector);
|
||||||
|
if ($.fn.DataTable.isDataTable($table)) {
|
||||||
|
$table.DataTable().clear().destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateTPAProceedButton(activeId) {
|
||||||
|
const $button = $('#tpaProceedButton');
|
||||||
|
if (!$button.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default: visible
|
||||||
|
$button.removeClass('d-none');
|
||||||
|
|
||||||
|
if (activeId === 'not-in-nhance-tab') {
|
||||||
|
$button.text('Proceed - Not in Nhance');
|
||||||
|
} else if (activeId === 'need-to-review-tab') {
|
||||||
|
$button.text('Proceed - Need to Review');
|
||||||
|
} else if (activeId === 'not-in-tpa-tab') {
|
||||||
|
// Hide button for "Not in TPA" section
|
||||||
|
$button.addClass('d-none');
|
||||||
|
} else {
|
||||||
|
$button.text('Proceed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// Update proceed button label/visibility on tab change
|
||||||
|
$('#tpaVariationTabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
||||||
|
const activeId = $(e.target).attr('id');
|
||||||
|
updateTPAProceedButton(activeId);
|
||||||
|
});
|
||||||
|
|
||||||
$('#datatable-buttons').DataTable({
|
$('#datatable-buttons').DataTable({
|
||||||
// dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
// dom: "<'row'<'col-12 d-flex justify-content-between align-items-center'<'datatable-search dataTables_filter'f><'datatable-buttons dt-buttons'B>>>" +
|
||||||
// "<'row'<'col-sm-12'tr>>" +
|
// "<'row'<'col-sm-12'tr>>" +
|
||||||
@ -281,7 +587,6 @@
|
|||||||
paging: true
|
paging: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Function to format a number in Indian Rupees format
|
// Function to format a number in Indian Rupees format
|
||||||
@ -393,5 +698,109 @@
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTPADataVariationReport(file_id) {
|
||||||
|
|
||||||
|
currentTPAVariationFileId = file_id;
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
let url = '<?= base_url('employee/getTPADataVariationReportView') ?>/' + file_id;
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', {}, function (response) {
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if (response && response.status && response.data) {
|
||||||
|
populateTPAVariationModal(response.data);
|
||||||
|
showTPAVariationModal();
|
||||||
|
} else {
|
||||||
|
toastr.warning((response && response.message) || 'No data found for variation report.', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function (xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
console.error('Error fetching TPA variation data:', error);
|
||||||
|
toastr.error('An error occurred while fetching the variation report.', 'ERROR');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceedTPADataVariationNextStep(tabKey) {
|
||||||
|
if (!currentTPAVariationFileId) {
|
||||||
|
toastr.warning('Unable to identify the selected file.', 'WARNING');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
const url = '<?= base_url('employee/proceedTPADataVariationNextStep') ?>/' + currentTPAVariationFileId + '?tab=' + encodeURIComponent(tabKey);
|
||||||
|
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', {}, function (response) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
if (response && response.status) {
|
||||||
|
toastr.success(response.message || 'Proceed to next step initiated successfully.', 'SUCCESS');
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.message || 'Unable to proceed to next step.', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.reload();
|
||||||
|
|
||||||
|
}, function (xhr, status, error) {
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
toastr.error('An error occurred while proceeding to the next step.', 'ERROR');
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceedNotInNhance() {
|
||||||
|
proceedTPADataVariationNextStep('not_in_nhance');
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceedNotInTPA() {
|
||||||
|
proceedTPADataVariationNextStep('not_in_tpa');
|
||||||
|
}
|
||||||
|
|
||||||
|
function proceedNeedToReview() {
|
||||||
|
proceedTPADataVariationNextStep('need_to_review');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleTPAProceed() {
|
||||||
|
const $activeTab = $('#tpaVariationTabs .nav-link.active');
|
||||||
|
const activeId = $activeTab.attr('id');
|
||||||
|
|
||||||
|
if (!activeId) {
|
||||||
|
toastr.warning('No active tab selected.', 'WARNING');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tabLabel = ($activeTab.text() || '').trim() || 'this tab';
|
||||||
|
|
||||||
|
confirmActionSweertAlert(
|
||||||
|
"Are you sure you want to proceed with the data in this tab?",
|
||||||
|
"Yes, Proceed",
|
||||||
|
"Cancel",
|
||||||
|
"warning"
|
||||||
|
).then(function(isConfirmed) {
|
||||||
|
if (!isConfirmed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeId === 'not-in-nhance-tab') {
|
||||||
|
proceedNotInNhance();
|
||||||
|
} else if (activeId === 'not-in-tpa-tab') {
|
||||||
|
proceedNotInTPA();
|
||||||
|
} else if (activeId === 'need-to-review-tab') {
|
||||||
|
proceedNeedToReview();
|
||||||
|
} else {
|
||||||
|
toastr.warning('Unknown tab selected.', 'WARNING');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user