From f36015e762ac8bfc0b9e7fa0790b9ce1674cf64f Mon Sep 17 00:00:00 2001 From: Kawlll Maxso Date: Mon, 15 Apr 2019 18:44:53 +0800 Subject: [PATCH] Fix for list order history api --- .../Orders/Services/ListsOrderHistory.php | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/app/Classes/Modules/Orders/Services/ListsOrderHistory.php b/app/Classes/Modules/Orders/Services/ListsOrderHistory.php index bf653f2..b8d2283 100644 --- a/app/Classes/Modules/Orders/Services/ListsOrderHistory.php +++ b/app/Classes/Modules/Orders/Services/ListsOrderHistory.php @@ -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){