custom clearance status

This commit is contained in:
omair saleh
2022-04-05 11:20:45 +08:00
parent b764ee0769
commit a19db06b6b
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -16,6 +16,7 @@ class TransportResource extends JsonResource
*/
public function toArray($request)
{
$currentSchedule = $this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first();
return [
'id' => $this->id,
'type' => $this->type,
@@ -24,9 +25,10 @@ class TransportResource extends JsonResource
'dispatch_date' => $this->dispatch_date ? $this->dispatch_date->format('d-m-Y') : $this->dispatch_date,
'drop_date' => $this->drop_date ? $this->drop_date->format('d-m-Y') : $this->drop_date,
'status' => $this->status,
'current_schedule' => new ScheduleResource($this->schedules()->where('status', '=', ApprovalStatus::APPROVED)->first()),
'current_schedule' => new ScheduleResource($currentSchedule),
'schedule_history' => ScheduleResource::collection($this->schedules()->where('status', '=', ApprovalStatus::EXPIRED)->get()),
'dropped_days' => Carbon::now()->diffInDays($this->drop_date, false)
'dropped_days' => Carbon::now()->diffInDays($this->drop_date, false),
'schedule_complete' => $currentSchedule->eta >= Carbon::now()
];
}
}
@@ -50,7 +50,7 @@
</div>
<div class="col-auto">
<small class="fs-10 all-caps muted">Status</small>
<p class="no-margin bold">{{status}}</p>
<p class="no-margin bold">{{item.container ? item.container.transport.schedule_complete ? 'Custom Clearance' : status : status}}</p>
</div>
<div class="col-auto" v-if="$store.getters.isAdmin">
<small class="fs-10 all-caps muted">Container</small>