@extends('admin.layouts.main', array('scripts' => array(path_asset('path.backoffice.js_path') . '/view/page-views-list.js')))

@section('content')
    <div id="generic_wrapper">
        <h1>Page Views {{ $visitor ? " - {$visitor->first_name} {$visitor->last_name}" : '' }}</h1>
        <div class="grid-btns-wrapper">
            <button type="button" data-toggle="tooltip" data-placement="right" class="btn btn-default command-export" title="Export to Excel">
                <span class="icon glyphicon glyphicon-export"></span>
            </button>
        </div>
        <div id="visitors">
            <table id="grid" class="table table-condensed table-hover table-striped">
                <thead>
                    <tr>
                        <th data-column-id="id" data-type="numeric" data-identifier="true" data-visible="false">ID</th>
                        <th data-column-id="visitor" data-visible="{{ $visitor ? 'false' : 'true' }}">Visitor</th>
                        <th data-column-id="visit_number">Session</th>
                        <th data-column-id="created_at" data-order="desc">Date</th>
                        <th data-column-id="page">Page</th>
                        <th data-column-id="referer_page">Referer</th>
                        <th data-column-id="ip">IP</th>
                    </tr>
                </thead>
            </table>
        </div>
    </div>
    <script>
        $(function() {
            var pageViewsList = new Eae.View.PageViewsList({
                el : $('#generic_wrapper'),
                userId : "{{ Auth::guard('admin')->user()->id }}",
                visitorId : {{ $visitor ? $visitor->id : 'null' }}
            });
        });
    </script>
@stop
