View.cshtml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Appendix.AppendixDataModel>
  5. <script>
  6. var deleteId;
  7. var gridScrollHeight;
  8. var gridScrollOffset = 240;
  9. var resizeFinished;
  10. $(document).ready(function () {
  11. gridScrollHeight = calculateGridScrollHeight();
  12. setTimeout(function () {
  13. devGridViewAppendix.PerformCallback();
  14. }, 500);
  15. });
  16. $(window).resize(function () {
  17. clearTimeout(window.resizedFinished);
  18. window.resizedFinished = setTimeout(function () {
  19. setGridScrollHeight();
  20. }, 250);
  21. });
  22. function calculateGridScrollHeight() {
  23. var windowHeight = $(window).height();
  24. var gridHeaderHeight = $("#devGridViewAppendix_DXHeadersRow0").height();
  25. var gridFooterHeight = $("#devGridViewAppendix_DXFooterRow").height();
  26. return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
  27. }
  28. function setGridScrollHeight() {
  29. gridScrollHeight = calculateGridScrollHeight();
  30. devGridViewAppendix.PerformCallback();
  31. }
  32. function onToolbarItemClick(s, e) {
  33. if (!s || !e) return;
  34. if (e.item.name == "Print") {
  35. parent.$(".printPopupContainer").remove();
  36. $.ajax({
  37. type: "POST",
  38. url: '@Url.Action("ExportPartialAppendices", "Appendix")',
  39. data: { displayMode: "popup", exportFormat: "" },
  40. success: function (response) {
  41. parent.$("body").append(response);
  42. parent.exportFormat = "pdf";
  43. }
  44. });
  45. } else if (e.item.name == "ToggleColumnChooser") {
  46. if (devGridViewAppendix.IsCustomizationWindowVisible())
  47. devGridViewAppendix.HideCustomizationWindow();
  48. else
  49. devGridViewAppendix.ShowCustomizationWindow();
  50. }
  51. }
  52. function editAppendix(id) {
  53. if (!id) return;
  54. $.ajax({
  55. url: '@Url.Action("EditAppendix", "Appendix")',
  56. data: { Id: id },
  57. success: function (response) {
  58. setTimeout(function () {
  59. $(".appendixEditContainer").remove();
  60. $("body").append(response);
  61. }, 200);
  62. },
  63. error: function () {
  64. alert("error occured");
  65. }
  66. });
  67. }
  68. function confirmDelete(id) {
  69. if (!id) return;
  70. deleteId = id;
  71. $.ajax({
  72. type: "GET",
  73. url: '@Url.Action("GetAppendix", "Appendix")',
  74. data: { Id: id },
  75. success: function (response) {
  76. if (response == "notFound") return;
  77. var appendix = JSON.parse(response);
  78. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteAppendix);
  79. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{appendix}", appendix.CustomNumber));
  80. $(".dialogText").text($(".dialogText").text().replace("{appendix}", appendix.CustomNumber));
  81. popupControl.Show();
  82. }
  83. });
  84. }
  85. function deleteAppendix() {
  86. $.ajax({
  87. type: "POST",
  88. url: '@Url.Action("DeleteAppendix", "Appendix")',
  89. data: { Id: deleteId },
  90. success: function (response) {
  91. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteAppendix);
  92. popupControl.Hide();
  93. setTimeout(function () {
  94. devGridViewAppendix.PerformCallback();
  95. }, 200);
  96. },
  97. error: function () {
  98. alert("error occured");
  99. }
  100. });
  101. }
  102. </script>
  103. @Html.Partial("~/Views/Appendices/_AppendixGridPartial.cshtml", Model)
  104. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  105. {
  106. PopupName = "devPopupControlDeleteAppendix",
  107. Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie den Nachtrag \"{appendix}\" löschen möchten?</div>",
  108. HeaderText = "\"{appendix}\" löschen",
  109. YesFunction = "function (s, e) { deleteAppendix(); }"
  110. })