@extends('dashboard.layout.layout')

@section('header')
    <i class="page-header-icon ion-ios-gear"></i>
    {{ __('navi.system_settings') }}
@endsection

@section('main')
    <div class="row">
        <div class="col-md-12">
            <div class="panel">
                <div class="table-primary">
                    <table class="table table-striped table-bordered" id="datatables">
                        <thead>
                        <tr>
                            <th width="7%">{{ __('main.id') }}</th>
                            <th width="18%">{{ __('main.title') }}</th>
                            <th width="50%">{{ __('main.value') }}</th>
                            <th>{{ __('main.created_at') }}</th>
                            <th>{{ __('main.updated_at') }}</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
@endsection

@section('scripts')
    <style>
        .table-header{
            display: none;
        }
    </style>
    <script>
        $(function() {
            var dataTable = $('#datatables').DataTable({
                "processing": true,
                "serverSide": true,
                "pageLength": 15,
                "lengthMenu": [[15, 30], [15, 30]],
                "ajax": {
                    "url": "{{ route('settings.index') }}"
                },
                "bAutoWidth": false,
                "columns": [
                    {data: 'id', name: 'id'},
                    {
                        data: 'title',
                        name: 'title',
                        render: function (data, type, row) {
                            return "<a class='link' href='" + row.editLink + "'>" + row.title + "</a>";
                        }
                    },
                    {data: 'value', name: 'value'},
                    {data: 'created_at', name: 'created_at'},
                    {data: 'updated_at', name: null}
                ]
            });
        });
    </script>
@endsection