@using BTCPayServer.Plugins.PointOfSale.Models @using BTCPayServer.Services @using Microsoft.AspNetCore.Mvc.TagHelpers @model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel @inject DisplayFormatter DisplayFormatter @{ Layout = "PointOfSale/Public/_Layout"; } @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; } }
@if (!string.IsNullOrEmpty(Model.Description)) {
@Safe.Raw(Model.Description)
}
@for (var x = 0; x < Model.Items.Length; x++) { var item = Model.Items[x]; 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);
@if (!string.IsNullOrWhiteSpace(item.Image)) { @Safe.Raw(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 (Model.ShowCustomAmount) {
Custom Amount

Create invoice to pay custom amount

}