@extends('admin.pros.view')
@section('content-inner')

    <div class="pb-3">

        <h5 class='my-3 d-flex stag-heading stag-heading-sub'>
            <div>Transactions</div>
            <div class="ml-auto">
                <a class="btn btn-primary btn-sm ml-2" up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href="{{route('pros_SINGLE-ACTION_add_new_credit_pro_transaction', ['uid' => $record->uid])}}?optimised=1"><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New Credit</a><a class="btn btn-primary btn-sm ml-2" up-modal=".form-contents" up-preload up-delay="25" up-width="800" up-history="false" href="{{route('pros_SINGLE-ACTION_add_new_debit_pro_transaction', ['uid' => $record->uid])}}?optimised=1"><i class='fa fa-plus-circle' aria-hidden='true'></i> Add New Debit</a>
            </div>
        </h5>

        <div class="table-responsive p-0 bg-white border stag-table stag-table-sub">
            <table class="table table-hover text-nowrap">
                <thead>
                <tr>
                    <th>&nbsp;</th>
<th>Created At</th>
<th>Pro</th>
<th>Client</th>
<th>Plus Or Minus</th>
<th>Reason Type</th>
<th>Amount</th>
<th>Resulting Balance</th>
                </tr>
                </thead>
                <tbody>
                @foreach($subRecords as $subRecord)
                    <tr>
                        <td><a href="/transactions/view/{{ $subRecord->uid }}/SUB_dashboard"><i class="fas fa-share-square"></i></a></td>
<td><a href="/transactions/view/{{ $subRecord->uid }}/SUB_dashboard"><?= friendly_date_time($subRecord->created_at) ?></a></td>
<td><?= value_from_rs($result_pros, 'name_display', [['id', '=', $subRecord->pro_id], ], 'all'); ?></td>
<td><?= value_from_rs($result_clients, 'name_display', [['id', '=', $subRecord->client_id], ], 'all'); ?></td>
<td><?= $subRecord->plus_or_minus ?></td>
<td><?= $subRecord->reason_type ?></td>
<td><?= $subRecord->amount ?></td>
<td><?= $subRecord->resulting_balance ?></td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

    </div>

@endsection
