_StatusEditPartial.cshtml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. @using GreenTree.Nachtragsmanagement.Web.Extensions
  2. @model GreenTree.Nachtragsmanagement.Web.Models.Deviation.StatusDataModel
  3. <div class="claimEditContainer">
  4. <script>
  5. function saveStatus() {
  6. var form = $("#statusEditForm");
  7. $(form).submit(function (e) {
  8. $.ajax({
  9. type: "POST",
  10. url: '@Url.Action("EditStatus", "Deviation")',
  11. data: form.serialize(),
  12. success: function (response) {
  13. setTimeout(function () {
  14. $(".claimEditContainer").remove();
  15. if (response == "success") {
  16. parent.callCustomEventListener('StatusDataCallbackEventReceiver');
  17. } else {
  18. $("body").append(response);
  19. }
  20. }, 200);
  21. }
  22. });
  23. e.preventDefault();
  24. });
  25. form.submit();
  26. }
  27. </script>
  28. @Html.DevExpress().PopupControl(s =>
  29. {
  30. s.Name = "devPopupControlEditStatus";
  31. if (Model.Id == -1)
  32. s.HeaderText = "Neuen Status erstellen";
  33. else
  34. s.HeaderText = "\"" + Model.Description + "\" bearbeiten";
  35. s.Modal = true;
  36. s.Width = new Unit(250, UnitType.Pixel);
  37. s.CloseAction = CloseAction.CloseButton;
  38. s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
  39. s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
  40. s.AllowDragging = false;
  41. s.AllowResize = false;
  42. s.ShowFooter = false;
  43. s.ShowOnPageLoad = true;
  44. s.SetContent(() =>
  45. {
  46. using (Html.BeginForm("EditStatus", "Deviation", FormMethod.Post, new { id = "statusEditForm" }))
  47. {
  48. ViewContext.Writer.Write("<div class='editFormWrapper'>");
  49. ViewContext.Writer.Write("<input type=\"hidden\" value=\"" + Model.Id + "\" id=\"Id\" name=\"Id\" />");
  50. ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Description, "Beschreibung:"));
  51. ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Description).ToHtmlString());
  52. Html.DevExpress().TextBoxFor(m => m.Description, t =>
  53. {
  54. t.Width = new Unit(100, UnitType.Percentage);
  55. }).Render();
  56. ViewContext.Writer.Write("</div>");
  57. Html.RenderPartial(
  58. "~/Views/Shared/_PopupButtonPanel.cshtml",
  59. new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
  60. {
  61. PopupName = "devPopupControlEditStatus",
  62. AcceptFunction = "function (s, e) { saveStatus(); }"
  63. }
  64. );
  65. }
  66. });
  67. s.Styles.Content.Paddings.Padding = new Unit(0);
  68. s.Styles.ModalBackground.Opacity = 0;
  69. }).GetHtml()
  70. </div>