- Introduced AppThemeMode enum to define theme options: System, Light, Dark. - Updated AppSettingsDocument to include ThemeMode property. - Created AppThemeState service to manage current theme mode and handle changes. - Integrated theme mode handling in CouchbaseLiteAppSettingsService for persistence. - Added JavaScript for theme management in the frontend, supporting system preference detection. - Enhanced CSS with theme variables for consistent styling across light and dark modes. - Updated Playwright tests to ensure sidebar functionality and responsiveness.
90 lines
3.2 KiB
Text
90 lines
3.2 KiB
Text
@page "/settings"
|
|
@attribute [Authorize]
|
|
|
|
@inject IAppSettingsService AppSettingsService
|
|
@inject AppThemeState ThemeState
|
|
|
|
<PageTitle>Settings</PageTitle>
|
|
|
|
<h1>Settings</h1>
|
|
<p class="text-muted">Default values used to compute manual work-unit totals and income.</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">Theme</label>
|
|
<InputSelect class="form-select" @bind-Value="settings.ThemeMode">
|
|
<option value="@AppThemeMode.System">Follow system</option>
|
|
<option value="@AppThemeMode.Light">Light</option>
|
|
<option value="@AppThemeMode.Dark">Dark</option>
|
|
</InputSelect>
|
|
</div>
|
|
<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">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);
|
|
ThemeState.SetThemeMode(settings.ThemeMode);
|
|
statusMessage = $"Saved at {DateTime.Now:t}";
|
|
}
|
|
}
|