Refactor AppSettingsDocument and CoeffSnapshotDocument: Remove LunchBreakHours property
Add CalendarEventDocument and CalendarEventType enum for event management Update WorkDayDocument to include WorkUnitDocument and CalendarEventDocument lists Enhance CouchbaseLiteWorkDayService with methods for managing WorkUnit and CalendarEvent Revise MonthlySummaryModel to track preview worked hours and counted work units Improve CSS for calendar view, including responsive design and new item styles
This commit is contained in:
parent
08e573d63c
commit
cab549ab3a
22 changed files with 1725 additions and 356 deletions
|
|
@ -15,6 +15,11 @@
|
|||
<button class="btn btn-outline-secondary btn-sm" @onclick="NextMonth">Next »</button>
|
||||
</div>
|
||||
|
||||
<div class="form-check mb-3">
|
||||
<input id="include-preview" type="checkbox" class="form-check-input" checked="@includePreview" @onchange="OnIncludePreviewChanged" />
|
||||
<label class="form-check-label" for="include-preview">Include preview work units in totals</label>
|
||||
</div>
|
||||
|
||||
@if (loading)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
|
|
@ -30,11 +35,35 @@ else if (summary is not null)
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Counted Work Units</div>
|
||||
<div class="fs-3 fw-bold">@summary.CountedWorkUnits</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Total Worked Hours</div>
|
||||
<div class="fs-3 fw-bold">@summary.TotalWorkedHours.ToString("N1")h</div>
|
||||
<div class="fs-3 fw-bold">@FormatHours(summary.TotalWorkedHours)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Preview Hours</div>
|
||||
<div class="fs-3 fw-bold">@FormatHours(summary.TotalPreviewWorkedHours)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Preview Units</div>
|
||||
<div class="fs-3 fw-bold">@summary.PreviewWorkUnits</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -42,7 +71,7 @@ else if (summary is not null)
|
|||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Hours Off</div>
|
||||
<div class="fs-3 fw-bold">@summary.TotalHoursOff.ToString("N1")h</div>
|
||||
<div class="fs-3 fw-bold">@FormatHours(summary.TotalHoursOff)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -89,8 +118,8 @@ else if (summary is not null)
|
|||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Sick Days</div>
|
||||
<div class="fs-3 fw-bold">@summary.SickDays</div>
|
||||
<div class="text-muted small">Closure Days</div>
|
||||
<div class="fs-3 fw-bold">@summary.ClosureDays</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -105,8 +134,8 @@ else if (summary is not null)
|
|||
<div class="col-6 col-md-4 col-xl-3">
|
||||
<div class="card text-center h-100">
|
||||
<div class="card-body">
|
||||
<div class="text-muted small">Closure Days</div>
|
||||
<div class="fs-3 fw-bold">@summary.ClosureDays</div>
|
||||
<div class="text-muted small">Sick Days</div>
|
||||
<div class="fs-3 fw-bold">@summary.SickDays</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -118,6 +147,7 @@ else if (summary is not null)
|
|||
|
||||
private DateOnly currentMonth;
|
||||
private bool loading = true;
|
||||
private bool includePreview;
|
||||
private MonthlySummaryModel? summary;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
|
@ -134,10 +164,16 @@ else if (summary is not null)
|
|||
await LoadSummary();
|
||||
}
|
||||
|
||||
private async Task OnIncludePreviewChanged(ChangeEventArgs e)
|
||||
{
|
||||
includePreview = e.Value is bool value && value;
|
||||
await LoadSummary();
|
||||
}
|
||||
|
||||
private async Task LoadSummary()
|
||||
{
|
||||
loading = true;
|
||||
summary = await WorkDayService.GetMonthlySummaryAsync(currentMonth.Year, currentMonth.Month);
|
||||
summary = await WorkDayService.GetMonthlySummaryAsync(currentMonth.Year, currentMonth.Month, includePreview);
|
||||
loading = false;
|
||||
}
|
||||
|
||||
|
|
@ -152,4 +188,12 @@ else if (summary is not null)
|
|||
currentMonth = currentMonth.AddMonths(1);
|
||||
await LoadSummary();
|
||||
}
|
||||
|
||||
private static string FormatHours(decimal value)
|
||||
{
|
||||
var totalMinutes = (int)Math.Round(value * 60m, MidpointRounding.AwayFromZero);
|
||||
var hours = totalMinutes / 60;
|
||||
var minutes = totalMinutes % 60;
|
||||
return $"{hours:00}:{minutes:00}";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue