mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 22:44:29 +01:00
@@ -17,6 +17,7 @@ namespace BTCPayServer.Models.AppViewModels
|
|||||||
public ItemPrice Price { get; set; }
|
public ItemPrice Price { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public bool Custom { get; set; }
|
public bool Custom { get; set; }
|
||||||
|
public string BuyButtonText { get; set; }
|
||||||
public int? Inventory { get; set; } = null;
|
public int? Inventory { get; set; } = null;
|
||||||
public string[] PaymentMethods { get; set; }
|
public string[] PaymentMethods { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,9 +321,9 @@ namespace BTCPayServer.Services.Apps
|
|||||||
Formatted = Currencies.FormatCurrency(cc.Value.Value, currency)
|
Formatted = Currencies.FormatCurrency(cc.Value.Value, currency)
|
||||||
}).Single(),
|
}).Single(),
|
||||||
Custom = c.GetDetailString("custom") == "true",
|
Custom = c.GetDetailString("custom") == "true",
|
||||||
|
BuyButtonText = c.GetDetailString("buyButtonText"),
|
||||||
Inventory = string.IsNullOrEmpty(c.GetDetailString("inventory")) ? (int?)null : int.Parse(c.GetDetailString("inventory"), CultureInfo.InvariantCulture),
|
Inventory = string.IsNullOrEmpty(c.GetDetailString("inventory")) ? (int?)null : int.Parse(c.GetDetailString("inventory"), CultureInfo.InvariantCulture),
|
||||||
PaymentMethods = c.GetDetailStringList("payment_methods")
|
PaymentMethods = c.GetDetailStringList("payment_methods")
|
||||||
|
|
||||||
})
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,12 @@
|
|||||||
<input type="text" required pattern="[^\*#]+" class="form-control mb-2" v-model="editingItem.id" ref="txtId"/>
|
<input type="text" required pattern="[^\*#]+" class="form-control mb-2" v-model="editingItem.id" ref="txtId"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<div class="col">
|
||||||
|
<label>Buy Button Text</label>
|
||||||
|
<input type="text" class="form-control mb-2" v-model="editingItem.buyButtonText" ref="txtBuyButtonText"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
@@ -185,7 +191,7 @@ $(function() {
|
|||||||
var line = lines[kl],
|
var line = lines[kl],
|
||||||
product = line.split("\n"),
|
product = line.split("\n"),
|
||||||
id, price, title, description, image = null,
|
id, price, title, description, image = null,
|
||||||
custom, inventory=null, paymentMethods = [];
|
custom, buyButtonText, inventory=null, paymentMethods = [];
|
||||||
|
|
||||||
var goingThroughMethods = false;
|
var goingThroughMethods = false;
|
||||||
for (var kp in product) {
|
for (var kp in product) {
|
||||||
@@ -215,6 +221,9 @@ $(function() {
|
|||||||
if (productProperty.indexOf('custom:') !== -1) {
|
if (productProperty.indexOf('custom:') !== -1) {
|
||||||
custom = productProperty.replace('custom:', '').trim();
|
custom = productProperty.replace('custom:', '').trim();
|
||||||
}
|
}
|
||||||
|
if (productProperty.indexOf('buyButtonText:') !== -1) {
|
||||||
|
buyButtonText = productProperty.replace('buyButtonText:', '').trim();
|
||||||
|
}
|
||||||
if (productProperty.indexOf('inventory:') !== -1) {
|
if (productProperty.indexOf('inventory:') !== -1) {
|
||||||
inventory = parseInt(productProperty.replace('inventory:', '').trim(),10);
|
inventory = parseInt(productProperty.replace('inventory:', '').trim(),10);
|
||||||
}
|
}
|
||||||
@@ -232,6 +241,7 @@ $(function() {
|
|||||||
image: image || null,
|
image: image || null,
|
||||||
description: description || '',
|
description: description || '',
|
||||||
custom: custom === "true",
|
custom: custom === "true",
|
||||||
|
buyButtonText: buyButtonText,
|
||||||
inventory: isNaN(inventory)? null: inventory,
|
inventory: isNaN(inventory)? null: inventory,
|
||||||
paymentMethods: paymentMethods
|
paymentMethods: paymentMethods
|
||||||
});
|
});
|
||||||
@@ -250,6 +260,7 @@ $(function() {
|
|||||||
image = product.image,
|
image = product.image,
|
||||||
description = product.description,
|
description = product.description,
|
||||||
custom = product.custom,
|
custom = product.custom,
|
||||||
|
buyButtonText = product.buyButtonText,
|
||||||
inventory = product.inventory,
|
inventory = product.inventory,
|
||||||
paymentMethods = product.paymentMethods;
|
paymentMethods = product.paymentMethods;
|
||||||
|
|
||||||
@@ -269,6 +280,9 @@ $(function() {
|
|||||||
if (custom != null) {
|
if (custom != null) {
|
||||||
template += ' custom: ' + custom + '\n';
|
template += ' custom: ' + custom + '\n';
|
||||||
}
|
}
|
||||||
|
if (buyButtonText != null && buyButtonText.length > 0) {
|
||||||
|
template += ' buyButtonText: ' + buyButtonText + '\n';
|
||||||
|
}
|
||||||
if(paymentMethods != null && paymentMethods.length > 0){
|
if(paymentMethods != null && paymentMethods.length > 0){
|
||||||
template+= ' payment_methods:\n';
|
template+= ' payment_methods:\n';
|
||||||
for (var method of paymentMethods){
|
for (var method of paymentMethods){
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@if (@Model.ShowDiscount)
|
@if (Model.ShowDiscount)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="5" class="border-top-0">
|
<th colspan="5" class="border-top-0">
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-footer pt-0 bg-transparent border-0">
|
<div class="card-footer pt-0 bg-transparent border-0">
|
||||||
|
|
||||||
<span class="text-muted small">@Model.ButtonText.Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted)</span>
|
<span class="text-muted small">@((item.BuyButtonText ?? Model.ButtonText).Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted))</span>
|
||||||
@if (item.Inventory.HasValue)
|
@if (item.Inventory.HasValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
{
|
{
|
||||||
<form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false">
|
<form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false">
|
||||||
<button type="submit" name="choiceKey" class="js-add-cart btn btn-primary" value="@item.Id">
|
<button type="submit" name="choiceKey" class="js-add-cart btn btn-primary" value="@item.Id">
|
||||||
@Model.ButtonText.Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted)
|
@((item.BuyButtonText ?? Model.ButtonText).Replace("{0}",item.Price.Formatted).Replace("{Price}",item.Price.Formatted))
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user