index.blade.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="row mb-2">
  4. <div class="col-md-6">
  5. <h3>Пользователи</h3>
  6. </div>
  7. <div class="col-md-6 text-end">
  8. <button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addModal">
  9. Добавить
  10. </button>
  11. </div>
  12. </div>
  13. @include('partials.table', [
  14. 'id' => $id,
  15. 'header' => $header,
  16. 'strings' => $users,
  17. 'routeName' => 'user.show',
  18. 'routeParam' => 'user',
  19. 'nav' => $nav ?? null,
  20. ])
  21. @include('partials.pagination', ['items' => $users])
  22. <!-- Модальное окно добавления-->
  23. <div class="modal fade" id="addModal" tabindex="-1" aria-labelledby="addModalLabel" aria-hidden="true">
  24. <div class="modal-dialog modal-fullscreen-sm-down modal-lg">
  25. <div class="modal-content">
  26. <div class="modal-header">
  27. <h1 class="modal-title fs-5" id="addModalLabel">Добавить пользователя</h1>
  28. <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
  29. </div>
  30. <div class="modal-body">
  31. <form action="{{ route('user.store') }}" method="post">
  32. @csrf
  33. <input type="hidden" name="nav" value="{{ $nav ?? '' }}">
  34. @include('partials.input', ['name' => 'email', 'type' => 'text', 'title' => 'Логин/email', 'required' => true])
  35. @include('partials.input', ['name' => 'name', 'title' => 'Имя', 'required' => true])
  36. @include('partials.input', ['name' => 'phone', 'title' => 'Телефон'])
  37. @include('partials.input', ['name' => 'password', 'type' => 'password', 'title' => 'Пароль', 'required' => true])
  38. @include('partials.select', ['name' => 'role', 'title' => 'Роль', 'options' => getRoles(), 'value' => $user->role ?? \App\Models\Role::MANAGER])
  39. @include('partials.submit', ['name' => 'Добавить', 'back_url' => route('user.index', session('gp_users', []))])
  40. </form>
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. @endsection