@extends ('layouts/template')

@section('content')
    <div class="p-3 mcp-theme-1">
        <div class="card">
            <div class="card-header py-2 px-1 d-flex align-items-center">
                <strong class="mr-4">
                    <i class="fas fa-user"></i>
                    MC Code Checks
                </strong>
            </div>
            <div class="card-body p-0">
                <table class="table table-sm table-striped p-0 m-0" style="table-layout: fixed">
                    <thead class="bg-light">
                        <tr>
                            	<th class="border-0">Patient</th>
                            
			
				<?php
                        $codeCheckKeys = [
                                'created_at' => 'Timestamp',
                                'procedure_code' => 'Code',
                                'procedure_label' => 'Label',
                                'plan_type' => 'Plan Type',
                                'active' => 'Active?',
                                'deductible' => 'Deductible',
                                'deductible_remaining' => 'Deductible Remaining',
                                'copayment' => 'Copayment',
                                'coinsurance_percent' => 'Coinsurance %',
                                'info_valid_till' => 'Info valid till',
                                'next_eligible_date_technical' => 'Next Elig. Date Technical',
                                'next_eligible_date_professional' => 'Next Elig. Date Professional'
                        ];
                ?>
                @foreach($codeCheckKeys as $codeCheckKey => $label)
                        <th class="border-0">
                                {{ $label}}
                        </th>
                @endforeach
				<th class="border-0">MCP</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($checks as $check)
                            <tr>
                                <td>
                                    <a href="/patients/view/{{ $check->client->uid }}">
                                        <b>{{ implode(", ", [$check->client->name_last, $check->client->name_first]) }}</b>
                                    </a>
                                </td>
				
                                @foreach($codeCheckKeys as $key => $label)
                                <td>{{ isset($check[$key]) ? $check[$key] : '--' }}</td>
                                @endforeach
				<td>
                                        <b>{{ implode(", ", [$check->client->mcp->name_last, $check->client->mcp->name_first]) }}</b>
				</td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
@endsection
