@extends('admin.layout.template') @section('title','Order Details') @section('content')
{{-- LEFT SIDE --}}
{{-- ORDER HEADER --}}
{{-- Header: Order Number + Payment + Status --}}

#{{ $order->order_number }} {{-- Payment Status --}} @if($order->payment_status == 'success') Success @elseif($order->payment_status == 'pending') Pending @elseif($order->payment_status == 'failed') Failed @endif {{-- Order Status --}} {{ ucfirst($order->status) }}

Order Date: {{ \Carbon\Carbon::parse($order->created_at)->format('d M Y h:i A') }}

@if($order->quotation_id)

Quatation Number: {{ $order->quotation->quotation_number }}

@endif
Download Invoice
{{-- Progress Section --}}
Progress
@php $stages = ['placed', 'processing', 'shipped', 'delivered']; $colors = [ 'placed'=>'bg-success', 'processing'=>'bg-success', 'shipped'=>'bg-success', 'delivered'=>'bg-success' ]; @endphp @foreach($stages as $stage) @php $currentIndex = array_search($order->status, $stages); $stageIndex = array_search($stage, $stages); if($stageIndex < $currentIndex){ $width=100; // previous stages fully completed $color='bg-success' ; } elseif($stageIndex==$currentIndex){ $width=50; // current stage half-filled $color='bg-success' ; } else{ $width=25; // upcoming stages $color='bg-secondary' ; } @endphp

{{ ucfirst($stage) }}

@endforeach
{{-- Card Footer: Tracking Info --}}
{{-- PRODUCTS --}}

Products

@foreach($order->items as $item) @endforeach
Product Sample ? Qty Price Total

{{ $item->product_name }}

{{-- Variant SKU --}} @if($item->variant) SKU: {{ $item->variant->sku ?? '-' }} @endif {{-- Master catalog --}} @if($item->product) CATALOG: {{ $item->product->master_catalogue_name ?? '-' }} ({{ $item->product->master_catalogue_code ?? '-' }}) @endif {{-- Curtain Details --}} @if(!empty($item->curtain_details)) @php $cd = $item->curtain_details; $modelName = \App\Models\ProductModel::where('id', $cd['model_id'] ?? null)->value('name'); @endphp
Model: {{ $modelName ?? '-' }} Size: {{ $cd['width'] ?? '-' }} × {{ $cd['height'] ?? '-' }} cm Panels: {{ $cd['panels'] ?? '-' }} Fabric: {{ $cd['fabric_meter'] ?? '-' }} m Stitch Rate: ₹{{ $cd['stitch_rate'] ?? '-' }} Stitch Total: ₹{{ $cd['stitch_total'] ?? '-' }}
@endif
{{ $item->is_sample == 1 ? 'Sample Purchase' : 'Not Sample' }} {{ $item->quantity }} ₹ {{ number_format($item->price,2) }} ₹ {{ number_format($item->total,2) }}
{{-- TIMELINE --}}

Order Timeline

{{-- Vertical dashed line --}} @foreach($order->statusHistory as $history)
{{-- Circle / Icon --}} {{-- Timeline Content --}}
{{ $history->status }}
@if($history->note)

{{ $history->note }}

@endif {{-- Optional: Buttons / actions based on status --}} @if(Str::contains(strtolower($history->status), 'invoice')) Resend Invoice @endif
{{-- Timestamp --}}

{{ \Carbon\Carbon::parse($history->created_at)->format('d M Y, h:i A') }}

@endforeach
{{-- RIGHT SIDE --}}
{{-- ORDER SUMMARY --}}

Order Summary

{{-- ================= BILLING TABLE ================= --}} {{-- Subtotal --}} {{-- Tax --}} {{-- Discount --}} {{-- Delivery --}}
Sub Total ₹ {{ number_format($order->sub_total, 2) }}
Tax ₹ {{ number_format($order->tax ?? 0, 2) }}
Discount - ₹ {{ number_format($order->discount, 2) }}
Delivery Fee ₹ {{ number_format($order->delivery_fee, 2) }}
{{-- ================= TOTAL ================= --}}
Total
₹ {{ number_format($order->total_amount, 2) }}
{{-- ================= PAYMENT SUMMARY (NEW STYLE) ================= --}}
Paid ₹ {{ number_format($order->paid_amount ?? 0, 2) }}
Balance ₹ {{ number_format(($order->total_amount - ($order->paid_amount ?? 0)), 2) }}
{{-- PAYMENT --}}

Payment

Method : {{ $order->payment_status }}

Status : @if($order->payment_status=='success') Paid @elseif($order->payment_status=='pending') Pending @elseif($order->payment_status=='failed') Failed @endif

{{-- Razorpay Details --}} @if($order->razorpay_order_id)

Razorpay Order ID: {{ $order->razorpay_order_id }}

Razorpay Payment ID: {{ $order->razorpay_payment_id }}

Razorpay Signature: {{ $order->razorpay_signature }}

@endif {{-- Coupon --}} @if($order->coupon_code)

Coupon Applied: {{ $order->coupon_code }}

@endif
{{-- SHIPPING ADDRESS --}}

Shipping Address

@if($order->shippingAddress)

{{ $order->shippingAddress->name }}

{{ $order->shippingAddress->address_line1 }}

{{ $order->shippingAddress->city }}, {{ $order->shippingAddress->state }}

{{ $order->shippingAddress->phone }}

@endif
{{-- BILLING ADDRESS --}}

Billing Address

@if($order->billingAddress)

{{ $order->billingAddress->name }}

{{ $order->billingAddress->address_line1 }}

{{ $order->billingAddress->city }}, {{ $order->billingAddress->state }}

{{ $order->billingAddress->phone }}

@endif
{{-- COURIER --}} @if($order->courier)

Courier

@if($order->courier->logo) @endif

{{ $order->courier->name }}

Tracking ID : {{ $order->tracking_id }}

@if($order->courier->website) Track Shipment @endif
@endif
@endsection