Index.cshtml 5.1 KB

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