@extends ('layouts.patient')

@section('inner-content')
<div id="client-settings-container">
    <div class="row">
        <div class="col-md-12">
            <h4 class="font-weight-bold m-0 mb-3">MCP Requests</h4>
            <div class="table-responsive border border-bottom-0">
                <table class="table table-sm table-striped table-bordered m-0">
                    <thead class="bg-light">
                        <tr>
                            <th class="border-0">Created At</th>
                            <th class="border-0">Created By</th>
                            <th class="border-0">Was Claimed?</th>
                            <th class="border-0">Claimed At</th>
                            <th class="border-0">Claimed By</th>
                            <th class="border-0">Waiting Time</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($patient->mcpRequests as $mcp)
                        <tr>
                            <td>{{friendly_date_time($mcp->created_at)}}</td>
                            <td>[{{$mcp->createdBy->session_type}}] {{$mcp->createdByName()}}</td>
                            <td>{{$mcp->was_claimed?'Yes':'No'}}</td>

                            @if($mcp->was_claimed)
                            <td>{{friendly_date_time($mcp->proClientWork->created_at)}}</td>
                            <td>{{$mcp->proClientWork->pro->name_first}} {{$mcp->proClientWork->pro->name_last}}</td>
                            @else
                            <td>-</td>
                            <td>-</td>
                            @endif
                            <td>{{$mcp->getWaitTime()}}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@endsection