112 lines
5.1 KiB
C#
112 lines
5.1 KiB
C#
|
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
using PlanTempus.Application.Features.Localization.Services;
|
||
|
|
|
||
|
|
namespace PlanTempus.Application.Features.Services.Components;
|
||
|
|
|
||
|
|
public class ServiceDetailRulesViewComponent : ViewComponent
|
||
|
|
{
|
||
|
|
private readonly ILocalizationService _localization;
|
||
|
|
|
||
|
|
public ServiceDetailRulesViewComponent(ILocalizationService localization)
|
||
|
|
{
|
||
|
|
_localization = localization;
|
||
|
|
}
|
||
|
|
|
||
|
|
public IViewComponentResult Invoke(string key)
|
||
|
|
{
|
||
|
|
var service = ServiceDetailCatalog.Get(key);
|
||
|
|
|
||
|
|
var model = new ServiceDetailRulesViewModel
|
||
|
|
{
|
||
|
|
// Data
|
||
|
|
MinNotice = service.MinNotice,
|
||
|
|
MaxAdvanceBooking = service.MaxAdvanceBooking,
|
||
|
|
CancellationDeadline = service.CancellationDeadline,
|
||
|
|
NoShowFee = service.NoShowFee,
|
||
|
|
RequiresConsultation = service.RequiresConsultation,
|
||
|
|
RequiresPatchTest = service.RequiresPatchTest,
|
||
|
|
AgeRestriction = service.AgeRestriction,
|
||
|
|
ShowInOnlineBooking = service.ShowInOnlineBookingRules,
|
||
|
|
AllowEmployeeSelection = service.AllowEmployeeSelection,
|
||
|
|
ShowPrice = service.ShowPrice,
|
||
|
|
ShowDuration = service.ShowDuration,
|
||
|
|
|
||
|
|
// Labels - Booking rules
|
||
|
|
LabelBookingRules = _localization.Get("services.detail.rules.bookingRules"),
|
||
|
|
LabelMinNotice = _localization.Get("services.detail.rules.minNotice"),
|
||
|
|
LabelMaxAdvanceBooking = _localization.Get("services.detail.rules.maxAdvanceBooking"),
|
||
|
|
LabelCancellationDeadline = _localization.Get("services.detail.rules.cancellationDeadline"),
|
||
|
|
LabelNoShowFee = _localization.Get("services.detail.rules.noShowFee"),
|
||
|
|
|
||
|
|
// Labels - Requirements
|
||
|
|
LabelRequirements = _localization.Get("services.detail.rules.requirements"),
|
||
|
|
LabelRequiresConsultation = _localization.Get("services.detail.rules.requiresConsultation"),
|
||
|
|
LabelRequiresConsultationDesc = _localization.Get("services.detail.rules.requiresConsultationDesc"),
|
||
|
|
LabelRequiresPatchTest = _localization.Get("services.detail.rules.requiresPatchTest"),
|
||
|
|
LabelRequiresPatchTestDesc = _localization.Get("services.detail.rules.requiresPatchTestDesc"),
|
||
|
|
LabelAgeRestriction = _localization.Get("services.detail.rules.ageRestriction"),
|
||
|
|
LabelAgeRestrictionDesc = _localization.Get("services.detail.rules.ageRestrictionDesc"),
|
||
|
|
|
||
|
|
// Labels - Online booking settings
|
||
|
|
LabelOnlineBookingSettings = _localization.Get("services.detail.rules.onlineBookingSettings"),
|
||
|
|
LabelShowInOnlineBooking = _localization.Get("services.detail.rules.showInOnlineBooking"),
|
||
|
|
LabelAllowEmployeeSelection = _localization.Get("services.detail.rules.allowEmployeeSelection"),
|
||
|
|
LabelShowPrice = _localization.Get("services.detail.rules.showPrice"),
|
||
|
|
LabelShowDuration = _localization.Get("services.detail.rules.showDuration"),
|
||
|
|
|
||
|
|
// Toggle labels
|
||
|
|
ToggleYes = _localization.Get("common.yes"),
|
||
|
|
ToggleNo = _localization.Get("common.no")
|
||
|
|
};
|
||
|
|
|
||
|
|
return View(model);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ServiceDetailRulesViewModel
|
||
|
|
{
|
||
|
|
// Data - Booking rules
|
||
|
|
public required string MinNotice { get; init; }
|
||
|
|
public required string MaxAdvanceBooking { get; init; }
|
||
|
|
public required string CancellationDeadline { get; init; }
|
||
|
|
public required string NoShowFee { get; init; }
|
||
|
|
|
||
|
|
// Data - Requirements
|
||
|
|
public bool RequiresConsultation { get; init; }
|
||
|
|
public bool RequiresPatchTest { get; init; }
|
||
|
|
public bool AgeRestriction { get; init; }
|
||
|
|
|
||
|
|
// Data - Online booking settings
|
||
|
|
public bool ShowInOnlineBooking { get; init; }
|
||
|
|
public bool AllowEmployeeSelection { get; init; }
|
||
|
|
public bool ShowPrice { get; init; }
|
||
|
|
public bool ShowDuration { get; init; }
|
||
|
|
|
||
|
|
// Labels - Booking rules
|
||
|
|
public required string LabelBookingRules { get; init; }
|
||
|
|
public required string LabelMinNotice { get; init; }
|
||
|
|
public required string LabelMaxAdvanceBooking { get; init; }
|
||
|
|
public required string LabelCancellationDeadline { get; init; }
|
||
|
|
public required string LabelNoShowFee { get; init; }
|
||
|
|
|
||
|
|
// Labels - Requirements
|
||
|
|
public required string LabelRequirements { get; init; }
|
||
|
|
public required string LabelRequiresConsultation { get; init; }
|
||
|
|
public required string LabelRequiresConsultationDesc { get; init; }
|
||
|
|
public required string LabelRequiresPatchTest { get; init; }
|
||
|
|
public required string LabelRequiresPatchTestDesc { get; init; }
|
||
|
|
public required string LabelAgeRestriction { get; init; }
|
||
|
|
public required string LabelAgeRestrictionDesc { get; init; }
|
||
|
|
|
||
|
|
// Labels - Online booking settings
|
||
|
|
public required string LabelOnlineBookingSettings { get; init; }
|
||
|
|
public required string LabelShowInOnlineBooking { get; init; }
|
||
|
|
public required string LabelAllowEmployeeSelection { get; init; }
|
||
|
|
public required string LabelShowPrice { get; init; }
|
||
|
|
public required string LabelShowDuration { get; init; }
|
||
|
|
|
||
|
|
// Toggle labels
|
||
|
|
public required string ToggleYes { get; init; }
|
||
|
|
public required string ToggleNo { get; init; }
|
||
|
|
}
|