@extends('layouts.main') @section('title', 'My Orders') @section('content')

My Orders

@if ($errors->any())
@endif @forelse ($orders as $order) @php $item_total = $order->checkoutProducts->sum(function ($item) { return $item->sales_price * $item->quantity; }); $item_gst = $order->checkoutProducts->sum(function ($item) { return $item->sales_price * $item->quantity * (($item->cgst + $item->sgst) / 100); }); $total = $item_total + $item_gst + $order->shipping_cost + $order->branding_cost; // echo $item_gst; @endphp
Order #{{ $order->payment_order_id }}
Placed on {{ \Carbon\Carbon::parse($order->created_at)->format('d M Y, h:i A') }}
{{-- Show View Invoice for all except unknown --}} @if (in_array($order->under_process, [1])) View Invoice @endif {{-- Show Track Order only if order is accepted --}} @if ( $order->under_process === 1 && $order->ready_to_delivery == 1 && $order->courier_id != '' && $order->active_shiprocket_order_count > 0) Track Order @elseif ($order->under_process === 1 && $order->courier_id == '') Track Order @endif {{-- Show action/status based on under_process value --}} @switch($order->under_process) @case(0) @break @case(1) Accepted @break @case(2) Cancelled (Refund Pending) @break @case(3) Cancelled by Admin (Refund Pending) @break @case(4) Refunded @break @default Unknown Status @endswitch
@foreach ($order->checkoutProducts as $product)
@php $previewDecoded = json_decode($product->preview, true); if (!empty($previewDecoded) && is_array($previewDecoded) && count($previewDecoded) > 0) { $imageUrl = url('images/previews/' . dec($previewDecoded[0])); } elseif (!empty($product->product_image)) { $imageUrl = url('images/products/' . $product->product_image); } else { $imageUrl = asset('assets/images/defaultimage.jpg'); } @endphp {{ $product->product_name }}
{{ $product->product_name }}

Quantity: {{ $product->quantity }}

{{-- Delivery & Cancellation Status --}} @if ($order->under_process == 2)
Order Cancelled by You
Refund will be processed within 15 to 20 business days.
Reason: {{ $order->cancel_remark_by_user ?? 'No reason provided' }}
@elseif ($order->under_process == 3)
Order Cancelled by Admin
Reason: {{ $order->cancelled_remark_by_admin ?? 'No reason provided' }}
Refund will be processed within 15 to 20 business days.
@elseif ($order->under_process == 4)
Order Cancelled and Refunded
@if ($order->cancelled_by === 'admin') Cancelled by: Admin
Reason: {{ $order->cancelled_remark_by_admin ?? 'No reason provided' }} @elseif ($order->cancelled_by === 'user') Cancelled by: You
Reason: {{ $order->cancel_remark_by_user ?? 'No reason provided' }} @else Cancelled by: Unknown @endif
@else {{-- Show Delivery Status Only If Not Cancelled --}} @if ($order->is_delivered == 1) Delivered @else @if ($order->courier_id == '') {{ config('constant.shipping_status.' . $order->manual_shipping_status) }} @else Pending Delivery @endif @endif @endif
Buy Again @auth @endauth
@endforeach
@empty
No Orders

No Orders Found

You haven't placed any orders yet. Start shopping to discover amazing products!

Shop Now
@endforelse
{{ $orders->appends(request()->input())->links('pagination::bootstrap-5') }}
@endsection