<x-user.head title="{{ auth()->user()->lastname.' '.auth()->user()->firstname }} | Account Statement - {{ config('settings.site_name') }}" />

<body class="bg-white" onload="printPromot()">
    <div class="nk-block">
        <div class="invoice invoice-print">
            <div class="invoice-wrap">
                <div class="invoice-brand text-center">
                    <img src="/images/logo.png" srcset="/images/logo.png 2x" alt="">
                </div>
                <div class="invoice-head">
                    <div class="invoice-contact">
                        <span class="overline-title">Bank Statement for</span>
                        <div class="invoice-contact-info">
                            <h4 class="title">{{ auth()->user()->firstname.' '.auth()->user()->lastname }}</h4>
                            <ul class="list-plain">
                                <li><em class="icon ni ni-map-pin-fill fs-18px"></em><span>{{ auth()->user()->address.','. auth()->user()->state.','. auth()->user()->country }}.</span></li>
                                <li><em class="icon ni ni-call-fill fs-14px"></em><span>{{ auth()->user()->phone_number }}</span></li>
                            </ul>
                        </div>
                    </div>
                    <div class="invoice-desc">
                        <h3 class="title">STATEMENT</h3>
                        <ul class="list-plain">
                            <li class="invoice-date"><span>Date</span>:<span>{{  date('d M, Y') }}</span></li>
                        </ul>
                    </div>
                </div><!-- .invoice-head -->
                <div class="invoice-bills">

                        <table class="table table-striped" data-auto-responsive="false">
                            <thead>
                                <tr class="nk-tb-item nk-tb-head">
                                    <th class="nk-tb-col"><span>txID</span></th>
                                    <th class="nk-tb-col"><span>Amount</span></th>
                                    <th class="nk-tb-col"><span>Account</span></th>
                                    <th class="nk-tb-col"><span>Type</span></th>
                                    <th class="nk-tb-col"><span>Bank</span></th>
                                    <th class="nk-tb-col"><span>Description</span></th>
                                    <th class="nk-tb-col"><span>Date/Time</span></th>
                                    <th class="nk-tb-col"><span>Status</span></th>
                                </tr><!-- .nk-tb-item -->
                            </thead>
                            <tbody>
                                @if($transactions->isEmpty())
                                    <tr class="nk-tb-item" >
                                        <td class="nk-tb-col text-center p-5" colspan="8">
                                            No records yet
                                        </td>
                                    </tr>
                                @else
                                    @foreach ($transactions as $tx)
                                        <tr class="nk-tb-item">
                                            <td class="nk-tb-col">
                                                <span class="tb-sub">{{ $tx->tx_id }}</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-lead">{{ getUserCurrency().numbers($tx->amount) }}</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-product">
                                                    <span class="title">{{ $tx->receiver_account }} <small>{{ ucwords($tx->receiver_name) }}</small></span>
                                                </span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-sub">{{ ucwords($tx->type) }}({{ $tx->category }})</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-sub">{{ ucwords($tx->bank_name) }}</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-sub">{{ substr($tx->remark,0,15) }}@if (strlen($tx->remark) > 15)...@endif</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                <span class="tb-sub">{{ $tx->created_at->format('Y-m-d h:i A') }}</span>
                                            </td>
                                            <td class="nk-tb-col">
                                                @if($tx->status === PENDING_TX)

                                                    <span class="tb-sub">Pending</span>

                                                @elseif($tx->status === APPROVED_TX)

                                                    <span class="tb-sub">Successful</span>

                                                @elseif($tx->status === HELD_BY_IMF_TX)

                                                    <span class="tb-sub">Hold by IMF</span>

                                                @elseif($tx->status === IN_PROGRESS_TX)

                                                    <span class="tb-sub">In Progress</span>

                                                @else
                                                    <span class="tb-sub">Failed</span>
                                                @endif
                                            </td>
                                        </tr>
                                    @endforeach
                                @endif
                            </tbody>
                        </table>

                </div><!-- .invoice-bills -->
            </div><!-- .invoice-wrap -->
        </div><!-- .invoice -->
    </div><!-- .nk-block -->
    <script>
        function printPromot() {
            window.print();
        }
    </script>
</body>

</html>
