FIX_CLIENT_ISSUES : RV
This commit is contained in:
parent
8f5fc52d9f
commit
5e8adfc72d
@ -1215,7 +1215,7 @@ class LeadsController extends BaseController
|
|||||||
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
'Total Lives' => $rfq_data['incept_no_of_lives'],
|
||||||
|
|
||||||
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
'Period of Insurance ' => !empty($rfq_data['policy_start_date']) && !empty($rfq_data['policy_end_date']) ? date('d/m/Y', strtotime($rfq_data['policy_start_date'])) . ' to ' . date('d/m/Y', strtotime($rfq_data['policy_end_date'])) : "To be decided",
|
||||||
'Policy Run Days' => $rfq_data['policy_run_days'],
|
// 'Policy Run Days' => $rfq_data['policy_run_days'],
|
||||||
];
|
];
|
||||||
} else if ($rfq_data['policy_type_id'] == 1) {
|
} else if ($rfq_data['policy_type_id'] == 1) {
|
||||||
$lead_data = [
|
$lead_data = [
|
||||||
@ -2163,6 +2163,13 @@ class LeadsController extends BaseController
|
|||||||
$mail_subject = $params['subject'];
|
$mail_subject = $params['subject'];
|
||||||
$attachment_file_ids = $params['selected_attachment_files'];
|
$attachment_file_ids = $params['selected_attachment_files'];
|
||||||
|
|
||||||
|
$from_mail = getenv('email.fromEmail');
|
||||||
|
if(in_array($recipient_type ,['placement', 'insurer', 'internal'])){
|
||||||
|
$from_mail = "im@nhanceindia.in";
|
||||||
|
}else if(in_array($recipient_type, ['client'])){
|
||||||
|
$from_mail = "bs@nhanceindia.in";
|
||||||
|
}
|
||||||
|
|
||||||
$result_data = [];
|
$result_data = [];
|
||||||
// dd($recipient_mail);
|
// dd($recipient_mail);
|
||||||
if ($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0)) {
|
if ($recipient_type == 'insurer' && (!is_array($recipient_mail) || count($recipient_mail) == 0)) {
|
||||||
@ -2348,7 +2355,7 @@ class LeadsController extends BaseController
|
|||||||
$string = implode(", ", $cc_mails);
|
$string = implode(", ", $cc_mails);
|
||||||
$bcc_string = implode(", ", $bcc_mails);
|
$bcc_string = implode(", ", $bcc_mails);
|
||||||
|
|
||||||
$res = MailHelper::send_email(['mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
|
$res = MailHelper::send_email(['from_mail' => $from_mail, 'mail' => $recipient['email'], 'cc' => $string, 'subject' => $subject, 'message' => $message, 'attachments' => $attachments, 'reply_to' => $reply_to, 'bcc' => $bcc_string]);
|
||||||
// !dd($res);
|
// !dd($res);
|
||||||
$result_data[] = ['mail' => $recipient['email'], 'status' => $res];
|
$result_data[] = ['mail' => $recipient['email'], 'status' => $res];
|
||||||
}
|
}
|
||||||
@ -4102,32 +4109,63 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
public function handleMultiFileAttachments($json_string, $lead_id)
|
public function handleMultiFileAttachments($json_string, $lead_id)
|
||||||
{
|
{
|
||||||
|
log_message('error', 'handleMultiFileAttachments called with lead_id: ' . $lead_id);
|
||||||
|
|
||||||
$attachments = [];
|
$attachments = [];
|
||||||
|
|
||||||
if (!empty($json_string)) {
|
if (!empty($json_string)) {
|
||||||
|
log_message('error', 'json_string is not empty');
|
||||||
|
|
||||||
$fileIds = json_decode($json_string, true);
|
$fileIds = json_decode($json_string, true);
|
||||||
|
log_message('error', 'Decoded fileIds: ' . print_r($fileIds, true));
|
||||||
|
|
||||||
$lead_file_path = WRITEPATH . 'uploads/lead_files/';
|
$lead_file_path = WRITEPATH . 'uploads/lead_files/';
|
||||||
|
log_message('error', 'Lead file path: ' . $lead_file_path);
|
||||||
|
|
||||||
foreach ($fileIds as $id) {
|
foreach ($fileIds as $id) {
|
||||||
$lead_file = $this->leadFilesModel->where('lead_id', $lead_id)->where('id', $id)->where('is_active', 1)->first();
|
log_message('error', 'Processing file ID: ' . $id);
|
||||||
|
|
||||||
|
$lead_file = $this->leadFilesModel
|
||||||
|
->where('lead_id', $lead_id)
|
||||||
|
->where('id', $id)
|
||||||
|
->where('is_active', 1)
|
||||||
|
->first();
|
||||||
|
|
||||||
if ($lead_file) {
|
if ($lead_file) {
|
||||||
|
log_message('error', 'Found lead file: ' . print_r($lead_file, true));
|
||||||
|
|
||||||
$fullPath = $lead_file_path . $lead_file['file_name'];
|
$fullPath = $lead_file_path . $lead_file['file_name'];
|
||||||
|
log_message('error', 'Full file path: ' . $fullPath);
|
||||||
|
|
||||||
if (file_exists($fullPath) && !empty($fileName)) {
|
if (file_exists($fullPath)) {
|
||||||
$attachments[] = [
|
log_message('error', 'File exists at path: ' . $fullPath);
|
||||||
'fileName' => $lead_file['file_name'],
|
|
||||||
'filePath' => $fullPath
|
if (!empty($lead_file['file_name'])) {
|
||||||
];
|
log_message('error', 'File name is not empty: ' . $lead_file['file_name']);
|
||||||
|
|
||||||
|
$attachments[] = [
|
||||||
|
'fileName' => $lead_file['file_name'],
|
||||||
|
'filePath' => $fullPath
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
log_message('warning', 'File name is empty for ID: ' . $id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log_message('warning', 'File does not exist at path: ' . $fullPath);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_message('warning', 'No active lead file found for ID: ' . $id . ' and lead_id: ' . $lead_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_message('error', 'json_string is empty');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_message('error', 'Attachments prepared: ' . print_r($attachments, true));
|
||||||
return $attachments;
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function handleMemberDataGPATotalSumInsurerFromExcel($params)
|
public function handleMemberDataGPATotalSumInsurerFromExcel($params)
|
||||||
{
|
{
|
||||||
$lead_id = $params['lead_id'];
|
$lead_id = $params['lead_id'];
|
||||||
|
|||||||
@ -1575,14 +1575,21 @@ class TicketController extends BaseController
|
|||||||
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
$statusMapping = json_decode($incoming_form_values['extra_fields_array_for_validate']);
|
||||||
|
|
||||||
foreach ($statusMapping as $status => $requiredFields) {
|
foreach ($statusMapping as $status => $requiredFields) {
|
||||||
|
|
||||||
// Ensure requiredFields is an array
|
// Ensure requiredFields is an array
|
||||||
if (!is_array($requiredFields)) {
|
if (!is_array($requiredFields)) {
|
||||||
$requiredFields = [$requiredFields];
|
$requiredFields = [$requiredFields];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all required fields exist and are not empty in the incoming form values
|
// Check if all required fields exist and are not empty in the incoming form values
|
||||||
$allFieldsMatched = true;
|
$allFieldsMatched = true;
|
||||||
foreach ($requiredFields as $field) {
|
foreach ($requiredFields as $field) {
|
||||||
|
|
||||||
|
if(in_array($field, ['approved_description'])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
if (!isset($incoming_form_values[$field]) || empty($incoming_form_values[$field])) {
|
||||||
$allFieldsMatched = false;
|
$allFieldsMatched = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -848,18 +848,25 @@ if (isset($selected_lead_type)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function waitForDropdownValue(selector, value, callback, retries = 20) {
|
function waitForDropdownValue(selector, value, callback, retries = 20) {
|
||||||
|
|
||||||
const trySet = () => {
|
const trySet = () => {
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
const $el = $(selector);
|
const $el = $(selector);
|
||||||
if ($el.find(`option[value="${value}"]`).length > 0) {
|
if ($el.find(`option[value="${value}"]`).length > 0) {
|
||||||
$el.val(value).trigger('change');
|
$el.val(value).trigger('change');
|
||||||
callback();
|
callback();
|
||||||
} else if (retries > 0) {
|
} else if (retries > 0) {
|
||||||
setTimeout(() => trySet(selector, value, callback, retries - 1), 300);
|
setTimeout(trySet, 300); // retry without re-passing arguments
|
||||||
|
retries--;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Value ${value} not found for ${selector}`);
|
console.warn(`Value ${value} not found for ${selector}`);
|
||||||
callback(); // Proceed anyway to avoid hanging
|
callback(); // Proceed anyway to avoid hanging
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
trySet();
|
trySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -868,40 +875,35 @@ if (isset($selected_lead_type)) {
|
|||||||
let lead_type = data.lead_type || null;
|
let lead_type = data.lead_type || null;
|
||||||
waitForDropdownValue('#client_id', data.client_id || '', () => {
|
waitForDropdownValue('#client_id', data.client_id || '', () => {
|
||||||
if (lead_type == 3) {
|
if (lead_type == 3) {
|
||||||
|
// Add "+ Add Client" option if not already present
|
||||||
|
if ($('#client_id option[value="add_client"]').length === 0) {
|
||||||
|
$('#client_id').prepend($('<option>', {
|
||||||
|
value: 'add_client',
|
||||||
|
text: '+ Add Client'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
$('#client_id').prepend($('<option>', {
|
console.log("Trying to remove 'required' attribute and asterisk");
|
||||||
value: 'add_client',
|
$("#source_policy_id").prop("required", false);
|
||||||
text: '+ Add Client'
|
$("#source_policy_id").closest("div").find("label .text-danger").remove();
|
||||||
}));
|
|
||||||
|
|
||||||
console.log("trying to remove required ");
|
} else {
|
||||||
$("#source_policy_id").prop("required",false);
|
|
||||||
$("#source_policy_id").closest("div") .find("label .text-danger").remove();
|
|
||||||
|
|
||||||
|
|
||||||
} else if (lead_type != 3) {
|
|
||||||
$("#source_policy_id").prop("required",true);
|
|
||||||
$("#source_policy_id").prop("required", true);
|
$("#source_policy_id").prop("required", true);
|
||||||
|
|
||||||
// Check if the asterisk doesn't already exist, then add it
|
// Add asterisk if not present
|
||||||
let $label = $("#source_policy_id")
|
let $label = $("#source_policy_id").closest("div").find("label");
|
||||||
.closest("div")
|
|
||||||
.find("label");
|
|
||||||
|
|
||||||
if ($label.find(".text-danger").length === 0) {
|
if ($label.find(".text-danger").length === 0) {
|
||||||
$label.append(' <span class="text-danger">*</span>');
|
$label.append(' <span class="text-danger">*</span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
var addOption = $('#client_id option[value="add_client"]');
|
// Remove "+ Add Client" option if exists
|
||||||
if (addOption.length > 0) {
|
$('#client_id option[value="add_client"]').remove();
|
||||||
addOption.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log("rying to remove required and option removed from client")
|
|
||||||
|
|
||||||
|
console.log("Set 'required' for source_policy_id and removed add_client option if present");
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForDropdownValue('#client_branch_id', data.client_branch_id || '', () => {
|
waitForDropdownValue('#client_branch_id', data.client_branch_id || '', () => {
|
||||||
// Fill other fields once both dropdowns are ready
|
// Fill other form fields
|
||||||
$('#source_policy_id').val(data.source_policy_id || '');
|
$('#source_policy_id').val(data.source_policy_id || '');
|
||||||
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
$('#source_policy_end_date').val(data.source_policy_end_date || '');
|
||||||
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
$('#source_policy_start_date').val(data.source_policy_start_date || '');
|
||||||
@ -917,9 +919,10 @@ if (isset($selected_lead_type)) {
|
|||||||
|
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
$(".loss_date").each(function () {
|
$(".loss_date").each(function () {
|
||||||
flatpickr(this, {
|
flatpickr(this, {
|
||||||
dateFormat: "d-m-Y",
|
dateFormat: "d-m-Y"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -480,6 +480,7 @@
|
|||||||
var doa = flatpickr("#doa", {
|
var doa = flatpickr("#doa", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
|
maxDate: "today",
|
||||||
onChange: function(selectedDates) {
|
onChange: function(selectedDates) {
|
||||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||||
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
dod.set("minDate", selectedDOA); // Set DOD minDate to DOA
|
||||||
@ -488,35 +489,43 @@
|
|||||||
|
|
||||||
var dod = flatpickr("#dod", {
|
var dod = flatpickr("#dod", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
allowInput: false
|
allowInput: false,
|
||||||
|
maxDate: "today"
|
||||||
});
|
});
|
||||||
|
|
||||||
flatpickr("#raised_date", {
|
flatpickr("#raised_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#registration_date", {
|
flatpickr("#registration_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#query_received_date", {
|
flatpickr("#query_received_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#denial_date", {
|
flatpickr("#denial_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#approved_date", {
|
flatpickr("#approved_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#settled_date", {
|
flatpickr("#settled_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#pay_initiate_date", {
|
flatpickr("#pay_initiate_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -633,6 +642,29 @@
|
|||||||
$field.prop('required', true);
|
$field.prop('required', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let extrafieldsArray = $('#extra_fields_array_for_validate').val();
|
||||||
|
try {
|
||||||
|
extrafieldsArray = JSON.parse(extrafieldsArray);
|
||||||
|
|
||||||
|
// Keep only the entry for the current claim_status_id
|
||||||
|
extrafieldsArray = {
|
||||||
|
[selectedVal]: extrafieldsArray[selectedVal]
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('Filtered extrafieldsArray:', extrafieldsArray);
|
||||||
|
|
||||||
|
extrafieldsArray = JSON.stringify(extrafieldsArray);
|
||||||
|
console.log('Filtered extrafieldsArray string:', extrafieldsArray);
|
||||||
|
|
||||||
|
$('#extra_fields_array_for_validate').val(extrafieldsArray);
|
||||||
|
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Invalid JSON format in extra_fields_array_for_validate:", error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function claimStatusFieldChanges(fields) {
|
function claimStatusFieldChanges(fields) {
|
||||||
@ -1080,6 +1112,7 @@
|
|||||||
console.log("doa not found, initializing");
|
console.log("doa not found, initializing");
|
||||||
doa = flatpickr("#doa", {
|
doa = flatpickr("#doa", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
onChange: function(selectedDates) {
|
onChange: function(selectedDates) {
|
||||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||||
@ -1089,6 +1122,7 @@
|
|||||||
});
|
});
|
||||||
var dod = flatpickr("#dod", {
|
var dod = flatpickr("#dod", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -364,21 +364,25 @@
|
|||||||
$("#emp_client_policy").select2();
|
$("#emp_client_policy").select2();
|
||||||
date_of_join = flatpickr("#date_of_join", {
|
date_of_join = flatpickr("#date_of_join", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
dob = flatpickr("#dob", {
|
dob = flatpickr("#dob", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var date_of_incep = flatpickr("#date_of_incep", {
|
var date_of_incep = flatpickr("#date_of_incep", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
date_of_accident = flatpickr("#date_of_accident", {
|
date_of_accident = flatpickr("#date_of_accident", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false,
|
allowInput: false,
|
||||||
onChange: function(selectedDates) {
|
onChange: function(selectedDates) {
|
||||||
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
let selectedDOA = selectedDates[0]; // Get selected DOA date
|
||||||
@ -389,20 +393,24 @@
|
|||||||
|
|
||||||
date_of_death = flatpickr("#date_of_death", {
|
date_of_death = flatpickr("#date_of_death", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
date_of_intimat = flatpickr("#date_of_intimat", {
|
date_of_intimat = flatpickr("#date_of_intimat", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
flatpickr("#approved_date", {
|
flatpickr("#approved_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
flatpickr("#settled_date", {
|
flatpickr("#settled_date", {
|
||||||
dateFormat: "d/m/Y",
|
dateFormat: "d/m/Y",
|
||||||
|
maxDate: "today",
|
||||||
allowInput: false
|
allowInput: false
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user