Add delivery status to job order. #617

This commit is contained in:
Korina Cordero 2021-08-18 08:26:25 +00:00
parent b6f840f5d7
commit 1554f173a8
6 changed files with 79 additions and 4 deletions

View file

@ -31,6 +31,7 @@ use App\Ramcar\AutoAssignStatus;
use App\Ramcar\WarrantySource;
use App\Ramcar\HubCriteria;
use App\Ramcar\CustomerSource;
use App\Ramcar\DeliveryStatus;
use App\Service\InvoiceGeneratorInterface;
use App\Service\RisingTideGateway;
@ -2947,6 +2948,7 @@ class APIController extends Controller implements LoggedController
$jo->setRider($assigned_rider);
$jo->setStatus(JOStatus::ASSIGNED);
$jo->setStatusAutoAssign(AutoAssignStatus::HUB_AND_RIDER_ASSIGNED);
$jo->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN);
$assigned_rider->setAvailable(false);

View file

@ -373,6 +373,7 @@ class RiderController extends APIController
'has_warranty_doc' => false,
'flag_coolant' => $jo->hasCoolant(),
'has_motolite' => $cv->hasMotoliteBattery(),
'delivery_status' => $jo->getDeliveryStatus(),
]
];
}

View file

@ -359,6 +359,12 @@ class JobOrder
*/
protected $no_trade_in_reason;
// delivery status of the job order
/**
* @ORM\Column(type="string", length=30, nullable=true)
*/
protected $delivery_status;
public function __construct()
{
$this->date_create = new DateTime();
@ -1032,4 +1038,16 @@ class JobOrder
{
return $this->no_trade_in_reason;
}
public function setDeliveryStatus($delivery_status)
{
$this->delivery_status = $delivery_status;
return $this;
}
public function getDeliveryStatus()
{
return $this->delivery_status;
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace App\Ramcar;
class DeliveryStatus extends NameValue
{
const RIDER_ASSIGN = 'rider_assign';
const REQUEUE = 'requeue';
const RIDER_ACCEPT = 'accept';
const RIDER_ARRIVE = 'arrive';
const RIDER_EDIT = 'rider_edit';
const RIDER_DEPART_HUB = 'rider_depart_hub';
const RIDER_ARRIVE_HUB_PRE_JO = 'rider_arrive_hub_pre_jo';
const RIDER_DEPART_HUB_PRE_JO = 'rider_depart_hub_pre_jo';
const RIDER_START = 'rider_start';
const RIDER_END = 'rider_end';
const RIDER_ARRIVE_HUB_POST_JO = 'rider_arrive_hub_post_jo';
const RIDER_DEPART_HUB_POST_JO = 'rider_depart_hub_post_jo';
const RIDER_ARRIVE_HUB = 'rider_arrive_hub';
const CANCELLED = 'cancelled';
const FULFILLED = 'fulfilled';
const COLLECTION = [
'rider_assign' => 'Assigned Rider',
'requeue' => 'Requeue',
'accept' => 'Rider Accept',
'arrive' => 'Rider Arrive',
'rider_edit' => 'Rider Edit',
'rider_depart_hub' => 'Rider Depart Hub',
'rider_arrive_hub_pre_jo' => 'Rider Arrive Hub Pre JO',
'rider_depart_hub_pre_jo' => 'Rider Depart Hub Pre JO',
'rider_start' => 'Rider Start',
'rider_end' => 'Rider End',
'rider_arrive_hub_post_jo' => 'Rider Arrive Hub Post JO',
'rider_depart_hub_post_jo' => 'Rider Depart Hub Post JO',
'rider_arrive_hub' => 'Rider Arrive Hub',
'cancelled' => 'Cancelled',
'fulfilled' => 'Fulfilled',
];
}

View file

@ -34,5 +34,13 @@ class JOEventType extends NameValue
'accept' => 'Rider Accept',
'arrive' => 'Rider Arrive',
'rider_edit' => 'Rider Edit',
'rider_depart_hub' => 'Rider Depart Hub',
'rider_arrive_hub_pre_jo' => 'Rider Arrive Hub Pre JO',
'rider_depart_hub_pre_jo' => 'Rider Depart Hub Pre JO',
'rider_start' => 'Rider Start',
'rider_end' => 'Rider End',
'rider_arrive_hub_post_jo' => 'Rider Arrive Hub Post JO',
'rider_depart_hub_post_jo' => 'Rider Depart Hub Post JO',
'rider_arrive_hub' => 'Rider Arrive Hub',
];
}

View file

@ -43,6 +43,7 @@ use App\Ramcar\NoTradeInReason;
use App\Ramcar\WillingToWaitContent;
use App\Ramcar\WarrantySource;
use App\Ramcar\HubCriteria;
use App\Ramcar\DeliveryStatus;
use App\Service\InvoiceGeneratorInterface;
use App\Service\JobOrderHandlerInterface;
@ -932,7 +933,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setLandmark($req->request->get('landmark'))
->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason);
->setNotWaitingNotes($more_reason)
->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN);
if ($user != null)
{
@ -1028,7 +1030,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setLandmark($req->request->get('landmark'))
->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason);
->setNotWaitingNotes($more_reason)
->setDeliveryStatus(DeliveryStatus::FULFILLED);
// validate
$errors = $this->validator->validate($obj);
@ -1143,7 +1146,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
$cancel_reason = $req->request->get('cancel_reason');
error_log($cancel_reason);
$obj->cancel($cancel_reason);
$obj->cancel($cancel_reason)
->setDeliveryStatus(DeliveryStatus::CANCELLED);
// the event
$event = new JOEvent();
@ -1484,7 +1488,8 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
->setLandmark($req->request->get('landmark'))
->setWillWait($req->request->get('flag_willing_to_wait'))
->setReasonNotWait($reason)
->setNotWaitingNotes($more_reason);
->setNotWaitingNotes($more_reason)
->setDeliveryStatus(DeliveryStatus::RIDER_ASSIGN);
if ($user != null)
{