Scaffolded project
This commit is contained in:
commit
17a561094a
123 changed files with 64313 additions and 0 deletions
13
Components/Pages/Auth.razor
Normal file
13
Components/Pages/Auth.razor
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
@page "/auth"
|
||||
|
||||
@using Microsoft.AspNetCore.Authorization
|
||||
|
||||
@attribute [Authorize]
|
||||
|
||||
<PageTitle>Auth</PageTitle>
|
||||
|
||||
<h1>You are authenticated</h1>
|
||||
|
||||
<AuthorizeView>
|
||||
Hello @context.User.Identity?.Name!
|
||||
</AuthorizeView>
|
||||
19
Components/Pages/Counter.razor
Normal file
19
Components/Pages/Counter.razor
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
@page "/counter"
|
||||
@rendermode InteractiveServer
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
36
Components/Pages/Error.razor
Normal file
36
Components/Pages/Error.razor
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
@page "/Error"
|
||||
@using System.Diagnostics
|
||||
|
||||
<PageTitle>Error</PageTitle>
|
||||
|
||||
<h1 class="text-danger">Error.</h1>
|
||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||
|
||||
@if (ShowRequestId)
|
||||
{
|
||||
<p>
|
||||
<strong>Request ID:</strong> <code>@RequestId</code>
|
||||
</p>
|
||||
}
|
||||
|
||||
<h3>Development Mode</h3>
|
||||
<p>
|
||||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||
</p>
|
||||
<p>
|
||||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
|
||||
It can result in displaying sensitive information from exceptions to end users.
|
||||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
|
||||
and restarting the app.
|
||||
</p>
|
||||
|
||||
@code{
|
||||
[CascadingParameter]
|
||||
private HttpContext? HttpContext { get; set; }
|
||||
|
||||
private string? RequestId { get; set; }
|
||||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
|
||||
|
||||
protected override void OnInitialized() =>
|
||||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
|
||||
}
|
||||
42
Components/Pages/Home.razor
Normal file
42
Components/Pages/Home.razor
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
@page "/"
|
||||
|
||||
<PageTitle>WorkTracker</PageTitle>
|
||||
|
||||
<h1>WorkTracker</h1>
|
||||
|
||||
<p class="lead">Phase 1 baseline is active: authentication, locale defaults, and configurable settings with MongoDB storage.</p>
|
||||
|
||||
<div class="row g-3 mt-1">
|
||||
<div class="col-12 col-md-6 col-xl-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h2 class="h5 card-title">Default work model</h2>
|
||||
<ul class="mb-0">
|
||||
<li>Standard day: 8h</li>
|
||||
<li>Lunch break: 1h</li>
|
||||
<li>Hourly gross: €17.50</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 col-xl-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h2 class="h5 card-title">Tax coefficients</h2>
|
||||
<ul class="mb-0">
|
||||
<li>Redditività: 67%</li>
|
||||
<li>INPS: 26,07%</li>
|
||||
<li>Imposta sostitutiva: 15%</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-12 col-xl-4">
|
||||
<div class="card h-100">
|
||||
<div class="card-body">
|
||||
<h2 class="h5 card-title">Next step</h2>
|
||||
<p class="mb-0">Open <a href="settings">Settings</a> to adjust the default values used to prefill each workday.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
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}";
|
||||
}
|
||||
}
|
||||
64
Components/Pages/Weather.razor
Normal file
64
Components/Pages/Weather.razor
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
@page "/weather"
|
||||
@attribute [StreamRendering]
|
||||
|
||||
<PageTitle>Weather</PageTitle>
|
||||
|
||||
<h1>Weather</h1>
|
||||
|
||||
<p>This component demonstrates showing data.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th aria-label="Temperature in Celsius">Temp. (C)</th>
|
||||
<th aria-label="Temperature in Farenheit">Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Simulate asynchronous loading to demonstrate streaming rendering
|
||||
await Task.Delay(500);
|
||||
|
||||
var startDate = DateOnly.FromDateTime(DateTime.Now);
|
||||
var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" };
|
||||
forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = startDate.AddDays(index),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = summaries[Random.Shared.Next(summaries.Length)]
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
private class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
public int TemperatureC { get; set; }
|
||||
public string? Summary { get; set; }
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue