@extends ('layouts/template')

@section('content')
<style>
	#rm-action-report-filters label {
		font-weight: bold;
	}

	#rm-action-report-filters .mw-100px {
		min-width: 100px;
	}
	.filter-container{
		display: flex;
		align-items: flex-start;
		flex-wrap: wrap;
	}
	.filter-container >div {
		width: 165px;
	}
	.filter-container >div:not(:last-child) {
		margin-right: 15px;
	}
	.sm-section {
		width: 150px !important;
	}
    thead.border-bottom-0 tr th {
        border-bottom: none;
    }
</style>
<div id="rm-action-report" class="p-3 mcp-theme-1">
    <div class="card">

        <div class="card-header px-2 py-1 d-flex align-items-center">
            <strong class="mr-4">
                <i class="fas fa-user"></i>
                Claims Report
            </strong>
        </div>
        <div class="card-body p-0 border-0 table-responsive">
            <div class="m-2">
                <form method="GET" action="{{ route('practice-management.claims-report') }}">
                    <div class="d-flex align-items-baseline">
                        <div class="form-group my-0 mr-2">
                            <label class="font-weight-normal mb-1">DOS From</label>
                            <input name="f_start" type="date" class="form-control form-control-sm" value="{{request()->input('f_start')}}">
                        </div>
                        <div class="form-group my-0 mr-2">
                            <label class="font-weight-normal mb-1">DOS To</label>
                            <input name="f_end" type="date" class="form-control form-control-sm" value="{{request()->input('f_end')}}">
                        </div>
                        <div class="form-group m-0">
                            <label class="font-weight-normal mb-1">&nbsp;</label>
                            <div class=" d-flex">
                                <button type="button" onclick="return fastLoad('{{  route('practice-management.claims-report') }}?' + $(this).closest('form').serialize())" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
                                <a href="#" onclick="return fastLoad('{{  route('practice-management.claims-report') }}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
                            </div>
                        </div>
                    </div>
                </form>
            </div> 
            <table class="table table-sm table-striped table-bordered border-0 p-0 m-0 text-nowrap">
                <thead class="bg-light border-bottom-0">
                    <tr>
                        <th class="border-left-0">@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Insurance', 'key' => 'payer_name'])</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'State', 'key' => 'mailing_address_state'])</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Patient', 'key' => 'client_name'])</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'DOB', 'key' => 'dob'])</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Provider', 'key' => 'pro_name'])</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'Date of Service', 'key' => 'date_of_service'])</th>
                        <th class="text-secondary">POS</th>
                        <th>@include('app.practice-management._sort_header_multi', ['route' => route("practice-management.claims-report"), 'label' => 'CPT', 'key' => 'cpt'])</th>
                        <th class="text-secondary">A</th>
                        <th class="text-secondary">Units</th>
                        <th class="text-secondary">Charges</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach ($rows as $row)
                    <tr class="{{false ? 'bg-light' : ''}}">
                        <td class="text-nowrap border-left-0">
                            {{$row->payer_name}}
                        </td>
                        <td>
                            {{$row->mailing_address_state}}
                        </td>
                        <td class="">
                            <a href="/patients/view/{{$row->client_uid}}">
                                {{$row->client_name}}
                            </a>
                        </td>
                        <td>
                            {{$row->dob}}
                        </td>
                        <td>
                            {{$row->pro_name}}
                        </td>
                        <td>
                            {{friendly_date($row->date_of_service)}}
                        </td>
                        <td>10</td>     <!-- dunno what these are!! -->
                        <td>{{$row->cpt}}</td>
                        <td>95</td>     <!-- dunno what these are!! -->
                        <td>1</td>      <!-- dunno what these are!! -->
                        <td>
                            {{$row->cpt ? chargeForCPT($row->cpt) : '-'}}
                        </td>
                    </tr>
                    @endforeach
                </tbody>
            </table>

        </div>
    </div>
    <div class="d-flex align-items-baseline mt-3">
        {!! $paginator->withQueryString()->links() !!}
        <div class="mb-3">
            <div class="ml-4 mb-3">Showing <b>{{$paginator->firstItem()}}</b> to <b>{{$paginator->lastItem()}}</b> (page {{$paginator->currentPage()}}) of <b>{{$paginator->total()}}</b> claims</div>
        </div>
    </div>

</div>

@endsection