Add images and odometer to JO info #424
This commit is contained in:
parent
391909c493
commit
ce9a2f42b9
1 changed files with 65 additions and 0 deletions
|
|
@ -653,11 +653,60 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
if (empty($trade_in_type))
|
||||
$trade_in_type = 'none';
|
||||
|
||||
// get date of status last change
|
||||
if ($jo->getDateStatusChange() == null)
|
||||
$date_status_change = null;
|
||||
else
|
||||
$date_status_change = $jo->getDateStatusChange()->format('Ymd H:i:s');
|
||||
|
||||
// get odometer reading
|
||||
$odo = $jo->getMeta('odometer');
|
||||
if ($odo <= 0)
|
||||
$odo = 0;
|
||||
|
||||
// get before images
|
||||
$before_images = [
|
||||
'speedomtr' => null,
|
||||
'plate_number' => null,
|
||||
'battery' => null,
|
||||
'others' => [],
|
||||
];
|
||||
$after_images = [
|
||||
'speedomtr' => null,
|
||||
'plate_number' => null,
|
||||
'battery' => null,
|
||||
'others' => [],
|
||||
];
|
||||
$jo_extra = $jo->getJOExtra();
|
||||
if ($jo_extra != null)
|
||||
{
|
||||
// before images
|
||||
$before_images['speedomtr'] = $this->getURLExtraImage($jo_extra->getBeforeSpeedImageFilename());
|
||||
$before_images['plate_number'] = $this->getURLExtraImage($jo_extra->getBeforePlateNumImageFilename());
|
||||
$before_images['battery'] = $this->getURLExtraImage($jo_extra->getBeforeBattImageFilename());
|
||||
|
||||
// other images
|
||||
$other_images = [];
|
||||
foreach ($jo_extra->getBeforeOtherImages() as $others)
|
||||
{
|
||||
$other_images[] = $this->getURLExtraImage($others);
|
||||
}
|
||||
$before_images['others'] = $other_images;
|
||||
|
||||
// after images
|
||||
$after_images['speedomtr'] = $this->getURLExtraImage($jo_extra->getAfterSpeedImageFilename());
|
||||
$after_images['plate_number'] = $this->getURLExtraImage($jo_extra->getAfterPlateNumImageFilename());
|
||||
$after_images['battery'] = $this->getURLExtraImage($jo_extra->getAfterBattImageFilename());
|
||||
|
||||
// other images
|
||||
$other_images = [];
|
||||
foreach ($jo_extra->getAfterOtherImages() as $others)
|
||||
{
|
||||
$other_images[] = $this->getURLExtraImage($others);
|
||||
}
|
||||
$after_images['others'] = $other_images;
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => $jo->getID(),
|
||||
'service_type' => $jo->getServiceType(),
|
||||
|
|
@ -699,6 +748,17 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
'has_warranty_doc' => false,
|
||||
'flag_coolant' => $jo->hasCoolant(),
|
||||
'has_motolite' => $cv->hasMotoliteBattery(),
|
||||
|
||||
// BEGIN: cmb specific details
|
||||
|
||||
// odometer
|
||||
'odometer' => $odo,
|
||||
|
||||
// images
|
||||
'arrive_photos' => $before_images,
|
||||
'finish_photos' => $after_images,
|
||||
|
||||
// END: cmb speicifc details
|
||||
];
|
||||
|
||||
return $data;
|
||||
|
|
@ -2142,4 +2202,9 @@ class CMBRiderAPIHandler implements RiderAPIHandlerInterface
|
|||
$all = $req->request->all();
|
||||
error_log(print_r($all, true));
|
||||
}
|
||||
|
||||
protected function getURLExtraImage(Request $req, $filename)
|
||||
{
|
||||
return $req->getScheme() . '://' . $req->getHttpHost() . $req->getBasePath() . '/uploads/jo_extra/' . $filename;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue