MailNotifications.cshtml 5.7 KB

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