FIX_Opportunities_TOGGLE_ISSUE
This commit is contained in:
parent
fc52973455
commit
3b56b0d1f8
@ -1014,10 +1014,10 @@ class LeadsController extends BaseController
|
||||
$insertCount[] = $insert;
|
||||
$this->insertLeadStatus($insert, $value['status'], 3);
|
||||
|
||||
if (in_array((int) $value['lead_type'], [1, 3], true) && $value['status'] == 'won') {
|
||||
$leadDataForClient = $this->leadsModel->find($insert);
|
||||
$this->createClientWithLeadData($leadDataForClient);
|
||||
}
|
||||
// if (in_array((int) $value['lead_type'], [1, 3], true) && $value['status'] == 'won') {
|
||||
// $leadDataForClient = $this->leadsModel->find($insert);
|
||||
// $this->createClientWithLeadData($leadDataForClient);
|
||||
// }
|
||||
|
||||
if ($value['lead_form_type'] == 1) {
|
||||
//for this push the job to the calculateMembersDemography() function
|
||||
@ -1045,12 +1045,12 @@ class LeadsController extends BaseController
|
||||
$this->insertMultiFilesData($data[0]['multi_file_data'], $id, $data[0]['lead_form_type']);
|
||||
$this->insertLeadStatus($id, $data[0]['status'], 3);
|
||||
|
||||
if (in_array((int) $data[0]['lead_type'], [1, 3], true) && $data[0]['status'] == 'won') {
|
||||
$leadDataForClient = $this->leadsModel->find($id);
|
||||
if (empty($leadDataForClient['is_client_created'])) {
|
||||
$this->createClientWithLeadData($leadDataForClient);
|
||||
}
|
||||
}
|
||||
// if (in_array((int) $data[0]['lead_type'], [1, 3], true) && $data[0]['status'] == 'won') {
|
||||
// $leadDataForClient = $this->leadsModel->find($id);
|
||||
// if (empty($leadDataForClient['is_client_created'])) {
|
||||
// $this->createClientWithLeadData($leadDataForClient);
|
||||
// }
|
||||
// }
|
||||
|
||||
return $this->respond(['status' => true, 'lead_id' => $id, 'message' => "Opportunity updated successfully", 'data' => $data], 200);
|
||||
}
|
||||
|
||||
@ -822,11 +822,15 @@
|
||||
$('#lost_reason').val(res.data.lost_reason || '');
|
||||
$('#notes').val(res.data.notes);
|
||||
|
||||
let existingClientId = res.data.client_id || res.data.is_client_created || 0;
|
||||
const isExistingClient = res.data.client_id !== undefined
|
||||
&& res.data.client_id !== null
|
||||
&& String(res.data.client_id) !== ''
|
||||
&& String(res.data.client_id) !== '0';
|
||||
let existingClientId = isExistingClient ? res.data.client_id : 0;
|
||||
console.log('existingClientId', existingClientId);
|
||||
|
||||
if (lead_type == 3) {
|
||||
if (existingClientId && existingClientId != 0) {
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
if (isExistingClient) {
|
||||
$('#exixting_client').prop('checked', true).trigger('change');
|
||||
} else {
|
||||
$('#exixting_client').prop('checked', false).trigger('change');
|
||||
|
||||
@ -831,6 +831,10 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
let policy_type_id = data.policy_type_id || null;
|
||||
let lead_type = data.lead_type || null;
|
||||
const isExistingClient = data.client_id !== undefined
|
||||
&& data.client_id !== null
|
||||
&& String(data.client_id) !== ''
|
||||
&& String(data.client_id) !== '0';
|
||||
|
||||
if ([1, 6, 7].includes(policy_type_id)) {
|
||||
let newId = 'appendAreaForClaim_' + dataIncrement;
|
||||
@ -849,7 +853,7 @@ if (isset($selected_lead_type)) {
|
||||
if (lead_type == 1 || lead_type == 3) {
|
||||
$('.claim-row').hide();
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
if(!isExistingClient){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
@ -1117,7 +1121,12 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
leadTypeBsedHideAndShow(lead_type);
|
||||
|
||||
if(data.client_id == 0 || data.client_id == null){
|
||||
const isExistingClient = data.client_id !== undefined
|
||||
&& data.client_id !== null
|
||||
&& String(data.client_id) !== ''
|
||||
&& String(data.client_id) !== '0';
|
||||
|
||||
if(!isExistingClient){
|
||||
temp_client_id = 0;
|
||||
}else{
|
||||
temp_client_id = data.client_id
|
||||
@ -1125,7 +1134,7 @@ if (isset($selected_lead_type)) {
|
||||
|
||||
if(lead_type == 1 || lead_type == 3){
|
||||
|
||||
if(data.is_client_created == null || data.is_client_created == 0 || data.is_client_created == ""){
|
||||
if(!isExistingClient){
|
||||
$('#exixting_client').prop('checked', false);
|
||||
$('#exixting_client').prop('disabled', true);
|
||||
|
||||
|
||||
@ -561,6 +561,22 @@ var pageBackButton = '<a href="<?= base_url('leads/list') ?>" class="topbar-icon
|
||||
addFileField(1);
|
||||
})
|
||||
|
||||
function togglePolicyDateFields(value, fallbackPolicyTypeId = null) {
|
||||
const policyTypesToHide = ['1', '2', '3', '4', '5', '6', '7'];
|
||||
const selectedPolicyTypeId = $('#policy_type_id').val();
|
||||
const policyTypeId = String(selectedPolicyTypeId || fallbackPolicyTypeId || '');
|
||||
const shouldHide = value == 1 && policyTypesToHide.includes(policyTypeId);
|
||||
const $policyDateFields = $('#policy_start_date, #policy_end_date').closest('.form-group');
|
||||
|
||||
$policyDateFields.toggle(!shouldHide);
|
||||
|
||||
if (shouldHide) {
|
||||
$policyDateFields.find('input').prop('required', false).val('');
|
||||
} else if (value == 1 || value == 3) {
|
||||
$policyDateFields.find('input').prop('required', true);
|
||||
}
|
||||
}
|
||||
|
||||
function getPolicyTypeFields(input) {
|
||||
|
||||
console.log('getPolicyTypeFields', input);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user