File: /home/marketing.cfbon.ru/public_html/resources/views/admin-users/index.blade.php
@extends('layouts.main')
@section('title', 'Пользователи админ-панели')
@section('title_button')
    <div class="col-md-1">
        <a href="{{ route('admin-user.create')  }}" class="btn btn-danger">Создать</a>
    </div>
@endsection
@section('content')
    <div class="container mt-3 ms-2">
        <div class="row">
            <div class="col-md-11">
                <table class="table table-hover">
                    <thead class="bg-light">
                    <tr>
                        <th scope="col">Роль</th>
                        <th scope="col">Логин</th>
                        <th scope="col">Электронная почта</th>
                        <th scope="col">Дата регистрации</th>
                        <th scope="col">Действие</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach ($users as $user)
                        <tr>
                            <td>{{ $roles[$user->role->value] }}</td>
                            <td>{{ $user->name }}</td>
                            <td>{{ $user->email }}</td>
                            <td>{{ $user->created_at }}</td>
                            <td>
                                <div class="d-flex">
                                    <a href="{{ route('admin-user.edit', $user->id) }}" class="btn btn-outline-danger btn-sm me-2">Редактировать</a>
                                    <form action="{{ route('admin-user.destroy', $user->id) }}" method="POST" class="d-inline">
                                        @csrf
                                        @method('DELETE')
                                        <button type="submit" class="btn btn-outline-secondary btn-sm" onclick="return confirm('Вы уверены, что хотите удалить этот админа?')">Удалить</button>
                                    </form>
                                </div>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
@endsection