@extends('layouts.layout-2')

@section('content')


    <h4 class="font-weight-bold py-3 mb-4">
        {{ __('User') }}
    </h4>


    <div class="card">
        <div class="card-datatable table-responsive py-2">
            <div class="mr-4 mb-2 text-right">
                <a href="{{ route('admin_user_edit', ['new']) }}" class="btn btn-sm btn-primary">Neuen User anlegen</a>
            </div>
            <table class="datatables-users table table-striped table-bordered">
                <thead>
                <tr>
                    <th>#</th>
                    <th>{{__('Name')}}</th>
                    <th>{{__('E-Mail')}}</th>
                    <th>{{__('Zugang')}}</th>
                    <th>{{__('verified')}}</th>
                    <th>{{__('active')}}</th>
                    <th>{{__('delete')}}</th>
                </tr>
                </thead>
            </table>
            <div class="mr-4 mt-2 text-right">
                <a href="{{ route('admin_user_edit', ['new']) }}" class="btn btn-sm btn-primary">Neuen User anlegen</a>
            </div>
        </div>
    </div>


    <div id="updateModalShow" class="modal fade in" tabindex="-1" role="dialog" aria-labelledby="myModalUpdate" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content" id="update-modal-content">
            </div>
        </div>
    </div>


    <script>
        $( document ).ready(function() {
            $('.datatables-users').dataTable({
                "processing": true,
                "serverSide": true,
                "ajax": '{!! route('admin_users_data_table') !!}',
                "columns": [
                    { data: 'action_edit', orderable: false, searchable: false},
                    { data: 'name', name: 'name' },
                    { data: 'email', name: 'email' },
                    { data: 'admin', name: 'admin' },
                    { data: 'confirmed', name: 'confirmed' },
                    { data: 'active', name: 'active' },
                    { data: 'action_delete', orderable: false, searchable: false},
                ],
                "bLengthChange": false,
                "iDisplayLength": 50,
                "language": {
                    "url": "/js/German.json"
                },
                "initComplete": function(settings, json) {
                    $(".update_modal_data_show").on('click', function (e) {
                        e.preventDefault();
                        update_modal_data_show(e, $(this));
                    });
                }
            });



        });


    </script>
@endsection