View.cshtml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Deviation.DeviationDataModel>
  5. <script>
  6. var deleteId;
  7. var gridScrollHeight;
  8. var gridScrollOffset = 350;
  9. var resizeFinished;
  10. $(document).ready(function () {
  11. gridScrollHeight = $(window).height() - gridScrollOffset;
  12. setTimeout(function () {
  13. devGridViewDeviation.PerformCallback();
  14. }, 500);
  15. });
  16. $(window).resize(function () {
  17. clearTimeout(window.resizedFinished);
  18. window.resizedFinished = setTimeout(function () {
  19. gridScrollHeight = $(window).height() - gridScrollOffset;
  20. devGridViewDeviation.PerformCallback();
  21. }, 250);
  22. });
  23. function onToolbarItemClick(s, e) {
  24. if (!s || !e) return;
  25. if (IsExportToolbarCommand(e.item.name)) {
  26. $("#Format").val(e.item.name);
  27. $("#deviationExportForm").submit();
  28. } else if (e.item.name == "ToggleColumnChooser") {
  29. if (devGridViewDeviation.IsCustomizationWindowVisible())
  30. devGridViewDeviation.HideCustomizationWindow();
  31. else
  32. devGridViewDeviation.ShowCustomizationWindow();
  33. }
  34. }
  35. function IsExportToolbarCommand(command) {
  36. return command == "Pdf" || command == "Xlsx" || command == "Xls";
  37. }
  38. function editDeviation(id) {
  39. if (!id) return;
  40. $.ajax({
  41. url: '@Url.Action("EditDeviation", "Deviation")',
  42. data: { Id: id },
  43. success: function (response) {
  44. setTimeout(function () {
  45. $(".deviationEditContainer").remove();
  46. $("body").append(response);
  47. }, 200);
  48. },
  49. error: function () {
  50. alert("error occured");
  51. }
  52. });
  53. }
  54. function confirmDelete(id) {
  55. if (!id) return;
  56. deleteId = id;
  57. $.ajax({
  58. type: "GET",
  59. url: '@Url.Action("GetDeviation", "Deviation")',
  60. data: { Id: id },
  61. success: function (response) {
  62. if (response == "notFound") return;
  63. var deviation = JSON.parse(response);
  64. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteDeviation);
  65. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{deviation}", deviation.CustomNumber));
  66. $(".dialogText").text($(".dialogText").text().replace("{deviation}", deviation.CustomNumber));
  67. popupControl.Show();
  68. }
  69. });
  70. }
  71. function deleteDeviation() {
  72. $.ajax({
  73. type: "POST",
  74. url: '@Url.Action("DeleteDeviation", "Deviation")',
  75. data: { Id: deleteId },
  76. success: function (response) {
  77. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteDeviation);
  78. popupControl.Hide();
  79. setTimeout(function () {
  80. devGridViewDeviation.PerformCallback();
  81. }, 200);
  82. },
  83. error: function () {
  84. alert("error occured");
  85. }
  86. });
  87. }
  88. </script>
  89. @using (Html.BeginForm("ExportPartialDeviations", "Deviation", FormMethod.Post, new { id = "deviationExportForm" }))
  90. {
  91. @Html.Hidden("Format")
  92. }
  93. @Html.Partial("~/Views/Deviations/_DeviationGridPartial.cshtml", Model)
  94. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  95. {
  96. PopupName = "devPopupControlDeleteDeviation",
  97. Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie die Vertragsabweichung \"{deviation}\" löschen möchten?</div>",
  98. HeaderText = "\"{deviation}\" löschen",
  99. YesFunction = "function (s, e) { deleteDeviation(); }"
  100. })