index.blade.php 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!--
  2. Copyright (C) 2021 Echedey López Romero <elr@disroot.org>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. -->
  14. @extends('layouts.app')
  15. @section('content')
  16. <div class="container">
  17. <div class="row mb-3">
  18. <h1 class="col-12 mb-0 text-center">Users list</h1>
  19. </div>
  20. @if (Session::get('success'))
  21. @php $message = Session::get('success'); @endphp
  22. <div class = "row mb-3">
  23. <span class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto mb-0 alert alert-success">{{ $message }}</span>
  24. </div>
  25. @endif
  26. <div class="row">
  27. <div class="col-lg-10 col-12 mx-auto">
  28. <div class="container">
  29. <div class="row">
  30. <form class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto" action="{{ route('users.search') }}" method="POST">
  31. @csrf
  32. <input class="form-control" name="search" type="text" value="{{ isset($oldSearch) ? $oldSearch : '' }}" placeholder="Search by name and email"/>
  33. </form>
  34. </div>
  35. @if (count($users) !== 0)
  36. @foreach ($users as $user)
  37. <div class="row mt-3">
  38. <div class="col-xl-7 col-lg-10 col-12 mx-auto p-3 border border-secondary rounded">
  39. <div class="container px-0">
  40. <div class="row mb-3">
  41. <span class="col-12 text-center fs-4">{{ $user->name }}</span>
  42. </div>
  43. <div class="row">
  44. <div class="col-md-4 col-12 mb-md-0 mb-2 pe-md-2">
  45. <div class="d-grid gap-2">
  46. <a href="{{ route('users.show', $user->id) }}" class="btn btn-primary">Show</a>
  47. </div>
  48. </div>
  49. <div class="col-md-4 col-12 mb-md-0 mb-2 ps-md-2 pe-md-2">
  50. <div class="d-grid gap-2">
  51. <a href="{{ route('users.edit', $user->id) }}" class="btn btn-warning">Edit</a>
  52. </div>
  53. </div>
  54. <form action="{{ route('users.destroy', $user->id) }}" method="POST" class="col-md-4 col-12 ps-md-2" onsubmit="return window.confirm('Do you want to remove this user?')">
  55. @csrf
  56. @method('DELETE')
  57. <div class="d-grid gap-2">
  58. <button type="submit" class="btn btn-danger">Delete</button>
  59. </div>
  60. </form>
  61. </div>
  62. </div>
  63. </div>
  64. </div>
  65. @endforeach
  66. <div class="row mt-3">
  67. <div class="d-flex col-12 justify-content-center">
  68. {{ $users->links() }}
  69. </div>
  70. </div>
  71. @else
  72. <div class="row mt-3">
  73. <div class='col-xl-6 col-lg-8 col-md-10 col-12 mx-auto text-center'>
  74. <span>There are not users.</span>
  75. </div>
  76. </div>
  77. @endif
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. @endsection