@foreach($orders as $order) @php //$order = \App\Order::find($order->id); $orderDetails = \App\OrderDetail::select('id','product_id','seller_id','quantity','packed_qty', 'order_id','price','payment_status','package_status','delivery_status') ->with('order:id,code,shipping_address') ->with('shop:user_id,postal_code') ->where('order_id', $order->id) ->where('delivery_status', 'confirmed') ->where('delivery_status', "!=", "cancelled"); if(auth()->id() == env('kvio_warehouse_id')){ /*$orderProduct = DB::table('order_details') ->select('order_details.id', 'order_details.packed_qty', 'order_details.order_id', 'order_details.quantity', 'order_details.price', 'order_details.payment_status', 'order_details.package_status', 'order_details.delivery_status','products.slug', 'products.name') ->where('order_details.delivery_status', 'confirmed') ->where('order_details.delivery_status', "!=", "cancelled") ->leftjoin('products', 'products.id', '=', 'order_details.product_id') ->where('order_details.order_id', $order->id) ->where('products.manage_by', '0') ->get();*/ $orderDetails->whereHas('product', function ($query) { $query->where('manage_by', '=', 0); })->with(['product' => function ($query) { $query->select('id','name','slug')->where('manage_by', '=', 0); }]); }else{ /*$orderProduct = DB::table('order_details') ->select('order_details.id', 'order_details.packed_qty', 'order_details.order_id', 'order_details.quantity', 'order_details.price', 'order_details.payment_status', 'order_details.package_status', 'order_details.delivery_status','products.slug', 'products.name') ->where('order_details.seller_id', Auth::user()->id) ->where('order_details.delivery_status', "!=", "cancelled") ->leftjoin('products', 'products.id', '=', 'order_details.product_id') ->where('order_details.order_id', $order->id) ->where('products.manage_by', '1') ->get();*/ $orderDetails->whereHas('product', function ($query) { $query->where('manage_by', '=', 1); })->with([ 'product' => function ($query) { $query->select('id','name','slug')->where('manage_by', '=', 1); } ])->where('seller_id', auth()->id()); } $orderProducts = $orderDetails->get(); //dd($orderProducts) @endphp @foreach ($orderProducts as $key => $orderProduct) @php //$orderID = \App\Order::find($order_id->order_id); //$XpreessBeeDelivery = \App\XpressBeeDeliveryPincode::pluck('pincode')->all(); $pickupPinCode = $orderProduct->shop->postal_code; $deliveryPinCode = array(json_decode($orderProduct->order->shipping_address)->postal_code); $checkXBeePickupZipcodeCount = \App\Models\V2\XpressBeePickupZipcode::where('pincode',$pickupPinCode)->count(); $checkXBeeDeliveryPinCodesCount = \App\XpressBeeDeliveryPincode::where('pincode',$deliveryPinCode)->count(); $checkEcomPinCodesCount = \App\Models\V2\EcomPinCode::whereIn('pincode',[$deliveryPinCode,$pickupPinCode])->count(); //dd($pickupPinCode,$deliveryPinCode); @endphp @if($orderProduct != null) @endif @endforeach @endforeach
{{translate('S.No')}} {{translate('Order ID')}} {{translate('Product Name')}} {{translate('Item Qty.')}} {{translate('Amount')}} {{translate('Delivery Status')}} {{translate('Payment Status')}} {{translate('Packed Qty.')}} {{translate('Available Qty. to Pack')}} {{translate('Shipping Service')}} {{translate('Action')}}
{{ $key+1 }} {{ $orderProduct->order->code }} @if ($orderProduct->product->name != null) {{ $orderProduct->product->name }} @else {{ translate('Product Unavailable') }} @endif {{$orderProduct->quantity}} {{ single_price($orderProduct->price) }} {{ ucwords(orderStatusDiscription($orderProduct->delivery_status)) }} @if ($orderProduct->payment_status == 'paid') {{ translate('Paid')}} @else {{ translate('Unpaid')}} @endif {{(!empty(@$orderProduct->packed_qty)) ? @$orderProduct->packed_qty : '0'}}
@if($orderProduct->package_status == 1) Packed @else @endif