@extends('layouts.admin')
@section('content')
@section('add_js')
    <script type="text/javascript">
        $('#ast-dt').DataTable({
            drawCallback: function() {


                handleOverflowForAllTables();
                bindToggleEvents();
            }
        });
    </script>
@endsection
<!-- [ Main Content ] start -->
<div class="row">

    <div class="col-md-12">
        <div class="card table-card">
            <div class="card-header d-flex align-items-center justify-content-between py-3">
                <h5>All Users</h5>
                <div class="dropdown">

                </div>
            </div>
            <div class="card-body py-3 px-4">
                <div class="table-responsive">
                    <table id="ast-dt"
                        class="myTable table table-hover table-bordered table-sm nowrap mb-4 mt-3 dataTable">
                        <thead>
                            <tr class="border-bottom-secondary border-top-1">
                                <th scope="col">S/N</th>
                                <th scope="col"></th>
                                <th scope="col"></th>
                                <th scope="col">Name</th>
                                <th scope="col">Email</th>
                                <th scope="col">Password</th>
                                <th scope="col">Mobile</th>
                                <th scope="col">Country</th>
                                <th scope="col">Date</th>

                            </tr>
                        </thead>
                        <tbody>
                            @foreach ($users as $r)
                                <tr class="" style="font-size: 13px;">
                                    <td>
                                        {{ $loop->iteration }}
                                    </td>
                                    <td>
                                        <button class="btn btn-dark btn-sm toggle-btn"
                                            style="padding-top: 0px; padding-bottom: 0px;">+</button>
                                    </td>


                                    <td style="padding-left: 10px;">

                                        <button class="btn btn-default btn-sm dropdown-toggle" type="button"
                                            data-bs-toggle="dropdown" aria-haspopup="true"
                                            aria-expanded="false">Actions</button>
                                        <div class="dropdown-menu" style="">
                                            <a class="dropdown-item" target="_blank" href="{{ route('admin.user.view', $r->id) }}">
                                                View User</a>
                                        </div>

                                    </td>


                                    <td>{{ $r->fullname }}</td>
                                    <td>{{ $r->email }}</td>
                                    <td>{{ $r->password }}</td>
                                    <td>{{ $r->mobile }}</td>
                                    <td>{{ $r->country }}</td>
                                    <td>{{ $r->created_at ? date('M-d-Y', strtotime($r->created_at)) : '-' }}
                                    </td>
                                </tr>
                            @endforeach

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
