Index.cshtml 5.0 KB

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