Logs.cshtml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.LogDataModel>
  5. <script>
  6. var gridScrollHeight;
  7. var gridScrollOffset = 195;
  8. var resizeFinished;
  9. $(document).ready(function () {
  10. gridScrollHeight = calculateGridScrollHeight();
  11. setTimeout(function () {
  12. devGridViewLog.PerformCallback();
  13. }, 500);
  14. $.ajaxSetup({
  15. cache: false
  16. });
  17. });
  18. $(window).resize(function () {
  19. clearTimeout(window.resizedFinished);
  20. window.resizedFinished = setTimeout(function () {
  21. setGridScrollHeight();
  22. }, 250);
  23. });
  24. function calculateGridScrollHeight() {
  25. var windowHeight = $(window).height();
  26. var gridHeaderHeight = $("#devGridViewLog_DXHeadersRow0").height();
  27. var gridFooterHeight = $("#devGridViewLog_DXFooterRow").height();
  28. return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
  29. }
  30. function setGridScrollHeight() {
  31. gridScrollHeight = calculateGridScrollHeight();
  32. devGridViewLog.PerformCallback();
  33. }
  34. function onToolbarItemClick(s, e) {
  35. if (!s || !e) return;
  36. if (e.item.name == "Print") {
  37. parent.$(".printPopupContainer").remove();
  38. $.ajax({
  39. type: "POST",
  40. url: '@Url.Action("ExportPartialLogs", "Misc")',
  41. data: { displayMode: "popup", exportFormat: "" },
  42. success: function (response) {
  43. parent.$("body").append(response);
  44. parent.exportFormat = "pdf";
  45. }
  46. });
  47. } else if (e.item.name == "ToggleColumnChooser") {
  48. if (devGridViewLog.IsCustomizationWindowVisible())
  49. devGridViewLog.HideCustomizationWindow();
  50. else
  51. devGridViewLog.ShowCustomizationWindow();
  52. } else if (e.item.name == "ResetSettings") {
  53. $.ajax({
  54. type: "POST",
  55. url: '@Url.Action("DeleteCookiesSessionVariablesAndUserConfigs", "Global")',
  56. data: {
  57. cookies: ["logGridStateCookie"],
  58. sessionVariables: ["LogGridState", "LogGridViewState"],
  59. userConfigItemNames: ["LogGridLayoutState"]
  60. },
  61. success: function (response) {
  62. if (response == "success") {
  63. window.location = window.location;
  64. }
  65. }
  66. });
  67. }
  68. }
  69. function viewLog(id) {
  70. if (!id) return;
  71. $.ajax({
  72. url: '@Url.Action("viewLog", "Misc")',
  73. data: { Id: id },
  74. success: function (response) {
  75. setTimeout(function () {
  76. $(".logViewContainer").remove();
  77. $("body").append(response);
  78. }, 200);
  79. },
  80. error: function () {
  81. alert("error occured");
  82. }
  83. });
  84. }
  85. function deleteLog(id) {
  86. $.ajax({
  87. type: "POST",
  88. url: '@Url.Action("DeleteLog", "Misc")',
  89. data: { Id: id },
  90. success: function (response) {
  91. setTimeout(function () {
  92. devGridViewLog.PerformCallback();
  93. }, 200);
  94. },
  95. error: function () {
  96. alert("error occured");
  97. }
  98. });
  99. }
  100. </script>
  101. @Html.Partial("~/Views/Misc/_LogGridPartial.cshtml", Model)