Index.cshtml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. @model IEnumerable<GreenTree.Strohrmann.ERP.Web.Models.Business.CustomerModel>
  2. @{
  3. ViewData["Title"] = "Kundenliste";
  4. }
  5. <!-- Custom JavaScript -->
  6. <script>
  7. $(document).ready(function () {
  8. $("#customersTable").DataTable({
  9. autoWidth: false,
  10. paging: true,
  11. pageLength: 50,
  12. "bInfo": false,
  13. columns: [
  14. {
  15. data: "@Html.DisplayNameFor(model => model.Id)",
  16. orderable: true
  17. },
  18. {
  19. data: "@Html.DisplayNameFor(model => model.Firstname)",
  20. orderable: true
  21. },
  22. {
  23. data: "@Html.DisplayNameFor(model => model.Lastname)",
  24. orderable: true
  25. },
  26. {
  27. data: "@Html.DisplayNameFor(model => model.CompanyName)",
  28. orderable: true
  29. },
  30. {
  31. data: "@Html.DisplayNameFor(model => model.IsBusiness)",
  32. orderable: true
  33. },
  34. {
  35. data: "@Html.DisplayNameFor(model => model.Address)",
  36. orderable: true
  37. },
  38. {
  39. data: "@Html.DisplayNameFor(model => model.Town)",
  40. orderable: true
  41. },
  42. {
  43. data: "@Html.DisplayNameFor(model => model.ZipCode)",
  44. orderable: true
  45. },
  46. {
  47. data: "@Html.DisplayNameFor(model => model.Country)",
  48. orderable: true
  49. },
  50. {
  51. data: "Aktionen",
  52. orderable: false
  53. }
  54. ],
  55. language: {
  56. zeroRecords: "Keine Einträge gefunden",
  57. search: "Suchen:",
  58. info: "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
  59. lengthMenu: "Zeige _MENU_ Einträge",
  60. paginate: {
  61. first: "Erste",
  62. last: "Letzte",
  63. next: "Nächste",
  64. previous: "Vorige"
  65. }
  66. }
  67. });
  68. });
  69. function showDeleteModal(id) {
  70. if (!id) return;
  71. $('#deleteModal').modal("show");
  72. $("[name='id'").val(id);
  73. }
  74. </script>
  75. <h1>Kundenliste</h1>
  76. <p>
  77. <a asp-action="Create">Neuen Kunden erstellen</a>
  78. </p>
  79. <table id="customersTable" class="table responsive">
  80. <thead>
  81. <tr>
  82. <th data-priority="1">
  83. @Html.DisplayNameFor(model => model.Id)
  84. </th>
  85. <th data-priority="2">
  86. @Html.DisplayNameFor(model => model.Firstname)
  87. </th>
  88. <th data-priority="3">
  89. @Html.DisplayNameFor(model => model.Lastname)
  90. </th>
  91. <th data-priority="4">
  92. @Html.DisplayNameFor(model => model.CompanyName)
  93. </th>
  94. <th>
  95. @Html.DisplayNameFor(model => model.IsBusiness)
  96. </th>
  97. <th>
  98. @Html.DisplayNameFor(model => model.Address)
  99. </th>
  100. <th>
  101. @Html.DisplayNameFor(model => model.Town)
  102. </th>
  103. <th>
  104. @Html.DisplayNameFor(model => model.ZipCode)
  105. </th>
  106. <th>
  107. @Html.DisplayNameFor(model => model.Country)
  108. </th>
  109. <th></th>
  110. </tr>
  111. </thead>
  112. <tbody>
  113. @foreach (var item in Model) {
  114. <tr>
  115. <td>
  116. @Html.DisplayFor(modelItem => item.Id)
  117. </td>
  118. <td>
  119. @Html.DisplayFor(modelItem => item.Firstname)
  120. </td>
  121. <td>
  122. @Html.DisplayFor(modelItem => item.Lastname)
  123. </td>
  124. <td>
  125. @Html.DisplayFor(modelItem => item.CompanyName)
  126. </td>
  127. <td>
  128. @Html.YesNoBadgeFor(modelItem => item.IsBusiness)
  129. </td>
  130. <td>
  131. @Html.DisplayFor(modelItem => item.Address)
  132. </td>
  133. <td>
  134. @Html.DisplayFor(modelItem => item.Town)
  135. </td>
  136. <td>
  137. @Html.DisplayFor(modelItem => item.ZipCode)
  138. </td>
  139. <td>
  140. @Html.DisplayFor(modelItem => item.Country)
  141. </td>
  142. <td>
  143. @Html.ActionLink("Bearbeiten", "Edit", new { id = item.Id }) |
  144. @Html.ActionLink("Anzeigen", "Details", new { id = item.Id }) |
  145. <a href="#" onclick="showDeleteModal(@item.Id)">Löschen</a>
  146. </td>
  147. </tr>
  148. }
  149. </tbody>
  150. </table>
  151. <div id="deleteModal" class="modal fade" tabindex="-1" role="dialog">
  152. <div class="modal-dialog" role="document">
  153. <div class="modal-content">
  154. <div class="modal-header">
  155. <h5 class="modal-title">Kunde löschen</h5>
  156. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  157. <span aria-hidden="true">&times;</span>
  158. </button>
  159. </div>
  160. <form asp-action="Delete">
  161. <div class="modal-body">
  162. <p>Sind Sie sicher, dass Sie diesen Kunden löschen möchten?</p>
  163. <input name="id" type="hidden" />
  164. </div>
  165. <div class="modal-footer">
  166. <button type="submit" class="btn btn-primary">Ja</button>
  167. <button type="button" class="btn btn-secondary" data-dismiss="modal">Nein</button>
  168. </div>
  169. </form>
  170. </div>
  171. </div>
  172. </div>