_ModalBody.cshtml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. @using System.Linq;
  2. @model ShwasherSys.Views.Shared.New.Modals.ModalBodyViewModel
  3. <div class="modal-body">
  4. <form class="form-horizontal " id="@Model.FormId">
  5. @{
  6. //string type = "text";
  7. foreach (var i in Model.Inputs)
  8. {
  9. @*if (i.IsHidden)
  10. {
  11. <input id="@i.Id" name="@i.Id" type="hidden" />
  12. continue;
  13. }*@
  14. string oBefore = "", oAfter = "", iBefore = "", iAfter = "";
  15. var special = Model.Specials == null ? null : Model.Specials.FirstOrDefault(a => a.Id == i.Id);
  16. string help = i.Help.IsEmpty() ? "" : "<span class=\"help-block\">" + i.Help + "</span>";
  17. if (!string.IsNullOrEmpty(i.DivOutBefore))
  18. {
  19. oBefore = i.DivOutBefore;
  20. }
  21. if (!string.IsNullOrEmpty(i.DivOutAfter))
  22. {
  23. oAfter = i.DivOutAfter;
  24. }
  25. if (!string.IsNullOrEmpty(i.DivInterBefore))
  26. {
  27. iBefore = i.DivInterBefore;
  28. }
  29. if (!string.IsNullOrEmpty(i.DivInterAfter))
  30. {
  31. iAfter = i.DivInterAfter;
  32. }
  33. @Html.Raw(oBefore)
  34. if (i.IsHidden)
  35. {
  36. <input class="@i.Class @i.Required" id="@i.Id" name="@i.Name" type="hidden" @i.DataOptions @i.Events @i.Disabled @i.ReadOnly style="@i.Styles" @i.Other />
  37. }
  38. else
  39. {
  40. <div class="form-group-sm @i.DivClass" @i.DivOther>
  41. @Html.Raw(i.Label)
  42. @if (special != null)
  43. {
  44. @Html.Raw(special.InputStr)
  45. continue;
  46. }
  47. <div class="@(i.InputLayoutClass)">
  48. @Html.Raw(iBefore)
  49. @Html.Partial("New/Modals/_InputView", i)
  50. @Html.Raw(help)
  51. @Html.Raw(iAfter)
  52. </div>
  53. </div>
  54. }
  55. @Html.Raw(oAfter)
  56. }
  57. }
  58. </form>
  59. </div>
  60. @*
  61. @if (i.InputType == InputTypes.List)
  62. {
  63. var style = i.Styles.IsNullOrEmpty() ? "width:100%" : i.Styles;
  64. var multiple = i.IsMultiple ? "multiple" : "";
  65. <select class="@i.Class @i.Required" id="@i.Id" name="@i.Name" placeholder="@(i.Placeholder)" value="@i.Value" @multiple @i.DataOptions @i.Events @i.Disabled @i.ReadOnly style="@style" @i.Other>
  66. @Html.Raw(i.SelectOptions)
  67. </select>
  68. }
  69. else if (i.InputType == InputTypes.Textarea)
  70. {
  71. <textarea rows="2" class="@i.Class @i.Required" id="@i.Id" name="@i.Name" placeholder="@(i.Placeholder)" value="@i.Value" @i.DataOptions @i.Events @i.Disabled @i.ReadOnly style="@i.Styles" @i.Other></textarea>
  72. }
  73. else if (i.InputType == InputTypes.File)
  74. {
  75. <div class="iwb-file">
  76. @if (i.FileOption == null)
  77. {
  78. <input type="hidden" id="@(i.Id)" name="@(i.Name)" value="" />
  79. <input type="hidden" id="@(i.Id)_name" name="@(i.Name)_name" value="" />
  80. <input type="hidden" id="@(i.Id)_ext" name="@(i.Name)_ext" value="" />
  81. <input class="iwb-file-input" id="@(i.Id)_file" type="file" onclick="FileUpload(this, {targetName:'@(i.Id)_name',targetExt:'@(i.Id)_ext'})">
  82. <label class="iwb-file-label" for="@(i.Id)_file">@L("SelectFile")</label>
  83. }
  84. else
  85. {
  86. var isImage = i.FileOption.IsImage ? "true" : "false";
  87. <input type="hidden" id="@(i.FileOption.FileInfoField)" name="@(i.FileOption.FileInfoField)" value="" />
  88. <input type="hidden" id="@(i.FileOption.FileNameField)" name="@(i.FileOption.FileNameField)" value="" />
  89. <input type="hidden" id="@(i.FileOption.FileExtField)" name="@(i.FileOption.FileExtField)" value="" />
  90. <input class="iwb-file-input" id="@(i.Id)_file" type="file" onclick="FileUpload(this, {targetInfo:'@(i.FileOption.FileInfoField)',targetName:'@(i.FileOption.FileNameField)',targetExt:'@(i.FileOption.FileExtField)',isImage:(@isImage),maxSize:(@i.FileOption.MaxSize)})">
  91. <label class="iwb-file-label" for="@(i.Id)_file">@L("SelectFile")</label>
  92. }
  93. </div>
  94. }
  95. else
  96. {
  97. if (!string.IsNullOrEmpty(i.SearchModalId))
  98. {
  99. <div class="input-group">
  100. <input class="@i.Class @i.Required" id="@i.Id" name="@i.Name" type="@i.TypeStr" placeholder="@(i.Placeholder)" @i.DataOptions @i.Events @i.Disabled @i.ReadOnly style="@i.Styles" @i.Other />
  101. <div class="input-group-addon" style="min-width: 30px;" onclick="ShowQueryModal('@i.SearchModalId','@(i.Target)');">
  102. <i class="iconfont icon-search"></i>
  103. </div>
  104. </div>
  105. }
  106. else
  107. {
  108. <input class="@i.Class @i.Required" id="@i.Id" name="@i.Name" type="@i.TypeStr" placeholder="@(i.Placeholder)" @i.DataOptions @i.Events @i.Disabled @i.ReadOnly style="@i.Styles" @i.Other />
  109. }
  110. }
  111. *@