2022-04-19 19:43:58 -04:00
|
|
|
@using Humanizer
|
|
|
|
@model WebfrontCore.ViewModels.ActionInfo
|
2018-03-27 00:54:20 -04:00
|
|
|
@{
|
|
|
|
Layout = null;
|
|
|
|
}
|
2022-10-25 15:03:35 -04:00
|
|
|
<h5 class="modal-title mb-10">@(Model.Name?.Split(" ").Length == 1 ? Model.Name?.Titleize() : Model.Name)</h5>
|
2022-06-11 12:34:00 -04:00
|
|
|
@if (Model.Inputs.Any(input => input.Type != "hidden"))
|
2022-04-19 19:43:58 -04:00
|
|
|
{
|
|
|
|
<hr class="mb-10"/>
|
|
|
|
}
|
2019-08-04 18:06:07 -04:00
|
|
|
<form class="action-form @(Model.ShouldRefresh ? "refreshable" : "")" action="/Action/@Model.Action">
|
2018-04-04 15:38:34 -04:00
|
|
|
@foreach (var input in Model.Inputs)
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
var inputType = input.Type ?? "text";
|
|
|
|
var value = input.Value ?? "";
|
2018-03-27 00:54:20 -04:00
|
|
|
|
2019-07-13 21:45:25 -04:00
|
|
|
if (input.Type != "hidden")
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
<div class="input-group mb-10">
|
2018-09-02 17:59:27 -04:00
|
|
|
|
2019-07-13 21:45:25 -04:00
|
|
|
<div class="input-group-prepend">
|
|
|
|
<span class="input-group-text" id="basic-addon-@input.Name">@input.Label</span>
|
2018-09-02 17:59:27 -04:00
|
|
|
</div>
|
|
|
|
|
2019-07-13 21:45:25 -04:00
|
|
|
@if (inputType == "select")
|
|
|
|
{
|
|
|
|
<select name="@input.Name" class="form-control" aria-label="@input.Name" aria-describedby="basic-addon-@input.Name">
|
2022-07-19 21:37:48 -04:00
|
|
|
@foreach (var (key, item) in input.Values)
|
2019-07-13 21:45:25 -04:00
|
|
|
{
|
2022-07-19 21:37:48 -04:00
|
|
|
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>
|
|
|
|
}
|
2019-07-13 21:45:25 -04:00
|
|
|
}
|
|
|
|
</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>
|
|
|
|
}
|
2022-07-20 11:32:26 -04:00
|
|
|
|
|
|
|
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>
|
|
|
|
}
|
2018-04-04 15:38:34 -04:00
|
|
|
|
2019-07-13 21:45:25 -04:00
|
|
|
else
|
|
|
|
{
|
2022-04-19 19:43:58 -04:00
|
|
|
<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">
|
2019-07-13 21:45:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<input type="@inputType" name="@input.Name" value="@value" hidden="hidden">
|
|
|
|
}
|
2018-04-04 15:38:34 -04:00
|
|
|
}
|
2022-06-11 12:34:00 -04:00
|
|
|
@if (Model.Inputs.Any(input => input.Type != "hidden"))
|
2022-04-19 19:43:58 -04:00
|
|
|
{
|
|
|
|
<hr class="mb-10"/>
|
|
|
|
}
|
|
|
|
<div class="ml-auto">
|
|
|
|
<button type="submit" class="btn btn-primary">@Model.ActionButtonLabel</button>
|
2022-07-05 13:02:43 -04:00
|
|
|
<a href="#" class="btn mr-5 ml-5" role="button" onclick="halfmoon.toggleModal('actionModal');">@ViewBag.Localization["WEBFRONT_ACTION_MODAL_BUTTON_CLOSE"]</a>
|
2022-04-19 19:43:58 -04:00
|
|
|
</div>
|
2022-04-08 18:14:04 -04:00
|
|
|
</form>
|