Index.cshtml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. @model IEnumerable<GreenTree.Strohrmann.ERP.Web.Models.Business.SupplierModel>
  2. @{
  3. ViewData["Title"] = "Lieferantenliste";
  4. }
  5. <!-- Custom JavaScript -->
  6. <script>
  7. $(document).ready(function () {
  8. $("#suppliersTable").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.Name)",
  20. orderable: true
  21. },
  22. {
  23. data: "@Html.DisplayNameFor(model => model.Description)",
  24. orderable: true
  25. },
  26. {
  27. data: "@Html.DisplayNameFor(model => model.Address)",
  28. orderable: true
  29. },
  30. {
  31. data: "@Html.DisplayNameFor(model => model.Town)",
  32. orderable: true
  33. },
  34. {
  35. data: "@Html.DisplayNameFor(model => model.ZipCode)",
  36. orderable: true
  37. },
  38. {
  39. data: "@Html.DisplayNameFor(model => model.Country)",
  40. orderable: true
  41. },
  42. {
  43. data: "@Html.DisplayNameFor(model => model.PhoneFirst)",
  44. orderable: true
  45. },
  46. {
  47. data: "@Html.DisplayNameFor(model => model.PhoneSecond)",
  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>Lieferantenliste</h1>
  76. <p>
  77. <a asp-action="Create">Neuen Lieferanten erstellen</a>
  78. </p>
  79. <table id="suppliersTable" class="table table-striped 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.Name)
  87. </th>
  88. <th data-priority="3">
  89. @Html.DisplayNameFor(model => model.Description)
  90. </th>
  91. <th>
  92. @Html.DisplayNameFor(model => model.Address)
  93. </th>
  94. <th>
  95. @Html.DisplayNameFor(model => model.Town)
  96. </th>
  97. <th>
  98. @Html.DisplayNameFor(model => model.ZipCode)
  99. </th>
  100. <th>
  101. @Html.DisplayNameFor(model => model.Country)
  102. </th>
  103. <th data-priority="4">
  104. @Html.DisplayNameFor(model => model.PhoneFirst)
  105. </th>
  106. <th data-priority="5">
  107. @Html.DisplayNameFor(model => model.MailFirst)
  108. </th>
  109. <th data-priority="1">
  110. Aktionen
  111. </th>
  112. </tr>
  113. </thead>
  114. <tbody>
  115. @foreach (var item in Model) {
  116. <tr>
  117. <td>
  118. @Html.DisplayFor(modelItem => item.Id)
  119. </td>
  120. <td>
  121. @Html.DisplayFor(modelItem => item.Name)
  122. </td>
  123. <td>
  124. @Html.DisplayFor(modelItem => item.Description)
  125. </td>
  126. <td>
  127. @Html.DisplayFor(modelItem => item.Address)
  128. </td>
  129. <td>
  130. @Html.DisplayFor(modelItem => item.Town)
  131. </td>
  132. <td>
  133. @Html.DisplayFor(modelItem => item.ZipCode)
  134. </td>
  135. <td>
  136. @Html.DisplayFor(modelItem => item.Country)
  137. </td>
  138. <td>
  139. @Html.DisplayFor(modelItem => item.PhoneFirst)
  140. </td>
  141. <td>
  142. @Html.DisplayFor(modelItem => item.MailFirst)
  143. </td>
  144. <td>
  145. @Html.ActionLink("Bearbeiten", "Edit", new { id = item.Id }) |
  146. @Html.ActionLink("Anzeigen", "Details", new { id = item.Id }) |
  147. <a href="#" onclick="showDeleteModal(@item.Id)">Löschen</a>
  148. </td>
  149. </tr>
  150. }
  151. </tbody>
  152. </table>
  153. <div id="deleteModal" class="modal fade" tabindex="-1" role="dialog">
  154. <div class="modal-dialog" role="document">
  155. <div class="modal-content">
  156. <div class="modal-header">
  157. <h5 class="modal-title">Lieferant löschen</h5>
  158. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  159. <span aria-hidden="true">&times;</span>
  160. </button>
  161. </div>
  162. <form asp-action="Delete">
  163. <div class="modal-body">
  164. <p>Sind Sie sicher, dass Sie diesen Lieferanten löschen möchten?</p>
  165. <input name="id" type="hidden" />
  166. </div>
  167. <div class="modal-footer">
  168. <button type="submit" class="btn btn-primary">Ja</button>
  169. <button type="button" class="btn btn-secondary" data-dismiss="modal">Nein</button>
  170. </div>
  171. </form>
  172. </div>
  173. </div>
  174. </div>