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:
Marco 2026-04-20 16:11:27 +02:00
commit cab549ab3a
22 changed files with 1725 additions and 356 deletions

View file

@ -6,8 +6,6 @@ public sealed class AppSettingsDocument
public decimal StandardWorkHoursPerDay { get; set; } = 8m;
public decimal LunchBreakHours { get; set; } = 1m;
public decimal HourlyGrossRate { get; set; } = 17.5m;
public decimal ProfitabilityCoefficient { get; set; } = 0.67m;

View file

@ -0,0 +1,20 @@
namespace WorkTracker.Domain;
public sealed class CalendarEventDocument
{
public string Id { get; set; } = string.Empty;
public CalendarEventType EventType { get; set; } = CalendarEventType.Generic;
public string Description { get; set; } = string.Empty;
public TimeOnly? StartTime { get; set; }
public TimeOnly? EndTime { get; set; }
public decimal? DurationHours { get; set; }
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}

View file

@ -0,0 +1,10 @@
namespace WorkTracker.Domain;
public enum CalendarEventType
{
Generic = 0,
DayOff = 1,
Closure = 2,
Holiday = 3,
Illness = 4
}

View file

@ -4,8 +4,6 @@ public sealed class CoeffSnapshotDocument
{
public decimal StandardWorkHoursPerDay { get; set; } = 8m;
public decimal LunchBreakHours { get; set; } = 1m;
public decimal HourlyGrossRate { get; set; } = 17.5m;
public decimal ProfitabilityCoefficient { get; set; } = 0.67m;

View file

@ -8,6 +8,12 @@ public sealed class MonthlySummaryModel
public decimal TotalWorkedHours { get; set; }
public decimal TotalPreviewWorkedHours { get; set; }
public int CountedWorkUnits { get; set; }
public int PreviewWorkUnits { get; set; }
public int OfficeDays { get; set; }
public int HomeDays { get; set; }

View file

@ -6,33 +6,13 @@ public sealed class WorkDayDocument
public DateOnly Date { get; set; }
public TimeOnly? StartTime { get; set; }
public TimeOnly? ProjectedExitTime { get; set; }
public TimeOnly? ActualExitTime { get; set; }
public DayType DayType { get; set; } = DayType.None;
public decimal ExtraHoursDelta { get; set; }
public decimal WorkedHoursBase { get; set; }
public decimal WorkedHoursFinal { get; set; }
public decimal HoursOff { get; set; }
public decimal GrossIncome { get; set; }
public decimal NetIncome { get; set; }
public bool IsWeekend { get; set; }
public bool IsItalianFestivity { get; set; }
public string? Notes { get; set; }
public List<WorkUnitDocument> WorkUnits { get; set; } = [];
public CoeffSnapshotDocument CoeffSnapshot { get; set; } = new();
public List<CalendarEventDocument> CalendarEvents { get; set; } = [];
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;

View file

@ -0,0 +1,34 @@
namespace WorkTracker.Domain;
public sealed class WorkUnitDocument
{
public string Id { get; set; } = string.Empty;
public string Label { get; set; } = "Work unit";
public WorkUnitLocation Location { get; set; } = WorkUnitLocation.Office;
public TimeOnly? StartTime { get; set; }
public TimeOnly? EndTime { get; set; }
public bool IsPreview { get; set; }
public decimal ManualWorkedHours { get; set; }
public decimal CalculatedWorkedHours { get; set; }
public decimal WorkedHoursDelta { get; set; }
public decimal GrossIncome { get; set; }
public decimal NetIncome { get; set; }
public string? Notes { get; set; }
public CoeffSnapshotDocument CoeffSnapshot { get; set; } = new();
public DateTimeOffset CreatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
public DateTimeOffset UpdatedAtUtc { get; set; } = DateTimeOffset.UtcNow;
}

View file

@ -0,0 +1,7 @@
namespace WorkTracker.Domain;
public enum WorkUnitLocation
{
Office = 1,
Home = 2
}