MailNotifications.cshtml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.MailNotificationDataModel>
  5. <script>
  6. var deleteId;
  7. var processId;
  8. var gridScrollHeight;
  9. var gridScrollOffset = 240;
  10. var resizeFinished;
  11. $(document).ready(function () {
  12. gridScrollHeight = calculateGridScrollHeight();
  13. setTimeout(function () {
  14. devGridViewMailNotifications.PerformCallback();
  15. }, 500);
  16. });
  17. $(window).resize(function () {
  18. clearTimeout(window.resizedFinished);
  19. window.resizedFinished = setTimeout(function () {
  20. setGridScrollHeight();
  21. }, 250);
  22. });
  23. function calculateGridScrollHeight() {
  24. var windowHeight = $(window).height();
  25. var gridHeaderHeight = $("#devGridViewMailNotifications_DXHeadersRow0").height();
  26. var gridFooterHeight = $("#devGridViewMailNotifications_DXFooterRow").height();
  27. return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
  28. }
  29. function setGridScrollHeight() {
  30. gridScrollHeight = calculateGridScrollHeight();
  31. devGridViewMailNotifications.PerformCallback();
  32. }
  33. function onToolbarItemClick(s, e) {
  34. if (!s || !e) return;
  35. if (e.item.name == "ToggleColumnChooser") {
  36. if (devGridViewMailNotifications.IsCustomizationWindowVisible())
  37. devGridViewMailNotifications.HideCustomizationWindow();
  38. else
  39. devGridViewMailNotifications.ShowCustomizationWindow();
  40. }
  41. }
  42. function IsExportToolbarCommand(command) {
  43. return command == "Pdf" || command == "Xlsx" || command == "Xls";
  44. }
  45. function editMailNotification(id) {
  46. if (!id) return;
  47. $.ajax({
  48. url: '@Url.Action("EditMailNotification", "Misc")',
  49. data: { Id: id },
  50. success: function (response) {
  51. setTimeout(function () {
  52. $(".mailNotificationEditContainer").remove();
  53. $("body").append(response);
  54. }, 200);
  55. },
  56. error: function () {
  57. alert("error occured");
  58. }
  59. });
  60. }
  61. function confirmDelete(id) {
  62. if (!id) return;
  63. deleteId = id;
  64. $.ajax({
  65. type: "GET",
  66. url: '@Url.Action("GetMailNotification", "Misc")',
  67. data: { Id: id },
  68. success: function (response) {
  69. if (response == "notFound") return;
  70. var mailNotification = JSON.parse(response);
  71. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteMailNotification);
  72. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  73. $(".dialogTextMailNotification").text($(".dialogTextMailNotification").text().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  74. popupControl.Show();
  75. }
  76. });
  77. }
  78. function deleteMailNotification() {
  79. $.ajax({
  80. type: "POST",
  81. url: '@Url.Action("DeleteMailNotification", "Misc")',
  82. data: { Id: deleteId },
  83. success: function (response) {
  84. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteMailNotification);
  85. popupControl.Hide();
  86. setTimeout(function () {
  87. devGridViewMailNotifications.PerformCallback();
  88. }, 200);
  89. },
  90. error: function () {
  91. alert("error occured");
  92. }
  93. });
  94. }
  95. function confirmProcess(id) {
  96. if (!id) return;
  97. processId = id;
  98. $.ajax({
  99. type: "GET",
  100. url: '@Url.Action("GetMailNotification", "Misc")',
  101. data: { Id: id },
  102. success: function (response) {
  103. if (response == "notFound") return;
  104. var mailNotification = JSON.parse(response);
  105. var popupControl = MVCxClientPopupControl.Cast(devPopupControlProcessMailNotification);
  106. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  107. $(".dialogTextMailNotificationProcess").text($(".dialogTextMailNotificationProcess").text().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  108. popupControl.Show();
  109. }
  110. });
  111. }
  112. function processMailNotification() {
  113. $.ajax({
  114. type: "POST",
  115. url: '@Url.Action("ProcessMailNotification", "Misc")',
  116. data: { Id: processId },
  117. success: function (response) {
  118. var popupControl = MVCxClientPopupControl.Cast(devPopupControlProcessMailNotification);
  119. popupControl.Hide();
  120. },
  121. error: function () {
  122. alert("error occured");
  123. }
  124. });
  125. }
  126. </script>
  127. @Html.Partial("~/Views/Misc/_MailNotificationGridPartial.cshtml", Model)
  128. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  129. {
  130. PopupName = "devPopupControlDeleteMailNotification",
  131. Content = "<div class='dialogTextMailNotification' style='padding: 12px'>Sind Sie sicher, dass Sie die Benachrichtigung " +
  132. "\"{mailNotification}\" löschen möchten?</div>",
  133. HeaderText = "\"{mailNotification}\" löschen",
  134. YesFunction = "function (s, e) { deleteMailNotification(); }",
  135. YesButtonName = "devButtonDeleteMailNotificationYes",
  136. NoButtonName = "devButtonDeleteMailNotificationNo"
  137. })
  138. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  139. {
  140. PopupName = "devPopupControlProcessMailNotification",
  141. Content = "<div class='dialogTextMailNotificationProcess' style='padding: 12px'>Sind Sie sicher, dass Sie die Benachrichtigung " +
  142. "\"{mailNotification}\" sofort durchführen möchten?</div>",
  143. HeaderText = "\"{mailNotification}\" löschen",
  144. YesFunction = "function (s, e) { processMailNotification(); }",
  145. YesButtonName = "devButtonProcessMailNotificationYes",
  146. NoButtonName = "devButtonProcessMailNotificationNo"
  147. })