Add rider details in API rider status call
This commit is contained in:
parent
21b7727278
commit
93b62a37a2
2 changed files with 34 additions and 3 deletions
|
|
@ -957,29 +957,55 @@ class APIController extends Controller
|
||||||
|
|
||||||
// get first jo that's pending
|
// get first jo that's pending
|
||||||
$jo = $ongoing_jos[0];
|
$jo = $ongoing_jos[0];
|
||||||
|
$dest = $jo->getCoordinates();
|
||||||
|
|
||||||
switch ($jo->getStatus())
|
switch ($jo->getStatus())
|
||||||
{
|
{
|
||||||
case JOStatus::PENDING:
|
case JOStatus::PENDING:
|
||||||
$res->setData([
|
$res->setData([
|
||||||
'status' => APIRiderStatus::OUTLET_ASSIGN,
|
'status' => APIRiderStatus::OUTLET_ASSIGN,
|
||||||
'jo_id' => $jo->getID(),
|
'jo_id' => $jo->getID(),
|
||||||
|
'destination' => [
|
||||||
|
'long' => $dest->getLongitude(),
|
||||||
|
'lat' => $dest->getLatitude(),
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
case JOStatus::RIDER_ASSIGN:
|
case JOStatus::RIDER_ASSIGN:
|
||||||
$res->setData([
|
$res->setData([
|
||||||
'status' => APIRiderStatus::RIDER_ASSIGN,
|
'status' => APIRiderStatus::RIDER_ASSIGN,
|
||||||
'jo_id' => $jo->getID(),
|
'jo_id' => $jo->getID(),
|
||||||
|
'destination' => [
|
||||||
|
'long' => $dest->getLongitude(),
|
||||||
|
'lat' => $dest->getLatitude(),
|
||||||
|
],
|
||||||
]);
|
]);
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
case JOStatus::ASSIGNED:
|
case JOStatus::ASSIGNED:
|
||||||
$coord = $jo->getOutlet()->getCoordinates();
|
$coord = $jo->getOutlet()->getCoordinates();
|
||||||
|
$rider = $jo->getRider();
|
||||||
|
// TODO: figure out cleaner way to generate urls
|
||||||
|
$image_url = 'http://resq.jankstudio.com/assets/images/user.gif';
|
||||||
|
if ($rider->getImageFile() != null)
|
||||||
|
$image_url = 'http://resq.jankstudio.com/uploads/' . $rider->getImageFile();
|
||||||
$res->setData([
|
$res->setData([
|
||||||
'status' => APIRiderStatus::RIDER_PICK_UP,
|
'status' => APIRiderStatus::RIDER_PICK_UP,
|
||||||
'jo_id' => $jo->getID(),
|
'jo_id' => $jo->getID(),
|
||||||
|
'destination' => [
|
||||||
|
'long' => $dest->getLongitude(),
|
||||||
|
'lat' => $dest->getLatitude(),
|
||||||
|
],
|
||||||
// TODO: fix this to actual location of rider
|
// TODO: fix this to actual location of rider
|
||||||
'lcoation' => [
|
'rider' => [
|
||||||
'long' => $coord->getLongitude(),
|
'id' => $rider->getID(),
|
||||||
'lat' => $coord->getLatitude()
|
'name' => $rider->getFullName(),
|
||||||
|
'plate_num' => $rider->getPlateNumber(),
|
||||||
|
'contact_num' => $rider->getContactNumber(),
|
||||||
|
'image_url' => $image_url,
|
||||||
|
'location' => [
|
||||||
|
'long' => $coord->getLongitude(),
|
||||||
|
'lat' => $coord->getLatitude()
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,11 @@ class Rider
|
||||||
return $this->last_name;
|
return $this->last_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFullName()
|
||||||
|
{
|
||||||
|
return $this->first_name . ' ' . $this->last_name;
|
||||||
|
}
|
||||||
|
|
||||||
public function setPlateNumber($plate_number)
|
public function setPlateNumber($plate_number)
|
||||||
{
|
{
|
||||||
$this->plate_number = $plate_number;
|
$this->plate_number = $plate_number;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue