{{-- resources/views/admin/payments/index.blade.php --}} @extends('admin.layouts.app') @section('title', $pageTitle ?? 'المدفوعات') @push('styles') @endpush @section('content') @php use Illuminate\Support\Facades\Route; $c = $cols ?? []; $F = $filters ?? []; $gateways = $gateways ?? []; $hasStart = Route::has('admin.payments.start'); $hasShow = Route::has('admin.payments.show'); $hasUpd = Route::has('admin.payments.updateStatus'); @endphp

{{ $pageTitle ?? 'المدفوعات' }}

تحديث
{{-- KPIs --}}
إجمالي السجلات
{{ number_format($payments->total()) }}
@if(!empty($c['amount']))
@php $pageSum = $payments->getCollection()->sum(fn($row)=> (float)($row->{$c['amount']} ?? 0)); @endphp
إجمالي المبالغ (صفحة)
{{ number_format($pageSum, 2) }}
@endif @if(!empty($c['is_paid']) || !empty($c['status']))
@php $paidCount = $payments->getCollection()->filter(function($row) use($c){ $v = $c['is_paid'] ? ($row->{$c['is_paid']} ?? null) : ($row->{$c['status']} ?? null); return in_array(strtolower((string)$v), ['1','true','paid','success','succeeded'], true); })->count(); @endphp
مدفوع (صفحة)
{{ number_format($paidCount) }}
@endif @php $dateCol = $c['paid_at'] ?? $c['created_at'] ?? null; @endphp @if($dateCol)
آخر عملية
{{ optional($payments->first()?->{$dateCol} ?? null)->format('Y-m-d') ?? (is_string($payments->first()?->{$dateCol} ?? null) ? \Illuminate\Support\Str::substr($payments->first()?->{$dateCol},0,10) : '—') }}
@endif
{{-- بدء عملية دفع جديدة (Woo-like) --}}
بدء عملية دفع
@if(!$hasStart)
مسار admin.payments.start غير معرّف. أضِف: POST /admin/payments/start → PaymentController@start
@elseif(empty($gateways))
لا توجد بوابات مفعّلة. أضِف إعداداتك في config/payments.php ضمن ['gateways' => ['stripe'=>['enabled'=>true], ...]].
@else
@csrf
@if(!empty($c['order_id']))
@endif
@endif
{{-- فلاتر البحث --}}
@php $st = $F['status'] ?? ''; @endphp
@php $gwf = $F['gateway'] ?? ''; @endphp
@if($dateCol)
@endif
@php $pp = (int)($F['per_page'] ?? 20); @endphp
{{-- جدول المدفوعات --}}
@if(!empty($c['reference'])) @endif @if(!empty($c['transaction_id'])) @endif @if(!empty($c['amount'])) @endif @if(!empty($c['currency'])) @endif @if(!empty($c['status']) || !empty($c['is_paid'])) @endif @if(!empty($c['gateway'])) @endif @if(!empty($c['email'])) @endif @if(!empty($c['phone'])) @endif @if(!empty($c['paid_at']) || !empty($c['created_at'])) @endif @forelse($payments as $row) @if(!empty($c['reference'])) @endif @if(!empty($c['transaction_id'])) @endif @if(!empty($c['amount'])) @endif @if(!empty($c['currency'])) @endif @if(!empty($c['status']) || !empty($c['is_paid'])) @php $sv = $c['status'] ? (string)($row->{$c['status']} ?? '') : ''; $pv = $c['is_paid'] ? (string)($row->{$c['is_paid']} ?? '') : ''; $isOk = in_array(strtolower($sv), ['paid','success','succeeded'], true) || in_array($pv, ['1','true'], true); $isPend = in_array(strtolower($sv), ['pending','processing'], true); $cls = $isOk ? 'bg-success' : ($isPend ? 'bg-warning text-dark' : 'bg-danger'); $txt = $sv !== '' ? $sv : ($isOk ? 'paid' : ($isPend ? 'pending' : 'failed')); @endphp @endif @if(!empty($c['gateway'])) @endif @if(!empty($c['email'])) @endif @if(!empty($c['phone'])) @endif @php $dcol = $c['paid_at'] ?? $c['created_at'] ?? null; @endphp @if($dcol) @endif @empty @endforelse
#المرجعرقم المعاملةالمبلغالعملةالحالةالبوابةالإيميلالهاتفالتاريخإجراءات
{{ $row->{$c['id'] ?? 'id'} ?? '—' }}{{ $row->{$c['reference']} }}{{ $row->{$c['transaction_id']} }}{{ number_format((float)($row->{$c['amount']} ?? 0), 2) }}{{ $row->{$c['currency']} ?? '—' }}{{ $txt }}{{ strtoupper((string)($row->{$c['gateway']} ?? '—')) }}{{ $row->{$c['email']} ?? '—' }}{{ $row->{$c['phone']} ?? '—' }} {{ optional($row->{$dcol} ?? null)->format('Y-m-d') ?? (is_string($row->{$dcol} ?? null) ? \Illuminate\Support\Str::substr($row->{$dcol},0,10) : '—') }}
@if($hasShow) @endif @if($hasUpd) @endif
@if($hasUpd) @endif
لا توجد نتائج حالياً.
عرض {{ $payments->firstItem() }}–{{ $payments->lastItem() }} من أصل {{ $payments->total() }}
@endsection @push('scripts') @endpush