_DeviationAssignPartial.cshtml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 description = DataBinder.Eval(c.DataItem, "Description").ToString();
  54. if (id == -1)
  55. ViewContext.Writer.Write(description);
  56. else
  57. ViewContext.Writer.Write("NT - {0} - {1}", id, description);
  58. });
  59. t.ControlStyle.Border.BorderStyle = BorderStyle.None;
  60. }).BindList(Model).Render();
  61. Html.RenderPartial(
  62. "~/Views/Shared/_PopupButtonPanel.cshtml",
  63. new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
  64. {
  65. PopupName = "devPopupControlAssignDeviation",
  66. AcceptFunction = "function (s, e) { assignDeviation(); }"
  67. }
  68. );
  69. });
  70. s.Styles.Content.Paddings.Padding = new Unit(0);
  71. s.Styles.ModalBackground.Opacity = 0;
  72. }).GetHtml()
  73. </div>