44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
<div class="col input-group">
|
|
<span class="input-group-text">@CurrReq.Key</span>
|
|
<input type="number" readonly class="form-control" value="@FormattedValue" />
|
|
@* <InputPercent CssClass="form-control" Value="@((decimal)CurrReq.Value)" ValueChanged="SetPerc"></InputPercent> *@
|
|
@if (Mode == TimeEstim.SetMode.Balance)
|
|
{
|
|
<button class="btn btn-sm btn-outline-success" @onclick="() => SetPerc(0)">0%</button>
|
|
<button class="btn btn-sm btn-outline-success" @onclick="() => SetPerc((decimal)0.5)">50%</button>
|
|
<button class="btn btn-sm btn-outline-success" @onclick="() => SetPerc(1)">100%</button>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
|
|
public record PercRequest(string Key, double Value);
|
|
|
|
[Parameter]
|
|
public PercRequest CurrReq { get; set; } = null!;
|
|
|
|
[Parameter]
|
|
public TimeEstim.SetMode Mode { get; set; } = TimeEstim.SetMode.None;
|
|
|
|
private string FormattedValue{
|
|
get
|
|
{
|
|
double ans = CurrReq.Value * 100;
|
|
return ans.ToString("F0", System.Globalization.CultureInfo.InvariantCulture) ?? "0";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Event for update
|
|
/// </summary>
|
|
[Parameter]
|
|
public EventCallback<PercRequest> EC_Updated { get; set; }
|
|
|
|
private async Task SetPerc(decimal reqValue)
|
|
{
|
|
CurrReq = CurrReq with { Value = (double)reqValue };
|
|
await EC_Updated.InvokeAsync(CurrReq);
|
|
}
|
|
|
|
}
|