_ModalInput.cshtml 1.4 KB

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