@extends ('layouts/template')

@section('content')
<div class="p-3 mcp-theme-1" id="patients-list">
    <div class="card">

        <div class="card-header px-2 py-1 d-flex align-items-center">
            <strong class="mr-4">
                <i class="fas fa-file-invoice-dollar"></i>
                Bills
            </strong>
        </div>

        <div class="card-body p-0">
            <div class="p-3">
                @include('app.mcp.bills_filters')
            </div>
            <table class="table table-sm table-striped border-top p-0 m-0">
                <thead class="bg-light">
                    <tr>
                        <th class="border-0">Date</th>
                        <th class="border-0">Patient</th>
                        <th class="border-0">Service</th>
                        <th class="border-0">Amount</th>
                        <th class="border-0">Is Cancelled</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($bills as $bill)
                    <tr>
                        <td>{{ friendly_date_time($bill->effective_date, false) }}</td>
                        <td>
                            <a target="_blank" native href="{{route('patients.view.dashboard', $bill->client)}}">
                                {{$bill->client->displayName()}}
                            </a>
                        </td>
                        <td>{{ $bill->code }}</td>
                        <td>{{ $bill->hcp_expected_payment_amount ? '$'.$bill->hcp_expected_payment_amount : '' }}</td>
                        <td>{{ $bill->is_cancelled ? 'YES':'NO' }}</td>
                    </tr>
                    @endforeach

                    @if(count($bills) === 0)
                    <tr>
                        <td colspan="5">No records found!</td>
                    </tr>
                    @endif
                </tbody>

            </table>

        </div>
    </div>
    <div class="mt-3">
        {{ $bills->appends(request()->input())->links() }}
    </div>

</div>
@endsection