minor changes

This commit is contained in:
Omair Saleh
2019-04-16 11:25:16 +08:00
parent b1d927b0c7
commit 2e266b6e5d
@@ -29,13 +29,15 @@ class ListsOrderHistory
foreach ($orderSteps as $step){
switch ($step->reference_id){
case Constants::ORDER_PROCESSING_STEP:
$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']);
$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']);
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']);
break;
case Constants::ORDER_WAREHOUSE_RECEIVING_STEP:
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => 'Arrived at '.Warehouse::find($order->warehouse_id)->first()->name.' warehouse in china on: ['.Carbon::parse($order->receiveNotes()->firstOrFail()->receive_date)->format('d-m-Y').']']);
$warehouse = Warehouse::find($order->warehouse_id)->first();
$history->push(['date' => $step->updated_at->format('d-m-Y H:i'), 'description' => 'Arrived at '.$warehouse ? $warehouse->name : null.' warehouse in china on: ['.Carbon::parse($order->receiveNotes()->firstOrFail()->receive_date)->format('d-m-Y').']']);
break;
case Constants::ORDER_WAREHOUSE_PACKING_STEP:
$packages = $order->packingLists()->firstOrFail()->packages()->selectRaw(DB::raw('((width/100) * (height/100) * (length/100)) * quantity as cbm, quantity'))->get();
@@ -82,12 +84,12 @@ class ListsOrderHistory
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]);
$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]);
} 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' => $shippingSchedules->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.'] Your Order has been scheduled for shipping ']);
$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 ']);
}
}
}