
<div class="table-responsive">
	<table class="table table-striped p-0 m-0 table-sm border-top border-bottom text-nowrap">
		<thead class="bg-light">
			<tr>
				<th class="border-0">#</th>
				<th class="border-0">Name</th>
				<th class="border-0">DOB</th>
				<th class="border-0">MCP</th>
				<th class="border-0">Notes pending claims</th>
				<th class="border-0">Deductible Remaining Amount</th>
				<th class="border-0">Eligible Last Updated</th>
				<th class="border-0"></th>
			</tr>
		</thead>
		<tbody>
			@foreach($patients as $patient)
			<tr>
				<td>
					<a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">
						{{$patient->chart_number}}
					</a>
				</td>
				<td>{{$patient->displayName()}}</td>
				<td>{{ friendly_date_time($patient->dob, false) }}</td>
				<td>{{ $patient->mcp ?  $patient->mcp->name_first.' '.$patient->mcp->name_last : '-' }}</td>
				<td>
					@foreach($patient->notesPendingClaimsClosed as $note)
						<div>
							<a href="/patients/view/{{$note->client->uid}}/notes/view/{{$note->uid}}">
									{{friendly_date($note->effective_dateest)}}
							</a>
						</div>
					@endforeach
				</td>
				<td>
					@if($patient->mpb_remaining)
						{{friendly_money($patient->mpb_remaining)}}
					@else 
						No data
					@endif	
				</td>
				<td>
					@if($patient->getPrimaryCoverage())
						{{friendly_date_time($patient->getPrimaryCoverage()->created_at)}}
					@else 
						No data
					@endif	
				</td>
				<td>
					<div moe relative>
                        <a href="" start show class="">Refresh</a>

                        <form url="/api/clientPrimaryCoverage/refreshCoverageForMedicare" class="mcp-theme-1">
                            <input type="hidden" name="uid" value="{{$patient->getPrimaryCoverage()->uid}}" class="form-control input-sm" />
                            <div class="form-group">
                                <p>Refresh?</p>
                            </div>
                            <div class="form-group text-nowrap mb-0">
                                <button class="btn btn-sm btn-primary" submit>Submt</button>
                                <button class="btn btn-sm btn-default border" close>Close</button>
                            </div>
                        </form>
                    </div>
				</td>
			</tr>
			@endforeach

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

	</table>
</div>
<div class="p-3">
	{{$patients->withQueryString()->links()}}
</div>
