MailNotifications.cshtml 5.9 KB

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