<div class="p-3 mcp-theme-1">
    <div class="card border-top-0">

        <div class="card-header px-2 py-1 hide-inside-popup border-bottom-0">
            <strong class="mr-4">
                <i class="fas fa-sticky-note"></i>
                Bills Pending Signature
            </strong>
        </div>

        <div class="card-body p-0 border-top-0 pb-0">
            <table class="table table-sm table-striped mb-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">Context</th>
                    <th class="border-0">Minutes</th>
                    <th class="border-0">Amount</th>
                    <th class="border-0">Sign</th>
                </tr>
                </thead>
                <tbody>
                @foreach($records as $row)
                    <tr>
                        <td>{{ friendly_date_time($row->effective_date, false) }}</td>
                        <td>
                            @if($row->client)
                            <a target="_blank" native href="{{route('patients.view.dashboard', $row->client)}}">
                                {{$row->client->displayName()}}
                            </a>
                            @else 
                            --
                            @endif
                        </td>
                        <td>{{ $row->code }}</td>
                        <td>{{ $row->generic_target_entity_type ?: '-' }}</td>
                        <td>{{ round(floor($row->number_of_units * 60)) }} m</td>
                        <td>
                            @if($row->generic_pro_id === $pro->id)
                                {{ $row->generic_pro_expected_payment_amount ? '$'.round($row->generic_pro_expected_payment_amount, 2) : '' }}
                            @elseif($row->hcp_pro_id === $pro->id)
                                {{ $row->hcp_expected_payment_amount ? '$'.round($row->hcp_expected_payment_amount, 2) : '' }}
                            @endif
                        </td>
                        <td>
                            @if($row->generic_pro_id === $pro->id)
                                @if($row->is_signed_by_generic_pro)
                                    <div class="d-block text-secondary text-nowrap">
                                        <i class="fa fa-check"></i>
                                        Signed
                                    </div>
                                @else
                                    <div moe relative>
                                        <a class="text-nowrap" href="" show start>Sign</a>
                                        <form url="/api/bill/signAsGenericPro" right>
                                            <input type="hidden" name="uid" value="{{$row->uid}}">
                                            <p>Sign this bill?</p>
                                            <div class="mb-0">
                                                <button class="btn btn-success btn-sm" submit>Sign</button>
                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                                            </div>
                                        </form>
                                    </div>
                                @endif
                            @elseif($row->hcp_pro_id === $pro->id)
                                @if($row->is_signed_by_hcp)
                                    <div class="d-block text-secondary text-nowrap">
                                        <i class="fa fa-check"></i>
                                        Signed
                                    </div>
                                @else
                                    <div moe relative>
                                        <a class="" href="" show start>Sign</a>
                                        <form url="/api/bill/signAsHcp" right>
                                            <input type="hidden" name="uid" value="{{$row->uid}}">
                                            <p>Sign this bill as HCP?</p>
                                            <div class="mb-0">
                                                <button class="btn btn-success btn-sm" submit>Sign</button>
                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                                            </div>
                                        </form>
                                    </div>
                                @endif
                            @endif
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>
    </div>
</div>
