FIX_ NEW API searchThePolicies
This commit is contained in:
parent
6999933cd0
commit
228f44b544
@ -115,6 +115,7 @@ $routes->group('api', ['filter' => 'appSignature'], function ($routes) {
|
|||||||
$routes->post('policy/updatePolicy', 'PolicyController::updatePolicy');
|
$routes->post('policy/updatePolicy', 'PolicyController::updatePolicy');
|
||||||
$routes->get('policy/downloadPolicyFile', 'PolicyController::downloadPolicyFile');
|
$routes->get('policy/downloadPolicyFile', 'PolicyController::downloadPolicyFile');
|
||||||
$routes->post('policy/uploadPolicyFile', 'PolicyController::uploadPolicyFile');
|
$routes->post('policy/uploadPolicyFile', 'PolicyController::uploadPolicyFile');
|
||||||
|
$routes->get("policy/searchThePolicies", "PolicyController::searchThePolicies");
|
||||||
|
|
||||||
//claims
|
//claims
|
||||||
$routes->get('claim/ClaimList', 'ClaimController::ClaimList');
|
$routes->get('claim/ClaimList', 'ClaimController::ClaimList');
|
||||||
@ -152,6 +153,7 @@ $routes->group('api', ['filter' => 'appSignature'], function ($routes) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// $routes->get("policy/searchThePolicies", "PolicyController::searchThePolicies");
|
||||||
// $routes->get("dashboard/businessDashboard", "DashboardController::businessDashboard");
|
// $routes->get("dashboard/businessDashboard", "DashboardController::businessDashboard");
|
||||||
// $routes->get("dashboard/partnerDashboard", "DashboardController::partnerDashboard");
|
// $routes->get("dashboard/partnerDashboard", "DashboardController::partnerDashboard");
|
||||||
// $routes->get("dashboard/productivityDashboard", "DashboardController::productivityDashboard");
|
// $routes->get("dashboard/productivityDashboard", "DashboardController::productivityDashboard");
|
||||||
|
|||||||
@ -935,7 +935,7 @@ class DashboardController extends ResourceController
|
|||||||
|
|
||||||
$builder->where('pa.manager_id',$manager_id);
|
$builder->where('pa.manager_id',$manager_id);
|
||||||
|
|
||||||
$builder->where('pp.id', null);
|
$builder->where('pp.id IS NULL');
|
||||||
$builder->orderBy('pa.name');
|
$builder->orderBy('pa.name');
|
||||||
if ($raw === true) {
|
if ($raw === true) {
|
||||||
return $builder->getCompiledSelect();
|
return $builder->getCompiledSelect();
|
||||||
|
|||||||
@ -767,6 +767,46 @@ class PolicyController extends ResourceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function searchThePolicies() {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
$policy_number = $this->request->getGet('policy_number');
|
||||||
|
$vehicle_no = $this->request->getGet('vehicle_number');
|
||||||
|
if ($policy_number == '' && $vehicle_no == '') {
|
||||||
|
return $this->respond([
|
||||||
|
'status' => 'failed',
|
||||||
|
'code' => 200,
|
||||||
|
'data' => 'Value Required'
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder = $this->PolicyModel->select('partner_policy.*, v.vehicle_no');
|
||||||
|
$builder->join('vehicle v', 'partner_policy.vehicle_id = v.id', 'left');
|
||||||
|
|
||||||
|
if ($policy_number) {
|
||||||
|
$builder->like('partner_policy.policy_number', $policy_number);
|
||||||
|
} elseif ($vehicle_no) {
|
||||||
|
$builder->like('v.vehicle_no', $vehicle_no);
|
||||||
|
} else {
|
||||||
|
$builder->groupStart()
|
||||||
|
->like('partner_policy.policy_number', $policy_number)
|
||||||
|
->orLike('v.vehicle_no', $vehicle_no)
|
||||||
|
->groupEnd();
|
||||||
|
}
|
||||||
|
$result = $builder->get()->getResultArray();
|
||||||
|
if (!$result) {
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 200, 'data' => 'No Data Found'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user