MailNotifications.cshtml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. } else if (e.item.name == "ResetSettings") {
  41. $.ajax({
  42. type: "POST",
  43. url: '@Url.Action("DeleteCookiesAndSessionVariables", "Global")',
  44. data: { cookies: ["mailNotificationGridStateCookie"], sessionVariables: [ "MailNotificationsGridState", "MailNotificationsGridViewState" ] },
  45. success: function (response) {
  46. if (response == "success") {
  47. window.location = window.location;
  48. }
  49. }
  50. });
  51. }
  52. }
  53. function IsExportToolbarCommand(command) {
  54. return command == "Pdf" || command == "Xlsx" || command == "Xls";
  55. }
  56. function editMailNotification(id) {
  57. if (!id) return;
  58. $.ajax({
  59. url: '@Url.Action("EditMailNotification", "Misc")',
  60. data: { Id: id },
  61. success: function (response) {
  62. setTimeout(function () {
  63. $(".mailNotificationEditContainer").remove();
  64. $("body").append(response);
  65. }, 200);
  66. },
  67. error: function () {
  68. alert("error occured");
  69. }
  70. });
  71. }
  72. function confirmDelete(id) {
  73. if (!id) return;
  74. deleteId = id;
  75. $.ajax({
  76. type: "GET",
  77. url: '@Url.Action("GetMailNotification", "Misc")',
  78. data: { Id: id },
  79. success: function (response) {
  80. if (response == "notFound") return;
  81. var mailNotification = JSON.parse(response);
  82. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteMailNotification);
  83. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  84. $(".dialogTextMailNotification").text($(".dialogTextMailNotification").text().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  85. popupControl.Show();
  86. }
  87. });
  88. }
  89. function deleteMailNotification() {
  90. $.ajax({
  91. type: "POST",
  92. url: '@Url.Action("DeleteMailNotification", "Misc")',
  93. data: { Id: deleteId },
  94. success: function (response) {
  95. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteMailNotification);
  96. popupControl.Hide();
  97. setTimeout(function () {
  98. devGridViewMailNotifications.PerformCallback();
  99. }, 200);
  100. },
  101. error: function () {
  102. alert("error occured");
  103. }
  104. });
  105. }
  106. function confirmProcess(id) {
  107. if (!id) return;
  108. processId = id;
  109. $.ajax({
  110. type: "GET",
  111. url: '@Url.Action("GetMailNotification", "Misc")',
  112. data: { Id: id },
  113. success: function (response) {
  114. if (response == "notFound") return;
  115. var mailNotification = JSON.parse(response);
  116. var popupControl = MVCxClientPopupControl.Cast(devPopupControlProcessMailNotification);
  117. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  118. $(".dialogTextMailNotificationProcess").text($(".dialogTextMailNotificationProcess").text().replace("{mailNotification}", mailNotification.NotificationPluginSystemNameDescription));
  119. popupControl.Show();
  120. }
  121. });
  122. }
  123. function processMailNotification() {
  124. $.ajax({
  125. type: "POST",
  126. url: '@Url.Action("ProcessMailNotification", "Misc")',
  127. data: { Id: processId },
  128. success: function (response) {
  129. var popupControl = MVCxClientPopupControl.Cast(devPopupControlProcessMailNotification);
  130. popupControl.Hide();
  131. },
  132. error: function () {
  133. alert("error occured");
  134. }
  135. });
  136. }
  137. </script>
  138. @Html.Partial("~/Views/Misc/_MailNotificationGridPartial.cshtml", Model)
  139. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  140. {
  141. PopupName = "devPopupControlDeleteMailNotification",
  142. Content = "<div class='dialogTextMailNotification' style='padding: 12px'>Sind Sie sicher, dass Sie die Benachrichtigung " +
  143. "\"{mailNotification}\" löschen möchten?</div>",
  144. HeaderText = "\"{mailNotification}\" löschen",
  145. YesFunction = "function (s, e) { deleteMailNotification(); }",
  146. YesButtonName = "devButtonDeleteMailNotificationYes",
  147. NoButtonName = "devButtonDeleteMailNotificationNo"
  148. })
  149. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  150. {
  151. PopupName = "devPopupControlProcessMailNotification",
  152. Content = "<div class='dialogTextMailNotificationProcess' style='padding: 12px'>Sind Sie sicher, dass Sie die Benachrichtigung " +
  153. "\"{mailNotification}\" sofort durchführen möchten?</div>",
  154. HeaderText = "\"{mailNotification}\" löschen",
  155. YesFunction = "function (s, e) { processMailNotification(); }",
  156. YesButtonName = "devButtonProcessMailNotificationYes",
  157. NoButtonName = "devButtonProcessMailNotificationNo"
  158. })