mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-24 22:58:28 +01:00
34 lines
1.1 KiB
Text
34 lines
1.1 KiB
Text
@using BTCPayServer.Abstractions.Form
|
|
@using Newtonsoft.Json.Linq
|
|
@model BTCPayServer.Abstractions.Form.Field
|
|
@{
|
|
var isInvalid = this.ViewContext.ModelState[Model.Name]?.ValidationState is Microsoft.AspNetCore.Mvc.ModelBinding.ModelValidationState.Invalid;
|
|
var error = isInvalid ? this.ViewContext.ModelState[Model.Name].Errors[0].ErrorMessage : null;
|
|
|
|
}
|
|
<div class="form-group">
|
|
@if (Model.Required)
|
|
{
|
|
<label class="form-label" for="@Model.Name" data-required>
|
|
@Model.Label
|
|
</label>
|
|
}
|
|
else
|
|
{
|
|
<label class="form-label" for="@Model.Name">
|
|
@Model.Label
|
|
</label>
|
|
}
|
|
|
|
<input class="form-control @(Model.IsValid() ? "" : "is-invalid")" id="@Model.Name" type="@Model.Type" required="@Model.Required" name="@Model.Name" value="@Model.Value" aria-describedby="@("HelpText" + Model.Name)"/>
|
|
@if(isInvalid)
|
|
{
|
|
<span class="text-danger">@error</span>
|
|
}
|
|
@if (!string.IsNullOrEmpty(Model.HelpText))
|
|
{
|
|
<div id="@("HelpText" + Model.Name)" class="form-text">@Model.HelpText</div>
|
|
}
|
|
|
|
|
|
</div>
|