@extends('layouts.'.(isset($layout)?$layout:'app'))


@section('pagetitle', __('Event logs for :boxname', ['boxname' => $box->alias ?: $box->name]))

@section('breadcrumbs')
    <ol class="breadcrumb float-sm-right">
        <li class="breadcrumb-item"><a href="{{route('dashboard')}}">{{__("Dashboard")}}</a></li>
        <li class="breadcrumb-item"><a href="{{route('controlbox', $box)}}">{{$box->alias ?: $box->name}}</a></li>
        <li class="breadcrumb-item active">{{__("Event logs")}}</li>
    </ol>
@endsection

@section('content')
    <a class="btn btn-primary" href="{{route('controlbox', $box)}}"><i class="fa fa-arrow-left"></i> {{__("Back")}}</a>
    <hr/>
<table class="datatable-init table table-striped">
    <thead>
    <tr>
        <th>{{__("Timestamp")}}</th>
        <th></th>
    </tr>
    </thead>
    <tbody>

    @foreach($box->eventlogs->reverse() as $log)
        <tr>
            <td>{{ }}</td>
            <td><a class="btn btn-primary" href="{{route('controlbox.eventlog.show', ['box' => $box, 'log' => $log])}}"><i class="fa fa-eye"></i> {{__('Open')}}</a></td>
        </tr>
    @endforeach
    </tbody>
</table>
@endsection

@section("page_js")
    <script>
        $(document).ready(function () {
            $('.datatable-init').DataTable(
                {
                    "order": [[ 0, "desc" ]],
                    responsive: true,
                    language: {
                        url: '{{asset('/js/datatables_lang/' . app()->getLocale() . '.json')}}'
                    },
                    'columnDefs': [
                        {
                            'targets': [0], /* column index */
                            responsivePriority: 1,
                        },
                        {
                            'targets': [1], /* column index */
                            responsivePriority: 1,
                            'orderable': false, /* true or false */
                        }]

                }
            );

        });
    </script>
@endsection
