@using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services @using Microsoft.AspNetCore.Mvc.TagHelpers @using Newtonsoft.Json.Linq @using BTCPayServer.Client @using BTCPayServer.Abstractions.TagHelpers @inject DisplayFormatter DisplayFormatter @inject BTCPayServer.Security.ContentSecurityPolicies Csp @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @{ Layout = "PointOfSale/Public/_Layout"; Csp.UnsafeEval(); } @section PageHeadContent { } @section PageFootContent { } @functions { private string GetItemPriceFormatted(ViewPointOfSaleViewModel.Item item) { if (item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup) return "any amount"; if (item.Price == 0) return "free"; var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol); return item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Minimum ? $"{formatted} minimum" : formatted; } }

@(string.IsNullOrEmpty(Model.Title) ? Model.StoreName : Model.Title)

@if (Model.ShowSearch) { } @if (Model.ShowCategories) {
}
@if (!string.IsNullOrEmpty(Model.Description)) {
@Safe.Raw(Model.Description)
}
@for (var index = 0; index < Model.Items.Length; index++) { var item = Model.Items[index]; var formatted = GetItemPriceFormatted(item); var inStock = item.Inventory is null or > 0; var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText; buttonText = buttonText.Replace("{0}", formatted).Replace("{Price}", formatted); var categories = new JArray(item.Categories ?? new object[] { });
@if (!string.IsNullOrWhiteSpace(item.Image)) { @item.Title }
@Safe.Raw(item.Title)
@if (item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup || item.Price == 0) { @Safe.Raw(char.ToUpper(formatted[0]) + formatted[1..]) } else { @Safe.Raw(formatted) } @if (item.Inventory.HasValue) { @(item.Inventory > 0 ? $"{item.Inventory} left" : "Sold out") }
@if (!string.IsNullOrWhiteSpace(item.Description)) {

@Safe.Raw(item.Description)

}
@if (inStock) {
}
}