@extends('layouts.app') @section('title', __('dashboard.sidebar_returns')) @section('page_heading', __('dashboard.sidebar_returns')) @section('content') @php $totalRefunded = $returns->sum('total_refunded'); $fullReturns = $returns->getCollection()->where('return_type','full')->count(); $partialReturns= $returns->getCollection()->where('return_type','partial')->count(); @endphp {{-- KPIs --}}
@foreach([ ['fa-solid fa-rotate-left', '#fef2f2','#dc2626', $returns->total(), 'إجمالي المرتجعات'], ['fa-solid fa-coins', '#fffbeb','#d97706', number_format($totalRefunded,2), 'إجمالي المبالغ المستردة (ج.م)'], ['fa-solid fa-circle-xmark', '#fef2f2','#dc2626', $fullReturns, 'مرتجعات كاملة'], ['fa-solid fa-circle-half-stroke','#eff6ff','#2563eb', $partialReturns, 'مرتجعات جزئية'], ] as [$ic,$bg,$cl,$val,$lbl])
{{ $val }}
{{ $lbl }}
@endforeach
{{-- Table card --}}
{{-- Head --}}
{{ __('dashboard.All Returns') }} {{ number_format($returns->total()) }}
ابدأ من الفاتورة
@if($returns->isEmpty())
@include('layouts.partials.index-empty-state',['icon'=>'fa-solid fa-rotate-left','title'=>__('dashboard.No returns found.'),'message'=>''])
@else
@foreach(['#','رقم الفاتورة','العميل','المبلغ المسترد','النوع','المنتجات','بواسطة','التاريخ',''] as $h) @endforeach @foreach($returns as $ret) @endforeach
{{ $h }}
{{ $ret->id }} #{{ $ret->sale_id }} @if($ret->sale?->customer)
{{ $ret->sale->customer->name }}
{{ $ret->sale->customer->phone }}
@else @endif
{{ number_format($ret->total_refunded,2) }}
ج.م
@if($ret->return_type === 'full') كامل @else جزئي @endif
@foreach($ret->items->take(2) as $item) {{ $item->product?->name ?? '—' }} ×{{ $item->quantity }} @endforeach @if($ret->items->count() > 2) +{{ $ret->items->count()-2 }} أخرى @endif
{{ $ret->creator?->name ?? '—' }} {{ $ret->created_at->format('Y-m-d') }} @canany(['view sale returns','delete sale returns'])
@can('view sale returns') عرض التفاصيل @endcan @can('delete sale returns')
@csrf @method('DELETE')
@endcan
@endcanany
{{ $returns->appends(request()->query())->links() }}
@endif
@endsection