Various CSS work

This commit is contained in:
Janus C. H. Knudsen 2026-01-12 22:10:57 +01:00
parent ef174af0e1
commit 15579acba8
52 changed files with 8001 additions and 944 deletions

View file

@ -0,0 +1,41 @@
@model PlanTempus.Application.Features.Employees.Components.EmployeeDetailHeaderViewModel
<swp-employee-detail-header>
<swp-employee-avatar-large class="@Model.AvatarColor">@Model.Initials</swp-employee-avatar-large>
<swp-employee-info>
<swp-employee-name-row>
<swp-employee-name contenteditable="true">@Model.Name</swp-employee-name>
@if (Model.Tags.Any())
{
<swp-tags-row>
@foreach (var tag in Model.Tags)
{
<swp-tag class="@tag.CssClass">@tag.Text</swp-tag>
}
</swp-tags-row>
}
<swp-employee-status data-active="@Model.IsActive.ToString().ToLower()">
<span class="icon">●</span>
<span class="text">@Model.StatusText</span>
</swp-employee-status>
</swp-employee-name-row>
<swp-fact-boxes-inline>
<swp-fact-inline>
<swp-fact-inline-value>@Model.BookingsThisYear</swp-fact-inline-value>
<swp-fact-inline-label>@Model.LabelBookings</swp-fact-inline-label>
</swp-fact-inline>
<swp-fact-inline>
<swp-fact-inline-value>@Model.RevenueThisYear</swp-fact-inline-value>
<swp-fact-inline-label>@Model.LabelRevenue</swp-fact-inline-label>
</swp-fact-inline>
<swp-fact-inline>
<swp-fact-inline-value>@Model.Rating</swp-fact-inline-value>
<swp-fact-inline-label>@Model.LabelRating</swp-fact-inline-label>
</swp-fact-inline>
<swp-fact-inline>
<swp-fact-inline-value>@Model.EmployedSince</swp-fact-inline-value>
<swp-fact-inline-label>@Model.LabelEmployedSince</swp-fact-inline-label>
</swp-fact-inline>
</swp-fact-boxes-inline>
</swp-employee-info>
</swp-employee-detail-header>

View file

@ -0,0 +1,68 @@
using Microsoft.AspNetCore.Mvc;
using PlanTempus.Application.Features.Localization.Services;
namespace PlanTempus.Application.Features.Employees.Components;
public class EmployeeDetailHeaderViewComponent : ViewComponent
{
private readonly ILocalizationService _localization;
public EmployeeDetailHeaderViewComponent(ILocalizationService localization)
{
_localization = localization;
}
public IViewComponentResult Invoke(string key)
{
var employee = EmployeeDetailCatalog.Get(key);
var model = new EmployeeDetailHeaderViewModel
{
Initials = employee.Initials,
Name = employee.Name,
AvatarColor = employee.AvatarColor,
Role = employee.Role,
RoleText = _localization.Get(employee.RoleKey),
Status = employee.Status,
StatusText = _localization.Get(employee.StatusKey),
BookingsThisYear = employee.BookingsThisYear,
RevenueThisYear = employee.RevenueThisYear,
Rating = employee.Rating,
EmployedSince = employee.EmployedSince,
LabelBookings = _localization.Get("employees.detail.bookings"),
LabelRevenue = _localization.Get("employees.detail.revenue"),
LabelRating = _localization.Get("employees.detail.rating"),
LabelEmployedSince = _localization.Get("employees.detail.employedsince"),
Tags = employee.Tags.Select(t => new EmployeeTagViewModel { Text = t.Text, CssClass = t.CssClass }).ToList()
};
return View(model);
}
}
public class EmployeeDetailHeaderViewModel
{
public required string Initials { get; init; }
public required string Name { get; init; }
public string? AvatarColor { get; init; }
public required string Role { get; init; }
public required string RoleText { get; init; }
public required string Status { get; init; }
public required string StatusText { get; init; }
public bool IsActive => Status == "active";
public required string BookingsThisYear { get; init; }
public required string RevenueThisYear { get; init; }
public required string Rating { get; init; }
public required string EmployedSince { get; init; }
public required string LabelBookings { get; init; }
public required string LabelRevenue { get; init; }
public required string LabelRating { get; init; }
public required string LabelEmployedSince { get; init; }
public List<EmployeeTagViewModel> Tags { get; init; } = new();
}
public class EmployeeTagViewModel
{
public required string Text { get; init; }
public required string CssClass { get; init; }
}