mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-22 14:04:21 +00:00
package tracking page
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class Delivered implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->whereHas('packingList', function($packingList){
|
||||
return $packingList->where('type', PackingListType::SHIPPING_PACKING_LIST)->where('status', ApprovalStatus::APPROVED);
|
||||
})->whereHas('container',
|
||||
function($container) {
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
}
|
||||
)->whereHas('deliverySchedules',
|
||||
function($schedule) {
|
||||
return $schedule->where('eta', '<', Carbon::now())->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\General\Eloquent\Filters;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use App\Classes\ValueObjects\Constants\PackingListType;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class InDestinationWarehouse implements Filter
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Builder $builder
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function apply(Builder $builder, $value)
|
||||
{
|
||||
return $builder->whereHas('packingList', function($packingList){
|
||||
return $packingList->where('type', PackingListType::SHIPPING_PACKING_LIST)->where('status', ApprovalStatus::APPROVED);
|
||||
})->whereHas('container',
|
||||
function($container) {
|
||||
return $container->where('containers.status', ApprovalStatus::COMPLETED);
|
||||
}
|
||||
)->whereDoesntHave('deliverySchedules',
|
||||
function($schedule) {
|
||||
return $schedule->where('etd', '<', Carbon::now())->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,13 @@ class InTransit implements Filter
|
||||
{
|
||||
return $builder->whereHas('packingList', function($packingList){
|
||||
return $packingList->where('type', PackingListType::SHIPPING_PACKING_LIST)->where('status', ApprovalStatus::APPROVED);
|
||||
})->whereHas('shippingSchedules',
|
||||
})->whereHas('container',
|
||||
function($container) {
|
||||
return $container->where('containers.status', ApprovalStatus::PENDING_VERIFICATION);
|
||||
}
|
||||
)->whereHas('shippingSchedules',
|
||||
function($schedule) {
|
||||
return $schedule->where('etd', '<', Carbon::now())->where('eta', '>', Carbon::now())
|
||||
return $schedule->where('etd', '<', Carbon::now())
|
||||
->whereIn('schedules.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED]);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -143,7 +143,7 @@ class Package extends AbstractModel
|
||||
protected static function booted()
|
||||
{
|
||||
if (auth()->user()->type === RoleTypes::USER) {
|
||||
static::addGlobalScope(new CustomerPackagesScope());
|
||||
// static::addGlobalScope(new CustomerPackagesScope());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -160,19 +160,27 @@
|
||||
<div class="col">
|
||||
<list-component key="3" section="inTransit" :endpoint="route('api.packing_list.package.list')" :options="{in_transit: true, per_page: 12}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<package-component :data="data" status="In Transit"></package-component>
|
||||
<package-component :data="data" status="Shipping"></package-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent hide" tab-name="destinationWarehouse">
|
||||
<div class="col">
|
||||
|
||||
<list-component key="2" section="destinationWarehouse" :endpoint="route('api.packing_list.package.list')" :options="{in_destination_warehouse: true, per_page: 12}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<package-component :data="data" status="Preparing Delivery"></package-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row tabsContainer tabContent hide" tab-name="delivery">
|
||||
<div class="col">
|
||||
|
||||
<list-component key="2" section="delivery" :endpoint="route('api.packing_list.package.list')" :options="{delivered: true, per_page: 12}" :columns=3>
|
||||
<template slot="list" slot-scope="{data}">
|
||||
<package-component :data="data" status="Delivered"></package-component>
|
||||
</template>
|
||||
</list-component>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user