Implements new service detail tabs for prices, duration, and rules Extends localization support for Danish and English translations Adds dynamic view components for managing service-specific configurations Introduces flexible pricing, duration, and booking rule management Enhances service management with granular configuration options
57 lines
2.2 KiB
C#
57 lines
2.2 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
|
using PlanTempus.Application.Features.Localization.Services;
|
|
|
|
namespace PlanTempus.Application.Features.Services.Components;
|
|
|
|
public class ServiceDetailDurationViewComponent : ViewComponent
|
|
{
|
|
private readonly ILocalizationService _localization;
|
|
|
|
public ServiceDetailDurationViewComponent(ILocalizationService localization)
|
|
{
|
|
_localization = localization;
|
|
}
|
|
|
|
public IViewComponentResult Invoke(string key)
|
|
{
|
|
var service = ServiceDetailCatalog.Get(key);
|
|
|
|
var model = new ServiceDetailDurationViewModel
|
|
{
|
|
// Data
|
|
DurationVariants = service.DurationVariants,
|
|
BufferBefore = service.BufferBefore,
|
|
BufferAfter = service.BufferAfter,
|
|
CleanupTime = service.CleanupTime,
|
|
|
|
// Labels
|
|
LabelDurationVariants = _localization.Get("services.detail.duration.durationVariants"),
|
|
LabelAddVariant = _localization.Get("services.detail.duration.addVariant"),
|
|
LabelBufferTimes = _localization.Get("services.detail.duration.bufferTimes"),
|
|
LabelBufferBefore = _localization.Get("services.detail.duration.bufferBefore"),
|
|
LabelBufferAfter = _localization.Get("services.detail.duration.bufferAfter"),
|
|
LabelCleanupTime = _localization.Get("services.detail.duration.cleanupTime"),
|
|
LabelMinutes = _localization.Get("services.detail.duration.minutes")
|
|
};
|
|
|
|
return View(model);
|
|
}
|
|
}
|
|
|
|
public class ServiceDetailDurationViewModel
|
|
{
|
|
// Data
|
|
public required List<DurationVariant> DurationVariants { get; init; }
|
|
public required string BufferBefore { get; init; }
|
|
public required string BufferAfter { get; init; }
|
|
public required string CleanupTime { get; init; }
|
|
|
|
// Labels
|
|
public required string LabelDurationVariants { get; init; }
|
|
public required string LabelAddVariant { get; init; }
|
|
public required string LabelBufferTimes { get; init; }
|
|
public required string LabelBufferBefore { get; init; }
|
|
public required string LabelBufferAfter { get; init; }
|
|
public required string LabelCleanupTime { get; init; }
|
|
public required string LabelMinutes { get; init; }
|
|
}
|