@extends('profile.layout') @section('title', __('Bildirişlər')) @section('content')

{{ __('Bildirişlər') }}

{{-- Tabs --}}
{{-- Orders tab --}}
@if($orders->isEmpty())

{{ __('Müraciət yoxdur') }}

@else
@foreach($orders as $o) @php // total_amount == 0 → это простая контакт-форма (обращение), // а не заказ с товарами. $isOrder = (float) $o->total_amount > 0; $initial = mb_strtoupper(mb_substr(trim($o->customer_name ?: '?'), 0, 1)); @endphp
{{-- Header --}}
{{ $initial }}
{{ $o->customer_name }} @if($isOrder) {{ __('Sifariş') }} @else {{ __('Müraciət') }} @endif
{{ $o->page->title ?? '—' }}
@if($isOrder)
{{ number_format((float) $o->total_amount, 2) }} ₼
@endif {{ \App\Models\Order::statusLabel($o->status) }}
{{-- Contacts: телефон → email → адрес --}}
{{ $o->customer_phone }} @if($o->customer_email) {{ $o->customer_email }} @endif @if($o->customer_address) {{ $o->customer_address }} @endif
{{-- Items (только для заказов) --}} @if($isOrder && !empty($o->items))
@foreach($o->items as $item) @php $lineTotal = ((float) ($item['price'] ?? 0)) * ((int) ($item['quantity'] ?? 1)); @endphp
{{ $item['quantity'] ?? 1 }} {{ $item['name'] ?? '' }} {{ number_format($lineTotal, 2) }} ₼
@endforeach
@endif {{-- Notes: для заказа — комментарий, для обращения — само сообщение --}} @if($o->notes)
{{ $o->notes }}
@endif {{-- Footer --}}
№ {{ $o->id }} {{ $o->created_at->format('d.m.Y, H:i') }}
@endforeach
{{ $orders->links() }}
@endif
{{-- System tab --}} @endsection @push('scripts') @endpush