_DeviationAssignPartial.cshtml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. @using GreenTree.Nachtragsmanagement.Web.Extensions
  2. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Appendix.AppendixDataModel>
  3. <div class="deviationAssignContainer">
  4. <script>
  5. function assignDeviation() {
  6. var id = $("#DeviationId").val();
  7. var appendixId = devListBoxAssignDeviation.GetValue();
  8. if (!id || !appendixId) return;
  9. $.ajax({
  10. type: "POST",
  11. url: '@Url.Action("AssignDeviation", "Deviation")',
  12. data: { Id: id, AppendixId: appendixId },
  13. success: function (response) {
  14. if (response == "success") {
  15. devPopupControlAssignDeviation.Hide();
  16. devTreeListSiteDeviationAppendices.PerformCallback();
  17. } else {
  18. $("body").append(response);
  19. }
  20. },
  21. error: function () {
  22. alert("error occured");
  23. }
  24. });
  25. }
  26. </script>
  27. @Html.DevExpress().PopupControl(s =>
  28. {
  29. s.Name = "devPopupControlAssignDeviation";
  30. s.Modal = false;
  31. s.Width = new Unit(350, UnitType.Pixel);
  32. s.CloseAction = CloseAction.OuterMouseClick;
  33. s.PopupHorizontalAlign = PopupHorizontalAlign.OutsideRight;
  34. s.PopupVerticalAlign = PopupVerticalAlign.TopSides;
  35. s.AllowDragging = false;
  36. s.AllowResize = false;
  37. s.ShowFooter = false;
  38. s.ShowHeader = false;
  39. s.ShowOnPageLoad = false;
  40. s.SetContent(() =>
  41. {
  42. ViewContext.Writer.Write("<input type=\"hidden\" value=\"" + ViewData["DeviationId"] + "\" id=\"DeviationId\" name=\"DeviationId\" />");
  43. Html.DevExpress().ListBox(t =>
  44. {
  45. t.Name = "devListBoxAssignDeviation";
  46. t.Width = new Unit(100, UnitType.Percentage);
  47. t.Height = new Unit(150, UnitType.Pixel);
  48. t.Properties.ValueField = "Id";
  49. t.Properties.ValueType = typeof(int);
  50. t.SetItemTemplateContent(c =>
  51. {
  52. var id = Convert.ToInt32(DataBinder.Eval(c.DataItem, "Id"));
  53. var customNumber = Convert.ToInt32(DataBinder.Eval(c.DataItem, "CustomNumber"));
  54. var description = DataBinder.Eval(c.DataItem, "Description").ToString();
  55. if (id == -1)
  56. ViewContext.Writer.Write(description);
  57. else
  58. ViewContext.Writer.Write("NT - {0} - {1}", customNumber, description);
  59. });
  60. t.ControlStyle.Border.BorderStyle = BorderStyle.None;
  61. }).BindList(Model).Render();
  62. Html.RenderPartial(
  63. "~/Views/Shared/_PopupButtonPanel.cshtml",
  64. new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
  65. {
  66. PopupName = "devPopupControlAssignDeviation",
  67. AcceptFunction = "function (s, e) { assignDeviation(); }"
  68. }
  69. );
  70. });
  71. s.Styles.Content.Paddings.Padding = new Unit(0);
  72. s.Styles.ModalBackground.Opacity = 0;
  73. }).GetHtml()
  74. </div>