MailNotifications.cshtml 5.3 KB

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