Add status_autoassign to JobOrder entity. Add setting of auto assign status when a JO is requested via API. #406
This commit is contained in:
parent
519ee61ff7
commit
092df7dc7e
3 changed files with 42 additions and 6 deletions
|
|
@ -24,6 +24,7 @@ use App\Ramcar\TransactionOrigin;
|
||||||
use App\Ramcar\TradeInType;
|
use App\Ramcar\TradeInType;
|
||||||
use App\Ramcar\JOEventType;
|
use App\Ramcar\JOEventType;
|
||||||
use App\Ramcar\AdvanceOrderSlot;
|
use App\Ramcar\AdvanceOrderSlot;
|
||||||
|
use App\Ramcar\AutoAssignStatus;
|
||||||
|
|
||||||
use App\Service\InvoiceGeneratorInterface;
|
use App\Service\InvoiceGeneratorInterface;
|
||||||
use App\Service\RisingTideGateway;
|
use App\Service\RisingTideGateway;
|
||||||
|
|
@ -2360,12 +2361,10 @@ class APIController extends Controller implements LoggedController
|
||||||
$schedule_date = $req->request->get('date_schedule');
|
$schedule_date = $req->request->get('date_schedule');
|
||||||
$slot_id = $req->request->get('slot_id');
|
$slot_id = $req->request->get('slot_id');
|
||||||
$advance_order = $req->request->get('flag_advance_order');
|
$advance_order = $req->request->get('flag_advance_order');
|
||||||
|
if ($advance_order)
|
||||||
// check for 'false' text
|
|
||||||
if ($advance_order === false || $advance_order === 0 || $advance_order === '0' || $advance_order == 'false')
|
|
||||||
$flag_advance_order = false;
|
|
||||||
else
|
|
||||||
$flag_advance_order = true;
|
$flag_advance_order = true;
|
||||||
|
else
|
||||||
|
$flag_advance_order = false;
|
||||||
// $flag_advance_order = $advance_order ? true : false;
|
// $flag_advance_order = $advance_order ? true : false;
|
||||||
|
|
||||||
$jo = new JobOrder();
|
$jo = new JobOrder();
|
||||||
|
|
@ -2379,7 +2378,8 @@ class APIController extends Controller implements LoggedController
|
||||||
->setDeliveryInstructions($instructions)
|
->setDeliveryInstructions($instructions)
|
||||||
// TODO: error check for valid mode of payment
|
// TODO: error check for valid mode of payment
|
||||||
->setModeOfPayment($req->request->get('mode_of_payment'))
|
->setModeOfPayment($req->request->get('mode_of_payment'))
|
||||||
->setAdvanceOrder($flag_advance_order);
|
->setAdvanceOrder($flag_advance_order)
|
||||||
|
->setStatusAutoAssign(AutoAssignStatus::NOT_ASSIGNED);
|
||||||
|
|
||||||
// customer
|
// customer
|
||||||
$cust = $this->session->getCustomer();
|
$cust = $this->session->getCustomer();
|
||||||
|
|
@ -2538,6 +2538,7 @@ class APIController extends Controller implements LoggedController
|
||||||
$jo->setHub($nearest_hub);
|
$jo->setHub($nearest_hub);
|
||||||
$jo->setRider($assigned_rider);
|
$jo->setRider($assigned_rider);
|
||||||
$jo->setStatus(JOStatus::ASSIGNED);
|
$jo->setStatus(JOStatus::ASSIGNED);
|
||||||
|
$jo->setStatusAutoAssign(AutoAssignStatus::HUB_AND_RIDER_ASSIGNED);
|
||||||
|
|
||||||
$assigned_rider->setAvailable(false);
|
$assigned_rider->setAvailable(false);
|
||||||
}
|
}
|
||||||
|
|
@ -2559,6 +2560,7 @@ class APIController extends Controller implements LoggedController
|
||||||
|
|
||||||
$jo->setHub($hub);
|
$jo->setHub($hub);
|
||||||
$jo->setStatus(JOStatus::RIDER_ASSIGN);
|
$jo->setStatus(JOStatus::RIDER_ASSIGN);
|
||||||
|
$jo->setStatusAutoAssign(AutoAssignStatus::HUB_ASSIGNED);
|
||||||
|
|
||||||
if ($date_schedule != null)
|
if ($date_schedule != null)
|
||||||
$jo->setDateSchedule($date_schedule);
|
$jo->setDateSchedule($date_schedule);
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,12 @@ class JobOrder
|
||||||
*/
|
*/
|
||||||
protected $priority;
|
protected $priority;
|
||||||
|
|
||||||
|
// autoassign status
|
||||||
|
/**
|
||||||
|
* @ORM\Column(type="string", length=30, nullable=true)
|
||||||
|
*/
|
||||||
|
protected $status_autoassign;
|
||||||
|
|
||||||
// meta
|
// meta
|
||||||
/**
|
/**
|
||||||
* @ORM\Column(type="json")
|
* @ORM\Column(type="json")
|
||||||
|
|
@ -845,4 +851,16 @@ class JobOrder
|
||||||
|
|
||||||
return $this->meta[$id];
|
return $this->meta[$id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setStatusAutoAssign($status_autoassign)
|
||||||
|
{
|
||||||
|
$this->status_autoassign = $status_autoassign;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatusAutoAssign()
|
||||||
|
{
|
||||||
|
return $this->status_autoassign;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
src/Ramcar/AutoAssignStatus.php
Normal file
16
src/Ramcar/AutoAssignStatus.php
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Ramcar;
|
||||||
|
|
||||||
|
class AutoAssignStatus extends NameValue
|
||||||
|
{
|
||||||
|
const NOT_ASSIGNED = 'not_assigned';
|
||||||
|
const HUB_ASSIGNED = 'hub_assigned';
|
||||||
|
const HUB_AND_RIDER_ASSIGNED = 'hub_and_rider_assigned';
|
||||||
|
|
||||||
|
const COLLECTION = [
|
||||||
|
'not_assigned' => 'Not Assigned',
|
||||||
|
'hub_assigned' => 'Hub Assigned',
|
||||||
|
'hub_and_rider_assgined' => 'Hub and Rider Assigned',
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue