Adds comprehensive service detail view with multiple tabs and dynamic interactions Implements client-side navigation between service list and detail views Introduces mock service data catalog for flexible component rendering Extends localization support for new service detail screens Improves user experience by adding edit capabilities and smooth view transitions
61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using PlanTempus.Application.Features.Localization.Services;
|
|
|
|
namespace PlanTempus.Application.Features.Services.Components;
|
|
|
|
public class ServiceDetailHeaderViewComponent : ViewComponent
|
|
{
|
|
private readonly ILocalizationService _localization;
|
|
|
|
public ServiceDetailHeaderViewComponent(ILocalizationService localization)
|
|
{
|
|
_localization = localization;
|
|
}
|
|
|
|
public IViewComponentResult Invoke(string key)
|
|
{
|
|
var service = ServiceDetailCatalog.Get(key);
|
|
|
|
var model = new ServiceDetailHeaderViewModel
|
|
{
|
|
Name = service.Name,
|
|
IsActive = service.IsActive,
|
|
StatusText = service.IsActive
|
|
? _localization.Get("services.detail.header.active")
|
|
: _localization.Get("services.detail.header.inactive"),
|
|
DurationRange = service.DurationRange,
|
|
FromPrice = service.FromPrice,
|
|
EmployeeCount = service.EmployeeCount,
|
|
BookingsThisYear = service.BookingsThisYear,
|
|
LabelDuration = _localization.Get("services.detail.header.duration"),
|
|
LabelFromPrice = _localization.Get("services.detail.header.fromPrice"),
|
|
LabelEmployees = _localization.Get("services.detail.header.employees"),
|
|
LabelBookingsThisYear = _localization.Get("services.detail.header.bookingsThisYear"),
|
|
Tags = service.Tags.Select(t => new ServiceTagViewModel { Text = t.Text, CssClass = t.CssClass }).ToList()
|
|
};
|
|
|
|
return View(model);
|
|
}
|
|
}
|
|
|
|
public class ServiceDetailHeaderViewModel
|
|
{
|
|
public required string Name { get; init; }
|
|
public required bool IsActive { get; init; }
|
|
public required string StatusText { get; init; }
|
|
public required string DurationRange { get; init; }
|
|
public required string FromPrice { get; init; }
|
|
public required string EmployeeCount { get; init; }
|
|
public required string BookingsThisYear { get; init; }
|
|
public required string LabelDuration { get; init; }
|
|
public required string LabelFromPrice { get; init; }
|
|
public required string LabelEmployees { get; init; }
|
|
public required string LabelBookingsThisYear { get; init; }
|
|
public List<ServiceTagViewModel> Tags { get; init; } = new();
|
|
}
|
|
|
|
public class ServiceTagViewModel
|
|
{
|
|
public required string Text { get; init; }
|
|
public required string CssClass { get; init; }
|
|
}
|