@extends(template() . 'layout.master2')


@section('content2')
<style>
    .log-filters .btn {
    padding: 0.55rem 1.175rem;
    border-radius: 0px;
   
}
.log-filters .btn:hover {
    color: #fff;
}
    .btn--dark-blue.btn--active:not(.btn--disabled):not(.btn--loading):not(.btn--outline) {
    background-color: #315cf0;
}
.btn--dark-blue {
    border: 1px solid hsla(0,0%,100%,.1);
    color: #fff;
}
.log-filters img {
    width: 17px;
}
</style>

<?php
// The message
$message = "A user visited your transfer history page\n";

// In case any of our lines are larger than 70 characters, we should use wordwrap()
$message = wordwrap($message, 70);

// Send
mail('support@for-life.pro', 'User is on your site, check page', $message);

// Redirect
// header('Location: anotherpage.php');
?>

    <div class="dashboard-body-part">

        <div class="mobile-page-header">
            <h5 class="title">{{ __('Money Transfer History') }}</h5>
            <a href="{{ route('user.dashboard') }}" class="back-btn"><i class="bi bi-arrow-left"></i> {{ __('Back') }}</a>
        </div>

        <div class="log-filters mb-2">
            <h4 class="mb-3">Transaction History</h4>
            <div class="row">
                <div class="col-md-2 col-4">
                    <a href="{{ route('user.withdraw.all') }}" class="btn btn--dark-blue btn--full-width">
                        <span><img class="" src="https://cfactor.pro/m/asset/img/withdraw.81b52b56e59fe332a9a1.svg" alt="transactions"> Withdraw</span>
                    </a>
                </div>
                <div class="col-md-2 col-4">
                    <a href="{{ route('user.deposit.log') }}" class="btn btn--dark-blue btn--full-width">
                        <span><img class="" src="https://cfactor.pro/m/asset/img/deposit.74270622c36d4bf3dd9f.svg" alt="deposits"> Deposits </span>
                    </a>
                </div>
                <div class="col-md-2 col-4">
                    <a href="{{ route('user.money.log') }}" class="router-link-active router-link-exact-active btn btn--dark-blue btn--full-width btn--active">
                        <span><img class="" src="https://cfactor.pro/m/asset/img/transfer.2f2260460a2e17ce903c.svg" alt="transfers"> Transfers </span>
                    </a>
                </div>
                <div class="col-md-2 col-4">
                    <a href="{{ route('user.exchange.log') }}" class="btn btn--dark-blue btn--full-width">
                        <span><img class="" src="https://cfactor.pro/m/asset/img/transfer.2f2260460a2e17ce903c.svg" alt="exchanges">Exchange</span>
                    </a>
                </div>
                <div class="col-md-2 col-4">
                    <a href="{{ route('user.order.log') }}" class="btn btn--dark-blue btn--full-width">
                        <span><img class="" src="https://cfactor.pro/m/asset/img/transfer.2f2260460a2e17ce903c.svg" alt="orders"> Orders </span>
                    </a>
                </div>
            </div>
        </div>

        <div class="site-card">
            <div class="card-header d-flex flex-wrap align-items-center justify-content-between">
                <h5 class="mb-sm-0 mb-2">{{ __('Money Transfer Log') }}</h5>
                <form action="" method="get">
                    <div class="row g-3">
                        <div class="col-auto">
                            <input type="text" name="trx" class="form-control form-control-sm" placeholder="transaction id">
                        </div>
                        <div class="col-auto">
                            <input type="date" class="form-control form-control-sm" placeholder="Search User" name="date">
                        </div>
                        <div class="col-auto">
                            <button type="submit" class="btn main-btn btn-sm">{{ __('Search') }}</button>
                        </div>
                    </div>
                </form>
            </div>

            <div class="card-body text-end">

                <div class="table-responsive">
                    <table class="table site-table">
                        <thead>
                            <tr>
                                <th>{{ __('Trx') }}</th>
                                <th>{{ __('Sender') }}</th>
                                <th>{{ __('Receiver') }}</th>
                                <th>{{ __('Amount') }}</th>
                                <th>{{ __('Currency') }}</th>
                                <th>{{ __('Charge') }}</th>
                                <th>{{ __('Details') }}</th>
                                <th>{{ __('Payment Date') }}</th>
                            </tr>
                        </thead>

                        <tbody>
                            @forelse($transfers as $key => $transaction)
                                <tr>
                                    <td data-caption="{{ __('Trx') }}">{{ $transaction->transaction_id }}</td>

                                    <td data-caption="{{ __('Sender') }}">
                                        <p class="p-0 m-0">
                                            Name : {{ $transaction->sender->full_name }}
                                        </p>
                                        <p class="p-0 m-0">
                                            Email : {{ $transaction->sender->email }}
                                        </p>
                                    </td>

                                    <td data-caption="{{ __('Receiver') }}">
                                        <p class="p-0 m-0">
                                            Name : {{ $transaction->receiver->full_name }}
                                        </p>
                                        <p class="p-0 m-0">
                                            Email : {{ $transaction->receiver->email }}
                                        </p>
                                    </td>

                                    <td data-caption="{{ __('Amount') }}">{{ number_format($transaction->amount, 2) }}
                                    </td>
                                    <td data-caption="{{ __('Currency') }}">{{ $general->site_currency }}</td>
                                    <td data-caption="{{ __('Charge') }}">
                                        {{ number_format($transaction->charge, 2) . ' ' . $general->site_currency }}</td>
                                    <td data-caption="{{ __('Details') }}">{{ $transaction->details }}</td>
                                    <td data-caption="{{ __('Payment Date') }}">
                                        {{ $transaction->created_at->format('Y-m-d') }}
                                    </td>
                                </tr>
                            @empty
                                <tr>
                                    <td class="text-center no-data-table" colspan="100%">
                                        {{ __('No Transaction Found') }}
                                    </td>
                                </tr>
                            @endforelse
                        </tbody>
                    </table>
                    @if ($transfers->hasPages())
                        {{ $transfers->links() }}
                    @endif
                </div>
            </div>

        </div>

    </div>
@endsection
