45 lines
1.7 KiB
C#
45 lines
1.7 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using PlanTempus.Application.Features.Localization.Services;
|
|
|
|
namespace PlanTempus.Application.Features.Employees.Components;
|
|
|
|
public class EmployeeDetailStatsViewComponent : ViewComponent
|
|
{
|
|
private readonly ILocalizationService _localization;
|
|
|
|
public EmployeeDetailStatsViewComponent(ILocalizationService localization)
|
|
{
|
|
_localization = localization;
|
|
}
|
|
|
|
public IViewComponentResult Invoke(string key)
|
|
{
|
|
var employee = EmployeeDetailCatalog.Get(key);
|
|
|
|
var model = new EmployeeDetailStatsViewModel
|
|
{
|
|
BookingsThisYear = employee.BookingsThisYear,
|
|
RevenueThisYear = employee.RevenueThisYear,
|
|
Rating = employee.Rating,
|
|
LabelPerformance = _localization.Get("employees.detail.stats.performance"),
|
|
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")
|
|
};
|
|
|
|
return View(model);
|
|
}
|
|
}
|
|
|
|
public class EmployeeDetailStatsViewModel
|
|
{
|
|
public required string BookingsThisYear { get; init; }
|
|
public required string RevenueThisYear { get; init; }
|
|
public required string Rating { get; init; }
|
|
public required string LabelPerformance { get; init; }
|
|
public required string LabelBookingsThisYear { get; init; }
|
|
public required string LabelRevenueThisYear { get; init; }
|
|
public required string LabelAvgRating { get; init; }
|
|
public required string LabelOccupancy { get; init; }
|
|
}
|