FIX_LEAD_TO_OPPRTUTITIES_AND_MEDIASSIST_CLAIMS_STATUS_MAPPING
This commit is contained in:
parent
ca7dca8575
commit
fc10f71680
@ -4774,7 +4774,7 @@ class LeadsController extends BaseController
|
|||||||
|
|
||||||
// 🔹 Client Details (Single Row)
|
// 🔹 Client Details (Single Row)
|
||||||
$data['actual_lead_client_details'] = $this->leadModel
|
$data['actual_lead_client_details'] = $this->leadModel
|
||||||
->select('sales_actual_leads.company_name, clients.short_name, sales_actual_leads.email, sales_actual_leads.phone, sales_actual_leads.address, sales_actual_leads.website, sales_actual_leads.gst_number, sales_actual_leads.status, sales_actual_leads.assigned_to')
|
->select('sales_actual_leads.company_name, clients.short_name, clients.client_type, sales_actual_leads.email, sales_actual_leads.phone, sales_actual_leads.address, sales_actual_leads.website, sales_actual_leads.gst_number, sales_actual_leads.status, sales_actual_leads.assigned_to')
|
||||||
->join('clients', 'clients.id = sales_actual_leads.client_id', 'left')
|
->join('clients', 'clients.id = sales_actual_leads.client_id', 'left')
|
||||||
->where('sales_actual_leads.lead_id', $actual_lead_id)
|
->where('sales_actual_leads.lead_id', $actual_lead_id)
|
||||||
->first(); // first row only
|
->first(); // first row only
|
||||||
@ -5527,7 +5527,7 @@ class LeadsController extends BaseController
|
|||||||
*
|
*
|
||||||
* @param string $recipientType insurer|client|internal
|
* @param string $recipientType insurer|client|internal
|
||||||
*/
|
*/
|
||||||
protected function downloadFileFromGoogleSheet(array $lead_data, string $recipientType = 'insurer'): array
|
protected function downloadFileFromGoogleSheet(array $lead_data, string $recipientType = 'insurer'): ?array
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$leadId = (int) ($lead_data['id'] ?? 0);
|
$leadId = (int) ($lead_data['id'] ?? 0);
|
||||||
|
|||||||
@ -596,7 +596,7 @@ class MediAssistApiController extends BaseController
|
|||||||
"Confirmation Awaited" => 4,
|
"Confirmation Awaited" => 4,
|
||||||
"Information Awaited Reminder" => 4,
|
"Information Awaited Reminder" => 4,
|
||||||
"Information Awaited Final Reminder" => 4,
|
"Information Awaited Final Reminder" => 4,
|
||||||
"Insurer Concurrence Awaited" => 6,
|
"Insurer Concurrence Awaited" => 7,
|
||||||
"Closed" => 12,
|
"Closed" => 12,
|
||||||
|
|
||||||
"Physical Documents Awaited" => 9,
|
"Physical Documents Awaited" => 9,
|
||||||
@ -944,7 +944,7 @@ class MediAssistApiController extends BaseController
|
|||||||
"Confirmation Awaited" => 4,
|
"Confirmation Awaited" => 4,
|
||||||
"Information Awaited Reminder" => 4,
|
"Information Awaited Reminder" => 4,
|
||||||
"Information Awaited Final Reminder" => 4,
|
"Information Awaited Final Reminder" => 4,
|
||||||
"Insurer Concurrence Awaited" => 6,
|
"Insurer Concurrence Awaited" => 7,
|
||||||
"Closed" => 12,
|
"Closed" => 12,
|
||||||
|
|
||||||
"Physical Documents Awaited" => 9,
|
"Physical Documents Awaited" => 9,
|
||||||
@ -1191,7 +1191,7 @@ class MediAssistApiController extends BaseController
|
|||||||
"Confirmation Awaited" => 4,
|
"Confirmation Awaited" => 4,
|
||||||
"Information Awaited Reminder" => 4,
|
"Information Awaited Reminder" => 4,
|
||||||
"Information Awaited Final Reminder" => 4,
|
"Information Awaited Final Reminder" => 4,
|
||||||
"Insurer Concurrence Awaited" => 6,
|
"Insurer Concurrence Awaited" => 7,
|
||||||
"Closed" => 12,
|
"Closed" => 12,
|
||||||
|
|
||||||
"Physical Documents Awaited" => 9,
|
"Physical Documents Awaited" => 9,
|
||||||
|
|||||||
@ -2516,6 +2516,9 @@
|
|||||||
$('#client_name').val(actualLeadClientName);
|
$('#client_name').val(actualLeadClientName);
|
||||||
|
|
||||||
$('#gst').val(actual_lead_client_details.gst_number || '');
|
$('#gst').val(actual_lead_client_details.gst_number || '');
|
||||||
|
if (actual_lead_client_details.client_type !== undefined && actual_lead_client_details.client_type !== null && actual_lead_client_details.client_type !== '') {
|
||||||
|
$('#client_type').val(String(actual_lead_client_details.client_type));
|
||||||
|
}
|
||||||
|
|
||||||
// existingShortName = actual_lead_client_details.short_name || '';
|
// existingShortName = actual_lead_client_details.short_name || '';
|
||||||
// if (existingShortName) {
|
// if (existingShortName) {
|
||||||
|
|||||||
@ -525,10 +525,14 @@ if (isset($selected_lead_type)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(client_type == ""){
|
if(client_type == ""){
|
||||||
|
var aid = $('#actual_lead_id').val();
|
||||||
|
if (!aid || aid === '0') {
|
||||||
toastr.warning('Please select the client type', 'Warning');
|
toastr.warning('Please select the client type', 'Warning');
|
||||||
$('#client_short_name').val('')
|
$('#client_short_name').val('');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Actual-lead autofill: short name may be set before client type is chosen; do not clear it.
|
||||||
|
}
|
||||||
|
|
||||||
let value = $(input).val();
|
let value = $(input).val();
|
||||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||||
|
|||||||
@ -853,8 +853,10 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
|
|||||||
// --- Re-populate Actual Lead data if it was cleared ---
|
// --- Re-populate Actual Lead data if it was cleared ---
|
||||||
if ($('#actual_lead_id').val() && $('#actual_lead_id').val() != 0) {
|
if ($('#actual_lead_id').val() && $('#actual_lead_id').val() != 0) {
|
||||||
$('#client_name').val(actualLeadClientName);
|
$('#client_name').val(actualLeadClientName);
|
||||||
// Re-generate short name from the stored client name to ensure consistency
|
if (actualLeadShortName.trim() !== '') {
|
||||||
if (actualLeadClientName.trim() !== '') {
|
$('#client_short_name').val(actualLeadShortName);
|
||||||
|
} else if (actualLeadClientName.trim() !== '') {
|
||||||
|
// Fallback only when no persisted short name is available.
|
||||||
let baseName = actualLeadClientName
|
let baseName = actualLeadClientName
|
||||||
.trim()
|
.trim()
|
||||||
.substring(0, 10)
|
.substring(0, 10)
|
||||||
@ -1359,15 +1361,16 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
|
|||||||
$('#client_name').val(actualLeadClientName);
|
$('#client_name').val(actualLeadClientName);
|
||||||
|
|
||||||
$('#gst').val(actual_lead_client_details.gst_number || '');
|
$('#gst').val(actual_lead_client_details.gst_number || '');
|
||||||
// existingShortName = actual_lead_client_details.short_name || '';
|
if (actual_lead_client_details.client_type !== undefined && actual_lead_client_details.client_type !== null && actual_lead_client_details.client_type !== '') {
|
||||||
// if (existingShortName) {
|
$('#client_type').val(String(actual_lead_client_details.client_type));
|
||||||
// // ── Short name EXISTS — just populate and validate ────────
|
}
|
||||||
// $('#client_short_name').val(existingShortName);
|
let existingShortName = actual_lead_client_details.short_name || '';
|
||||||
// // validateInput($('#client_short_name')[0], 'clients', 'short_name');
|
if (existingShortName) {
|
||||||
|
// Prefer persisted short name while editing.
|
||||||
// } else {}
|
actualLeadShortName = existingShortName;
|
||||||
// Auto-generate short name from company name
|
$('#client_short_name').val(existingShortName);
|
||||||
// Use a small delay to ensure DOM is ready
|
} else {
|
||||||
|
// Fallback: generate only when short name is unavailable.
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
let baseName = actual_lead_client_details.company_name
|
let baseName = actual_lead_client_details.company_name
|
||||||
.trim()
|
.trim()
|
||||||
@ -1378,6 +1381,7 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
|
|||||||
makeUniqueShortName(baseName);
|
makeUniqueShortName(baseName);
|
||||||
}, 300);
|
}, 300);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Auto-generate short name from client name on user input.
|
// Auto-generate short name from client name on user input.
|
||||||
$('#client_name').on('input', function() {
|
$('#client_name').on('input', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user