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

This commit is contained in:
sanjeev.p 2026-04-18 13:57:44 +05:30
commit 0f35747f12
5 changed files with 30 additions and 19 deletions

View File

@ -4774,7 +4774,7 @@ class LeadsController extends BaseController
// 🔹 Client Details (Single Row)
$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')
->where('sales_actual_leads.lead_id', $actual_lead_id)
->first(); // first row only
@ -5527,7 +5527,7 @@ class LeadsController extends BaseController
*
* @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 {
$leadId = (int) ($lead_data['id'] ?? 0);

View File

@ -596,7 +596,7 @@ class MediAssistApiController extends BaseController
"Confirmation Awaited" => 4,
"Information Awaited Reminder" => 4,
"Information Awaited Final Reminder" => 4,
"Insurer Concurrence Awaited" => 6,
"Insurer Concurrence Awaited" => 7,
"Closed" => 12,
"Physical Documents Awaited" => 9,
@ -944,7 +944,7 @@ class MediAssistApiController extends BaseController
"Confirmation Awaited" => 4,
"Information Awaited Reminder" => 4,
"Information Awaited Final Reminder" => 4,
"Insurer Concurrence Awaited" => 6,
"Insurer Concurrence Awaited" => 7,
"Closed" => 12,
"Physical Documents Awaited" => 9,
@ -1191,7 +1191,7 @@ class MediAssistApiController extends BaseController
"Confirmation Awaited" => 4,
"Information Awaited Reminder" => 4,
"Information Awaited Final Reminder" => 4,
"Insurer Concurrence Awaited" => 6,
"Insurer Concurrence Awaited" => 7,
"Closed" => 12,
"Physical Documents Awaited" => 9,

View File

@ -2516,6 +2516,9 @@
$('#client_name').val(actualLeadClientName);
$('#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 || '';
// if (existingShortName) {

View File

@ -525,9 +525,13 @@ if (isset($selected_lead_type)) {
}
if(client_type == ""){
toastr.warning('Please select the client type', 'Warning');
$('#client_short_name').val('')
return;
var aid = $('#actual_lead_id').val();
if (!aid || aid === '0') {
toastr.warning('Please select the client type', 'Warning');
$('#client_short_name').val('');
return;
}
// Actual-lead autofill: short name may be set before client type is chosen; do not clear it.
}
let value = $(input).val();

View File

@ -853,8 +853,10 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
// --- Re-populate Actual Lead data if it was cleared ---
if ($('#actual_lead_id').val() && $('#actual_lead_id').val() != 0) {
$('#client_name').val(actualLeadClientName);
// Re-generate short name from the stored client name to ensure consistency
if (actualLeadClientName.trim() !== '') {
if (actualLeadShortName.trim() !== '') {
$('#client_short_name').val(actualLeadShortName);
} else if (actualLeadClientName.trim() !== '') {
// Fallback only when no persisted short name is available.
let baseName = actualLeadClientName
.trim()
.substring(0, 10)
@ -1359,15 +1361,16 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
$('#client_name').val(actualLeadClientName);
$('#gst').val(actual_lead_client_details.gst_number || '');
// existingShortName = actual_lead_client_details.short_name || '';
// if (existingShortName) {
// // ── Short name EXISTS — just populate and validate ────────
// $('#client_short_name').val(existingShortName);
// // validateInput($('#client_short_name')[0], 'clients', 'short_name');
// } else {}
// Auto-generate short name from company name
// Use a small delay to ensure DOM is ready
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));
}
let existingShortName = actual_lead_client_details.short_name || '';
if (existingShortName) {
// Prefer persisted short name while editing.
actualLeadShortName = existingShortName;
$('#client_short_name').val(existingShortName);
} else {
// Fallback: generate only when short name is unavailable.
setTimeout(function () {
let baseName = actual_lead_client_details.company_name
.trim()
@ -1377,6 +1380,7 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
makeUniqueShortName(baseName);
}, 300);
}
}
// Auto-generate short name from client name on user input.