mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-29 17:34:25 +00:00
container create with n/a eta and etd
This commit is contained in:
+12
-2
@@ -93,10 +93,20 @@ class CreateLoadContainerLogic extends AbstractControllerLogic
|
||||
|
||||
$container = $this->createsContainer->execute($object, $this->fetchesCompanyModule->execute(['id' => $request->input('company_module_id')]));
|
||||
|
||||
$transportObject = new TransportObject(TransportType::LAND, null, $request->input('tracking'), Carbon::parse($request->input('receive_date')), Carbon::parse($request->input('receive_date')), ApprovalStatus::APPROVED);
|
||||
$transportObject = new TransportObject(
|
||||
TransportType::LAND, null,
|
||||
$request->input('tracking'),
|
||||
Carbon::parse($request->input('receive_date')),
|
||||
Carbon::parse($request->input('receive_date')),
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$transport = $this->createsTransport->execute($transportObject, $container);
|
||||
|
||||
$scheduleObject = new ScheduleObject(Carbon::parse($request->input('receive_date')), Carbon::parse($request->input('receive_date')), ApprovalStatus::APPROVED);
|
||||
$scheduleObject = new ScheduleObject(
|
||||
null,
|
||||
null,
|
||||
ApprovalStatus::APPROVED
|
||||
);
|
||||
$schedule = $this->createsSchedule->execute($transport, $scheduleObject);
|
||||
|
||||
return $this->resourceResponse(new ContainerResource($container));
|
||||
|
||||
@@ -23,7 +23,7 @@ class ScheduleObject implements DataTransferObject
|
||||
* @param Carbon $eta
|
||||
* @param int $status
|
||||
*/
|
||||
public function __construct(Carbon $etd, Carbon $eta, int $status)
|
||||
public function __construct(?Carbon $etd, ?Carbon $eta, int $status)
|
||||
{
|
||||
$this->etd = $etd;
|
||||
$this->eta = $eta;
|
||||
@@ -33,7 +33,7 @@ class ScheduleObject implements DataTransferObject
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getEtd(): Carbon
|
||||
public function getEtd(): ?Carbon
|
||||
{
|
||||
return $this->etd;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class ScheduleObject implements DataTransferObject
|
||||
/**
|
||||
* @return Carbon
|
||||
*/
|
||||
public function getEta(): Carbon
|
||||
public function getEta(): ?Carbon
|
||||
{
|
||||
return $this->eta;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ class ScheduleResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'etd' => $this->etd->format('d-m-Y'),
|
||||
'eta' => $this->eta->format('d-m-Y'),
|
||||
'etd' => $this->etd ? $this->etd->format('d-m-Y') : 'n/a',
|
||||
'eta' => $this->eta ? $this->eta->format('d-m-Y') : 'n/a',
|
||||
'status' => $this->status,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user