@extends('layouts.app') @section('title', 'Đơn hàng của tôi - XING NEW') @section('content')

Lịch sử đơn hàng

{{ substr(Auth::user()->name, 0, 1) }}

{{ Auth::user()->name }}

{{ Auth::user()->email }}

@forelse($orders as $order)
{{ $order->order_number }} @if($order->status == 'new') Chờ xác nhận @elseif($order->status == 'processing') Đang xử lý @elseif($order->status == 'shipped') Đang giao hàng @elseif($order->status == 'completed') Đã giao hàng @else Đã hủy @endif
Ngày đặt: {{ $order->created_at->format('d/m/Y H:i') }}
Tổng tiền
{{ number_format($order->total_amount, 0, ',', '.') }}đ
@foreach($order->items as $item)
@if($item->product && $item->product->image) @else
@endif

{{ $item->product?->name ?? 'Sản phẩm không còn tồn tại' }}

@if($item->options)
@foreach($item->options as $opt => $val) {{ $opt }}: {{ $val }} @endforeach
@endif
Số lượng: {{ $item->quantity }}
{{ number_format($item->price, 0, ',', '.') }}đ
@endforeach
@if($order->status == 'new' && !$order->cancel_requested)
@csrf
@elseif($order->cancel_requested && $order->status != 'cancelled')
Đang chờ hệ thống xác nhận hủy đơn...
@endif
@empty

Chưa có đơn hàng nào

Bạn chưa thực hiện đơn hàng nào trên hệ thống của chúng tôi.

Mua sắm ngay
@endforelse
{{ $orders->links() }}
@endsection