View.cshtml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Deviation.DeviationDataModel>
  5. <script>
  6. var deleteId;
  7. function editDeviation(id) {
  8. if (!id) return;
  9. $.ajax({
  10. url: '@Url.Action("EditDeviation", "Deviation")',
  11. data: { Id: id },
  12. success: function (response) {
  13. setTimeout(function () {
  14. $(".deviationEditContainer").remove();
  15. $("body").append(response);
  16. }, 200);
  17. },
  18. error: function () {
  19. alert("error occured");
  20. }
  21. });
  22. }
  23. function confirmDelete(id) {
  24. if (!id) return;
  25. deleteId = id;
  26. $.ajax({
  27. type: "GET",
  28. url: '@Url.Action("GetDeviation", "Deviation")',
  29. data: { Id: id },
  30. success: function (response) {
  31. if (response == "notFound") return;
  32. var deviation = JSON.parse(response);
  33. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteDeviation);
  34. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{deviation}", deviation.CustomNumber));
  35. $(".dialogText").text($(".dialogText").text().replace("{deviation}", deviation.CustomNumber));
  36. popupControl.Show();
  37. }
  38. });
  39. }
  40. function deleteDeviation() {
  41. $.ajax({
  42. type: "POST",
  43. url: '@Url.Action("DeleteDeviation", "Deviation")',
  44. data: { Id: deleteId },
  45. success: function (response) {
  46. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteDeviation);
  47. popupControl.Hide();
  48. setTimeout(function () {
  49. devGridViewDeviation.PerformCallback();
  50. }, 200);
  51. },
  52. error: function () {
  53. alert("error occured");
  54. }
  55. });
  56. }
  57. </script>
  58. @Html.Partial("~/Views/Deviations/_DeviationGridPartial.cshtml", Model)
  59. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  60. {
  61. PopupName = "devPopupControlDeleteDeviation",
  62. Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie die Vertragsabweichung \"{deviation}\" löschen möchten?</div>",
  63. HeaderText = "\"{deviation}\" löschen",
  64. YesFunction = "function (s, e) { deleteDeviation(); }"
  65. })