@extends('admin.layout.master') @section('content') @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif
@csrf @method('PUT')
{{-- ROW1 --}}

Order # {{ $order->id }} @ {{ $order->created_at }}

Customer's Information
@if ($paidCount > 1) Returning customer {{ $paidCount }} times @endif
Customer Comments
{{ $order->comments }}
{{-- Start of form --}}
@csrf @method('PUT') {{-- Assuming you are updating an existing order --}}
Office Remark
{{-- Submit Button --}}
{{-- End of form --}}
{{-- ROW2 --}}

@csrf @method('PUT')
Deliver Information
Photos
@csrf @if ($order->photos && $order->photos->count() > 0)
@foreach ($order->photos as $photo)
Photo
@endforeach
@else

No photos available for this order.

@endif
{{-- ROW3 --}}

Summary
@foreach ($order->items as $item)
@if ($item->product) {{ $item->product->name_chi }} @else NA @endif
${{ number_format($item->unitPrice, 2) }}
{{ $item->qty }}
${{ number_format($item->qty * $item->unitPrice, 2) }}
@endforeach
Delivery Fees
${{ number_format($order->deliveryFees, 2) }}
Total:
${{ number_format( $order->items->sum(function ($item) { return $item->qty * $item->unitPrice; }) + $order->deliveryFees, 2, ) }}
@php $color = 'btn-primary'; $paid = ''; $paymentDate = ''; $paymentAmount = ''; switch ($order->paid) { case 0: $paid = 'Unpaid'; $color = 'btn-danger'; break; case 1: $paid = 'Paypal'; $paymentDate = $order->paypal_date ?? 'N/A'; $paymentAmount = $order->paypal_amount ?? 'N/A'; // Assuming you have a paypal_amount field break; case 2: $paid = 'ATM'; $paymentDate = $order->atm_date ?? 'N/A'; $paymentAmount = $order->atm_amount !== null ? '$' . number_format($order->atm_amount, 2) : 'N/A'; break; case 3: $paid = 'Cash'; $paymentDate = $order->cash_date ?? 'N/A'; $paymentAmount = $order->cash_amount !== null ? '$' . number_format($order->cash_amount, 2) : 'N/A'; break; } @endphp
Payment
{{ $paid }}
{{ $paymentDate }}
{{ $paymentAmount }}
Modify
@foreach ($order->items as $item)
@if ($item->product) {{ $item->product->name_chi }} @else NA @endif
@csrf @method('PUT')
@csrf @method('DELETE')
@endforeach
@csrf
Add new item to this order
{{-- Product Dropdown --}} {{-- Quantity Input --}} {{-- Submit Button --}}
Discount
@csrf
@error('discountPercentage') {{ $message }} @enderror
@error('unitPrice') {{ $message }} @enderror
Payment (paid_status)
Payment Status: @switch($order->paid) @case(0) Unpaid @break @case(1) PayPal - Date: {{ $order->paypal_date ?? 'N/A' }}, Ref: {{ $order->paypal_ref ?? 'N/A' }} @break @case(2) ATM - Date: {{ $order->atm_date ?? 'N/A' }}, Amount: {{ $order->atm_amount ?? 'N/A' }} @break @case(3) Cash - Date: {{ $order->cash_date ?? 'N/A' }}, Amount: {{ $order->cash_amount ?? 'N/A' }} @break @endswitch
@csrf
ATM
Date
Amount
@csrf
Cash
Date
Amount
@endsection