diff --git a/app/Controllers/LeadsController.php b/app/Controllers/LeadsController.php index 960e9aaf..77a6ba81 100644 --- a/app/Controllers/LeadsController.php +++ b/app/Controllers/LeadsController.php @@ -241,8 +241,12 @@ class LeadsController extends BaseController $form_file_name = "file_name_" . $index_plus_one; $form_docs_name = "docs_name_" . $index_plus_one; $leads_file_primary_key = $data['leads_file_id'] ?? []; - $files = $this->request->getFileMultiple($form_file_name); - $multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key); + + $multi_file_data = []; + if(isset($data[$form_docs_name])){ + $files = $this->request->getFileMultiple($form_file_name); + $multi_file_data = $this->uploadMultiFiles($files, $data[$form_docs_name], $leads_file_primary_key); + } // Separate the insurer and insurer branch, handle missing or invalid data if (isset($data['insurer']) && strpos($data['insurer'], '-') !== false) { @@ -677,7 +681,9 @@ class LeadsController extends BaseController if ($lead_data['lead_type'] != 1) { $client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first(); - $data['policy_terms'] = $client_policy_data['policy_terms']; + if (isset($client_policy_data)) { + $data['policy_terms'] = $client_policy_data['policy_terms']; + } } $data['question_json'] = $lead_data['question_json']; @@ -736,7 +742,10 @@ class LeadsController extends BaseController if ($lead_data['lead_type'] != 1 && $data['rfq_count'] == 0) { $client_policy_data = $this->clientPolicyModel->where('is_active', 1)->where('id', $lead_data['source_policy_id'])->first(); - $data['rfq_data']['json'] = $client_policy_data['placement_json']; + if (isset($client_policy_data)) { + + $data['rfq_data']['json'] = $client_policy_data['placement_json']; + } } if (!empty($data['question_json'])) { diff --git a/app/Views/leads_form_handler.php b/app/Views/leads_form_handler.php index 94db97a4..7d9a6006 100644 --- a/app/Views/leads_form_handler.php +++ b/app/Views/leads_form_handler.php @@ -292,6 +292,7 @@ if (isset($selected_lead_type)) { } else { $('#source_policy_id').empty(); + // let lead_type = data.lead_type || null; if (temp_branch_id == 0) { console.log("Step 1: temp_branch_id is 0 - No Policies Found for the selected branch"); console.log('second client_branch_id', client_branch_id); @@ -301,11 +302,17 @@ if (isset($selected_lead_type)) { } else { console.log("Step 3: v exists - Assigning temp_branch_id = client_branch_id"); temp_branch_id = client_id; - toastr.warning("No Policies Found for the selected Branch", 'Warning'); + if (lead_type != 3) { + + toastr.warning("No Policies Found for the selected Branch", 'Warning'); + } } } else { console.log("Step 4: temp_branch_id is not 0 - Showing warning"); - toastr.warning("No Policies Found for the selected Branch", 'Warning'); + if (lead_type != 3) { + + toastr.warning("No Policies Found for the selected Branch", 'Warning'); + } } } @@ -331,24 +338,24 @@ if (isset($selected_lead_type)) { $('#salse_person_id').trigger('change'); } - function validateInput(input, table, field){ + // function validateInput(input, table, field){ - let value = $(input).val(); - let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim(); + // let value = $(input).val(); + // let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim(); - let message = "Value is duplicate!"; - if(label){ - message = label + " already exists!"; - } + // let message = "Value is duplicate!"; + // if(label){ + // message = label + " already exists!"; + // } - checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { - if (isDuplicate) { - toastr.warning(message, 'WARNING'); - $(input).val('') - } - }); + // checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) { + // if (isDuplicate) { + // toastr.warning(message, 'WARNING'); + // $(input).val('') + // } + // }); - } + // } // -------------------------------------------------------------------------------------------------------- @@ -485,6 +492,8 @@ if (isset($selected_lead_type)) { diff --git a/app/Views/leads_non_eb.php b/app/Views/leads_non_eb.php index 409965e3..3b1f02c5 100644 --- a/app/Views/leads_non_eb.php +++ b/app/Views/leads_non_eb.php @@ -661,6 +661,13 @@ $('.renewalFields').show(); $('.renewalFields').find('select, input').attr('required', 'required'); + if (value == 3) { + $("#source_policy_id").removeAttr("required"); + $("#source_policy_start_date").removeAttr("required"); + $("#source_policy_end_date").removeAttr("required"); + + } + $('.proposed_div').show().find('select, input').attr('required', 'required'); $('#policy_end_date').removeAttr('required'); diff --git a/app/Views/newClientModal.php b/app/Views/newClientModal.php index 9f75a734..b0d72494 100644 --- a/app/Views/newClientModal.php +++ b/app/Views/newClientModal.php @@ -22,7 +22,7 @@
- +
@@ -39,7 +39,7 @@
+ onkeypress="return onlyNumbers(event)" onchange="validateInputForClient(this, 'clients', 'phone')">
@@ -48,7 +48,7 @@
- +
@@ -96,7 +96,7 @@
-
@@ -113,8 +113,52 @@