Merge branch 'order-list-history' into 'master'

Omair's order history list

See merge request CIEFWorldwideSdnBhd/izyim!21
This commit is contained in:
omair saleh
2019-04-16 03:45:48 +00:00
@@ -29,8 +29,9 @@ class ListsOrderHistory
foreach ($orderSteps as $step){
switch ($step->reference_id){
case Constants::ORDER_PROCESSING_STEP:
$warehouse = Warehouse::find($order->warehouse_id)->first();
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => $warehouse ? $warehouse->name.' confirmed as your order\'s warehouse' : ' Your order\'s warehouse has been confirmed']);
if($order->warehouse_id){
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => Warehouse::find($order->warehouse_id)->first()->name.' confirmed as your order\'s warehouse']);
}
break;
case Constants::ORDER_NO_WAREHOUSE_PENDING_SUPPLIER:
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => 'Your Order has been loaded into container']);
@@ -45,14 +46,14 @@ class ListsOrderHistory
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => 'Invoice has been issued, waiting for shipping payment']);
break;
case Constants::ORDER_SHIPPING_STEP:
$shippingArrangment = $order->shippingArrangement()->first();
if($shippingArrangment){
$shippingSchedules = $shippingArrangment->shippingSchedule()->get();
$shippingArrangement = $order->shippingArrangement()->first();
if($shippingArrangement){
$shippingSchedules = $shippingArrangement->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]);
$customIssue = CustomIssues::where('schedule_id', $schedule->id)->first();
if($customIssue !== 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: '.$customIssue->remark]);
} else {
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']);
}
@@ -77,19 +78,19 @@ class ListsOrderHistory
}
if($order->current_step === Constants::ORDER_SHIPPING_STEP){
$shippingArrangment = $order->shippingArrangement()->first();
if($shippingArrangment){
$shippingSchedules = $shippingArrangment->shippingSchedule()->get();
$shippingArrangement = $order->shippingArrangement()->first();
if($shippingArrangement){
$shippingSchedules = $shippingArrangement->shippingSchedule()->get();
foreach ($shippingSchedules as $schedule){
if($schedule->status === 2){
$customeIssue = CustomIssues::where('schedule_id', $schedule->id)->first();
if($customeIssue !== null){
$history->push(['date' => $shippingSchedules->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customeIssue->remark]);
$customIssue = CustomIssues::where('schedule_id', $schedule->id)->first();
if($customIssue !== null){
$history->push(['date' => $schedule->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed due to: '.$customIssue->remark]);
} else {
$history->push(['date' => $shippingSchedules->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']);
$history->push(['date' => $schedule->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Shipping Schedule failed']);
}
} else {
$history->push(['date' => $shippingSchedules->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']);
$history->push(['date' => $schedule->updated_at->format('d-m-Y H:i'), 'description' => '[ETD: '.$schedule->ETD.', ETA: '.$schedule->ETA.'] Your Order has been scheduled for shipping ']);
}
}
}