Scaffolded project
This commit is contained in:
commit
17a561094a
123 changed files with 64313 additions and 0 deletions
84
Components/Pages/Settings.razor
Normal file
84
Components/Pages/Settings.razor
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
@page "/settings"
|
||||
@attribute [Authorize]
|
||||
|
||||
@inject IAppSettingsService AppSettingsService
|
||||
|
||||
<PageTitle>Settings</PageTitle>
|
||||
|
||||
<h1>Settings</h1>
|
||||
<p class="text-muted">Default values used to prefill each workday. Every day can still override these values.</p>
|
||||
|
||||
@if (settings is null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<EditForm Model="settings" OnValidSubmit="SaveAsync">
|
||||
<DataAnnotationsValidator />
|
||||
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Standard work hours/day</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.StandardWorkHoursPerDay" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Lunch break hours</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.LunchBreakHours" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Hourly gross rate (€)</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.HourlyGrossRate" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Profitability coefficient</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.ProfitabilityCoefficient" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">INPS rate</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.InpsRate" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Substitute tax rate</label>
|
||||
<InputNumber class="form-control" @bind-Value="settings.SubstituteTaxRate" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Locale</label>
|
||||
<InputText class="form-control" @bind-Value="settings.Locale" />
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
<label class="form-label">Currency</label>
|
||||
<InputText class="form-control" @bind-Value="settings.Currency" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex align-items-center gap-2 mt-4">
|
||||
<button class="btn btn-primary" type="submit">Save</button>
|
||||
@if (!string.IsNullOrWhiteSpace(statusMessage))
|
||||
{
|
||||
<span class="text-success">@statusMessage</span>
|
||||
}
|
||||
</div>
|
||||
</EditForm>
|
||||
}
|
||||
|
||||
@code {
|
||||
private AppSettingsDocument? settings;
|
||||
private string? statusMessage;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
settings = await AppSettingsService.GetAsync();
|
||||
}
|
||||
|
||||
private async Task SaveAsync()
|
||||
{
|
||||
if (settings is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
settings = await AppSettingsService.SaveAsync(settings);
|
||||
statusMessage = $"Saved at {DateTime.Now:t}";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue