Add back insurance status to vehicle list so latest status can be displayed #761
This commit is contained in:
parent
ac2cf864f2
commit
b1ff62d9ec
3 changed files with 5 additions and 5 deletions
|
|
@ -190,7 +190,7 @@ class VehicleController extends ApiController
|
|||
// only get the customer's vehicles whose flag_active is true
|
||||
$cvs = $this->em->getRepository(CustomerVehicle::class)->findBy(['flag_active' => true, 'customer' => $cust]);
|
||||
foreach ($cvs as $cv) {
|
||||
$cv_list[] = $this->generateVehicleInfo($cv);
|
||||
$cv_list[] = $this->generateVehicleInfo($cv, true);
|
||||
}
|
||||
|
||||
// response
|
||||
|
|
|
|||
|
|
@ -298,10 +298,12 @@ class CustomerVehicle
|
|||
public function getLatestInsuranceApplication()
|
||||
{
|
||||
$criteria = Criteria::create()
|
||||
->where(Criteria::expr()->notIn('status', [InsuranceApplicationStatus::EXPIRED, InsuranceApplicationStatus::CANCELLED]))
|
||||
->where(Criteria::expr()->notIn('status', [InsuranceApplicationStatus::CANCELLED]))
|
||||
->orderBy(['date_submit' => Criteria::DESC])
|
||||
->setMaxResults(1);
|
||||
|
||||
return $this->insurance_applications->matching($criteria)[0];
|
||||
$result = $this->insurance_applications->matching($criteria);
|
||||
|
||||
return !empty($result) ? $result[0] : null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ class InsuranceApplicationStatus extends NameValue
|
|||
const PAID = 'paid';
|
||||
const COMPLETED = 'completed';
|
||||
const CANCELLED = 'cancelled';
|
||||
const EXPIRED = 'expired';
|
||||
|
||||
const COLLECTION = [
|
||||
'created' => 'Created',
|
||||
'paid' => 'Paid',
|
||||
'completed' => 'Completed',
|
||||
'cancelled' => 'Cancelled',
|
||||
'expired' => 'Expired',
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue