View.cshtml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Config.ConfigItemDataModel>
  5. <script>
  6. var deleteId;
  7. var gridScrollHeight;
  8. var gridScrollOffset = 240;
  9. var resizeFinished;
  10. $(document).ready(function () {
  11. gridScrollHeight = calculateGridScrollHeight();
  12. setTimeout(function () {
  13. devGridViewConfigItem.PerformCallback();
  14. }, 500);
  15. });
  16. $(window).resize(function () {
  17. clearTimeout(window.resizedFinished);
  18. window.resizedFinished = setTimeout(function () {
  19. setGridScrollHeight();
  20. }, 250);
  21. });
  22. function calculateGridScrollHeight() {
  23. var windowHeight = $(window).height();
  24. var gridHeaderHeight = $("#devGridViewConfigItem_DXHeadersRow0").height();
  25. var gridFooterHeight = $("#devGridViewConfigItem_DXFooterRow").height();
  26. return windowHeight - gridHeaderHeight - gridFooterHeight - gridScrollOffset;
  27. }
  28. function setGridScrollHeight() {
  29. gridScrollHeight = calculateGridScrollHeight();
  30. devGridViewConfigItem.PerformCallback();
  31. }
  32. function onToolbarItemClick(s, e) {
  33. if (!s || !e) return;
  34. if (IsExportToolbarCommand(e.item.name)) {
  35. $("#Format").val(e.item.name);
  36. $("#configItemExportForm").submit();
  37. } else if (e.item.name == "ToggleColumnChooser") {
  38. if (devGridViewConfigItem.IsCustomizationWindowVisible())
  39. devGridViewConfigItem.HideCustomizationWindow();
  40. else
  41. devGridViewConfigItem.ShowCustomizationWindow();
  42. }
  43. }
  44. function IsExportToolbarCommand(command) {
  45. return command == "Pdf" || command == "Xlsx" || command == "Xls";
  46. }
  47. function editConfigItem(id) {
  48. if (!id) return;
  49. $.ajax({
  50. url: '@Url.Action("EditConfigItem", "Misc")',
  51. data: { Id: id },
  52. success: function (response) {
  53. setTimeout(function () {
  54. $(".configItemEditContainer").remove();
  55. $("body").append(response);
  56. }, 200);
  57. },
  58. error: function () {
  59. alert("error occured");
  60. }
  61. });
  62. }
  63. function confirmDelete(id) {
  64. if (!id) return;
  65. deleteId = id;
  66. $.ajax({
  67. type: "GET",
  68. url: '@Url.Action("GetConfigItem", "Misc")',
  69. data: { Id: id },
  70. success: function (response) {
  71. if (response == "notFound") return;
  72. var configItem = JSON.parse(response);
  73. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteConfigItem);
  74. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{configItem}", configItem.NotificationPluginSystemNameDescription));
  75. $(".dialogTextConfigItem").text($(".dialogTextConfigItem").text().replace("{configItem}", configItem.NotificationPluginSystemNameDescription));
  76. popupControl.Show();
  77. }
  78. });
  79. }
  80. function deleteConfigItem() {
  81. $.ajax({
  82. type: "POST",
  83. url: '@Url.Action("DeleteConfigItem", "Misc")',
  84. data: { Id: deleteId },
  85. success: function (response) {
  86. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteConfigItem);
  87. popupControl.Hide();
  88. setTimeout(function () {
  89. devGridViewConfigItem.PerformCallback();
  90. }, 200);
  91. },
  92. error: function () {
  93. alert("error occured");
  94. }
  95. });
  96. }
  97. </script>
  98. @Html.Partial("~/Views/Config/_ConfigItemGridPartial.cshtml", Model)
  99. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  100. {
  101. PopupName = "devPopupControlDeleteConfigItem",
  102. Content = "<div class='dialogTextConfigItem' style='padding: 12px'>Sind Sie sicher, dass Sie die Benachrichtigung " +
  103. "\"{configItem}\" löschen möchten?</div>",
  104. HeaderText = "\"{configItem}\" löschen",
  105. YesFunction = "function (s, e) { deleteConfigItem(); }",
  106. YesButtonName = "devButtonDeleteConfigItemYes",
  107. NoButtonName = "devButtonDeleteConfigItemNo"
  108. })