show container total cbm

This commit is contained in:
omair saleh
2021-09-23 18:34:53 +08:00
parent 8039446db5
commit 9719f1da77
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -2,6 +2,7 @@
namespace App\Http\Resources;
use App\Classes\ValueObjects\Constants\ContainerTypes;
use Illuminate\Http\Resources\Json\JsonResource;
class ContainerResource extends JsonResource
@@ -17,7 +18,7 @@ class ContainerResource extends JsonResource
return [
'id' => $this->id,
'container_reference' => $this->reference,
'container_type' => $this->container_type,
'container_specification' => ContainerTypes::CONTAINER_SPECIFICATION[$this->container_type],
'container_number' => $this->container_number,
'seal_reference' => $this->seal_reference,
'transport' => new TransportResource($this->transports()->first()),
@@ -22,6 +22,10 @@
<p class="no-margin fs-10 all-caps">ETA</p>
<p class="no-margin">{{item.transport ? item.transport.current_schedule.eta : 'n/a'}}</p>
</div>
<div class="col-2">
<p class="no-margin fs-10 all-caps">Loaded CBM</p>
<p class="no-margin">{{ (Math.ceil((item.packing_lists.reduce((total, obj) => total + obj.packages.reduce((total, obj) => obj.cbm + total, 0), 0)) * 1000) / 1000).toFixed(3) }}</p>
</div>
<div class="col">
<p class="no-margin fs-10 all-caps">Status</p>
<p class="no-margin bold" :class="{'text-success': item.status === 3, 'text-complete': item.status !== 3}">{{item.status === 3 ? 'Un-stuffed' : 'In Progress'}}</p>