81 lines
3.2 KiB
Plaintext
81 lines
3.2 KiB
Plaintext
@using Humanizer
|
|
@model WebfrontCore.ViewModels.ActionInfo
|
|
@{
|
|
Layout = null;
|
|
}
|
|
<h5 class="modal-title mb-10">@Model.Name.Titleize()</h5>
|
|
@if (Model.Inputs.Any(input => input.Type != "hidden"))
|
|
{
|
|
<hr class="mb-10"/>
|
|
}
|
|
<form class="action-form @(Model.ShouldRefresh ? "refreshable" : "")" action="/Action/@Model.Action">
|
|
@foreach (var input in Model.Inputs)
|
|
{
|
|
var inputType = input.Type ?? "text";
|
|
var value = input.Value ?? "";
|
|
|
|
if (input.Type != "hidden")
|
|
{
|
|
<div class="input-group mb-10">
|
|
|
|
<div class="input-group-prepend">
|
|
<span class="input-group-text" id="basic-addon-@input.Name">@input.Label</span>
|
|
</div>
|
|
|
|
@if (inputType == "select")
|
|
{
|
|
<select name="@input.Name" class="form-control" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
|
|
@foreach (var (key, item) in input.Values)
|
|
{
|
|
if (key.StartsWith("!selected!"))
|
|
{
|
|
<option value="@key.Replace("!selected!", "")" selected>
|
|
<color-code value="@item"></color-code>
|
|
</option>
|
|
}
|
|
else
|
|
{
|
|
<option value="@key">
|
|
<color-code value="@item"></color-code>
|
|
</option>
|
|
}
|
|
}
|
|
</select>
|
|
}
|
|
|
|
else if (inputType == "checkbox")
|
|
{
|
|
<div class="btn-group-toggle" data-toggle="buttons">
|
|
<label class="btn btn-primary active">
|
|
<input type="checkbox" name="@input.Name" @(input.Checked ? "checked" : "") autocomplete="off">@input.Label
|
|
</label>
|
|
</div>
|
|
}
|
|
|
|
else if (inputType == "textarea")
|
|
{
|
|
<textarea name="@input.Name" class="form-control @(input.Required ? "required" : "")" placeholder="@input.Placeholder" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">@value</textarea>
|
|
}
|
|
|
|
else
|
|
{
|
|
<input type="@inputType" name="@input.Name" value="@value" class="form-control @(input.Required ? "required" : "")" placeholder="@input.Placeholder" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
|
|
}
|
|
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<input type="@inputType" name="@input.Name" value="@value" hidden="hidden">
|
|
}
|
|
}
|
|
@if (Model.Inputs.Any(input => input.Type != "hidden"))
|
|
{
|
|
<hr class="mb-10"/>
|
|
}
|
|
<div class="ml-auto">
|
|
<button type="submit" class="btn btn-primary">@Model.ActionButtonLabel</button>
|
|
<a href="#" class="btn mr-5 ml-5" role="button" onclick="halfmoon.toggleModal('actionModal');">@ViewBag.Localization["WEBFRONT_ACTION_MODAL_BUTTON_CLOSE"]</a>
|
|
</div>
|
|
</form>
|