@extends ('layouts/template')

@section('content')
    <style>
        .report-table-header {
            font-size: large;
            font-weight: bolder;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.css">
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.js"></script>
    <div class="p-3 mcp-theme-1">

        <div class="card">
            <div class="card-body">
                <h1 class="report-table-header">Treatment Service Utilization - Org.</h1>
                <table class="table table-bordered table-striped table-sm" id="table0">
                    <thead>
                    <tr>
                        <th>Date</th>
                        <th>Total hrs.</th>
                        <th>Total Bills</th>
                        <th>Total Pros</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php
                    $dowMap = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
                    ?>
                    @foreach($view_treatment_service_utilization_org as $x)
                        <tr>
                            <td>
                                {{$x->effective_date}} ---
                                {{ $dowMap[date('w', strtotime($x->effective_date))] }}
                            </td>
                            <td>{{$x->total_hrs}}</td>
                            <td>{{$x->total_bills}}</td>
                            <td>{{$x->total_pros}}</td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>

        <div class="card mt-4">
            <div class="card-body">
                <h1 class="report-table-header">Treatment Service Utilization</h1>
                <table class="table table-bordered table-striped table-sm" id="table1">
                    <thead>
                    <tr>
                        <th>HCP</th>
                        <th>Date</th>
                        <th>Total hrs.</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($view_treatment_service_utilization as $x)
                        <tr>
                            <td>{{$x->name_last}}, {{$x->name_first}}</td>
                            <td>
                                {{$x->effective_date}} ---
                                {{ $dowMap[date('w', strtotime($x->effective_date))] }}
                            </td>
                            <td>{{$x->total_hrs}}</td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>

        <div class="card mt-4">
            <div class="card-body">
                <h1 class="report-table-header">Treatment Service Utilization By Patient</h1>
                <table class="table table-bordered table-striped table-sm" id="table2">
                    <thead>
                    <tr>
                        <th>HCP</th>
                        <th>Pt.</th>
                        <th>Total hrs.</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($view_treatment_service_utilization_by_patient as $x)
                        <tr>
                            <td>
                                {{$x->pro_lname}}, {{$x->pro_fname}}
                            </td>
                            <td>
                                <a href="{{route('patients.view.notes', $x->pt_uid)}}">
                                    {{$x->pt_lname}}, {{$x->pt_fname}}
                                </a>
                            </td>
                            <td>{{$x->total_hrs}}</td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <script>
        $(document).ready( function () {
            setTimeout(function(){
                $('#table1').DataTable();
                $('#table2').DataTable();
            }, 3000);
        } );
    </script>

@endsection
