mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Fix cart view and provide better naming for default items fixes #5012
This commit is contained in:
parent
79836ef1de
commit
35dd580e74
4 changed files with 12 additions and 14 deletions
|
@ -51,7 +51,6 @@ namespace BTCPayServer.Plugins.PointOfSale
|
||||||
private readonly LinkGenerator _linkGenerator;
|
private readonly LinkGenerator _linkGenerator;
|
||||||
private readonly IOptions<BTCPayServerOptions> _btcPayServerOptions;
|
private readonly IOptions<BTCPayServerOptions> _btcPayServerOptions;
|
||||||
private readonly DisplayFormatter _displayFormatter;
|
private readonly DisplayFormatter _displayFormatter;
|
||||||
private readonly HtmlSanitizer _htmlSanitizer;
|
|
||||||
public const string AppType = "PointOfSale";
|
public const string AppType = "PointOfSale";
|
||||||
|
|
||||||
public PointOfSaleAppType(
|
public PointOfSaleAppType(
|
||||||
|
@ -65,7 +64,6 @@ namespace BTCPayServer.Plugins.PointOfSale
|
||||||
_linkGenerator = linkGenerator;
|
_linkGenerator = linkGenerator;
|
||||||
_btcPayServerOptions = btcPayServerOptions;
|
_btcPayServerOptions = btcPayServerOptions;
|
||||||
_displayFormatter = displayFormatter;
|
_displayFormatter = displayFormatter;
|
||||||
_htmlSanitizer = htmlSanitizer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task<string> ConfigureLink(AppData app)
|
public override Task<string> ConfigureLink(AppData app)
|
||||||
|
|
|
@ -34,44 +34,44 @@ namespace BTCPayServer.Services.Apps
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = "rooibos",
|
Id = "rooibos",
|
||||||
Title = "Rooibos",
|
Title = "Rooibos (limited)",
|
||||||
Description =
|
Description =
|
||||||
"Rooibos is a dramatic red tea made from a South African herb that contains polyphenols and flavonoids. Often called 'African redbush tea', Rooibos herbal tea delights the senses and delivers potential health benefits with each caffeine-free sip.",
|
"Rooibos is a dramatic red tea made from a South African herb that contains polyphenols and flavonoids. Often called 'African redbush tea', Rooibos herbal tea delights the senses and delivers potential health benefits with each caffeine-free sip.",
|
||||||
Image = "~/img/pos-sample/rooibos.jpg",
|
Image = "~/img/pos-sample/rooibos.jpg",
|
||||||
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed,
|
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed,
|
||||||
Price = 1.2m
|
Price = 1.2m,
|
||||||
|
Inventory = 5,
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = "pu-erh",
|
Id = "pu-erh",
|
||||||
Title = "Pu Erh",
|
Title = "Pu Erh (free)",
|
||||||
Description =
|
Description =
|
||||||
"This loose pur-erh tea is produced in Yunnan Province, China. The process in a relatively high humidity environment has mellowed the elemental character of the tea when compared to young Pu-erh.",
|
"This loose pur-erh tea is produced in Yunnan Province, China. The process in a relatively high humidity environment has mellowed the elemental character of the tea when compared to young Pu-erh.",
|
||||||
Image = "~/img/pos-sample/pu-erh.jpg",
|
Image = "~/img/pos-sample/pu-erh.jpg",
|
||||||
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed,
|
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Fixed,
|
||||||
Price = 2
|
Price = 0
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = "herbal-tea",
|
Id = "herbal-tea",
|
||||||
Title = "Herbal Tea",
|
Title = "Herbal Tea (minimum)",
|
||||||
Description =
|
Description =
|
||||||
"Chamomile tea is made from the flower heads of the chamomile plant. The medicinal use of chamomile dates back to the ancient Egyptians, Romans and Greeks. Pay us what you want!",
|
"Chamomile tea is made from the flower heads of the chamomile plant. The medicinal use of chamomile dates back to the ancient Egyptians, Romans and Greeks. Pay us what you want!",
|
||||||
Image = "~/img/pos-sample/herbal-tea.jpg",
|
Image = "~/img/pos-sample/herbal-tea.jpg",
|
||||||
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Minimum,
|
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Minimum,
|
||||||
Price = 1.8m,
|
Price = 1.8m,
|
||||||
Disabled = true
|
Disabled = false
|
||||||
},
|
},
|
||||||
new()
|
new()
|
||||||
{
|
{
|
||||||
Id = "fruit-tea",
|
Id = "fruit-tea",
|
||||||
Title = "Fruit Tea",
|
Title = "Fruit Tea (any amount)",
|
||||||
Description =
|
Description =
|
||||||
"The Tibetan Himalayas, the land is majestic and beautiful—a spiritual place where, despite the perilous environment, many journey seeking enlightenment. Pay us what you want!",
|
"The Tibetan Himalayas, the land is majestic and beautiful—a spiritual place where, despite the perilous environment, many journey seeking enlightenment. Pay us what you want!",
|
||||||
Image = "~/img/pos-sample/fruit-tea.jpg",
|
Image = "~/img/pos-sample/fruit-tea.jpg",
|
||||||
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Topup,
|
PriceType = ViewPointOfSaleViewModel.ItemPriceType.Topup,
|
||||||
Inventory = 5,
|
Disabled = false
|
||||||
Disabled = true
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DefaultView = PosViewType.Static;
|
DefaultView = PosViewType.Static;
|
||||||
|
|
|
@ -255,7 +255,7 @@
|
||||||
|
|
||||||
<span class="text-muted small">
|
<span class="text-muted small">
|
||||||
@{
|
@{
|
||||||
var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Fixed ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText;
|
var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText;
|
||||||
if (item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Topup)
|
if (item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Topup)
|
||||||
{
|
{
|
||||||
var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol);
|
var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol);
|
||||||
|
|
|
@ -112,7 +112,7 @@ Cart.prototype.getTotalProducts = function() {
|
||||||
typeof this.content[key] != 'undefined' &&
|
typeof this.content[key] != 'undefined' &&
|
||||||
!this.content[key].disabled
|
!this.content[key].disabled
|
||||||
) {
|
) {
|
||||||
const price = this.toCents(this.content[key].price.value ||0);
|
const price = this.toCents(this.content[key].price ||0);
|
||||||
amount += (this.content[key].count * price);
|
amount += (this.content[key].count * price);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ Cart.prototype.listItems = function() {
|
||||||
'title': this.escape(item.title),
|
'title': this.escape(item.title),
|
||||||
'count': this.escape(item.count),
|
'count': this.escape(item.count),
|
||||||
'inventory': this.escape(item.inventory < 0? 99999: item.inventory),
|
'inventory': this.escape(item.inventory < 0? 99999: item.inventory),
|
||||||
'price': this.escape(item.price.formatted || 0)
|
'price': this.escape(item.price || 0)
|
||||||
});
|
});
|
||||||
list.push($(tableTemplate));
|
list.push($(tableTemplate));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue