@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.header', ['title' => 'Quản lý đơn hàng'])
Danh sách đặt hàng
@foreach($orders as $order) @php $totalAmount = 0; $productNames = []; @endphp @foreach($order->items as $item) @php $totalAmount += $item->price * $item->quantity; $productNames[] = $item->product->product_name; @endphp @endforeach @endforeach
STT Khách hàng Số lượng Tổng tiền Thời gian đặt hàng Trạng thái Thao tác
{{ $loop->iteration }} {{ $order->user->full_name }} {{ $order->items->sum('quantity') }} {{ number_format($totalAmount, 0, ',', '.') }} đ {{ $order->created_at }} @if($order->status == 'Pending') {{ $order->status }} @elseif($order->status == 'Success') {{ $order->status }} @elseif($order->status == 'Cancelled') {{ $order->status }} @endif Xem chi tiết
@endsection @push('js') @endpush