Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2026-06-02 14:26:35 +05:30
commit 172b4f429c
35 changed files with 825 additions and 231 deletions

View File

@ -50,6 +50,7 @@ $routes->get("updatajson", "EmpDataServiceController::updatajson");
$routes->get("view", "EmployeeController::viewECard/$1");
$routes->get("checkWellnessOnboardStatus/(:any)", "EmployeeController::checkWellnessOnboardStatus/$1");
$routes->get("initiateWellnessOnboard/(:any)", "EmployeeController::initiateWellnessOnboard/$1");
$routes->get("resetWellnessOnboard/(:any)", "EmployeeController::resetWellnessOnboard/$1");
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
$routes->get("testMailAttachments", "ClientController::testMailAttachments");
$routes->get("updatePolicyTermsKey", "ClientController::updatePolicyTermsKey");

View File

@ -6652,7 +6652,7 @@ class ClientController extends AdminController
// Check in Enrollment (client_policy)
$client_policy_data = $this->clientPolicyModel
->where('is_active', 1)
->where('policy_status', 1)
// ->where('policy_status', 1)
->where('TRIM(policy_no)', $policy_no)
->first();
@ -7312,6 +7312,8 @@ class ClientController extends AdminController
// dd($res);
$employeeController = new EmployeeController();
// $payload = json_decode('{"client_policy_id":"6272"}', true);
// $response = $employeeController->initiateWellnessOnboardJob($payload); dd($response);
// $response = $employeeController->getEmployeeEcardFromTmpFolderAndZipToS3(json_decode('{"batch_no":2,"last_emp_policy_id":"13218","folder_name":"bulk_ecards_IOCL-77448855996699885555_2026-02-05_09-32-22","processed_in_this_batch_data_count":7,"pdf_count":0,"hr_id":"1"}', true));
// $response = $employeeController->bulkEcardDownloadAsZipFromS3(json_decode('{"client_policy_id":"6066","hr_id":"1"}', true));
// dd($response);

View File

@ -896,7 +896,7 @@ class EmployeeController extends AdminController
session()->setFlashdata('success', 'File Uploaded Successfully File is being validated.');
return redirect()->to(base_url('employee/upload'));
} else {
session()->setFlashdata($return['status'], $return['message']);
session()->setFlashdata($return['status'] ?? 'error', $return['message'] ?? 'Something went wrong! Try Later');
return redirect()->to(base_url('employee/upload'));
}
} else if ($event_type == 'correction') {
@ -3622,7 +3622,22 @@ class EmployeeController extends AdminController
public function checkWellnessOnboardStatus($client_policy_id)
{
{
$fetch_onboarded_employees = $this->request->getGet('fetch_onboarded_employees') ?? false;
if($fetch_onboarded_employees){
$data = $this->employeePolicyModel->select('employee_polices.*')
->where('employee_polices.is_active', 1)
->where('employee_polices.status', 'active')
->where('employee_polices.client_policy_id', $client_policy_id)
->where('employee_polices.wellness_onboard !=', '0')
->findAll();
return $this->respond(['status' => true, 'code' => 200, 'data' => count($data)], 200);
}
// echo $client_policy_id;die();
$data = $this->employeePolicyModel->select('employee_polices.*,emp.name,emp.relationship,emp.emp_code,emp.name,emp.email_corporate,emp.mobile,emp.dob,cp.policy_no,cp.wellness_plan_id,cp.wellness_vendor_id,cp.policy_start_date as cp_policy_start_date,cp.policy_end_date,cls.short_name')
->join('client_policy cp', 'cp.id = employee_polices.client_policy_id')
@ -3656,9 +3671,9 @@ class EmployeeController extends AdminController
// return $this->respond(['status' => true, 'code' => 200, 'message' => 'Inception and Member data comparision skiped successfully!'], 200);
}
public function initiateWellnessOnboard($client_policy_id)
public function initiateWellnessOnboard($client_policy_id, $emp_code = null)
{
$r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id]]);
$r = Jobs::addJob(['job_name' => 'initiateWellnessOnboardJob','payload' => ['client_policy_id' => $client_policy_id, 'emp_code' => $emp_code ?? null ]]);
// $this->initiateWellnessOnboardJob(['client_policy_id' => $client_policy_id]);
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Process started'], 200);
}
@ -3774,6 +3789,7 @@ class EmployeeController extends AdminController
public function initiateWellnessOnboardJob($arr)
{
$client_policy_id = $arr['client_policy_id'] ?? null;
$emp_code = $arr['emp_code'] ?? null;
if (!$client_policy_id) {
log_message('error', '[WellnessOnboard] Missing client_policy_id in payload');
@ -3789,7 +3805,7 @@ class EmployeeController extends AdminController
// ----------------------------------------------------------------
// 1. FETCH DATA
// ----------------------------------------------------------------
$data = $this->employeePolicyModel
$query = $this->employeePolicyModel
->select('employee_polices.*,
emp.name, emp.relationship, emp.emp_code, emp.email_corporate,
emp.mobile, emp.dob, emp.gender,
@ -3817,8 +3833,13 @@ class EmployeeController extends AdminController
->orWhere('cp.wellness_vendor_id =', 0)
->groupEnd()
->where('cp.policy_status', 1)
->where('cp.is_active', 1)
->findAll($perPage, $offset);
->where('cp.is_active', 1);
if(!empty($emp_code)){
$query->where('emp.emp_code', trim($emp_code));
}
$data = $query->findAll($perPage, $offset);
// ----------------------------------------------------------------
// 2. NO DATA FOUND
@ -3852,7 +3873,7 @@ class EmployeeController extends AdminController
foreach ($families as $empCode => $members) {
$familiesPayload[$empCode] = $this->buildFamilyPayload($empCode, $members);
}
log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload));
log_message('error', "[WellnessOnboard] Page {$page} API calls done. Families processed: " . json_encode($familiesPayload));
// ----------------------------------------------------------------
// 5. SEND TO WELLNESS API
// ----------------------------------------------------------------
@ -3885,6 +3906,33 @@ class EmployeeController extends AdminController
return true;
}
public function resetWellnessOnboard($client_policy_id, $emp_code = null)
{
if(!empty($emp_code)){
$employees = db_connect()->table('employees')
->select('id')
->where('emp_code', trim($emp_code))
->get()
->getResult();
if (!empty($employees)) {
$employeeIds = array_column($employees, 'id');
$this->employeePolicyModel
->where('client_policy_id', $client_policy_id)
->whereIn('employee_id', $employeeIds)
->set('wellness_onboard', '0')
->update();
}
} else {
$this->employeePolicyModel->where('client_policy_id', $client_policy_id)->set('wellness_onboard', '0')->update();
}
return $this->respond(['status' => true, 'code' => 200, 'message' => 'Wellness onboard resetted successfully'], 200);
}
# ------------------ FUNCTION TO BUILD FAMILY PAYLOAD ------------------

View File

