index.blade.php 3.45 KB
@extends ('backend.layouts.app')

@section ('title', trans('labels.backend.beacon.management'))

@section('after-styles')
{{ Html::style("https://cdn.datatables.net/v/bs/dt-1.10.15/datatables.min.css") }}
@endsection

@section('page-header')
<h1>
    {{ trans('labels.backend.beacon.management') }}
    <small>{{ trans('labels.backend.beacon.active') }}</small>
</h1>
@endsection

@section('content')
<div class="box box-success">
    <div class="box-header with-border">
        <h3 class="box-title">{{ trans('labels.backend.beacon.active') }}</h3>

        <div class="box-tools pull-right">
            @include('backend.beacon.includes.Partials.beacon-header-button')
        </div><!--box-tools pull-right-->

    </div><!-- /.box-header -->

    <div class="box-body">
        <div class="table-responsive">
            <table id="users-table" class="table table-condensed table-hover">
                <thead>
                <tr>
                    {{--<th>选择</th>--}}
                    <th>{{ trans('labels.backend.beacon.table.device_id') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.major') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.minor') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.rssi') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.sd') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.name') }}</th>
                    <th>{{ trans('labels.backend.beacon.table.status') }}</th>
                    <th>{{ trans('labels.general.actions') }}</th>
                </tr>
                </thead>
            </table>
        </div><!--table-responsive-->
    </div><!-- /.box-body -->
</div><!--box-->
@endsection

@section('after-scripts')
{{ Html::script("https://cdn.datatables.net/v/bs/dt-1.10.15/datatables.min.js") }}
{{ Html::script("js/backend/plugin/datatables/dataTables-extend.js") }}

<script>
    $(function () {
        $('#users-table').DataTable({
            dom: 'lfrtip',
            processing: false,
            serverSide: true,
            autoWidth: false,
            ajax: {
                url: '{{ route("admin.beacon.get") }}',
                type: 'get',
                data: {status: 1, trashed: false},
                error: function (xhr, err) {
                    if (err === 'parsererror')
                        location.reload();
                }
            },
            columns: [
//                { data:'device_id',name:'device_id',render: function(data, type, row, meta) {
//
//                    return '<input type="checkbox" name="checklist" value="' + data + '" />'
//                }},
                {data: 'device_id', name: 'device_id'},
                {data: 'major', name: 'major'},
                {data: 'minor', name: 'minor'},
                {data: 'rssi', name: 'rssi'},
                {data: 'sd', name: 'sd'},
                {data: 'name', name: 'name'},
                {data: 'status', name: 'status',render: function (data, type, row, meta) {

                    if (data == 0) {
                           data='启用'
                    } else if (data == 1){
                           data ='禁用'
                    }

                    return data;
                }

                },
                {data: 'actions', name: 'actions', searchable: false, sortable: false}
            ],
            order: [[0, "asc"]],
            searchDelay: 500
        });
    });
</script>
@endsection