MailNotifications.cshtml 5.9 KB

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