PlanTempusApp/PlanTempus.Application/Features/Services/Components/ServiceDetailPrices/ServiceDetailPricesViewComponent.cs
Janus C. H. Knudsen 5e3811347c Adds comprehensive service detail views and localization
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
2026-01-17 01:21:00 +01:00

105 lines
4.5 KiB
C#

using Microsoft.AspNetCore.Mvc;
using PlanTempus.Application.Features.Localization.Services;
namespace PlanTempus.Application.Features.Services.Components;
public class ServiceDetailPricesViewComponent : ViewComponent
{
private readonly ILocalizationService _localization;
public ServiceDetailPricesViewComponent(ILocalizationService localization)
{
_localization = localization;
}
public IViewComponentResult Invoke(string key)
{
var service = ServiceDetailCatalog.Get(key);
var model = new ServiceDetailPricesViewModel
{
// Data
PriceMode = service.PriceMode,
SimplePrice = service.SimplePrice,
PriceMatrix = service.PriceMatrix,
VatRate = service.VatRate,
ProductCost = service.ProductCost,
Commission = service.Commission,
MemberDiscount = service.MemberDiscount,
GiftCardPayment = service.GiftCardPayment,
LoyaltyPoints = service.LoyaltyPoints,
// Labels - Price structure
LabelPriceStructure = _localization.Get("services.detail.prices.priceStructure"),
LabelSimplePrice = _localization.Get("services.detail.prices.simplePrice"),
LabelMatrixPrice = _localization.Get("services.detail.prices.matrixPrice"),
LabelPrice = _localization.Get("services.detail.prices.price"),
LabelLevel = _localization.Get("services.detail.prices.level"),
LabelShortHair = _localization.Get("services.detail.prices.shortHair"),
LabelMediumHair = _localization.Get("services.detail.prices.mediumHair"),
LabelLongHair = _localization.Get("services.detail.prices.longHair"),
LabelExtraLongHair = _localization.Get("services.detail.prices.extraLongHair"),
LabelAddLevel = _localization.Get("services.detail.prices.addLevel"),
// Labels - Economy
LabelEconomy = _localization.Get("services.detail.prices.economy"),
LabelVatRate = _localization.Get("services.detail.prices.vatRate"),
LabelProductCost = _localization.Get("services.detail.prices.productCost"),
LabelCommission = _localization.Get("services.detail.prices.commission"),
// Labels - Discounts
LabelDiscounts = _localization.Get("services.detail.prices.discounts"),
LabelMemberDiscount = _localization.Get("services.detail.prices.memberDiscount"),
LabelGiftCardPayment = _localization.Get("services.detail.prices.giftCardPayment"),
LabelLoyaltyPoints = _localization.Get("services.detail.prices.loyaltyPoints"),
// Toggle labels
ToggleYes = _localization.Get("common.yes"),
ToggleNo = _localization.Get("common.no")
};
return View(model);
}
}
public class ServiceDetailPricesViewModel
{
// Data
public PriceMode PriceMode { get; init; }
public required string SimplePrice { get; init; }
public required List<PriceMatrixRow> PriceMatrix { get; init; }
public required string VatRate { get; init; }
public required string ProductCost { get; init; }
public required string Commission { get; init; }
public bool MemberDiscount { get; init; }
public bool GiftCardPayment { get; init; }
public bool LoyaltyPoints { get; init; }
// Labels - Price structure
public required string LabelPriceStructure { get; init; }
public required string LabelSimplePrice { get; init; }
public required string LabelMatrixPrice { get; init; }
public required string LabelPrice { get; init; }
public required string LabelLevel { get; init; }
public required string LabelShortHair { get; init; }
public required string LabelMediumHair { get; init; }
public required string LabelLongHair { get; init; }
public required string LabelExtraLongHair { get; init; }
public required string LabelAddLevel { get; init; }
// Labels - Economy
public required string LabelEconomy { get; init; }
public required string LabelVatRate { get; init; }
public required string LabelProductCost { get; init; }
public required string LabelCommission { get; init; }
// Labels - Discounts
public required string LabelDiscounts { get; init; }
public required string LabelMemberDiscount { get; init; }
public required string LabelGiftCardPayment { get; init; }
public required string LabelLoyaltyPoints { get; init; }
// Toggle labels
public required string ToggleYes { get; init; }
public required string ToggleNo { get; init; }
}