_InputGroup.cshtml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @using VberZero.Tools.StringModel
  2. @using VberAdmin.Web.Models.Input
  3. @model VberAdmin.Web.Models.Input.VmInputGroup
  4. @if (Model is {HiddenInputs.Count: > 0 })
  5. {
  6. if (Model.HiddenInputs.Any())
  7. {
  8. foreach (var hInput in Model.HiddenInputs)
  9. {
  10. @await Html.PartialAsync("Input/_Input",hInput)
  11. }
  12. }
  13. }
  14. @if (Model is {Count: > 0 })
  15. {
  16. //string divClass = Model.IsChild ? $"{Model.Parent.LayoutClass}" : "row g-9 mb-3";
  17. <div class="@(Model.Count==1?"":"row") g-3 mb-3">
  18. @for (int i = 0; i < Model.Count; i++)
  19. {
  20. VmInputGroup group = null;//Model.GetGroup(i);
  21. if (group != null)
  22. {
  23. @await Html.PartialAsync("Input/_InputGroup",group)
  24. }
  25. else
  26. {
  27. var input = Model.GetInput(i);
  28. if (input is {IsHidden: false })
  29. {
  30. @if (input.Special.Empty())
  31. {
  32. if (Model.Count>1)
  33. {
  34. @Html.Raw($"<div class=\"{Model.LayoutClass}\">")
  35. }
  36. @if (input.Help.Empty()){
  37. <div class="d-flex flex-column ">
  38. @if (input.Help.Empty())
  39. {
  40. <label class="@(input.LabelClass) @(input.IsRequired ? "required" : "") ">@input.DisplayName</label>
  41. }
  42. else
  43. {
  44. <label class="d-flex align-items-center @(input.LabelClass)">
  45. <span class="@(input.IsRequired ? "required" : "")">@input.DisplayName &nbsp;</span>
  46. <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" data-bs-delay-hide="800" data-bs-delay-show="200" title="@(input.Help)"></i>
  47. </label>
  48. }
  49. @await Html.PartialAsync("Input/_Input", input)
  50. <div class="invalid-feedback"></div>
  51. </div>
  52. }
  53. else
  54. {
  55. switch (input.InputType)
  56. {
  57. case VmInputType.RadioBox:
  58. case VmInputType.CheckBox:
  59. case VmInputType.Switch:
  60. <div class="d-flex flex-stack">
  61. <div class="fw-bold me-5">
  62. <label class="@(input.LabelClass) @(input.IsRequired ? "required" : "")">@input.DisplayName</label>
  63. @if (input.Help.NotEmpty())
  64. {
  65. <div class="fs-7 text-muted">@input.Help</div>
  66. }
  67. </div>
  68. @await Html.PartialAsync("Input/_Input", input)
  69. </div>
  70. break;
  71. default:
  72. <div class="d-flex flex-column ">
  73. @if (input.Help.Empty())
  74. {
  75. <label class="@(input.LabelClass) @(input.IsRequired ? "required" : "") ">@input.DisplayName</label>
  76. }
  77. else
  78. {
  79. <label class="d-flex align-items-center @(input.LabelClass)">
  80. <span class="@(input.IsRequired ? "required" : "")">@input.DisplayName &nbsp;</span>
  81. <i class="fas fa-exclamation-circle ms-2 fs-7" data-bs-toggle="tooltip" data-bs-delay-hide="800" data-bs-delay-show="200" title="@(input.Help)"></i>
  82. </label>
  83. }
  84. @await Html.PartialAsync("Input/_Input", input)
  85. <div class="invalid-feedback"></div>
  86. </div>
  87. break;
  88. }
  89. }
  90. if (Model.Count>1)
  91. {
  92. @Html.Raw(" </div>")
  93. }
  94. }
  95. else
  96. {
  97. @Html.Raw(input.Special)
  98. }
  99. }
  100. }
  101. }
  102. </div>
  103. }