Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
sanjeev.p 2026-05-05 12:20:27 +05:30
commit 217ada5156
7 changed files with 132 additions and 26 deletions

View File

@ -73,11 +73,11 @@ class AppContentManagementController extends AdminController
]
],
'client_id' => [
'rules' => 'required|integer|is_natural_no_zero',
'rules' => 'required|integer|is_natural',
'errors' => [
'required' => 'Client is required',
'integer' => 'Invalid client selected',
'is_natural_no_zero' => 'Invalid client selected'
'required' => 'Client is required',
'integer' => 'Invalid client selected',
'is_natural' => 'Invalid client selected',
]
],
'advertise_image' => [
@ -85,15 +85,13 @@ class AppContentManagementController extends AdminController
. 'is_image[advertise_image]'
. '|mime_in[advertise_image,image/jpg,image/jpeg,image/png]'
. '|max_size[advertise_image,200]'
. '|min_dims[advertise_image,1640,664]'
. '|max_dims[advertise_image,1640,664]',
'errors' => [
'uploaded' => 'Image is required',
'is_image' => 'File must be an image',
'mime_in' => 'Only JPG, JPEG, PNG allowed',
'max_size' => 'Image size must not exceed 200 KB',
'min_dims' => 'Image dimensions must be exactly 1640x664 pixels',
'max_dims' => 'Image dimensions must be exactly 1640x664 pixels',
'max_dims' => 'Image dimensions must not exceed 1640x664 pixels',
]
],
];
@ -110,9 +108,11 @@ class AppContentManagementController extends AdminController
$file = $this->request->getFile('advertise_image');
$client_id = (int)($sanitized_post_data['client_id'] ?? 0);
$clientExists = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
if (!$clientExists) {
return $this->respond(['status' => false, 'message' => 'Invalid client selected.'], 400);
if ($client_id !== 0) {
$clientExists = $this->clientModel->where('id', $client_id)->where('is_active', 1)->first();
if (!$clientExists) {
return $this->respond(['status' => false, 'message' => 'Invalid client selected.'], 400);
}
}
if (!$file || !$file->isValid()) {
@ -123,6 +123,11 @@ class AppContentManagementController extends AdminController
return $this->respond(['status' => false, 'message' => 'Only JPG, JPEG, PNG files are allowed.'], 400);
}
$dimInfo = @getimagesize($file->getTempName());
if ($dimInfo === false || (int) $dimInfo[0] !== 1640 || (int) $dimInfo[1] !== 664) {
return $this->respond(['status' => false, 'message' => 'Image dimensions must be exactly 1640x664 pixels.'], 400);
}
$fileName = sanitize_upload_filename($file->getClientName());
$existing = $this->addImgModel->where('name', $fileName)->where('client_id', $client_id)->where('is_active', 1)->first();
if($existing){ return $this->respond(['status' => false, 'message' => 'This file has already been uploaded in active state.'], 400); }

View File

@ -497,6 +497,7 @@ class EmployeeController extends AdminController
batch_files.is_active,
batch_files.amount,
batch_files.status,
batch_files.icici_status_flag,
batch_files.client_branch_id,
insurers.short_name as insurer_short_name,
tpa.short_name as tpa_short_name,
@ -4367,10 +4368,55 @@ class EmployeeController extends AdminController
$not_in_tpa = $this->employeePolicyModel->getTPADataVariationReport($client_id, $client_policy_id, $file_id, $tpa_emp_codes);
if (!empty($not_in_tpa) || !empty($not_in_nhance) || !empty($emp_data_wo_tpa_id)) {
$not_in_nhance_button_enable_status = false;
if(count($not_in_tpa))
{
foreach($not_in_nhance as $nih)
{
if($nih['ref'] === '' || empty($nih['ref']))
{
$not_in_nhance_button_enable_status = true;
break;
}
}
}
$not_in_nhance_inception_count = 0;
$not_in_nhance_deletion_count = 0;
foreach ($not_in_nhance as $nih) {
$hasRefKey = array_key_exists('ref', $nih);
$ref = $hasRefKey ? $nih['ref'] : null;
// Empty/null ref: no key, NULL, '', or whitespace-only string.
$refIsEmpty = !$hasRefKey
|| $ref === null
|| $ref === ''
|| (is_string($ref) && trim($ref) === '');
$actionIsDeletion = strtoupper(trim((string) ($nih['action_flag_status'] ?? ''))) === 'D';
// Every empty/null ref row counts as inception; those that also have flag D additionally count as deletion.
if ($refIsEmpty) {
$not_in_nhance_inception_count++;
if ($actionIsDeletion) {
$not_in_nhance_deletion_count++;
}
}
}
$not_in_nhance_proceed_button_text = sprintf(
'Proceed - Inception(%d) + Deletion(%d)',
$not_in_nhance_inception_count,
$not_in_nhance_deletion_count
);
$response = [
'not_in_tpa' => $not_in_tpa,
'not_in_nhance' => $not_in_nhance,
'mismatch_data' => $emp_data_wo_tpa_id,
'not_in_nhance_button_enable_status' => $not_in_nhance_button_enable_status,
'not_in_nhance_inception_count' => $not_in_nhance_inception_count,
'not_in_nhance_deletion_count' => $not_in_nhance_deletion_count,
'not_in_nhance_proceed_button_text' => $not_in_nhance_proceed_button_text,
];
if ($type === 'view') {
@ -4447,10 +4493,10 @@ class EmployeeController extends AdminController
{
if($generationResult['data']['file_id'])
{
sleep(1);
// sleep(1);
//initiate update references b/w tpa_api_data and employess (pk update)
// $this->reconTpaApiDataWithEmployeepolicies(['file_id' => $file_id]);
sleep(1);
// sleep(1);
//initiate deleteion if any
// $this->initializeDeletionProcessForTpaApiData(['file_id' => $file_id]);

View File

@ -1069,6 +1069,11 @@ class FhplApiController extends BaseController
'is_active' => 1,
'created_by' => $file_info[0]['created_by'] ?? null,
'action_flag_status' => $row['IsActive'] == 1 ? 'A' : 'D'
'si' => $row['BASE_SUMINSURED'],
'doj' => change_date_format($row['DATE_OF_JOINING'],'Y-m-d\TH:i:s'),
'endorsement_no' => $row['ENDORSEMENT_NO']
// 'date_of_exit' => $row['DATE_OF_RESIGN_FROM_POLICY']
];
}

View File

@ -1092,7 +1092,10 @@ class HealthIndiaApiController extends BaseController
'is_active' => 1,
'created_by' => $file_info[0]['created_by'] ?? null,
'action_flag_status' => $row['insuredStatus'] == 'Active' ? 'A' : 'D'
'action_flag_status' => $row['insuredStatus'] == 'Active' ? 'A' : 'D',
'doj' => change_date_format($row['doj'],),
'si' => $row['baseSumInsured'],
'endorsement_no' => $row['endorsementNumber']
];
}
// log_message('error','HEALTH_INDIA - COUNT' . count($mappedRows));

View File

@ -661,6 +661,13 @@ if (! function_exists('change_date_format')) {
$date_str = trim($date_str);
// Allowed date formats
$allowed_formats = [
// ISO 8601 datetime (must come before plain Y-m-d to avoid partial match issues)
'Y-m-d\TH:i:sP', // 2025-07-26T00:00:00+05:30
'Y-m-d\TH:i:s\Z', // 2025-07-26T00:00:00Z
'Y-m-d\TH:i:s', // 2025-07-26T00:00:00
// Day Month Year (clear unambiguous formats)
'd M Y', // 01 Dec 2024
'd-M-Y', // 01-Dec-2024

View File

@ -61,6 +61,11 @@ for ($i = 0; $i < $batch_col_count; $i++) {
cursor: pointer;
}
/* Allow line breaks in tooltip titles using \n */
.tooltip-inner {
white-space: pre-line;
}
/* Column widths from max data length (see PHP above).
Avoid table-layout:fixed + identical max-width on TH it fights DataTables col sizing and skews TH vs TD.
Do not max-width THEAD cells (sort icons use position:absolute; narrow max clips them). */
@ -289,15 +294,32 @@ for ($i = 0; $i < $batch_col_count; $i++) {
<td><?php echo $file['event_type'] ?></td>
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?>
<?php $insurer_or_tpa_display = $insurer_or_tpa[$file['insurer_or_tpa']] == 'TPA' ? $file['tpa_short_name'] : $file['insurer_short_name'] ?>
<a href=""
class="fe-alert-circle" style="color: #000;" aria-hidden="true"
data-toggle="tooltip" data-placement="top" title="<?php echo $insurer_or_tpa_display ?>"></a>
<?php $insurer_or_tpa_display = $insurer_or_tpa[$file['insurer_or_tpa']] == 'TPA' ? $file['tpa_short_name'] : $file['insurer_short_name'] ?>
<a href="#" class="fe-alert-circle" style="color: #000;" aria-hidden="true" data-toggle="tooltip" data-placement="top" title="<?php echo $insurer_or_tpa_display ?>"></a>
</td>
<td>
<?php echo $import_or_export[$file['actions']] ?? ucfirst($file['actions']); ?>
<?php if ($file['actions'] == 'push'): ?>
<?php $tpa_push_status = $file['icici_status_flag']; ?>
<?php
$tooltipText = $insurer_or_tpa_display . ' TPA Push Status: ' . ($tpa_push_status ?? 'N/A');
$tooltipText .= "\n\n\nNote: TPA ID can be fetched only after the TPA push status is completed.";
?>
<a href="#"
class="fe-alert-circle"
style="color: #000;"
aria-hidden="true"
data-toggle="tooltip"
data-placement="top"
title="<?php echo htmlspecialchars($tooltipText, ENT_QUOTES, 'UTF-8'); ?>">
</a>
<?php endif; ?>
</td>
<td><?php echo $import_or_export[$file['actions']] ?? ucfirst($file['actions']) ?></td>
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
<td><?php echo format_indian_number($file['amount'])?></td>
@ -522,6 +544,10 @@ for ($i = 0; $i < $batch_col_count; $i++) {
<script>
let currentTPAVariationFileId = null;
/** From API `not_in_nhance_button_enable_status` — when false, Proceed is disabled on "Not in Nhance" tab. */
let tpaNotInNhanceProceedEnabled = true;
/** From API `not_in_nhance_proceed_button_text` — label for Proceed on "Not in Nhance" tab. */
let tpaNotInNhanceProceedButtonText = 'Proceed - Not in Nhance';
const tpaVariationColumns = {
not_in_nhance: [
@ -661,7 +687,13 @@ for ($i = 0; $i < $batch_col_count; $i++) {
renderVariationTable('#not_in_tpa_table', notInTpa, tpaVariationColumns.not_in_tpa);
renderVariationTable('#need_to_review_table', reviewData, tpaVariationColumns.need_to_review);
// Default tab: Not in Nhance — select tab and init DataTable for #not_in_nhance_table as soon as data is rendered.
tpaNotInNhanceProceedEnabled = data.not_in_nhance_button_enable_status !== false;
if (typeof data.not_in_nhance_proceed_button_text === 'string' && data.not_in_nhance_proceed_button_text.trim() !== '') {
tpaNotInNhanceProceedButtonText = data.not_in_nhance_proceed_button_text.trim();
} else {
tpaNotInNhanceProceedButtonText = 'Proceed - Not in Nhance';
}
showTPAVariationTabByLinkId('not-in-nhance-tab');
updateTPAProceedButton('not-in-nhance-tab');
adjustVariationTableByTabId('not-in-nhance-tab');
@ -773,15 +805,17 @@ for ($i = 0; $i < $batch_col_count; $i++) {
return;
}
// Default: visible
$button.removeClass('d-none');
$button.prop('disabled', false);
if (activeId === 'not-in-nhance-tab') {
$button.text('Proceed - Not in Nhance');
$button.text(tpaNotInNhanceProceedButtonText);
if (!tpaNotInNhanceProceedEnabled) {
$button.prop('disabled', true);
}
} 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');
@ -798,7 +832,6 @@ for ($i = 0; $i < $batch_col_count; $i++) {
});
$('#tpa_variation_modal').on('shown.bs.modal', function () {
// Always show "Not in Nhance" first; re-measure DataTable now that the modal is visible.
showTPAVariationTabByLinkId('not-in-nhance-tab');
updateTPAProceedButton('not-in-nhance-tab');
adjustVariationTableByTabId('not-in-nhance-tab');
@ -808,6 +841,9 @@ for ($i = 0; $i < $batch_col_count; $i++) {
destroyVariationDataTable('#not_in_nhance_table');
destroyVariationDataTable('#not_in_tpa_table');
destroyVariationDataTable('#need_to_review_table');
tpaNotInNhanceProceedEnabled = true;
tpaNotInNhanceProceedButtonText = 'Proceed - Not in Nhance';
$('#tpaProceedButton').prop('disabled', false);
});
/* footer.php sets scrollX/scrollY on $.fn.dataTable.defaults — force off for this init so DT does not split thead into .dataTables_scrollHead / tbody into .dataTables_scrollBody (only the body strip would scroll horizontally). */
@ -1111,6 +1147,10 @@ for ($i = 0; $i < $batch_col_count; $i++) {
}
if (activeId === 'not-in-nhance-tab') {
if (!tpaNotInNhanceProceedEnabled) {
toastr.warning('Proceed is not available for this tab.', 'WARNING');
return;
}
proceedNotInNhance();
} else if (activeId === 'not-in-tpa-tab') {
proceedNotInTPA();

View File

@ -251,7 +251,7 @@ input:checked + .slider_blue::before {
<div class="form-group col-md-4">
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" oninput="checkPolicyNo(this)" placeholder="Enter Policy Number" name="policy_no" id="policy_no" required
data-parsley-pattern="^[a-zA-Z0-9\\s_\\-/\\\\]+$"
data-parsley-pattern="^[a-zA-Z0-9\\s_/\\\\-]+$"
data-parsley-pattern-message="Invalid characters in Policy No.">
</div>
</div>