_ModalBody.cshtml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. @using System.Linq;
  2. @using WeApp.Views.Shared.Modals
  3. @model ModalBodyViewModel
  4. <div class="modal-body">
  5. <form class="form-horizontal " id="@Model.FormId">
  6. @{
  7. //string type = "text";
  8. foreach (var i in Model.Inputs)
  9. {
  10. if (i.IsHidden)
  11. {
  12. <input id="@i.Id" name="@i.Id" type="hidden" />
  13. continue;
  14. }
  15. string oBefore = "", oAfter = "", iBefore = "", iAfter = "";
  16. var special = Model.Specials?.FirstOrDefault(a => a.Id == i.Id);
  17. string help = i.Help.IsEmpty() ? "" : "<span class=\"help-block\">" + i.Help + "</span>";
  18. if (!string.IsNullOrEmpty(i.DivOutBefore))
  19. {
  20. oBefore = i.DivOutBefore;
  21. }
  22. if (!string.IsNullOrEmpty(i.DivOutAfter))
  23. {
  24. oAfter = i.DivOutAfter;
  25. }
  26. if (!string.IsNullOrEmpty(i.DivInterBefore))
  27. {
  28. iBefore = i.DivInterBefore;
  29. }
  30. if (!string.IsNullOrEmpty(i.DivInterAfter))
  31. {
  32. iAfter = i.DivInterAfter;
  33. }
  34. @Html.Raw(oBefore)
  35. <div class="@i.DivClass" @i.DivOther>
  36. @Html.Raw(i.Label)
  37. @if (special != null)
  38. {
  39. @Html.Raw(special.InputStr)
  40. continue;
  41. }
  42. <div class="@(i.InputLayoutClass)">
  43. @Html.Raw(iBefore)
  44. @Html.Partial("Modals/_InputView", i)
  45. @Html.Raw(help)
  46. @Html.Raw(iAfter)
  47. </div>
  48. </div>
  49. @Html.Raw(oAfter)
  50. }
  51. }
  52. </form>
  53. </div>