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
|
// only get the customer's vehicles whose flag_active is true
|
||||||
$cvs = $this->em->getRepository(CustomerVehicle::class)->findBy(['flag_active' => true, 'customer' => $cust]);
|
$cvs = $this->em->getRepository(CustomerVehicle::class)->findBy(['flag_active' => true, 'customer' => $cust]);
|
||||||
foreach ($cvs as $cv) {
|
foreach ($cvs as $cv) {
|
||||||
$cv_list[] = $this->generateVehicleInfo($cv);
|
$cv_list[] = $this->generateVehicleInfo($cv, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// response
|
// response
|
||||||
|
|
|
||||||
|
|
@ -298,10 +298,12 @@ class CustomerVehicle
|
||||||
public function getLatestInsuranceApplication()
|
public function getLatestInsuranceApplication()
|
||||||
{
|
{
|
||||||
$criteria = Criteria::create()
|
$criteria = Criteria::create()
|
||||||
->where(Criteria::expr()->notIn('status', [InsuranceApplicationStatus::EXPIRED, InsuranceApplicationStatus::CANCELLED]))
|
->where(Criteria::expr()->notIn('status', [InsuranceApplicationStatus::CANCELLED]))
|
||||||
->orderBy(['date_submit' => Criteria::DESC])
|
->orderBy(['date_submit' => Criteria::DESC])
|
||||||
->setMaxResults(1);
|
->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 PAID = 'paid';
|
||||||
const COMPLETED = 'completed';
|
const COMPLETED = 'completed';
|
||||||
const CANCELLED = 'cancelled';
|
const CANCELLED = 'cancelled';
|
||||||
const EXPIRED = 'expired';
|
|
||||||
|
|
||||||
const COLLECTION = [
|
const COLLECTION = [
|
||||||
'created' => 'Created',
|
'created' => 'Created',
|
||||||
'paid' => 'Paid',
|
'paid' => 'Paid',
|
||||||
'completed' => 'Completed',
|
'completed' => 'Completed',
|
||||||
'cancelled' => 'Cancelled',
|
'cancelled' => 'Cancelled',
|
||||||
'expired' => 'Expired',
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue