CHANGE_CLIENT_ID_STORE_IN_LEAD_TABLE : RV
This commit is contained in:
parent
31820a8905
commit
cc61206101
@ -1056,6 +1056,7 @@ class LeadsController extends BaseController
|
||||
|
||||
if ($client_id) {
|
||||
$this->createClientBranchAndContactWithLeadData($data, $client_id);
|
||||
$this->leadsModel->where('id', $data['id'])->set('is_client_created', $client_id)->update();
|
||||
}
|
||||
|
||||
return $client_id;
|
||||
@ -1079,7 +1080,7 @@ class LeadsController extends BaseController
|
||||
$branch_id = $this->clientBranchModel->insert($branch_data);
|
||||
|
||||
if ($branch_id) {
|
||||
|
||||
$this->leadsModel->where('id', $data['id'])->set('is_client_created', $client_id)->update();
|
||||
$contact_data = $this->prepareContactData($data, $branch_id);
|
||||
$this->levelContactModel->insert($contact_data);
|
||||
|
||||
@ -1116,7 +1117,14 @@ class LeadsController extends BaseController
|
||||
public function createClientPolicyWithLeadData($data, $client_id, $branch_id)
|
||||
{
|
||||
$client_policy_data = $this->prepareClientPolicyData($data, $client_id, $branch_id);
|
||||
return $this->clientPolicyModel->insert($client_policy_data);
|
||||
$client_policy_id = $this->clientPolicyModel->insert($client_policy_data);
|
||||
|
||||
|
||||
if($client_policy_id){
|
||||
$this->leadsModel->where('id', $data['id'])->set('is_client_created', $client_id)->update();
|
||||
}
|
||||
|
||||
return $client_policy_id;
|
||||
}
|
||||
|
||||
private function prepareClientPolicyData($data, $client_id, $branch_id)
|
||||
|
||||
@ -51,6 +51,7 @@ class LeadsModel extends Model
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'is_active',
|
||||
'is_client_created',
|
||||
];
|
||||
|
||||
|
||||
@ -127,7 +128,10 @@ class LeadsModel extends Model
|
||||
->join('user_profiles', 'leads.created_by = user_profiles.id')
|
||||
->where('leads.is_active', 1)
|
||||
->where('leads.status', 'won')
|
||||
->where("leads.proposel_data IS NOT NULL AND leads.proposel_data <> ''");
|
||||
->where("leads.proposel_data IS NOT NULL AND leads.proposel_data <> ''")
|
||||
->where("(leads.is_client_created = '' OR leads.is_client_created IS NULL)");
|
||||
|
||||
|
||||
|
||||
if ($type) {
|
||||
$query->where('leads.lead_type', $type);
|
||||
|
||||
@ -107,7 +107,7 @@ table.dataTable thead th {
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="featchClient()">Featch Client</button>
|
||||
<button type="submit" class="btn btn-primary" onclick="featchClient()">Fetch Client</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
|
||||
@ -217,7 +217,7 @@
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right m-b-0" id="hide_smbt_btn">
|
||||
<button type="submit" class="btn btn-primary" onclick="featchClient()">Featch Client</button>
|
||||
<button type="submit" class="btn btn-primary" onclick="featchClient()">Fetch Client</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user