Index.cshtml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. @model IEnumerable<GreenTree.Maschinenbestellungen.Web.Models.Rights.User.UserModel>
  2. @{
  3. ViewData["Title"] = "Benutzerverwaltung";
  4. }
  5. <!-- Custom JavaScript -->
  6. <script>
  7. $(window).resize(function () {
  8. $(".dataTables_scrollBody").height($(window).height() - 260);
  9. });
  10. $(document).ready(function () {
  11. $("#usersTable").DataTable({
  12. scrollY: $(window).height() - 260 + "px",
  13. autoWidth: true,
  14. paging: false,
  15. "bInfo": false,
  16. columns: [
  17. {
  18. data: "ID",
  19. orderable: true
  20. },
  21. {
  22. data: "Kontoname",
  23. orderable: true
  24. },
  25. {
  26. data: "Vorname",
  27. orderable: true
  28. },
  29. {
  30. data: "Nachname",
  31. orderable: true
  32. },
  33. {
  34. data: "Geburtsdatum",
  35. orderable: true
  36. },
  37. {
  38. data: "Aktiviert",
  39. orderable: true
  40. },
  41. {
  42. data: "Rechte",
  43. orderable: false
  44. },
  45. {
  46. data: "Aktionen",
  47. orderable: false
  48. }
  49. ],
  50. language: {
  51. zeroRecords: "Keine Einträge gefunden",
  52. search: "Suchen:"
  53. }
  54. });
  55. });
  56. function showDeleteModal(id) {
  57. if (!id) return;
  58. $('#deleteModal').modal("show");
  59. $("[name='id'").val(id);
  60. }
  61. </script>
  62. <h1>Benutzerverwaltung</h1>
  63. <p>
  64. <a asp-action="Create">Neuen Benutzer anlegen</a>
  65. </p>
  66. <table id="usersTable" class="table">
  67. <thead>
  68. <tr>
  69. <th>
  70. @Html.DisplayNameFor(model => model.Id)
  71. </th>
  72. <th>
  73. @Html.DisplayNameFor(model => model.Accountname)
  74. </th>
  75. <th>
  76. @Html.DisplayNameFor(model => model.Forename)
  77. </th>
  78. <th>
  79. @Html.DisplayNameFor(model => model.Lastname)
  80. </th>
  81. <th>
  82. @Html.DisplayNameFor(model => model.Birthdate)
  83. </th>
  84. <th>
  85. @Html.DisplayNameFor(model => model.Activated)
  86. </th>
  87. <th>
  88. @Html.DisplayNameFor(model => model.Policies)
  89. </th>
  90. <th>
  91. Aktionen
  92. </th>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. @foreach (var item in Model) {
  97. <tr>
  98. <td>
  99. @Html.DisplayFor(modelItem => item.Id)
  100. </td>
  101. <td>
  102. @Html.DisplayFor(modelItem => item.Accountname)
  103. </td>
  104. <td>
  105. @Html.DisplayFor(modelItem => item.Forename)
  106. </td>
  107. <td>
  108. @Html.DisplayFor(modelItem => item.Lastname)
  109. </td>
  110. <td>
  111. @Html.DisplayFor(modelItem => item.Birthdate)
  112. </td>
  113. <td>
  114. @Html.YesNoBadgeFor(modelItem => item.Activated)
  115. </td>
  116. <td>
  117. @Html.TokenBoxFor(modelItem => item.Policies)
  118. </td>
  119. <td>
  120. @Html.ActionLink("Bearbeiten", "Edit", new { id = item.Id }) |
  121. @Html.ActionLink("Anzeigen", "Details", new { id = item.Id }) |
  122. <a href="#" onclick="showDeleteModal(@item.Id)">Löschen</a>
  123. </td>
  124. </tr>
  125. }
  126. </tbody>
  127. </table>
  128. <div id="deleteModal" class="modal fade" tabindex="-1" role="dialog">
  129. <div class="modal-dialog" role="document">
  130. <div class="modal-content">
  131. <div class="modal-header">
  132. <h5 class="modal-title">Benutzer löschen</h5>
  133. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  134. <span aria-hidden="true">&times;</span>
  135. </button>
  136. </div>
  137. <form asp-action="Delete">
  138. <div class="modal-body">
  139. <p>Sind Sie sicher, dass Sie diesen Benutzer löschen möchten?</p>
  140. <input name="id" type="hidden" />
  141. </div>
  142. <div class="modal-footer">
  143. <button type="submit" class="btn btn-primary">Ja</button>
  144. <button type="button" class="btn btn-secondary" data-dismiss="modal">Nein</button>
  145. </div>
  146. </form>
  147. </div>
  148. </div>
  149. </div>
  150. @section Scripts {
  151. @{
  152. await Html.RenderPartialAsync("_TokenBoxLibPartial");
  153. }
  154. }