Fix for list order history api

This commit is contained in:
Kawlll Maxso
2019-04-15 18:44:53 +08:00
parent bf40f0975f
commit f36015e762
@@ -72,26 +72,25 @@ class ListsOrderHistory
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => 'Out for delivery']);
break;
}
}
if($order->current_step === Constants::ORDER_SHIPPING_STEP){
$shippingArrangment = $order->shippingArrangement()->first();
if($shippingArrangment){
$shippingSchedules = $shippingArrangment->shippingSchedule()->get();
foreach ($shippingSchedules as $schedule){
if($schedule->status === 2){
$customeIssue = CustomIssues::where('schedule_id', $schedule->id)->first();
if($customeIssue !== null){
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]);
if($order->current_step === Constants::ORDER_SHIPPING_STEP){
$shippingArrangment = $order->shippingArrangement()->first();
if($shippingArrangment){
$shippingSchedules = $shippingArrangment->shippingSchedule()->get();
foreach ($shippingSchedules as $schedule){
if($schedule->status === 2){
$customeIssue = CustomIssues::where('schedule_id', $schedule->id)->first();
if($customeIssue !== null){
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]);
} else {
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']);
}
} else {
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']);
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']);
}
} else {
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']);
}
}
}
}
}
if($complete){