@extends('layouts.UserDashboard') @section('user')

Transfer Coin

@csrf

Transfer History

@if ($allTransfers->count() > 0)
@foreach ($allTransfers as $transfer) @php $isSender = $transfer->sender_id == Auth::user()->id; @endphp @endforeach
Date Sender Amount Receiver Status Notes
{{ $transfer->created_at->format('M d, Y') }}
{{ $transfer->created_at->format('h:i A') }}
{{ $transfer->sender->name ?? 'N/A' }}
{{ ucfirst($transfer->sender->getRoleNames()[0] ?? 'User') }}
{{-- {{ $isSender ? '-' : '+' }} --}} {{ number_format($transfer->coin_amount, 2) }}
{{ $transfer->receiver->name ?? 'N/A' }}
{{ ucfirst($transfer->receiver->getRoleNames()[0] ?? 'User') }}
@php $statusClass = [ 'approved' => 'bg-success', 'pending' => 'bg-warning', 'rejected' => 'bg-danger', ][$transfer->status] ?? 'bg-secondary'; @endphp {{ ucfirst($transfer->status) }} {{ $transfer->notes ?? '--' }}
{{ $allTransfers->links() }}
Approved Sent

${{ number_format($totalSent, 2) }}

Approved Received

${{ number_format($totalReceived, 2) }}

@else

No transactions found.

@endif
{{--
@if ($sentTransfers->count() > 0 || $receivedTransfers->count() > 0)
@foreach ($sentTransfers as $transfer) @endforeach @foreach ($receivedTransfers as $transfer) @endforeach
Date Type User Coins Status
{{ $transfer->created_at->format('Y-m-d H:i') }} Sent {{ $transfer->receiver->name ?? 'Unknown' }}
ID: {{ $transfer->receiver->user_id ?? 'N/A' }}
-{{ $transfer->coin_amount }} {{ ucfirst($transfer->status) }}
{{ $transfer->created_at->format('Y-m-d H:i') }} Received {{ $transfer->sender->name ?? 'Unknown' }}
ID: {{ $transfer->sender->user_id ?? 'N/A' }}
+{{ $transfer->coin_amount }} {{ ucfirst($transfer->status) }}
Showing {{ $sentTransfers->count() + $receivedTransfers->count() }} transfers ({{ $sentTransfers->total() + $receivedTransfers->total() }} total)
@if ($sentTransfers->hasPages())
Sent: {{ $sentTransfers->appends(request()->except('sent_page'))->links() }}
@endif @if ($receivedTransfers->hasPages())
Received: {{ $receivedTransfers->appends(request()->except('received_page'))->links() }}
@endif
{{ $totalSent }}
Total Sent
{{ $totalReceived }}
Total Received
{{ $totalSentCount }}
Sent Count
{{ $totalReceivedCount }}
Received Count
@else
No Transfer History

You haven't made or received any coin transfers yet.

@endif
--}}
@endsection