Index.cshtml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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="1">
  75. Aktionen
  76. </th>
  77. </tr>
  78. </thead>
  79. <tbody>
  80. @foreach (var item in Model) {
  81. <tr>
  82. <td>
  83. @Html.DisplayFor(modelItem => item.Id)
  84. </td>
  85. <td>
  86. @Html.DisplayFor(modelItem => item.Name)
  87. </td>
  88. <td>
  89. @Html.DisplayFor(modelItem => item.CreationDate)
  90. </td>
  91. <td>
  92. @Html.DisplayFor(modelItem => item.Customer.Fullname)
  93. </td>
  94. <td>
  95. @Html.ActionLink("Bearbeiten", "Edit", new { id = item.Id }) |
  96. @Html.ActionLink("Anzeigen", "Details", new { id = item.Id }) |
  97. <a href="#" onclick="showDeleteModal(@item.Id)">Löschen</a>
  98. </td>
  99. </tr>
  100. }
  101. </tbody>
  102. </table>
  103. <div id="deleteModal" class="modal fade" tabindex="-1" role="dialog">
  104. <div class="modal-dialog" role="document">
  105. <div class="modal-content">
  106. <div class="modal-header">
  107. <h5 class="modal-title">Gewerk löschen</h5>
  108. <button type="button" class="close" data-dismiss="modal" aria-label="Close">
  109. <span aria-hidden="true">&times;</span>
  110. </button>
  111. </div>
  112. <form asp-action="Delete">
  113. <div class="modal-body">
  114. <p>Sind Sie sicher, dass Sie dieses Gewerk löschen möchten?</p>
  115. <input name="id" type="hidden" />
  116. </div>
  117. <div class="modal-footer">
  118. <button type="submit" class="btn btn-primary">Ja</button>
  119. <button type="button" class="btn btn-secondary" data-dismiss="modal">Nein</button>
  120. </div>
  121. </form>
  122. </div>
  123. </div>
  124. </div>