Removed insurer from enquiry and added in quotation table : GWM
This commit is contained in:
parent
74938ec1e5
commit
3dab61e6f2
@ -76,10 +76,13 @@ class DashboardController extends ResourceController
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
if(count($performanceAgents) == 1 && $performanceAgents[0]['agent_name'] == null){
|
||||
$performanceAgents = [];
|
||||
}
|
||||
|
||||
// --- Un assigned enquiry ---
|
||||
$unassignedEnquiry = $this->db->table('partner_enquiry pe')
|
||||
->where('pe.assigned_to', null)
|
||||
->where('pe.assigned_to', 0)
|
||||
->where('pe.manager_id', $manager_id)
|
||||
->get()
|
||||
->getResultArray();
|
||||
@ -151,8 +154,7 @@ class DashboardController extends ResourceController
|
||||
|
||||
// --- Quotation pending for staff (last 30 days) ---
|
||||
$quotationsPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name, I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->select('pe.* ')
|
||||
->where('pe.assigned_to',$staff_id)
|
||||
->whereIn('pe.status',["Awaiting Quotation","Quotation Rejected"])
|
||||
->orderBy('pe.created_on', 'DESC')
|
||||
@ -162,8 +164,7 @@ class DashboardController extends ResourceController
|
||||
|
||||
// --- Quotation Approval pending for staff (last 30 days) ---
|
||||
$quotationsApprovalPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name, I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->select('pe.* ')
|
||||
->where('pe.assigned_to',$staff_id)
|
||||
->whereIn('pe.status',["Quotation Created"])
|
||||
->orderBy('pe.created_on', 'DESC')
|
||||
@ -173,7 +174,8 @@ class DashboardController extends ResourceController
|
||||
// --- Policy pending for staff (last 30 days) ---
|
||||
$policiesPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name, I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('partner_quotation Q', 'Q.enquiry_id = pe.id AND Q.status = "Accepted"', 'left')
|
||||
->join('insurers I', 'I.id = Q.insurer_id', 'left')
|
||||
->where('pe.assigned_to',$staff_id)
|
||||
->whereIn('pe.status',["Quotation Accepted"])
|
||||
->orderBy('pe.created_on', 'DESC')
|
||||
@ -247,8 +249,7 @@ class DashboardController extends ResourceController
|
||||
|
||||
// --- Quotation pending for agent (last 30 days) ---
|
||||
$quotationsPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name , I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->select('pe.* ')
|
||||
->where('pe.created_on >=', $last30)
|
||||
->where('pe.agent_id',$agent_id)
|
||||
->whereIn('pe.status',["Awaiting Quotation","Quotation Rejected"])
|
||||
@ -258,8 +259,7 @@ class DashboardController extends ResourceController
|
||||
|
||||
// --- Quotation approval pending for agent (last 30 days) ---
|
||||
$quotationsApprovalPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name , I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->select('pe.* ')
|
||||
->where('pe.created_on >=', $last30)
|
||||
->where('pe.agent_id',$agent_id)
|
||||
->whereIn('pe.status',["Awaiting Created"])
|
||||
@ -270,7 +270,8 @@ class DashboardController extends ResourceController
|
||||
// --- Policy pending for agent (last 30 days) ---
|
||||
$policiesPending = $this->db->table('partner_enquiry pe')
|
||||
->select('pe.* , I.name as insurer_name , I.short_name as insurer_short_name')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('partner_quotation Q', 'Q.enquiry_id = pe.id AND Q.status = "Accepted"', 'left')
|
||||
->join('insurers I', 'I.id = Q.insurer_id', 'left')
|
||||
->where('pe.created_on >=', $last30)
|
||||
->where('pe.agent_id',$agent_id)
|
||||
->where('pe.status','Quotation Accepted')
|
||||
|
||||
@ -88,8 +88,7 @@ class EnquiryController extends ResourceController
|
||||
}
|
||||
|
||||
//Get enquiry details
|
||||
$enquiry = $this->enquiryModel->select('partner_enquiry.*, I.name as insurer_name ')
|
||||
->join('insurers I', 'I.id = partner_enquiry.insurer_id', 'left')
|
||||
$enquiry = $this->enquiryModel->select('partner_enquiry.*')
|
||||
->where('partner_enquiry.id', $enquiry_id)
|
||||
->where('partner_enquiry.is_active', 1)
|
||||
->first();
|
||||
@ -101,7 +100,7 @@ class EnquiryController extends ResourceController
|
||||
//Get related quotations
|
||||
$quotations = $this->QuotationModel->select('partner_quotation.*, pe.reg_no , I.name as insurer_name, ipti.insurance_plan_type' )
|
||||
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('insurers I', 'I.id = partner_quotation.insurer_id', 'left')
|
||||
->join('partner_insurance_plan_type_master ipti', 'ipti.id = partner_quotation.insurance_plan_type_id', 'left')
|
||||
->where('partner_quotation.enquiry_id', $enquiry_id)
|
||||
->where('partner_quotation.is_active', 1)
|
||||
@ -118,8 +117,8 @@ class EnquiryController extends ResourceController
|
||||
|
||||
$policies = $this->PolicyModel->select('partner_policy.*, pe.reg_no, I.name as insurer_name, pq.insured_declared_value, ipti.insurance_plan_type')
|
||||
->join('partner_enquiry pe', 'pe.id = partner_policy.enquiry_id', 'left')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('partner_quotation pq', 'pq.id = partner_policy.quotation_id', 'left')
|
||||
->join('insurers I', 'I.id = pq.insurer_id', 'left')
|
||||
->join('partner_insurance_plan_type_master ipti', 'ipti.id = pq.insurance_plan_type_id', 'left')
|
||||
->where('partner_policy.quotation_id', $quotationId)
|
||||
->where('partner_policy.is_active', 1)
|
||||
@ -186,9 +185,6 @@ class EnquiryController extends ResourceController
|
||||
$previousPolicy->move($uploadPath, $previousPolicyFileName);
|
||||
}
|
||||
|
||||
//get insurer_branch_id
|
||||
$query = $this->db->query("SELECT id FROM insurer_branch WHERE insurer_id = ? LIMIT 1", [$data['insurer_id']]);
|
||||
$insurerBranchresult = $query->getRowArray();
|
||||
|
||||
$insertData = [
|
||||
'agent_id' => $data['agent_id'],
|
||||
@ -197,8 +193,6 @@ class EnquiryController extends ResourceController
|
||||
'email' => $data['email'],
|
||||
'reg_no' => $data['reg_no'],
|
||||
'vehicle_type_id' => $data['vehicle_type_id'],
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'insurer_branch_id' => $insurerBranchresult['id'] ?? 0,
|
||||
'rc_file_name' => $rcFileName,
|
||||
'id_proof_file_name' => $idProofFileName,
|
||||
'previous_policy_file_name' => $previousPolicyFileName,
|
||||
|
||||
@ -9,9 +9,11 @@ class QuotationController extends ResourceController
|
||||
{
|
||||
protected $QuotationModel;
|
||||
protected $EnquiryModel;
|
||||
protected $db;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->db = db_connect();
|
||||
$this->QuotationModel = new QuotationModel();
|
||||
$this->EnquiryModel = new EnquiryModel();
|
||||
}
|
||||
@ -25,7 +27,7 @@ class QuotationController extends ResourceController
|
||||
|
||||
$data = $this->QuotationModel->select('partner_quotation.* , pe.reg_no , I.name as insurer_name, ipti.insurance_plan_type')
|
||||
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('insurers I', 'I.id = partner_quotation.insurer_id', 'left')
|
||||
->join('partner_insurance_plan_type_master ipti', 'ipti.id = partner_quotation.insurance_plan_type_id', 'left')
|
||||
->where('partner_quotation.manager_id',$manager_id)
|
||||
->findAll();
|
||||
@ -43,7 +45,7 @@ class QuotationController extends ResourceController
|
||||
$id = $this->request->getGet('id');
|
||||
$record = $this->QuotationModel->select('partner_quotation.* , pe.reg_no , I.name as insurer_name, ipti.insurance_plan_type')
|
||||
->join('partner_enquiry pe', 'pe.id = partner_quotation.enquiry_id', 'left')
|
||||
->join('insurers I', 'I.id = pe.insurer_id', 'left')
|
||||
->join('insurers I', 'I.id = partner_quotation.insurer_id', 'left')
|
||||
->join('partner_insurance_plan_type_master ipti', 'ipti.id = partner_quotation.insurance_plan_type_id', 'left')
|
||||
->where('partner_quotation.id',$id)
|
||||
->find();
|
||||
@ -76,11 +78,17 @@ class QuotationController extends ResourceController
|
||||
$uploadFile->move($uploadPath, $uploadedFileName);
|
||||
}
|
||||
|
||||
//get insurer_branch_id
|
||||
$query = $this->db->query("SELECT id FROM insurer_branch WHERE insurer_id = ? LIMIT 1", [$data['insurer_id']]);
|
||||
$insurerBranchresult = $query->getRowArray();
|
||||
|
||||
$insertData = [
|
||||
'enquiry_id' => $data['enquiry_id'],
|
||||
'insured_declared_value' => $data['insured_declared_value'],
|
||||
'premium_amount' => $data['premium_amount'],
|
||||
'insurance_plan_type_id' => $data['insurance_plan_type_id'],
|
||||
'insurer_id' => $data['insurer_id'],
|
||||
'insurer_branch_id' => $insurerBranchresult['id'] ?? 0,
|
||||
'additional_uploaded_file_name' => $uploadedFileName,
|
||||
'created_by' => $data['created_by'],
|
||||
'manager_id' => $data['manager_id']
|
||||
|
||||
@ -16,8 +16,6 @@ class EnquiryModel extends Model
|
||||
'email',
|
||||
'reg_no',
|
||||
'vehicle_type_id',
|
||||
'insurer_id',
|
||||
'insurer_branch_id',
|
||||
'rc_file_name',
|
||||
'id_proof_file_name',
|
||||
'previous_policy_file_name',
|
||||
@ -50,9 +48,9 @@ class EnquiryModel extends Model
|
||||
)
|
||||
->join('vehicle_type VT', 'VT.id = partner_enquiry.vehicle_type_id', 'left')
|
||||
->join('partner_agent A', 'A.id = partner_enquiry.agent_id', 'left')
|
||||
->join('insurers I', 'I.id = partner_enquiry.insurer_id', 'left')
|
||||
->join('partner_staff S', 'S.id = partner_enquiry.assigned_to', 'left')
|
||||
->join('partner_quotation Q', 'Q.enquiry_id = partner_enquiry.id AND Q.status = "Accepted"', 'left')
|
||||
->join('insurers I', 'I.id = Q.insurer_id', 'left')
|
||||
->join('partner_policy P', 'P.quotation_id = Q.id', 'left')
|
||||
->where('partner_enquiry.is_active', 1)
|
||||
->orderBy('partner_enquiry.created_on', 'ASC');
|
||||
|
||||
@ -12,6 +12,8 @@ class QuotationModel extends Model
|
||||
'insured_declared_value',
|
||||
'premium_amount',
|
||||
'insurance_plan_type_id',
|
||||
'insurer_id',
|
||||
'insurer_branch_id',
|
||||
'additional_uploaded_file_name',
|
||||
'status',
|
||||
'reject_reason',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user