@extends('site.layout.layout') @section('title',__('Order details')) @if($order) @section('content')

{{ __('Order details') }}

@php $progress = $order->shipping_progress; $steps = [ ['threshold' => 0, 'label' => __('Pending'), 'icon' => ''], ['threshold' => 33, 'label' => __('Ready for Shipping'), 'icon' => ''], ['threshold' => 66, 'label' => __('Shipping in Progress'), 'icon' => ''], ['threshold' => 100, 'label' => __('Shipped'), 'icon' => ''], ]; $doneIcon = $steps[0]['icon']; // Use first step's icon for all "done" steps @endphp
@foreach ($steps as $index => $step) @php $class = 'next'; if ($progress >= $step['threshold']) { $class = 'done'; } elseif ( $progress < $step['threshold'] && ($index === 0 || $progress >= $steps[$index - 1]['threshold']) ) { $class = 'current'; } $icon = $class === 'done' ? $doneIcon : $step['icon']; @endphp
{!! $icon !!}
{{ $step['label'] }}
@endforeach
{{ __('Order no') }}#{{ $order->id }}
{{ $order->orderProducts()->count() ?? 0 }} {{ __('product') }}
{{ __('Order placed on :date', ['date' => $order->created_at->format('d-m-Y')]) }}
{{ __('Total') }}: {{ $order->total }}
@php $progress = $order->shipping_progress; if ($progress < 33) { $statusText = __('Pending'); $statusClass = 'orange'; } elseif ($progress < 66) { $statusText = __('Ready for Shipping'); $statusClass = 'orange'; } elseif ($progress < 100) { $statusText = __('Shipping in Progress'); $statusClass = 'orange'; } else { $statusText = __('Shipped'); $statusClass = 'green'; } @endphp

{{ $statusText }} ( {{ $progress }}% )

{{ __('Products information') }}

@foreach($order->orderProducts ?? [] as $orderProduct)
{{ __('Store title') }}: {{ $orderProduct->store?->getTranslation('title',app()->getLocale()) }}
{{ $orderProduct->product?->getTranslation('title',app()->getLocale()) }}

{{ $orderProduct->price }}

{{ $orderProduct->shipping_status_label }}

@if($orderProduct->shipping_status != 'shipped') @if($orderProduct->shipping_type == 3)
{{$orderProduct->shippingCompany?->title }}
{{ $orderProduct->shipping_cost }}
getLocale() == 'ar') src="{{ asset('site/img/shipping-icon.png') }}" @else src="{{ asset('site/img/shipping-icon-en.png') }}" @endif alt=""> {{ __('Company delivery') }}
@elseif($orderProduct->shipping_type == 2)
{{ $order->address?->first_name . ' ' . $order->address?->second_name }}
{{ $order->address?->city?->getTranslation('city',app()->getLocale()) . ' ' . $order->address?->region . ' ' . $order->address?->street . ' ' . $order->address?->distinct }}
{{ $order->address?->country_code . ' ' . $order->address?->mobile }}
getLocale() == 'ar') src="{{ asset('site/img/shipping-icon.png') }}" @else src="{{ asset('site/img/shipping-icon-en.png') }}" @endif alt=""> {{ __('Store delivery') }}
@else
{{ $orderProduct->store?->getTranslation('title',app()->getLocale()) }}
{{ $orderProduct->store?->city?->getTranslation('city',app()->getLocale()) . ' ' . $orderProduct->store?->region }}
{{ $orderProduct->store?->owner?->country_code . ' ' . $orderProduct->store?->owner?->mobile }}
getLocale() == 'ar') src="{{ asset('site/img/shipping-icon.png') }}" @else src="{{ asset('site/img/shipping-icon-en.png') }}" @endif alt=""> {{ __('PickUp') }}
@endif @else