Enhance employee stats view with completed bookings

Adds a new data table to employee detail stats showing completed bookings

Includes:
- Expanded EmployeeDetailStatsViewComponent with booking data
- Updated localization translations for new table labels
- Created mock booking data for demonstration
- Updated .gitignore to simplify temporary file handling
This commit is contained in:
Janus C. H. Knudsen 2026-01-13 23:46:38 +01:00
parent f71f00099a
commit e739ce2ac7
11 changed files with 895 additions and 62 deletions

View file

@ -22,4 +22,33 @@
</swp-stat-card>
</swp-stats-row>
</swp-card>
<swp-card class="stats-bookings">
<swp-section-label>@Model.LabelCompletedBookings</swp-section-label>
<swp-data-table>
<swp-data-table-header>
<swp-data-table-cell>@Model.LabelDate</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelTime</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelCustomer</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelServices</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelDuration</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelAmount</swp-data-table-cell>
<swp-data-table-cell>@Model.LabelStatus</swp-data-table-cell>
</swp-data-table-header>
@foreach (var booking in Model.CompletedBookings)
{
<swp-data-table-row>
<swp-data-table-cell>@booking.Date</swp-data-table-cell>
<swp-data-table-cell>@booking.Time</swp-data-table-cell>
<swp-data-table-cell>@booking.Customer</swp-data-table-cell>
<swp-data-table-cell>@booking.Services</swp-data-table-cell>
<swp-data-table-cell>@booking.Duration</swp-data-table-cell>
<swp-data-table-cell>@booking.Amount</swp-data-table-cell>
<swp-data-table-cell>
<swp-status-badge class="@booking.StatusClass">@booking.Status</swp-status-badge>
</swp-data-table-cell>
</swp-data-table-row>
}
</swp-data-table>
</swp-card>
</swp-detail-grid>

View file

@ -25,11 +25,32 @@ public class EmployeeDetailStatsViewComponent : ViewComponent
LabelBookingsThisYear = _localization.Get("employees.detail.stats.bookingsyear"),
LabelRevenueThisYear = _localization.Get("employees.detail.stats.revenueyear"),
LabelAvgRating = _localization.Get("employees.detail.stats.avgrating"),
LabelOccupancy = _localization.Get("employees.detail.stats.occupancy")
LabelOccupancy = _localization.Get("employees.detail.stats.occupancy"),
LabelCompletedBookings = _localization.Get("employees.detail.stats.completedbookings"),
LabelDate = _localization.Get("employees.detail.stats.date"),
LabelTime = _localization.Get("employees.detail.stats.time"),
LabelCustomer = _localization.Get("employees.detail.stats.customer"),
LabelServices = _localization.Get("employees.detail.stats.services"),
LabelDuration = _localization.Get("employees.detail.stats.duration"),
LabelAmount = _localization.Get("employees.detail.stats.amount"),
LabelStatus = _localization.Get("employees.detail.stats.status"),
CompletedBookings = GetMockBookings()
};
return View(model);
}
private List<CompletedBookingItem> GetMockBookings()
{
return new List<CompletedBookingItem>
{
new() { Date = "23. dec 2024", Time = "10:00", Customer = "Maria Hansen", Services = "Dameklip, Bundfarve", Duration = "2t 30m", Amount = "1.510 kr", Status = "Betalt", StatusClass = "paid" },
new() { Date = "23. dec 2024", Time = "14:30", Customer = "Sofie Nielsen", Services = "Herreklip", Duration = "30m", Amount = "350 kr", Status = "Betalt", StatusClass = "paid" },
new() { Date = "22. dec 2024", Time = "09:00", Customer = "Emma Pedersen", Services = "Dameklip, Highlights", Duration = "3t 15m", Amount = "2.150 kr", Status = "Afventer", StatusClass = "pending" },
new() { Date = "22. dec 2024", Time = "13:00", Customer = "Anne Larsen", Services = "Dameklip", Duration = "45m", Amount = "450 kr", Status = "Betalt", StatusClass = "paid" },
new() { Date = "21. dec 2024", Time = "11:00", Customer = "Katrine Jensen", Services = "Balayage, Olaplex", Duration = "4t", Amount = "3.200 kr", Status = "Betalt", StatusClass = "paid" }
};
}
}
public class EmployeeDetailStatsViewModel
@ -42,4 +63,25 @@ public class EmployeeDetailStatsViewModel
public required string LabelRevenueThisYear { get; init; }
public required string LabelAvgRating { get; init; }
public required string LabelOccupancy { get; init; }
public required string LabelCompletedBookings { get; init; }
public required string LabelDate { get; init; }
public required string LabelTime { get; init; }
public required string LabelCustomer { get; init; }
public required string LabelServices { get; init; }
public required string LabelDuration { get; init; }
public required string LabelAmount { get; init; }
public required string LabelStatus { get; init; }
public required List<CompletedBookingItem> CompletedBookings { get; init; }
}
public class CompletedBookingItem
{
public required string Date { get; init; }
public required string Time { get; init; }
public required string Customer { get; init; }
public required string Services { get; init; }
public required string Duration { get; init; }
public required string Amount { get; init; }
public required string Status { get; init; }
public required string StatusClass { get; init; }
}