index.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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">Penalties 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. @if (Auth::user()->hasRole('Administrator'))
  30. <div class="row">
  31. <form class="col-xl-6 col-lg-8 col-md-10 col-12 mx-auto" action="{{ route('penalties.search') }}" method="POST">
  32. @csrf
  33. <input class="form-control" name="search" type="text" value="{{ isset($oldSearch) ? $oldSearch : '' }}" placeholder="Search by user name and email"/>
  34. </form>
  35. </div>
  36. @endif
  37. @if (count($penalties) !== 0)
  38. @if (Auth::user()->hasRole('Administrator'))
  39. <div class="row mt-3 p-3 d-md-flex d-none">
  40. @else
  41. <div class="row p-3 d-md-flex d-none">
  42. @endif
  43. <div class='col-3 my-auto text-center'>
  44. <span class="fs-5">User</span>
  45. </div>
  46. <div class="col my-auto">
  47. </div>
  48. <div class='col-3 my-auto text-center'>
  49. <span class="fs-5">End</span>
  50. </div>
  51. <div class="col my-auto">
  52. </div>
  53. <div class='col-3 my-auto text-center'>
  54. <span class="fs-5">Actions</span>
  55. </div>
  56. </div>
  57. @foreach ($penalties as $penalty)
  58. <div class="row mt-3 p-3 border border-secondary rounded">
  59. <div class='col-md-3 col-12 my-md-auto mb-3 text-center'>
  60. <span class="fs-5">{{ $penalty->user->name }}</span>
  61. </div>
  62. <div class="col my-md-auto my-0">
  63. </div>
  64. <div class='col-md-3 col-12 my-md-auto mb-3 text-center'>
  65. <span>{{ \Carbon\Carbon::parse($penalty->end)->format('d/m/Y') }}</span>
  66. </div>
  67. <div class="col my-md-auto my-0">
  68. </div>
  69. <div class='col-md-3 col-12 px-0'>
  70. <div class="container px-0">
  71. <div class="row">
  72. <div class="col-12">
  73. <div class="d-grid gap-2">
  74. <a href="{{ route('penalties.show', $penalty->id) }}" class="btn btn-primary">Show</a>
  75. </div>
  76. </div>
  77. </div>
  78. @if (Auth::user()->hasRole('Administrator'))
  79. <div class="row mt-2">
  80. <div class="col-12">
  81. <div class="d-grid gap-2">
  82. <a href="{{ route('penalties.edit', $penalty->id) }}" class="btn btn-warning">Edit</a>
  83. </div>
  84. </div>
  85. </div>
  86. <div class="row mt-2">
  87. <form action="{{ route('penalties.destroy', $penalty->id) }}" method="POST" class="col-12" onsubmit="return window.confirm('Do you want to remove this penalty?')">
  88. @csrf
  89. @method('DELETE')
  90. <div class="d-grid gap-2">
  91. <button type="submit" class="btn btn-danger">Delete</button>
  92. </div>
  93. </form>
  94. </div>
  95. @endif
  96. </div>
  97. </div>
  98. </div>
  99. @endforeach
  100. <div class="row mt-3">
  101. <div class="d-flex col-12 justify-content-center">
  102. {{ $penalties->links() }}
  103. </div>
  104. </div>
  105. @else
  106. <div class="row mt-3">
  107. <div class='col-xl-6 col-lg-8 col-md-10 col-12 mx-auto text-center'>
  108. <span>There are not penalties.</span>
  109. </div>
  110. </div>
  111. @endif
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. @endsection