Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Nov 16, 2023
2 parents f229613 + 46f0818 commit d729e5d
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 15 deletions.
2 changes: 2 additions & 0 deletions BTCPayServer.Client/Models/CreateAppRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class CreatePointOfSaleAppRequest : CreateAppRequest
public PosViewType DefaultView { get; set; }
public bool ShowCustomAmount { get; set; } = false;
public bool ShowDiscount { get; set; } = true;
public bool ShowSearch { get; set; } = true;
public bool ShowCategories { get; set; } = true;
public bool EnableTips { get; set; } = true;
public string CustomAmountPayButtonText { get; set; } = null;
public string FixedAmountPayButtonText { get; set; } = null;
Expand Down
2 changes: 2 additions & 0 deletions BTCPayServer.Client/Models/PointOfSaleAppData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class PointOfSaleAppData : AppDataBase
public string DefaultView { get; set; }
public bool ShowCustomAmount { get; set; }
public bool ShowDiscount { get; set; }
public bool ShowSearch { get; set; }
public bool ShowCategories { get; set; }
public bool EnableTips { get; set; }
public string Currency { get; set; }
public object Items { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions BTCPayServer.Tests/docker-compose.altcoins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ services:
- "5432"

merchant_lnd:
image: btcpayserver/lnd:v0.17.0-beta
image: btcpayserver/lnd:v0.17.1-beta
restart: unless-stopped
environment:
LND_CHAIN: "btc"
Expand Down Expand Up @@ -259,7 +259,7 @@ services:
- bitcoind

customer_lnd:
image: btcpayserver/lnd:v0.17.0-beta
image: btcpayserver/lnd:v0.17.1-beta
restart: unless-stopped
environment:
LND_CHAIN: "btc"
Expand Down
4 changes: 2 additions & 2 deletions BTCPayServer.Tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ services:
- "5432"

merchant_lnd:
image: btcpayserver/lnd:v0.17.0-beta
image: btcpayserver/lnd:v0.17.1-beta
restart: unless-stopped
environment:
LND_CHAIN: "btc"
Expand Down Expand Up @@ -248,7 +248,7 @@ services:
- bitcoind

customer_lnd:
image: btcpayserver/lnd:v0.17.0-beta
image: btcpayserver/lnd:v0.17.1-beta
restart: unless-stopped
environment:
LND_CHAIN: "btc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ private CrowdfundSettings ToCrowdfundSettings(CreateCrowdfundAppRequest request)

private PointOfSaleSettings ToPointOfSaleSettings(CreatePointOfSaleAppRequest request)
{
return new PointOfSaleSettings()
return new PointOfSaleSettings
{
Title = request.Title,
DefaultView = (PosViewType)request.DefaultView,
ShowCustomAmount = request.ShowCustomAmount,
ShowDiscount = request.ShowDiscount,
ShowSearch = request.ShowSearch,
ShowCategories = request.ShowCategories,
EnableTips = request.EnableTips,
Currency = request.Currency,
Template = request.Template != null ? AppService.SerializeTemplate(AppService.Parse(request.Template)) : null,
Expand Down Expand Up @@ -336,6 +338,8 @@ private PointOfSaleAppData ToPointOfSaleModel(AppData appData)
DefaultView = settings.DefaultView.ToString(),
ShowCustomAmount = settings.ShowCustomAmount,
ShowDiscount = settings.ShowDiscount,
ShowSearch = settings.ShowSearch,
ShowCategories = settings.ShowCategories,
EnableTips = settings.EnableTips,
Currency = settings.Currency,
Items = JsonConvert.DeserializeObject(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ public async Task<IActionResult> ViewPointOfSale(string appId, PosViewType? view
ViewType = (PosViewType)viewType,
ShowCustomAmount = settings.ShowCustomAmount,
ShowDiscount = settings.ShowDiscount,
ShowSearch = settings.ShowSearch,
ShowCategories = settings.ShowCategories,
EnableTips = settings.EnableTips,
CurrencyCode = settings.Currency,
CurrencySymbol = numberFormatInfo.CurrencySymbol,
Expand Down Expand Up @@ -543,6 +545,8 @@ public async Task<IActionResult> UpdatePointOfSale(string appId)
DefaultView = settings.DefaultView,
ShowCustomAmount = settings.ShowCustomAmount,
ShowDiscount = settings.ShowDiscount,
ShowSearch = settings.ShowSearch,
ShowCategories = settings.ShowCategories,
EnableTips = settings.EnableTips,
Currency = settings.Currency,
Template = settings.Template,
Expand Down Expand Up @@ -631,6 +635,8 @@ public async Task<IActionResult> UpdatePointOfSale(string appId, UpdatePointOfSa
DefaultView = vm.DefaultView,
ShowCustomAmount = vm.ShowCustomAmount,
ShowDiscount = vm.ShowDiscount,
ShowSearch = vm.ShowSearch,
ShowCategories = vm.ShowCategories,
EnableTips = vm.EnableTips,
Currency = vm.Currency,
Template = vm.Template,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class UpdatePointOfSaleViewModel
public bool ShowCustomAmount { get; set; }
[Display(Name = "User can input discount in %")]
public bool ShowDiscount { get; set; }
[Display(Name = "Display the search bar")]
public bool ShowSearch { get; set; }
[Display(Name = "Display the category list")]
public bool ShowCategories { get; set; }
[Display(Name = "Enable tips")]
public bool EnableTips { get; set; }
public string Example1 { get; internal set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class CurrencyInfoData
public PosViewType ViewType { get; set; }
public bool ShowCustomAmount { get; set; }
public bool ShowDiscount { get; set; }
public bool ShowSearch { get; set; } = true;
public bool ShowCategories { get; set; } = true;
public bool EnableTips { get; set; }
public string Step { get; set; }
public string Title { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions BTCPayServer/Services/Apps/PointOfSaleSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public PointOfSaleSettings()
DefaultView = PosViewType.Static;
ShowCustomAmount = false;
ShowDiscount = true;
ShowSearch = true;
ShowCategories = true;
EnableTips = true;
RequiresRefundEmail = RequiresRefundEmail.InheritFromStore;
}
Expand All @@ -87,6 +89,8 @@ public PointOfSaleSettings()
public PosViewType DefaultView { get; set; }
public bool ShowCustomAmount { get; set; }
public bool ShowDiscount { get; set; }
public bool ShowSearch { get; set; } = true;
public bool ShowCategories { get; set; } = true;
public bool EnableTips { get; set; }
public RequiresRefundEmail RequiresRefundEmail { get; set; }

Expand Down
26 changes: 16 additions & 10 deletions BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,28 @@
<div id="content">
<div class="public-page-wrap container-xl">
<header class="sticky-top bg-body d-flex flex-column py-3 py-lg-4 gap-3">
<div class="d-flex align-items-center justify-content-center gap-3 pe-5 position-relative">
<div class="d-flex align-items-center justify-content-center gap-3 px-5 position-relative">
<h1 class="mb-0">@(string.IsNullOrEmpty(Model.Title) ? Model.StoreName : Model.Title)</h1>
<button id="CartToggle" class="cart-toggle-btn" type="button" v-on:click="toggleCart" aria-controls="cart" :disabled="cartCount === 0">
<vc:icon symbol="pos-cart" />
<span id="CartBadge" class="badge rounded-pill bg-danger p-1 ms-1" v-text="cartCount" v-if="cartCount !== 0"></span>
</button>
</div>
<input id="SearchTerm" class="form-control rounded-pill" placeholder="Search…" v-model="searchTerm">
<div id="Categories" ref="categories" v-if="allCategories" :class="{ 'scrollable': categoriesScrollable }">
<nav class="btcpay-pills d-flex align-items-center gap-3" ref="categoriesNav">
<template v-for="cat in allCategories">
<input :id="`Category-${cat.value}`" type="radio" name="category" autocomplete="off" v-model="displayCategory" :value="cat.value">
<label :for="`Category-${cat.value}`" class="btcpay-pill text-nowrap">{{ cat.text }}</label>
</template>
</nav>
</div>
@if (Model.ShowSearch)
{
<input id="SearchTerm" class="form-control rounded-pill" placeholder="Search…" v-model="searchTerm" v-if="showSearch">
}
@if (Model.ShowCategories)
{
<div id="Categories" ref="categories" v-if="showCategories && allCategories" class="btcpay-pills d-flex flex-wrap align-items-center justify-content-center gap-3" :class="{ 'scrollable': categoriesScrollable }">
<nav class="btcpay-pills d-flex align-items-center gap-3" ref="categoriesNav">
<template v-for="cat in allCategories">
<input :id="`Category-${cat.value}`" type="radio" name="category" autocomplete="off" v-model="displayCategory" :value="cat.value">
<label :for="`Category-${cat.value}`" class="btcpay-pill text-nowrap">{{ cat.text }}</label>
</template>
</nav>
</div>
}
</header>
<main>
<partial name="_StatusMessage" />
Expand Down
13 changes: 13 additions & 0 deletions BTCPayServer/Views/Shared/PointOfSale/UpdatePointOfSale.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@
<span asp-validation-for="FormId" class="text-danger"></span>
</div>
</fieldset>
<fieldset id="cart-display" class="mt-2">
<legend class="h5 mb-3 fw-semibold">Cart</legend>
<div class="form-group d-flex align-items-center pt-2">
<input asp-for="ShowSearch" type="checkbox" class="btcpay-toggle me-3" />
<label asp-for="ShowSearch" class="form-label mb-0"></label>
<span asp-validation-for="ShowSearch" class="text-danger"></span>
</div>
<div class="form-group d-flex align-items-center">
<input asp-for="ShowCategories" type="checkbox" class="btcpay-toggle me-3" />
<label asp-for="ShowCategories" class="form-label mb-0"></label>
<span asp-validation-for="ShowCategories" class="text-danger"></span>
</div>
</fieldset>
<fieldset id="tips" class="mt-2">
<legend class="h5 mb-3 fw-semibold">Tips</legend>
<div class="form-group d-flex align-items-center pt-2">
Expand Down
4 changes: 4 additions & 0 deletions BTCPayServer/wwwroot/pos/admin.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const description = document.getElementById('description');
const products = document.getElementById('products');
const tips = document.getElementById('tips');
const cart = document.getElementById('cart-display');
const discounts = document.getElementById('discounts');
const buttonPriceText = document.getElementById('button-price-text');
const customPayments = document.getElementById('custom-payments');
Expand All @@ -16,13 +17,15 @@ function updateFormForDefaultView(type) {
case 'Static':
case 'Print':
hide(tips);
hide(cart);
hide(discounts);
hide(buttonPriceText);
show(description);
show(products);
show(customPayments);
break;
case 'Cart':
show(cart);
show(tips);
show(products);
show(discounts);
Expand All @@ -33,6 +36,7 @@ function updateFormForDefaultView(type) {
case 'Light':
show(tips);
show(discounts);
hide(cart);
hide(products);
hide(description);
hide(buttonPriceText);
Expand Down
12 changes: 12 additions & 0 deletions BTCPayServer/wwwroot/swagger/v1/swagger.template.apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,18 @@
"description": "Whether the option to enter a discount is shown",
"example": false
},
"showSearch": {
"type": "boolean",
"description": "Display the search bar",
"example": false,
"default": true
},
"showCategories": {
"type": "boolean",
"description": "Display the list of categories",
"example": false,
"default": true
},
"enableTips": {
"type": "boolean",
"description": "Whether the option to enter a tip is shown",
Expand Down

0 comments on commit d729e5d

Please sign in to comment.