mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
fix vt container update
This commit is contained in:
+10
-19
@@ -256,29 +256,20 @@ Route::get('/container/{reference}/refresh/', function (string $reference){
|
||||
$container = Container::where('reference', $reference)->first();
|
||||
$supplier = in_array($container->owner_id, [3, 4]) ? 'VT' : 'YD';
|
||||
|
||||
$arrivalDates = \App\Models\PackingList::whereIn('reference', $container->packingLists->pluck('reference'))->where('type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->get()->map(function($packingList){
|
||||
return $packingList->transports()->first()->drop_date;
|
||||
})->sortBy(function($date){
|
||||
return $date;
|
||||
});
|
||||
|
||||
$startDate = $arrivalDates->first()->subDay()->format('d-m-Y');
|
||||
$endDate = $arrivalDates->last()->addDay()->format('d-m-Y');
|
||||
|
||||
if($supplier === 'VT'){
|
||||
$arrivalDates = \App\Models\PackingList::whereIn('reference', $container->packingLists->pluck('reference'))->where('type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->get()->map(function($packingList){
|
||||
return $packingList->transports()->first()->drop_date;
|
||||
})->sortBy(function($date){
|
||||
return $date;
|
||||
});
|
||||
|
||||
$startDate = $arrivalDates->first()->subDay()->format('d-m-Y');
|
||||
$endDate = $arrivalDates->last()->addDay()->format('d-m-Y');
|
||||
|
||||
(App()->make(\App\Classes\Modules\PackingLists\Processors\FetchLoadedContainersFromVTPortalProcessor::class))->execute($startDate, $endDate);
|
||||
return (App()->make(\App\Classes\Modules\PackingLists\Processors\FetchLoadedContainersFromVTPortalProcessor::class))->execute($startDate, $endDate);
|
||||
}
|
||||
|
||||
if($supplier === 'YD'){
|
||||
$arrivalDates = \App\Models\PackingList::whereIn('reference', $container->packingLists->pluck('reference'))->where('type', \App\Classes\ValueObjects\Constants\PackingListType::WAREHOUSE_RECEIVE_LIST)->get()->map(function($packingList){
|
||||
return $packingList->transports()->first()->drop_date;
|
||||
})->sortBy(function($date){
|
||||
return $date;
|
||||
});
|
||||
|
||||
$startDate = $arrivalDates->first()->subDay()->format('d-m-Y');
|
||||
$endDate = $arrivalDates->last()->addDay()->format('d-m-Y');
|
||||
|
||||
return redirect(route('yd.refresh').'?start_date='.$startDate.'&end_date='.$endDate);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user