_EditCommentPartial.cshtml 2.5 KB

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