@extends ('layouts/template')

@section('content')

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

        <div class="card-header px-3 py-2 d-flex align-items-center">
            <strong class="mr-4">
                <i class="fas fa-user-injured"></i>
                Claims
            </strong>
            <a native href="{{route('practice-management.download-claims')}}" target="_blank">Download</a>
        </div>
        <div class="card-body p-0">
            <table class="table table-sm table-condensed p-0 m-0">
                <thead class="bg-light">
                <tr>
                    <th class="border-0">#</th>
                    <th>Submitted?</th>
                    <th class="border-0">Lines</th>
                    <th class="px-3 border-0">Created</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($claims as $claim)
                    <tr>
                        <td>{{$claim->iid}}</td>
                        <td>{{$claim->was_submitted?'Yes':'No'}}</td>
                        <td>
                            <strong>Claim Lines</strong>
                            <table class="table table-sm table-condensed table-striped">
                                <tr>
                                    <th>CPT</th>
                                    <th>ICDs</th>
                                    <th>Date of Service</th>
                                </tr>
                                @foreach($claim->lines as $claimLine)
                                <tr>
                                    <td>{{$claimLine->cpt}}</td>
                                    <td>{{$claimLine->icds()}}</td>
                                    <td>{{$claimLine->date_of_service}}</td>
                                </tr>
                                @endforeach
                            </table>
                        </td>
                        <td>{{$claim->created_at}}</td>
                    </tr>                               
                @endforeach
                </tbody>
            </table>
            <div>
                {{$claims->links()}}
            </div>
        </div>
    </div>
    </div>

@endsection
