@extends('layout.app')


@section('content')
    <div class="card">
        <div class="card-body">

        </div>
    </div>

    <div class="card">
        <div class="card-body" id="result">
            <div class="row">
                <div class="col-sm-6 col-md-6">
                    <div class="card" style="height: 560px;overflow-y: scroll;padding-bottom:25px;">
                        <div class="card-body">

                            <a class="noprint btn btn-primary" href="{{ route('tokenReportDownload') }}?type=week"><i
                                    class="fa fa-print"></i> Download CSV</a>

                            <h3>Last 7 Days Report</h3>
                            <table class="display table table-bordered table-striped table-responsive">
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Total Token</th>
                                        <th>Lowest Time </th>
                                        <th>Higest Time </th>
                                        <th>Average Time </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($employeeDataLat7Days as $employee)
                                        <tr>
                                            <td>{{ $employee['name'] }}</td>
                                            <td>{{ $employee['total_token_last_7_days'] }}</td>
                                            <td> <a target="_blank"
                                                    href="{{ route('token.show', $employee['tokenIdLowestCloseTimeLast7Days']) }}">
                                                    {{ $employee['lowestCloseTimeLast7Days'] }} </a> </td>
                                            <td> <a target="_blank"
                                                    href="{{ route('token.show', $employee['tokenIdHighestCloseTimeLast7Days']) }}">
                                                    {{ $employee['highestCloseTimeLast7Days'] }} </a> </td>
                                            <td>{{ $employee['averageCloseTime7days'] }}</td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                <div class="col-sm-6 col-md-6">
                    <div class="card" style="height: 560px;overflow-y: scroll;padding-bottom:25px;">
                        <div class="card-body">

                            <a class="noprint btn btn-primary" href="{{ route('tokenReportDownload') }}?type=month"><i
                                    class="fa fa-print"></i> Download CSV</a>

                            <h3>Last 30 Days Report</h3>
                            <table class="table table-bordered table-striped table-responsive" id="dataTable">
                                <thead>
                                    <tr>
                                        <th>Name</th>
                                        <th>Total Token</th>
                                        <th>Lowest Time </th>
                                        <th>Higest Time </th>
                                        <th>Average Time </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    @foreach ($employeeDataLat30Days as $employee)
                                        <tr>
                                            <td>{{ $employee['name'] }}</td>
                                            <td>{{ $employee['total_token_last_30_days'] }}</td>
                                            <td> <a target="_blank"
                                                    href="{{ route('token.show', $employee['tokenIdLowestCloseTimeLast30Days']) }}">{{ $employee['lowestCloseTimeLast30Days'] }}</a>
                                            </td>
                                            <td> <a target="_blank"
                                                    href="{{ route('token.show', $employee['tokenIdHighestCloseTimeLast30Days']) }}">{{ $employee['highestCloseTimeLast30Days'] }}</a>
                                            </td>
                                            <td>{{ $employee['averageCloseTime30days'] }}</td>
                                        </tr>
                                    @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('ajax')
    <script type="text/javascript">
        $(function() {


        });

        $(document).ready(function() {
            $('table.display').DataTable();
        });
    </script>
@endsection
