Modify ScheduleOptionStatus. #591

This commit is contained in:
Korina Cordero 2021-07-12 10:28:06 +00:00
parent d51e052a72
commit 003b5f2aa1

View file

@ -37,7 +37,6 @@ use App\Service\HubSelector;
use App\Service\HubDistributor;
use App\Service\HubFilterLogger;
use App\Service\HubFilteringGeoChecker;
use App\Service\MapTools;
use App\Service\MobileAPIHandler;
use App\Service\RiderTracker;
@ -159,7 +158,7 @@ class JobOrderController extends APIController
}
public function newRequestJobOrder(Request $req, InvoiceGeneratorInterface $ic, GeofenceTracker $geo,
MapTools $map_tools, InventoryManager $im, MQTTClient $mclient,
InventoryManager $im, MQTTClient $mclient,
RiderAssignmentHandlerInterface $rah, PromoLogger $promo_logger,
HubSelector $hub_select, HubDistributor $hub_dist, HubFilterLogger $hub_filter_logger,
HubFilteringGeoChecker $hub_geofence, EntityManagerInterface $em,
@ -600,13 +599,24 @@ class JobOrderController extends APIController
return new APIResponse(true, 'Hub and slot found', $data);
}
public function scheduleOptionStatus(Request $req, EntityManagerInterface $em)
public function scheduleOptionStatus(Request $req, EntityManagerInterface $em, MobileAPIHandler $mah)
{
$this->denyAccessUnlessGranted('mobile_jo.schedule_option.status', null, 'No access.');
// check required parameters and api key
$required_params = [];
$res = $this->checkParamsAndKey($req, $em, $required_params);
if ($res->isError())
return $res->getReturnResponse();
$msg = $this->checkRequiredParameters($req, $required_params);
if ($msg)
return new APIResponse(false, $msg);
// get capi user to link to mobile user
$user_id = $this->getUser()->getID();
// get mobile user
$mobile_user = $mah->findMobileUser($user_id);
if ($mobile_user == null)
return new APIResponse(false, 'No mobile user found.');
$schedule_choice = true;
@ -624,9 +634,8 @@ class JobOrderController extends APIController
$data = [
'display_schedule_choice' => $schedule_choice,
];
$res->setData($data);
return $res->getReturnResponse();
return new APIResponse(true, 'Schedule option status check', $data);
}
protected function randomizeRider($riders)