Resolve "Resq - message prompt for non-serviceable area" #1353

Merged
korina.cordero merged 176 commits from 463-resq-message-prompt-for-non-serviceable-area into 465-resq-august-13-release 2020-08-12 05:41:57 +00:00
Showing only changes of commit ce9a2f42b9 - Show all commits

View file

@ -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;
}
}