@ -2288,6 +2288,8 @@ class LeadsController extends BaseController
// 'Insurer' => $rfq_data['insurer_name'] ?? " - ",
// 'TPA' => $rfq_data['tpa_name'] ?? " - ",
'Policy Type' => $this->leadType[$rfq_data['lead_type']] ?? "",
'Mortality Experience for last 3 years' => $claim_history == "1" ? "Mentioned in Claims sheet" : "Nil",
];
}else {

View File

@ -968,6 +968,58 @@ class TicketController extends BaseController
return $extra_fields;
}
/**
* Overlay conditional `required` rules onto a base validation rule-set based on the
* submitted `claim_status_id`. For example, when claim_status_id is a "Settled" status
* (11/24/34/44), fields like `utr_details` and `settled_date` are promoted from
* `permit_empty` to `required` so the request is rejected when they are blank.
*
* Letter URL fields (`approved_letter`, `settle_letter`) accept an alternative PDF
* upload, so they are intentionally not promoted here; that pairing is enforced by
* the upload validation flow. `approved_description` stays optional to match the
* existing UI contract.
*/
private function applyClaimStatusConditionalRules(array $rules): array
{
$claimStatusId = (int) $this->request->getPost('claim_status_id');
if ($claimStatusId <= 0) {
return $rules;
}
if (!isset($this->extraFields[$claimStatusId]) || !is_array($this->extraFields[$claimStatusId])) {
return $rules;
}
$requiredFields = $this->extraFields[$claimStatusId];
$skipFields = ['approved_letter', 'settle_letter', 'approved_description'];
foreach ($requiredFields as $field) {
if (in_array($field, $skipFields, true) || !isset($rules[$field])) {
continue;
}
$existingRules = $rules[$field]['rules'] ?? '';
$parts = $existingRules === ''
? []
: array_values(array_filter(array_map('trim', explode('|', $existingRules)), function ($part) {
return $part !== '' && $part !== 'permit_empty';
}));
if (!in_array('required', $parts, true)) {
array_unshift($parts, 'required');
}
$rules[$field]['rules'] = implode('|', array_unique($parts));
if (!isset($rules[$field]['errors']) || !is_array($rules[$field]['errors'])) {
$rules[$field]['errors'] = [];
}
$label = $rules[$field]['label'] ?? ucwords(str_replace('_', ' ', $field));
$rules[$field]['errors']['required'] = $label . ' is required for the selected claim status.';
}
return $rules;
}
public function view_ticket($ticket_id)
{
// $ticket_data = $this->ticketMasterModel->where('id', $ticket_id)->where('is_active', 1)->first();
@ -1456,6 +1508,8 @@ class TicketController extends BaseController
];
}
$rules = $this->applyClaimStatusConditionalRules($rules);
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
@ -1944,6 +1998,9 @@ class TicketController extends BaseController
'return_remark' => ['label' => 'Return Remark','rules' => 'permit_empty','errors' => []],
];
}
$rules = $this->applyClaimStatusConditionalRules($rules);
if (!$this->validate($rules)) {
return $this->response->setStatusCode(400)->setJSON([
'status' => false,
@ -3053,7 +3110,7 @@ class TicketController extends BaseController
}
}
public function getLastMatchedStatus($incoming_form_values, $old_ticket_data)
public function getLastMatchedStatusOld($incoming_form_values, $old_ticket_data)
{
if (empty($incoming_form_values) || !isset($incoming_form_values['claim_status_id']) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
return null;
@ -3122,6 +3179,71 @@ class TicketController extends BaseController
return $lastMatchedStatus;
}
public function getLastMatchedStatus($incoming_form_values, $old_ticket_data)
{
// Preserve the incoming claim_status_id (if any) as the safe fallback so callers
// never accidentally nullify the status when validation inputs are missing.
$incomingStatus = $incoming_form_values['claim_status_id'] ?? null;
if (empty($incoming_form_values) || !isset($incoming_form_values['extra_fields_array_for_validate'])) {
return $incomingStatus;
}
$lastMatchedStatus = $incomingStatus;
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate'], true);
if (!is_array($statusMapping) || empty($statusMapping)) {
return $incomingStatus;
}
// Drop transitional / aggregate statuses that should never be auto-selected.
$removeKeys = is_array($this->removeArrayKey) ? $this->removeArrayKey : [];
$statusMapping = array_diff_key($statusMapping, $removeKeys);
$oldStatusId = is_array($old_ticket_data) ? ($old_ticket_data['claim_status_id'] ?? null) : null;
$skipFields = ['approved_description'];
foreach ($statusMapping as $status => $requiredFields) {
if (empty($requiredFields)) {
continue;
}
// Skip the current/old status — we only advance forward to a newer status.
if ($oldStatusId !== null && (int) $status === (int) $oldStatusId) {
continue;
}
if (!is_array($requiredFields)) {
$requiredFields = [$requiredFields];
}
$allFieldsMatched = true;
foreach ($requiredFields as $field) {
if (in_array($field, $skipFields, true)) {
continue;
}
if (!isset($incoming_form_values[$field]) || $incoming_form_values[$field] === '' || $incoming_form_values[$field] === null) {
$allFieldsMatched = false;
break;
}
}
if ($allFieldsMatched) {
$lastMatchedStatus = $status;
}
}
// When a TPA number is present, promote the base "registered" statuses
// (1 -> 2 for standard, 67 -> 68 for the alternate flow).
if (!empty($incoming_form_values['tpa_no']) && in_array((int) $lastMatchedStatus, [1, 67], true)) {
$lastMatchedStatus = ((int) $lastMatchedStatus === 1) ? 2 : 68;
}
return $lastMatchedStatus;
}
public function getPolicyStartDate()
{
@ -3560,7 +3682,7 @@ class TicketController extends BaseController
{
$fileId = $this->claimFilesModel->insert([
'ticket_id' => $ticketId,
'ticket_type' => $ticketTypeId,
// 'ticket_type' => $ticketTypeId,
'file_type' => 3,
'doc_name' => $docName,
'file_name' => $uploadedFile['file_name'],

View File

@ -133,6 +133,7 @@ class UserModel extends Model
->select('user_profiles.*')
->select('roles.role as user_role')
->join('roles', 'roles.id = user_profiles.role')
->where('user_profiles.is_active', 1)
->get()
->getResultArray();
}
@ -143,13 +144,26 @@ class UserModel extends Model
->select('roles.role as user_role')
->join('roles', 'roles.id = user_profiles.role')
->join('user_teams', 'user_teams.user_id = user_profiles.id')
->where('user_profiles.is_active', 1)
->get()
->getResultArray();
// The user_teams join produces one row per (user, team) pair, so users
// belonging to multiple teams appear multiple times. Collapse to one
// row per user while keeping a team_id from [6, 7] when available, so
// the existing in_array($user['team_id'], [6, 7]) checks in the views
// continue to work correctly.
$deduped = [];
foreach ($data as $row) {
$userId = $row['id'];
if (!isset($deduped[$userId])) {
$deduped[$userId] = $row;
} elseif (in_array($row['team_id'], [6, 7])) {
$deduped[$userId]['team_id'] = $row['team_id'];
}
}
// dd($data);
return $data;
return array_values($deduped);
}
}

View File

@ -34,7 +34,7 @@ if (!empty($batch_list) && is_array($batch_list)) {
$countStr = ($file['count'] ?? null) === null ? '-' : (string) $file['count'];
$batch_col_max_len[9] = max($batch_col_max_len[9], mb_strlen($countStr));
$batch_col_max_len[10] = max($batch_col_max_len[10], mb_strlen((string) format_indian_number($file['amount'])));
$userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd M Y h:i a')
$userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd/m/Y h:i a')
. ' by '
. get_username($file['created_by'] ?? '');
$batch_col_max_len[11] = max($batch_col_max_len[11], mb_strlen($userTime));
@ -350,7 +350,7 @@ for ($i = 0; $i < $batch_col_count; $i++) {
<td><?php echo format_indian_number($file['amount'])?></td>
<td class="reload">
<?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>

View File

@ -49,7 +49,7 @@
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name'] ?>
</td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd M Y h:i A') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd/m/Y h:i A') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td>
<?php if ($file['status'] == "failed") { ?>
<span> <?= $file['status'] ?> </span>

View File

@ -107,13 +107,50 @@
var isCdMasterPage = <?php echo isset($CD_Master_Data) ? 'true' : 'false'; ?>;
console.log("isCdMasterPage", isCdMasterPage);
function formatCdOpeningDateForInput(inputDate) {
if (!inputDate || String(inputDate).trim() === '') {
return '';
}
var str = String(inputDate).trim();
var iso = str.match(/^(\d{4})-(\d{2})-(\d{2})/);
if (iso) {
return iso[3] + '/' + iso[2] + '/' + iso[1];
}
var dmy = str.match(/^(\d{1,2})[-\/](\d{1,2})[-\/](\d{4})$/);
if (dmy) {
var day = ('0' + dmy[1]).slice(-2);
var month = ('0' + dmy[2]).slice(-2);
return day + '/' + month + '/' + dmy[3];
}
return str;
}
function cdOpeningDateForSubmit(inputDate) {
var formatted = formatCdOpeningDateForInput(inputDate);
if (!formatted) {
return inputDate || '';
}
var parts = formatted.split('/');
return parts[0] + '-' + parts[1] + '-' + parts[2];
}
var openingDatePicker;
$(document).ready(function(){
var openingDatePicker = flatpickr("#opening_date", {
dateFormat: "d-m-Y",
openingDatePicker = flatpickr("#opening_date", {
dateFormat: "d/m/Y",
allowInput: false
});
$('#con-close-modal').on('shown.bs.modal', function() {
var val = $('#opening_date').val();
if (val) {
var formatted = formatCdOpeningDateForInput(val);
openingDatePicker.setDate(formatted, false);
}
});
if(isCdMasterPage == true){
$('#cd_client_id').select2();
$('#insurer_id_for_cd').select2();
@ -172,6 +209,10 @@
}
let formData = new FormData($('#CDMasterForm')[0]);
var openingDate = formData.get('opening_date');
if (openingDate) {
formData.set('opening_date', cdOpeningDateForSubmit(openingDate));
}
console.log("formData", formData);
let url = '<?= base_url('master/cash_deposite/create') ?>';

View File

@ -15,12 +15,12 @@ foreach ($CD_Master_Data as $index => $row) {
$cdm_col_max_len[1] = max($cdm_col_max_len[1], mb_strlen($clientCell));
$cdm_col_max_len[2] = max($cdm_col_max_len[2], mb_strlen((string) ($row['insurer_name'] ?? '')));
$cdm_col_max_len[3] = max($cdm_col_max_len[3], mb_strlen((string) ($row['insurer_branch_name'] ?? '')));
$od = ! empty($row['opening_date']) ? date('d-m-Y', strtotime((string) $row['opening_date'])) : '';
$od = ! empty($row['opening_date']) ? date('d/m/Y', strtotime((string) $row['opening_date'])) : '';
$cdm_col_max_len[4] = max($cdm_col_max_len[4], mb_strlen($od));
$cdm_col_max_len[5] = max($cdm_col_max_len[5], mb_strlen((string) ($row['cd_ac_no'] ?? '')));
$cdm_col_max_len[6] = max($cdm_col_max_len[6], mb_strlen((string) ($row['opening_bal'] ?? '')));
$du = ! empty($row['created_at'])
? (date('d-M-Y h:i A', strtotime((string) $row['created_at'])) . ' by ' . ($row['user_name'] ?? ''))
? (date('d/m/Y h:i A', strtotime((string) $row['created_at'])) . ' by ' . ($row['user_name'] ?? ''))
: '';
$cdm_col_max_len[7] = max($cdm_col_max_len[7], mb_strlen($du));
$cdm_col_max_len[8] = max($cdm_col_max_len[8], 4);
@ -118,10 +118,10 @@ $cdm_col_width_px = nhance_dt_column_widths_px($cdm_header_labels, $cdm_col_max_
<td><?php echo $row['client_name']; ?>( <?= $row['short_name'] ?> )</td>
<td><?php echo $row['insurer_name']; ?></td>
<td><?php echo $row['insurer_branch_name']; ?></td>
<td><?php echo date('d-m-Y', strtotime($row['opening_date'])); ?></td>
<td><?php echo date('d/m/Y', strtotime($row['opening_date'])); ?></td>
<td><?php echo $row['cd_ac_no']; ?></td>
<td><?php echo $row['opening_bal']; ?></td>
<td><?php echo date('d-M-Y h:i A', strtotime($row['created_at'])) ?> <br>by <?php echo $row['user_name']; ?></td>
<td><?php echo date('d/m/Y h:i A', strtotime($row['created_at'])) ?> <br>by <?php echo $row['user_name']; ?></td>
<td class="text-center table-action-cell">
<div class="btn-group dropdown">
<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>

View File

@ -161,7 +161,7 @@
<td style="overflow: hidden;" class="reload truncate" data-toggle="tooltip" data-placement="top" title="<?php echo $file['file_name'] ?>">
<?php echo $file['file_name'] ?>
</td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd M Y h:i A') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td><?php echo change_date_format($file['created_at'], 'Y-m-d H:i:s', 'd/m/Y h:i A') . ' by <strong>' . $file['user_name'] . '</strong>' ?> </td>
<td>
<?php if ($file['status'] == "failed") { ?>
<span style="color : #BD0707 ;"> <?= $file['status'] ?> </span>
@ -262,7 +262,7 @@
<label for="tpa">TPA<span id="tpa_danger" class="text-danger"></span></label>
<select class="form-control readonly-select" id="tpa_id" name="tpa_id">
<option value="">Select TPA</option>
<?php foreach ($tpa_list as $value) { ?>
<?php foreach ($tpa_list ?? [] as $value) { ?>
<option value="<?= $value['id'] ?>"><?= $value['short_name'] ?></option>
<?php } ?>
</select>

View File

@ -209,7 +209,7 @@ input:checked + .slider_blue::before {
data-parsley-pattern="^[1-9][0-9]*$"
data-parsley-pattern-message="Please select a valid Policy Type.">
<option value="0">Select Policy Type</option>
<?php foreach ($policy_types as $value) { ?>
<?php foreach ($policy_types ?? [] as $value) { ?>
<option value="<?= $value['id']?>"><?= $value['policy_type'] ?></option>
<?php } ?>
</select>
@ -230,7 +230,7 @@ input:checked + .slider_blue::before {
<label for="insurer">Insurer<span class="text-danger">*</span></label>
<select class="form-control" id="insurer" name="insurer" onchange="setInsuerAndBranchValue(this)" required>
<option value="">Select Insurer</option>
<?php foreach ($insurer as $value) { ?>
<?php foreach ($insurer ?? [] as $value) { ?>
<option data-id="<?= $value['insurer_id']?>" value="<?= $value['id'] . '-' . $value['insurer_id'] ?>">
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?></option>
<?php } ?>
@ -241,7 +241,7 @@ input:checked + .slider_blue::before {
<label for="tpa">TPA<span id="tpa_danger" class="text-danger">*</span></label>
<select class="form-control" id="tpa" name="tpa" required>
<option value="">Select TPA</option>
<?php foreach ($tpa as $value) { ?>
<?php foreach ($tpa ?? [] as $value) { ?>
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?></option>
<?php } ?>
@ -454,7 +454,7 @@ input:checked + .slider_blue::before {
const showExpired = $('#chk-show-expired').is(':checked');
var startDatePicker = flatpickr("#start_date", {
dateFormat: "d-m-Y",
dateFormat: "d/m/Y",
defaultDate: today,
allowInput: false,
onChange: function(selectedDates, dateStr, instance) {
@ -467,7 +467,7 @@ input:checked + .slider_blue::before {
// Initialize Flatpickr for the start date with today's date
var openDatePicker = flatpickr("#open_date", {
dateFormat: "d-m-Y",
dateFormat: "d/m/Y",
defaultDate: today,
allowInput: false,
});
@ -478,14 +478,14 @@ input:checked + .slider_blue::before {
closeDate.setDate(closeDate.getDate() - 1); // Set end date to last day of next year
var endDatePicker = flatpickr("#end_date", {
dateFormat: "d-m-Y",
dateFormat: "d/m/Y",
defaultDate: closeDate,
allowInput: false
});
// Initialize Flatpickr for the end date with the calculated end date
var closeDatePicker = flatpickr("#close_date", {
dateFormat: "d-m-Y",
dateFormat: "d/m/Y",
defaultDate: today,
allowInput: false
});
@ -566,7 +566,7 @@ input:checked + .slider_blue::before {
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td>${formatPolicyDisplayDate(item.policy_start_date)} - ${formatPolicyDisplayDate(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
@ -751,6 +751,12 @@ input:checked + .slider_blue::before {
$('.loader-mask').fadeIn();
var formData = new FormData($('#policy_form')[0]);
['policy_start_date', 'policy_end_date', 'open_date', 'close_date'].forEach(function(fieldName) {
var val = formData.get(fieldName);
if (val) {
formData.set(fieldName, policyFormDateForSubmit(val));
}
});
var policy_form_action = $('#policy_form_action').val();
console.log(formData+'form data');
$.ajax({
@ -853,7 +859,7 @@ input:checked + .slider_blue::before {
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td>${formatPolicyDisplayDate(item.policy_start_date)} - ${formatPolicyDisplayDate(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
<div class="btn-group dropdown">
@ -1512,31 +1518,74 @@ input:checked + .slider_blue::before {
});
//for date convert to indian formate like this 'yyyy-mm-dd' to this 'dd-mm-yyyy'
function rearrangeDateFormat(inputDate) {
console.log('inputDate', inputDate)
// Check if inputDate is a string and not empty
if (typeof inputDate === 'string' && inputDate.trim() !== '') {
var dateComponents = inputDate.split("-");
// Check if dateComponents has the expected number of parts
if (dateComponents.length === 3) {
var rearrangedDate = dateComponents[2] + "-" + dateComponents[1] + "-" + dateComponents[0];
return rearrangedDate;
} else {
// Handle unexpected date format
return '';
}
} else {
// Handle the case where inputDate is not a valid string
return '';
function parsePolicyDate(inputDate) {
if (!inputDate || (typeof inputDate === 'string' && inputDate.trim() === '')) {
return null;
}
var str = String(inputDate).trim();
var dmyMon = str.match(/^(\d{1,2})\/([A-Za-z]{3})\/(\d{4})$/i);
if (dmyMon) {
return new Date(str);
}
var dmy = str.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
if (dmy) {
return new Date(parseInt(dmy[3], 10), parseInt(dmy[2], 10) - 1, parseInt(dmy[1], 10));
}
var iso = str.match(/^(\d{4})-(\d{2})-(\d{2})/);
if (iso) {
return new Date(parseInt(iso[1], 10), parseInt(iso[2], 10) - 1, parseInt(iso[3], 10));
}
var dmyDash = str.match(/^(\d{1,2})-([A-Za-z]{3}|\d{1,2})-(\d{4})$/i);
if (dmyDash) {
if (/^[A-Za-z]{3}$/i.test(dmyDash[2])) {
return new Date(str);
}
return new Date(parseInt(dmyDash[3], 10), parseInt(dmyDash[2], 10) - 1, parseInt(dmyDash[1], 10));
}
var parsed = new Date(str);
return isNaN(parsed.getTime()) ? null : parsed;
}
var policyMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
function formatPolicyDisplayDate(inputDate) {
var d = parsePolicyDate(inputDate);
if (!d) {
return (inputDate && String(inputDate).trim() !== '') ? String(inputDate) : '';
}
return d.getDate() + '/' + policyMonthNames[d.getMonth()] + '/' + d.getFullYear();
}
function formatPolicyFormDate(inputDate) {
var d = parsePolicyDate(inputDate);
if (!d) {
return (inputDate && String(inputDate).trim() !== '') ? String(inputDate) : '';
}
var day = ('0' + d.getDate()).slice(-2);
var month = ('0' + (d.getMonth() + 1)).slice(-2);
return day + '/' + month + '/' + d.getFullYear();
}
function policyFormDateForSubmit(inputDate) {
var formatted = formatPolicyFormDate(inputDate);
if (!formatted) {
return inputDate || '';
}
var parts = formatted.split('/');
return parts[0] + '-' + parts[1] + '-' + parts[2];
}
// Convert API/storage dates to d/m/Y for form inputs
function rearrangeDateFormat(inputDate) {
return formatPolicyFormDate(inputDate);
}
function checkDateStatus(inputDate, bg = false) {
var givenDate = new Date(inputDate);
var givenDate = parsePolicyDate(inputDate);
if (!givenDate) {
return bg ? '' : '';
}
var currentDate = new Date();
if (bg != false) {
@ -2763,7 +2812,7 @@ $(document).ready(function () {
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td>${formatPolicyDisplayDate(item.policy_start_date)} - ${formatPolicyDisplayDate(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>
@ -2809,7 +2858,7 @@ $(document).ready(function () {
<td>${policy_name_data}</td>
<td>${item.branch_name ? item.branch_name : ' - '}</td>
<td>${tpaValue}</td>
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
<td>${formatPolicyDisplayDate(item.policy_start_date)} - ${formatPolicyDisplayDate(item.policy_end_date)}</td>
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
<td>

View File

@ -182,7 +182,7 @@
<td><?php echo ucfirst($row['department']) ?> </td>
<td><?php echo $row['rules_count'] ?></td>
<td><?php echo ucfirst($row['file_status']) ?> </td>
<td><?php echo change_date_format($row['created_at'],'Y-m-d H:i:s', 'd M Y h:i A') . ' by <strong>' . $row['created_user_name'] . '</strong>' ?>
<td><?php echo change_date_format($row['created_at'],'Y-m-d H:i:s', 'd/m/Y h:i A') . ' by <strong>' . $row['created_user_name'] . '</strong>' ?>
<td>
<div class="btn-group dropdown">
<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>

View File

@ -361,6 +361,12 @@ $gst_total = 0;
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
<?php } ?>
<?php if(strtolower($employee['relationship']) == 'self' && $employee['wellness_onboard'] == '0') { ?>
<a class="dropdown-item" onclick="initiateWellnessOnboard('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-heart-pulse mr-2 text-muted font-18 vertical-middle"></i>Initiate Wellness Onboard</a>
<?php }else if(strtolower($employee['relationship']) == 'self' && $employee['wellness_onboard'] != '0') { ?>
<a class="dropdown-item" onclick="resetWellnessOnboard('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-restart mr-2 text-muted font-18 vertical-middle"></i>Reset Wellness Onboard</a>
<?php } ?>
</div>
</div>
</td>

View File

@ -81,7 +81,7 @@
<div class="form-group col-md-4">
<label>Policy</label> <br />
<select class="form-control" id="policies">
<select class="form-control" id="policies" onchange="getOnboardedemployees(event)">
<option value="0">Select</option>
</select>
</div>
@ -90,7 +90,7 @@
<label>Status</label> <br />
<select class="form-control" name="status2[]" id="status2" multiple>
<option value="0">Select</option>
<?php foreach ($status as $key => $value) { ?>
<?php foreach ($status ?? [] as $key => $value) { ?>
<option value="<?= $key ?>"
<?php
if ((!isset($getData) || in_array('active', $getData['status'])) && $key == 'active') {
@ -116,6 +116,15 @@
</div>
<div class="row justify-content-end">
<div id="resetWellnessOnboardBtn_div" class="col-auto" style="display: none;">
<!-- <div id="categoryFilter_12"> -->
<a href="#" id="resetWellnessOnboardBtn" class="btn btn-primary waves-effect waves-light"
style="background-color: #F5FFFF; color:black; border:1px solid #00999E;"
onclick="resetWellnessOnboard(this)">Wellness Onboard Reset</a>
<!-- </div> -->
</div>
<div class="col-auto">
<!-- <div id="categoryFilter_12"> -->
<a href="#" class="btn btn-primary waves-effect waves-light"
@ -148,6 +157,7 @@
<!-- end row -->
<div id="loader" class="loader" style="display:none;">SPINNER</div>
<script>
// document.addEventListener("DOMContentLoaded", function () {
// const table = document.getElementById("tickets-table");
@ -454,93 +464,6 @@
$('#status2').trigger('change');
});
// $(document).ready(function() {
// console.log("document loaded");
// //fetchClientPolicies();
// });
// $(window).on("load", function() {
// console.log("window loaded");
// fetchClientPolicies();
// });
// function fetchClientPolicies() {
// $('#loader').show();
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
// console.log('fetchClientPolicies');
// // console.log(apiURL);
// $.ajax({
// url: apiURL,
// method: 'GET',
// headers: {
// "Content-Type": "application/json",
// "X-Requested-With": "XMLHttpRequest"
// },
// success: function(response) {
// // console.log(response.code);
// // console.log(response.dataStatus);
// // console.log(response.data);
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
// try {
// clientPolicies = (response.data);
// response.data.forEach(policy => {
// // console.log('policies', policy.policies);
// policy.policies.forEach(p => {
// clientPoliciesWithBranch.policies.push(p);
// });
// });
// // console.log('1',clientPolicies);
// appendClients(clientPolicies);
// //this function for reselect the policy
// setTimeout(function() {
// if (client_id != 0) {
// var foundPolicies = clientPolicies.find(function(item) {
// // console.log(typeof item.id)
// return item.id == client_id;
// });
// appendBranch(foundPolicies.branchs);
// }
// }, 500);
// setTimeout(function() {
// if (client_branch_id != 0) {
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
// // console.log('item', item);
// return item.branch_id === client_branch_id;
// });
// if (foundPolicies) {
// // console.log('foundPolicies', foundPolicies);
// appendPolicies(foundPolicies);
// } else {
// console.log('No policies found for the selected client');
// }
// }
// }, 500);
// //end
// } catch (error) {
// console.error('Error parsing API response data:', error);
// }
// } else if (response.code === 404 && response.dataStatus === false) {
// console.error('no data found', response);
// } else {
// console.error('Something went wrong!');
// }
// },
// error: function(xhr, status, error) {
// console.error('Error fetching data from API:', error);
// }
// });
// $('#loader').hide();
// }
function appendClients(data) {
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
$.each(data, function(index, item) {
@ -724,14 +647,12 @@
});
}
document.getElementById('toggleIcon').addEventListener('click', function() {
var icon = document.getElementById('icon');
icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up');
});
function sendManualEcard(input) {
console.log('sendManualEcard function called');
@ -793,4 +714,159 @@
});
}
function getOnboardedemployees(event)
{
console.log(event.target.id);
var policy_id = (event.target.value);
console.log('getOnboardedemployees called ' + policy_id);
if(policy_id != 0 && policy_id != " " && policy_id != undefined)
{
var apiURL = '<?php echo base_url();?>' + 'checkWellnessOnboardStatus/' + policy_id + '?fetch_onboarded_employees=true';
// console.log(apiURL);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log('check wellness response', response);
if(response.data && response.data != 0) {
var btn_txt = 'Wellness Onboard Reset ('+ response.data +')';
$('#resetWellnessOnboardBtn').text(btn_txt);
$('#resetWellnessOnboardBtn_div').show();
} else {
console.log('wellness button remains disabled');
$('#resetWellnessOnboardBtn_div').hide();
}
},
error: function(xhr, status, error) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.error('Error fetching data from checkPolicyTermsAndRackRatesHasDefiend API:', error);
return false;
}
});
}
}
function resetWellnessOnboard($client_policy_id = null, $emp_code = null) {
console.log('resetWellnessOnboard function called');
var client_id = $('#clients').val()
var client_branch_id = $('#branch_id').val()
var policy_id = $('#policies').val()
console.log('client_id', client_id);
console.log('client_branch_id', client_branch_id);
console.log('policy_id', policy_id);
if (client_id == 0 || client_branch_id == 0 || policy_id == 0) {
toastr.warning('Please select the Client, Client Branch and Policy.', 'WARNING');
return false
}
if($client_policy_id && $emp_code) {
var apiURL = '<?= base_url("resetWellnessOnboard/") ?>' + $client_policy_id + '/' + $emp_code;
} else {
var apiURL = '<?= base_url("resetWellnessOnboard/") ?>' + policy_id;
}
Swal.fire({
title: "Do you want to reset Wellness Onboard?",
showDenyButton: true,
showCancelButton: false,
confirmButtonText: "Yes,Reset",
denyButtonText: "Don't Reset"
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: apiURL,
type: "GET",
dataType: 'json',
success: function(res) {
console.log('resetWellnessOnboard', res)
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
toastr.success(res.message, 'Success');
setTimeout(function() {
window.location.reload();
}, 800);
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
}
});
}
function initiateWellnessOnboard($policy_id, $emp_code)
{
if($policy_id == "" || $emp_code == "") {
toastr.error('Please select policy to initiate wellness onboard', 'Error');
return false;
}
if($policy_id != 0 && $policy_id != " " && $policy_id != undefined)
{
var apiURL = '<?php echo base_url();?>' + 'initiateWellnessOnboard/' + $policy_id + '/' + $emp_code;
// console.log(apiURL);
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
$.ajax({
url: apiURL,
method: 'GET',
headers: {
"Content-Type": "application/json",
"X-Requested-With": "XMLHttpRequest"
},
success: function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.log('initiate wellness response', response);
toastr.success(response.message, 'Success');
setTimeout(function() {
window.location.reload();
}, 800);
},
error: function(xhr, status, error) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
console.error('Error initiate data from initiateWellnessOnboard API:', error);
toastr.error(error, 'Error');
return false;
}
});
}else{
toastr.error('Please select policy to initiate wellness onboard', 'Error');
return false;
}
}
</script>

View File

@ -252,7 +252,7 @@ $ex_col_width_px = nhance_dt_column_widths_px($ex_header_labels, $ex_col_max_len
<td><?= number_format((float) ($row['amount'] ?? 0), 2); ?></td>
<td>
<?php if (! empty($row['expense_date'])): ?>
<?= date('d-m-Y', strtotime($row['expense_date'])); ?>
<?= date('d/m/Y', strtotime($row['expense_date'])); ?>
<?php endif; ?>
</td>
<td>

View File

@ -23,7 +23,7 @@ if (!empty($fileList) && is_array($fileList)) {
);
$fl_col_max_len[4] = max($fl_col_max_len[4], mb_strlen($policy_display));
$fl_col_max_len[5] = max($fl_col_max_len[5], mb_strlen((string) ($file['action'] ?? '')));
$userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd M Y h:i a')
$userTime = change_date_format($file['created_at'] ?? '', 'Y-m-d H:i:s', 'd/m/Y h:i a')
. ' by '
. ($file['first_name'] ?? '');
$fl_col_max_len[6] = max($fl_col_max_len[6], mb_strlen($userTime));
@ -203,7 +203,7 @@ $fl_col_width_px = nhance_dt_column_widths_px($fl_header_labels, $fl_col_max_len
<!-- <td><?php echo isset($file['policy_name']) ? $file['policy_name'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?> - <?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?></td> -->
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
<td><?php echo $file['action'] ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd/m/Y h:i a') . ' by <strong>' . $file['first_name'] . '</strong>' ?>
</td>
<td>
<?php

View File

@ -255,7 +255,7 @@ $hr_col_width_px = nhance_dt_column_widths_px($hr_header_labels, $hr_col_max_len
<td><?php echo $file['branch_name'] ?></td>
<td><?php echo $file['policy_no'] ?></td>
<td><?php echo $file['file_action'] ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd M Y h:i A') . ' by <strong>' . $file['first_name'] . '</strong>' ?></td>
<td><?php echo change_date_format($file['created_at'],'Y-m-d H:i:s', 'd/m/Y h:i A') . ' by <strong>' . $file['first_name'] . '</strong>' ?></td>
<td><?php echo $file['status']; ?> </td>
<td> </td>
</tr>

View File

@ -2172,7 +2172,7 @@
// <label for="first_year_${increment}">Year<span class="text-danger">*</span></label>
// <select class="form-control first_year_" id="first_year_${increment}" name="first_year[]">
// <option value="">Select Year</option>
// <?php foreach ($lastFiveYears as $year) {echo "<option value='$year'>$year</option>";} ?>
// <?php foreach ($lastFiveYears ?? [] as $year) {echo "<option value='$year'>$year</option>";} ?>
// </select>
// </div>
// <div class="form-group col-md-2">
@ -2187,7 +2187,7 @@
// <label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger">*</span></label>
// <select class="form-control" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
// <option value="">Select Cause of Death</option>
// <?php foreach ($causeOfDeath as $cause => $death_value) {echo "<option value='$cause'>$death_value</option>";} ?>
// <?php foreach ($causeOfDeath ?? [] as $cause => $death_value) {echo "<option value='$cause'>$death_value</option>";} ?>
// </select>
// </div>
// <div class="form-group col-md-2 lifeClaimFields" style="display:none;">
@ -2198,7 +2198,7 @@
// <label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
// <select class="form-control" id="claim_type_${increment}" name="claim_type[]">
// <option value="">Select Claim Type</option>
// <?php foreach ($gpaClaimType as $claimType => $claim_value) {echo "<option value='$claimType'>$claim_value</option>";} ?>
// <?php foreach ($gpaClaimType ?? [] as $claimType => $claim_value) {echo "<option value='$claimType'>$claim_value</option>";} ?>
// </select>
// </div>
// <div class="form-group col-md-2">
@ -2245,7 +2245,7 @@
}
function getClaimHistoryLabel(leadType) {
return String(leadType) === '1' ? 'Mortality Claims' : 'Claims History';
return String(leadType) === '1' ? 'Mortality Experience' : 'Claims Experience';
}
function shouldShowClaimHistorySwitch(leadType, policyTypeId) {
@ -2304,7 +2304,7 @@
<label for="first_year_${increment}">Year<span class="text-danger claim-required-star">*</span></label>
<select class="form-control first_year_ claim-input" id="first_year_${increment}" name="first_year[]">
<option value="">Select Year</option>
<?php foreach ($lastFiveYears as $year) {
<?php foreach ($lastFiveYears ?? [] as $year) {
echo "<option value='$year'>$year</option>";
} ?>
</select>
@ -2361,7 +2361,7 @@
<label for="first_cause_of_death_${increment}">Nature/Cause Of Death <span class="text-danger claim-required-star">*</span></label>
<select class="form-control claim-input" id="first_cause_of_death_${increment}" name="first_cause_of_death[]">
<option value="">Select Cause of Death</option>
<?php foreach ($causeOfDeath as $cause => $death_value) {
<?php foreach ($causeOfDeath ?? [] as $cause => $death_value) {
echo "<option value='$cause'>$death_value</option>";
} ?>
</select>
@ -2381,7 +2381,7 @@
<label for="claim_type_${increment}">Claim Type<span class="text-danger">*</span></label>
<select class="form-control" id="claim_type_${increment}" name="claim_type[]">
<option value="">Select Claim Type</option>
<?php foreach ($gpaClaimType as $claimType => $claim_value) {
<?php foreach ($gpaClaimType ?? [] as $claimType => $claim_value) {
echo "<option value='$claimType'>$claim_value</option>";
} ?>
</select>

View File

@ -400,7 +400,7 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
<?php
$savedViewers = [];
if (!empty($lead_edit_data['rfq_qcr_viewers'] ?? null)) {
$decoded = json_decode($lead_edit_data['rfq_qcr_viewers'], true);
$decoded = json_decode($lead_edit_data['rfq_qcr_viewers'] ?? "", true);
if (is_array($decoded)) $savedViewers = $decoded;
}
?>
@ -906,11 +906,11 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
})
function getClaimHistoryLabel(leadType) {
return String(leadType) === '1' ? 'Mortality Claims' : 'Claims History';
return String(leadType) === '1' ? 'Mortality Experience' : 'Claims Experience';
}
function getClaimDetailsSectionTitle(leadType) {
return String(leadType) === '1' ? 'Mortality Claims' : 'Claim Details';
return String(leadType) === '1' ? 'Mortality Experience' : 'Claims Experience';
}
function shouldShowNonEbClaimHistory(leadType) {
@ -1402,7 +1402,7 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
<label for="first_year_${increment}">Year<span class="text-danger claim-required-star">*</span></label>
<select class="form-control claim-input first_year_" id="first_year_${increment}" name="first_year[]">
<option value="">Select Year</option>
<?php foreach ($lastFiveYears as $year) {
<?php foreach ($lastFiveYears ?? [] as $year) {
echo "<option value='$year'>$year</option>";
} ?>
</select>

View File

@ -64,7 +64,7 @@
<td><?= $row['nhance_claim_ref_no'] ?: 'N/A'; ?></td>
<td><?= $row['short_name'] ?: ($row['client_name'] ?? 'N/A'); ?></td>
<td><?= $row['insurer_short_name'] ?: ($row['insurer_name'] ?: 'N/A'); ?></td>
<td><?= !empty($row['loss_date']) ? date('d-m-Y', strtotime($row['loss_date'])) : 'N/A'; ?></td>
<td><?= !empty($row['loss_date']) ? date('d/m/Y', strtotime($row['loss_date'])) : 'N/A'; ?></td>
<td><?= $row['nature_of_loss'] ?: 'N/A'; ?></td>
<td style="display:none;"><?= $row['acm_name'] ?? ''; ?></td>

View File

@ -181,7 +181,7 @@
}
</style>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>"></script>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>?v=20260529"></script>
<div class="tab-pane fade active show" id="form">
<div class="row" id="endorsement_form">
@ -297,7 +297,7 @@
<div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly>
<input type="text" class="form-control" id="policy_no" name="policy_no" placeholder="Enter Policy No" readonly data-parsley-validate="false" data-parsley-exclude-charset="true">
</div>
<div class="form-group col-md-3">
@ -326,7 +326,7 @@
<div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')">
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" data-parsley-validate="false" data-parsley-exclude-charset="true">
</div>
<div class="form-group col-md-3">
@ -757,6 +757,9 @@
// console.log('tpa',tpa);
$('#policy_no').val(policy_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#insurer_id').val(insurer);
$('#tpa').val(tpa).change();
// $('#cd_ac_no').val(cd_ac_no);
@ -1206,6 +1209,9 @@
$('#policy_no').val(res.data.policy_no);
$('#action_type').val(res.data.action_type);
$('#endorsement_no').val(res.data.endorsement_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#data_received_date').val(res.data.data_received_date);
$('#policy_issue_date').val(res.data.policy_issue_date);
$('#emp_count').val(res.data.emp_count);

View File

@ -195,7 +195,7 @@
}
</style>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>"></script>
<script src="<?= base_url('public/assets/js/pages/policy_transaction_endorsement_form_validation.js') ?>?v=20260529"></script>
<div class="row" id="endorsement_form" style="display: none;">
<div class="col-12">
@ -310,7 +310,7 @@
<div class="form-group col-md-3">
<label for="addon_policy">Policy No<span id="base_danger"class="text-danger"></span></label>
<input type="text" class="form-control" id="policy_no" name="policy_no"placeholder="Enter Policy No" readonly>
<input type="text" class="form-control" id="policy_no" name="policy_no" placeholder="Enter Policy No" readonly data-parsley-validate="false" data-parsley-exclude-charset="true">
</div>
<div class="form-group col-md-3">
@ -339,7 +339,7 @@
<div class="form-group col-md-3">
<label for="addon_policy">Endorsement No<span id="base_danger" class="text-danger"></span></label>
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" onchange="validateInput(this, 'policy_transaction', 'endorsement_no')">
<input type="text" class="form-control" id="endorsement_no" name="endorsement_no" placeholder="Enter Endorsement No" data-parsley-validate="false" data-parsley-exclude-charset="true">
</div>
<div class="form-group col-md-3">
@ -613,6 +613,9 @@
// console.log('tpa',tpa);
$('#policy_no').val(policy_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#insurer_id').val(insurer);
$('#tpa').val(tpa).change();
// $('#cd_ac_no').val(cd_ac_no);
@ -1037,6 +1040,9 @@
$('#policy_no').val(res.data.policy_no);
$('#action_type').val(res.data.action_type);
$('#endorsement_no').val(res.data.endorsement_no);
if (typeof window.clearEndorsementExcludedFieldsValidation === 'function') {
window.clearEndorsementExcludedFieldsValidation('#endorsement_form_id');
}
$('#data_received_date').val(res.data.data_received_date);
$('#policy_issue_date').val(res.data.policy_issue_date);
$('#emp_count').val(res.data.emp_count);

View File

@ -1,11 +1,14 @@
<style>
.table th,
.table td {
padding: 8px;
#scroll-horizontal-datatable thead th,
#scroll-horizontal-datatable tbody td {
padding: 4px 4px !important;
box-sizing: border-box;
}
table.dataTable tbody td {
#scroll-horizontal-datatable_wrapper .dataTables_scrollHead table thead th,
#scroll-horizontal-datatable_wrapper .dataTables_scrollBody table tbody td {
padding: 4px 4px !important;
box-sizing: border-box;
}
.col-12 {
@ -76,7 +79,7 @@ table.dataTable tbody td {
</div>
<div class="badge-container">
Total Policy Count: <span class="text-primary"><?= $policy_count ?></span>
Total Policy Count: <span class="text-primary"><?= $policy_count ?? 0 ?></span>
</div>
</div>
@ -111,7 +114,7 @@ table.dataTable tbody td {
<th style="display: none;">Total Premium</th>
<th>Agreed BP %</th>
<th>Agreed TP %</th>
<th style="display: true;">Rewards</th>
<th>Rewards</th>
<th>Agreed Amount</th>
<th>Invoiced Amount</th>
<th>Outstanding Amount</th>
@ -199,7 +202,7 @@ table.dataTable tbody td {
<td class="right-align-input" style="display: none;"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['total_premium'] ?: '0.00') : '0.00'; ?></td>
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_bp_per'] ?: '0.00') : '0.00'; ?>%</td>
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['agreed_tp_or_ter_per'] ?: '0.00') : '0.00'; ?>%</td>
<td class="right-align-input" style="display: true;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
<td class="right-align-input"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
<?php
// Below Line its old version i am removed. reason no value ['total_irda_amt'] means taken as ['exp_amt'] so.
@ -335,8 +338,9 @@ $(document).ready(function() {
var ticketsTable = $('#scroll-horizontal-datatable');
if (ticketsTable.length) {
ticketsTable.DataTable({
scrollX: true,
nhanceListDataTableBeforeInit();
var nhBdsReportTable = ticketsTable.DataTable(nhanceMergeListDataTableOptions({
autoWidth: false,
// dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
// "<'row'<'col-sm-12'tr>>" +
// "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
@ -711,7 +715,9 @@ $(document).ready(function() {
// var totalUnbilled = getUniqueUnbilled(27);
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
}
});
}));
nhanceListDataTableAfterInit();
nhanceListDataTableBindAdjust(nhBdsReportTable);
} else {
console.error("Table atet found.");
}

View File

@ -257,7 +257,7 @@ $ret_col_width_px = nhance_dt_column_widths_px($ret_header_labels, $ret_col_max_
<td><?php echo $employee['agent_name'] ?? 'N/A' ?></td>
<td><?php echo $employee['manager_name'] ?? 'N/A' ?></td>
<td><?php if (!empty($employee['created_at'])):
$cd = date("j F Y", strtotime($employee['created_at']));
$cd = date("j/F/Y", strtotime($employee['created_at']));
$ct = date("h:i A", strtotime($employee['created_at']));
echo $cd . "<br><span class='time'> " . $ct . "</span>";
endif; ?></td>

View File

@ -16,7 +16,7 @@
: [['year' => '', 'claim_amount' => '', 'status' => '', 'policy_type' => '', 'date_of_loss' => '', 'cause_of_loss' => '']];
$leadType = (int) ($lead_edit_data['lead_type'] ?? 0);
$showClaimsSection = in_array($leadType, [1, 2, 3], true);
$claimHistoryLabel = $leadType === 1 ? 'Mortality Claims' : 'Claims History';
$claimHistoryLabel = $leadType === 1 ? 'Mortality Experience' : 'Claims Experience';
?>
<?php if ($showClaimsSection) { ?>
<div class="custom-control custom-switch">

View File

@ -64,8 +64,8 @@
&& in_array((int) $lead_edit_data['lead_type'], [1, 2, 3], true)
&& in_array((int) $lead_edit_data['policy_type_id'], [1, 6, 7], true);
$claimHistoryLabel = (isset($lead_edit_data['lead_type']) && (int) $lead_edit_data['lead_type'] === 1)
? 'Mortality Claims'
: 'Claims History';
? 'Mortality Experience'
: 'Claims Experience';
?>
<?php if ($showClaimHistorySwitch) { ?>
<div class="custom-control custom-switch">

View File

@ -901,7 +901,7 @@ async function viewDetail(id) {
function renderCard(opps) {
const opp_cont = document.getElementById('opportunitiesContainer');
opp_cont.innerHTML = opps.length ? opps.map(o => {
let lead_type = o.lead_type == 1 ? 'EB' : 'Non-EB';
let lead_type = o.lead_form_type == 1 ? 'EB' : 'Non-EB';
let status = o.status?.toLowerCase();
let statusClass = {
won: 'status-text-won',

View File

@ -269,7 +269,7 @@ $gst_total = 0;
<td><?php echo $employee['emp_code']; ?></td>
<td><?php echo $employee['relationship']; ?></td>
<td><?php echo $employee['gender']; ?></td>
<td><?php echo date('d/M/Y', strtotime($employee['dob'])); ?></td>
<td><?php echo date('d/m/Y', strtotime($employee['dob'])); ?></td>
<?php /*
<!-- <td><?php //echo isset($employee['policy_type']) ? $employee['policy_type'] : ''; ?> - <?php echo isset($employee['policy_no']) ? $employee['policy_no'] : ''; ?></td>

View File

@ -188,7 +188,7 @@ beccause = dataTables_length and dataTables_paginate need in same line thats why
<td class="text-left"><?php echo $row['assignee_name'] ? $row['assignee_name'] : 'N/A'; ?></td>
<td class="text-left">
<?php if (!empty($row['created_at'])):
$cd = date("j M Y", strtotime($row['created_at']));
$cd = date("j/m/Y", strtotime($row['created_at']));
$ct = date("h:i A", strtotime($row['created_at']));
echo $cd . "<br><span class='time'> " . $ct . "</span>";
endif;
@ -196,7 +196,7 @@ beccause = dataTables_length and dataTables_paginate need in same line thats why
</td>
<td class="text-left">
<?php if (!empty($row['updated_at'])):
$ud = date("j M Y", strtotime($row['updated_at']));
$ud = date("j/m/Y", strtotime($row['updated_at']));
$ut = date("h:i A", strtotime($row['updated_at']));
echo $ud . "<br><span class='time'> " . $ut . "</span>";
endif;

View File

@ -579,6 +579,42 @@
var doa;
var STATUS_SECTION_CLASSES = ['cda_ir', 'settled', 'approved', 'rejected', 'up_qdr', 'up_cnu', 'canceled', 'returned', 'payment', 'non_id'];
var statusSectionInitialValues = {};
// Cached full mapping of claim_status_id -> required fields.
// The hidden input gets destructively reduced when the status dropdown changes,
// so we capture the full map once at load time for use by frontend required-logic.
var STATUS_REQUIRED_FIELDS_MAP = {};
function initStatusRequiredFieldsMap() {
var raw = $('#extra_fields_array_for_validate').val();
if (!raw) {
STATUS_REQUIRED_FIELDS_MAP = {};
return;
}
try {
var parsed = JSON.parse(raw);
STATUS_REQUIRED_FIELDS_MAP = (parsed && typeof parsed === 'object') ? parsed : {};
} catch (e) {
STATUS_REQUIRED_FIELDS_MAP = {};
}
}
function getRequiredFieldsForSelectedStatus() {
if (!STATUS_REQUIRED_FIELDS_MAP) {
return [];
}
var selected = $('#claim_status_id').val();
if (selected === undefined || selected === null || selected === '') {
return [];
}
var fields = STATUS_REQUIRED_FIELDS_MAP[selected];
if (Array.isArray(fields)) {
return fields;
}
if (fields) {
return [fields];
}
return [];
}
function captureSectionInitialValues(sectionClass) {
if (!sectionClass) {
@ -656,12 +692,40 @@
return;
}
if (sectionClass === 'approved' || sectionClass === 'settled') {
// The URL-or-File letter pair has its own validity rules (see enforceLetterPairRules).
// We still need to enforce required on the other status-mandated fields
// (e.g. utr_details, settled_date, approved_amount, approved_date), which the
// previous early-return was skipping.
enforceLetterPairRules();
updateSectionRequiredLabels(sectionClass, hasSectionChanged(sectionClass));
var letterPairIds = sectionClass === 'approved'
? ['approved_letter', 'approved_letter_file', 'approved_description']
: ['settle_letter', 'settle_letter_file'];
var statusRequiredFields = getRequiredFieldsForSelectedStatus();
var sectionChanged = hasSectionChanged(sectionClass);
$('.' + sectionClass).find('input, textarea, select').each(function () {
var id = this.id;
if (!id || letterPairIds.indexOf(id) !== -1) {
return;
}
var statusRequires = statusRequiredFields.indexOf(id) !== -1;
$(this).prop('required', statusRequires || sectionChanged);
});
var statusMandatesSection = false;
for (var i = 0; i < statusRequiredFields.length; i++) {
if ($('.' + sectionClass + ' #' + statusRequiredFields[i]).length > 0) {
statusMandatesSection = true;
break;
}
}
updateSectionRequiredLabels(sectionClass, sectionChanged || statusMandatesSection);
return;
}
var changed = hasSectionChanged(sectionClass);
$('.' + sectionClass).find('input, textarea, select').each(function() {
$('.' + sectionClass).find('input, textarea, select').each(function () {
if (this.id === 'approved_description') {
return;
}
@ -738,6 +802,7 @@
allowInput: false
});
initStatusRequiredFieldsMap();
updateClaimStatusDisplay("<?= isset($ticket_data['claim_status_id']) ? $ticket_data['claim_status_id'] : 0 ?>")
var extraFields = <?= json_encode(isset($extra_fields) ? $extra_fields : []); ?>;
GlobelExtraFields = extraFields;

View File

@ -80,7 +80,7 @@
var end = moment(end, 'DD/MM/YYYY');
function cb(start, end) {
$('#reportrange span').html(start.format('D-MM-YYYY') + ' - ' + end.format('D-MM-YYYY'));
$('#reportrange span').html(start.format('D/MM/YYYY') + ' - ' + end.format('D/MM/YYYY'));
$('#startDate').val(start.format('DD-MM-YYYY'));
$('#endDate').val(end.format('DD-MM-YYYY'));
}

View File

@ -1,12 +1,79 @@
<?php
helper('datatable_view');
$vd_header_labels = [
'Date', 'Record Date', 'Unit', 'Policy', 'Endorsement No', 'Sub Type',
'Credit', 'Debit', 'Balance', 'Description', 'User',
];
$vd_col_count = count($vd_header_labels);
$vd_col_max_len = array_fill(0, $vd_col_count, 0);
for ($i = 0; $i < $vd_col_count; $i++) {
$vd_col_max_len[$i] = mb_strlen($vd_header_labels[$i]);
}
$depositdata = $depositdata ?? [];
$subTypeOptions = $subTypeOptions ?? [];
foreach ($depositdata as $row) {
$vd_col_max_len[0] = max($vd_col_max_len[0], mb_strlen(date('d-M-Y h:i A', strtotime((string) $row->created_at))));
$rec = ! empty($row->record_date) ? date('d-M-Y', strtotime((string) $row->record_date)) : '-';
$vd_col_max_len[1] = max($vd_col_max_len[1], mb_strlen($rec));
$vd_col_max_len[2] = max($vd_col_max_len[2], mb_strlen(trim((string) ($row->unit ?? ' - '))));
$policyType = $row->policy_type ?? '';
$policyNo = $row->policy_no ?? '';
$policyCell = ($policyType || $policyNo) ? trim($policyType . ' - ' . $policyNo, ' -') : '-';
$vd_col_max_len[3] = max($vd_col_max_len[3], mb_strlen($policyCell));
$vd_col_max_len[4] = max($vd_col_max_len[4], mb_strlen(strip_tags((string) ($row->endorsement_no ?? '-'))));
$subLabel = isset($subTypeOptions[$row->sub_type]) ? (string) $subTypeOptions[$row->sub_type] : '';
$vd_col_max_len[5] = max($vd_col_max_len[5], mb_strlen($subLabel));
$credit = ($row->transaction_type ?? '') === 'Credit' ? (string) ($row->amount ?? '-') : '-';
$debit = ($row->transaction_type ?? '') === 'Debit' ? (string) ($row->amount ?? '-') : '-';
$vd_col_max_len[6] = max($vd_col_max_len[6], mb_strlen($credit));
$vd_col_max_len[7] = max($vd_col_max_len[7], mb_strlen($debit));
$vd_col_max_len[8] = max($vd_col_max_len[8], mb_strlen((string) ($row->balance ?? '')));
$vd_col_max_len[9] = max($vd_col_max_len[9], mb_strlen((string) ($row->description ?? '')));
$vd_col_max_len[10] = max($vd_col_max_len[10], mb_strlen((string) ($row->username ?? '')));
}
$vd_col_min_px = [120, 100, 72, 160, 110, 88, 88, 88, 100, 140, 100];
$vd_col_max_px = [200, 120, 120, 360, 160, 140, 120, 120, 140, 400, 200];
$vd_col_width_px = nhance_dt_column_widths_px($vd_header_labels, $vd_col_max_len, $vd_col_min_px, $vd_col_max_px);
?>
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
<?php for ($i = 0; $i < $vd_col_count; $i++) : ?>
#scroll-horizontal-datatable_wrapper .dataTables_scrollHead table thead th:nth-child(<?= $i + 1 ?>),
#scroll-horizontal-datatable thead th:nth-child(<?= $i + 1 ?>) {
min-width: <?= (int) $vd_col_width_px[$i] ?>px;
width: <?= (int) $vd_col_width_px[$i] ?>px;
box-sizing: border-box;
vertical-align: middle;
overflow: visible !important;
}
#scroll-horizontal-datatable tbody td:nth-child(<?= $i + 1 ?>) {
width: <?= (int) $vd_col_width_px[$i] ?>px;
max-width: <?= (int) $vd_col_width_px[$i] ?>px;
min-width: <?= (int) $vd_col_width_px[$i] ?>px;
box-sizing: border-box;
vertical-align: middle;
}
<?php endfor; ?>
#scroll-horizontal-datatable tbody td {
padding: 5px 11px !important;
font-size: 13px;
line-height: 1.25;
overflow: hidden;
text-overflow: ellipsis;
}
#scroll-horizontal-datatable_wrapper .dataTables_scrollHead table thead th,
#scroll-horizontal-datatable thead th {
padding: 5px 11px !important;
font-size: 13px;
line-height: 1.25;
}
#scroll-horizontal-datatable_wrapper .dataTables_scrollHead table,
#scroll-horizontal-datatable_wrapper .dataTables_scrollBody table {
table-layout: fixed;
width: 100% !important;
}
#List-page .card-body > .table-responsive {
overflow-x: auto;
}
.deposit-header {
display: flex;
align-items: center;
@ -123,7 +190,7 @@
</div> -->
<div class="table-responsive">
<table data-custom-table-css="table" class="table mb-0 nowrap w-100 table-centered" cellspacing="0" id="scroll-horizontal-datatable">
<table data-custom-table-css="table" class="table mb-0 nowrap w-100" cellspacing="0" id="scroll-horizontal-datatable">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">Date</th>
@ -154,11 +221,11 @@
if ($policyType || $policyNo) {
echo trim($policyType . ' - ' . $policyNo, ' -');
} else {
echo '<center> - </center>';
echo '-';
}
?>
</td>
<td><?php echo $row->endorsement_no ?? '<center> - </center>'; ?></td>
<td><?php echo $row->endorsement_no ?? '-'; ?></td>
<td><?php echo isset($subTypeOptions[$row->sub_type]) ? $subTypeOptions[$row->sub_type] : ''; ?>
</td>
<td><?php echo ($row->transaction_type == 'Credit') ? $row->amount : '-'; ?></td>
@ -304,8 +371,8 @@
allowInput: false,
});
$('#scroll-horizontal-datatable').DataTable({
scrollX: true,
nhanceListDataTableBeforeInit();
var vdDepositTable = $('#scroll-horizontal-datatable').DataTable(nhanceMergeListDataTableOptions({
// dom: "<'row'<'col-sm-2'f><'col-sm-10 text-right'B>>" +
// "<'row'<'col-sm-12'tr>>" +
// "<'row'<'col-sm-5'i><'col-sm-7'p>>",
@ -400,8 +467,16 @@
emptyTable: '<div class="text-center text-muted">No Data found</div>'
},
ordering: false,
paging: true
});
paging: true,
autoWidth: false,
columnDefs: [
<?php for ($i = 0; $i < $vd_col_count; $i++) : ?>
{ targets: <?= $i ?>, width: '<?= (int) $vd_col_width_px[$i] ?>px' },
<?php endfor; ?>
],
}));
nhanceListDataTableAfterInit();
nhanceListDataTableBindAdjust(vdDepositTable);
});
</script>

View File

@ -1,3 +1,5 @@
<?php $page_name = $page_name ?? ""; ?>
<style>
.table-container {
@ -496,8 +498,8 @@
</div>
<div class="col-2" style="position: relative;right: 255px;">
<?php if($lead_data['demography_file_status'] == "failed") { ?>
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=').$lead_data['id'] ?>"
<?php if($lead_data['demography_file_status'] ?? "" == "failed") { ?>
<a href="<?= base_url('util/getMemberDataExcelFileErrors?lead_id=') . ($lead_data['id'] ?? '') ?>"
class="mdi mdi-information-outline text-danger"
style="cursor: pointer; font-size: 27px"
data-toggle="tooltip"
@ -801,7 +803,7 @@
<div class="form-group col-md-4">
<label for="cc">CC </label>
<select class="form-control" id="cc" name="cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -981,7 +983,7 @@
<div class="form-group col-md-6">
<label for="placement_cc">CC </label>
<select class="form-control" id="placement_cc" name="placement_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
>
<?php foreach ($exclusiveUserList as $user) { ?>
@ -1356,7 +1358,7 @@ let intervalId;
$(document).ready(function () {
console.log("Document ready");
var demography_file_status_for_hide_and_show = '<?= $lead_data['demography_file_status'] ?>';
var demography_file_status_for_hide_and_show = '<?= $lead_data['demography_file_status'] ?? "" ?>';
toggleButtons(demography_file_status_for_hide_and_show);
let lead_status = '<?= isset($lead_data['status']) ? $lead_data['status'] : '' ?>';
@ -1404,7 +1406,7 @@ $('.remove-icon').on('click', function() {
var currentThrdottedMenu = '';
var proposal_colum_count = 1;
var demography_file_status = '<?= $lead_data['demography_file_status'] ?>';
var demography_file_status = '<?= $lead_data['demography_file_status'] ?? "" ?>';
var over_all_column_data = {
"Proposal 1": {
@ -1818,7 +1820,7 @@ function addSuggestionsToTable() {
<span class="dropdown" onclick="showThreeDottedMenu(event)">
<button class="dropbtn"></button>
<div class="dropdown-content">
<a href="#" class="addInsurer">Add Insurer</a>
<a href="#" class="F">Add Insurer</a>
<a href="#" class="qcrProposal" style="background-color: rgb(221, 221, 221);">
QCR <i class="mdi mdi-checkbox-marked" style="color: green; margin-left: 8px;"></i>
</a>
@ -2549,7 +2551,7 @@ function detachDynamicEventListeners() {
function addInsurer(event) {
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -2701,7 +2703,7 @@ function dupInsurer(event) {
const thPosition = getThPosition(event);
console.log(thPosition);
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -3217,7 +3219,7 @@ function changeInsurer(event) {
}
// let newInsurerName = prompt("Enter New insurer name:");
const insurers = <?= json_encode($insurer); ?>;
const insurers = <?= json_encode($insurer ?? []); ?>;
selectInsurer(insurers).then(result => {
@ -4124,7 +4126,7 @@ function appendInput(data) {
<div class="form-group col-md-6">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4139,7 +4141,7 @@ function appendInput(data) {
<div class="form-group col-md-6">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4190,7 +4192,7 @@ function appendInput(data) {
<div class="form-group col-md-4">
<label for="client_cc">CC </label>
<select class="form-control" id="client_cc" name="client_cc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
@ -4205,10 +4207,11 @@ function appendInput(data) {
<div class="form-group col-md-4">
<label for="client_bcc">BCC </label>
<select class="form-control" id="client_bcc" name="client_bcc" required multiple>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList; } ?>
<?php if($page_name == "RFQ") { $exclusiveUserList = $userList ?? []; } ?>
<?php if (isset($exclusiveUserList)) { ?>
<?php foreach ($exclusiveUserList as $user) { ?>
<?php if ($page_name == "RFQ" || in_array($user['role'],[1,5]) || in_array($user['team_id'],[6,7])) { ?>
<option value="<?= $user['id'];?>">
<?= $user['first_name'].' - '.$user['email'];?>
</option>
<?php } } ?>

View File

@ -47,12 +47,61 @@
return true;
}
function isExcludedCharsetField(el) {
if (!el) {
return false;
}
if ($(el).attr('data-parsley-exclude-charset') === 'true') {
return true;
}
var id = (el.id || '').toLowerCase();
var name = (el.name || '').toLowerCase();
return id === 'policy_no' || id === 'endorsement_no' ||
name === 'policy_no' || name === 'endorsement_no';
}
function clearExcludedFieldValidation($form) {
if (!$form || !$form.length) {
return;
}
$form.find('input, textarea, select').each(function () {
var el = this;
if (!isExcludedCharsetField(el)) {
return;
}
var $el = $(el);
$el.removeAttr('data-parsley-endorsementcharset');
$el.attr('data-parsley-validate', 'false');
$el.removeClass('parsley-error parsley-success');
$el.siblings('ul.parsley-errors-list').remove();
$el.closest('.form-group').find('ul.parsley-errors-list').remove();
if (typeof $el.parsley === 'function') {
try {
var fieldInstance = $el.parsley();
if (fieldInstance && typeof fieldInstance.reset === 'function') {
fieldInstance.reset();
}
if (fieldInstance && typeof fieldInstance.destroy === 'function') {
fieldInstance.destroy();
}
} catch (e) {
// no-op
}
}
});
refreshParsley($form);
}
function registerValidator() {
if (!isParsleyReady() || window.Parsley.__endorsementFormValidatorRegistered) {
return;
}
window.Parsley.addValidator('endorsementcharset', {
validateString: function (value) {
var el = this.$element && this.$element.length ? this.$element[0] : null;
if (isExcludedCharsetField(el)) {
return true;
}
if (!value || String(value).trim() === '') {
return true;
}
@ -85,6 +134,12 @@
return;
}
if (isExcludedCharsetField(el)) {
$el.removeAttr('data-parsley-endorsementcharset');
$el.attr('data-parsley-validate', 'false');
return;
}
if (isCharsetCandidate(el) || isDocumentNameField(el)) {
if (!$el.attr('data-parsley-endorsementcharset')) {
$el.attr('data-parsley-endorsementcharset', 'true');
@ -144,7 +199,7 @@
}
function validateField(field) {
if (!field || isSkippableField(field) || !isParsleyReady()) {
if (!field || isSkippableField(field) || isExcludedCharsetField(field) || !isParsleyReady()) {
return;
}
var $field = $(field);
@ -181,6 +236,7 @@
registerValidator();
applyConstraints($form);
clearExcludedFieldValidation($form);
refreshParsley($form);
stripParsleyFormSubmitHandlers($form);
@ -237,18 +293,14 @@
initWithRetry(40);
});
$(window).on('load', function () {
if (!isParsleyReady()) {
window.clearEndorsementExcludedFieldsValidation = function (formSelector) {
var sel = formSelector || '#endorsement_form_id';
var $form = $(sel);
if (!$form.length || !isParsleyReady()) {
return;
}
FORM_SELECTORS.forEach(function (selector) {
var $f = $(selector);
if ($f.length) {
refreshParsley($f);
stripParsleyFormSubmitHandlers($f);
}
});
});
clearExcludedFieldValidation($form);
};
window.refreshEndorsementFormValidation = function (formSelector) {
if (!formSelector || !isParsleyReady()) {
@ -271,12 +323,32 @@
stripOrphanParsleyUi($form);
$form.removeData(LIVE_VALIDATE_DATA);
try {
clearExcludedFieldValidation($form);
refreshParsley($form);
stripParsleyFormSubmitHandlers($form);
} catch (e2) {
// no-op
}
};
// form-validation.init.js binds all .parsley-examples after this script loads
$(window).on('load', function () {
window.setTimeout(function () {
if (!isParsleyReady()) {
return;
}
FORM_SELECTORS.forEach(function (selector) {
var $f = $(selector);
if (!$f.length) {
return;
}
applyConstraints($f);
clearExcludedFieldValidation($f);
refreshParsley($f);
stripParsleyFormSubmitHandlers($f);
});
}, 0);
});
})(function () {
return window.jQuery;
});