2022-07-18 20:51:53 +02:00
|
|
|
@using BTCPayServer.Plugins.PointOfSale.Models
|
2023-05-23 02:18:57 +02:00
|
|
|
@using BTCPayServer.Services
|
2022-07-18 20:51:53 +02:00
|
|
|
@model BTCPayServer.Plugins.PointOfSale.Models.ViewPointOfSaleViewModel
|
2023-05-23 02:18:57 +02:00
|
|
|
@inject DisplayFormatter DisplayFormatter
|
2020-05-26 21:52:42 +02:00
|
|
|
@{
|
2023-01-30 09:23:49 +01:00
|
|
|
Layout = "PointOfSale/Public/_Layout";
|
2022-07-22 15:41:14 +02:00
|
|
|
var customTipPercentages = Model.CustomTipPercentages;
|
2020-05-26 21:52:42 +02:00
|
|
|
var anyInventoryItems = Model.Items.Any(item => item.Inventory.HasValue);
|
|
|
|
}
|
2023-02-10 16:26:38 +01:00
|
|
|
@section PageHeadContent {
|
|
|
|
<link rel="stylesheet" href="~/cart/css/style.css" asp-append-version="true">
|
|
|
|
<style>
|
|
|
|
.js-cart-item-minus .fa,
|
|
|
|
.js-cart-item-plus .fa {
|
|
|
|
background: #fff;
|
|
|
|
border-radius: 50%;
|
|
|
|
width: 17px;
|
|
|
|
height: 17px;
|
|
|
|
display: inline-flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
}
|
|
|
|
@section PageFootContent {
|
|
|
|
<script>var srvModel = @Safe.Json(Model);</script>
|
|
|
|
<script src="~/cart/js/cart.js" asp-append-version="true"></script>
|
|
|
|
<script src="~/cart/js/cart.jquery.js" asp-append-version="true"></script>
|
|
|
|
<script id="template-cart-item" type="text/template">
|
|
|
|
<tr data-id="{id}">
|
|
|
|
<td class="align-middle pe-0" width="1%">{image}</td>
|
|
|
|
<td class="align-middle pe-0 ps-2"><b>{title}</b></td>
|
|
|
|
<td class="align-middle px-0">
|
|
|
|
<a class="js-cart-item-remove btn btn-link" href="#"><i class="fa fa-trash text-muted"></i></a>
|
|
|
|
</td>
|
|
|
|
<td class="align-middle px-0">
|
|
|
|
<div class="input-group align-items-center">
|
|
|
|
<a class="js-cart-item-minus btn btn-link px-2" href="#"><i class="fa fa-minus-circle fa-fw text-danger"></i></a>
|
|
|
|
<input class="js-cart-item-count form-control form-control-sm pull-left hide-number-spin text-end" type="number" step="1" name="count" placeholder="Qty" max="{inventory}" value="{count}" data-prev="{count}">
|
|
|
|
<a class="input-group-text js-cart-item-plus btn btn-link px-2" href="#">
|
|
|
|
<i class="fa fa-plus-circle fa-fw text-success"></i>
|
|
|
|
</a>
|
2020-05-26 21:52:42 +02:00
|
|
|
</div>
|
2023-02-10 16:26:38 +01:00
|
|
|
</td>
|
|
|
|
<td class="align-middle text-end">{price}</td>
|
|
|
|
</tr>
|
|
|
|
</script>
|
2020-05-26 21:52:42 +02:00
|
|
|
|
2023-02-10 16:26:38 +01:00
|
|
|
<script id="template-cart-item-image" type="text/template">
|
|
|
|
<img class="cart-item-image" src="{image}" alt="">
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script id="template-cart-custom-amount" type="text/template">
|
2020-05-26 21:52:42 +02:00
|
|
|
<tr>
|
2023-02-10 16:26:38 +01:00
|
|
|
<td colspan="5">
|
2020-05-26 21:52:42 +02:00
|
|
|
<div class="input-group">
|
2021-05-19 04:39:27 +02:00
|
|
|
<span class="input-group-text"><i class="fa fa-shopping-cart fa-fw"></i></span>
|
2023-02-10 16:26:38 +01:00
|
|
|
<input class="js-cart-custom-amount form-control" type="number" min="0" step="@Model.Step" name="amount" placeholder="Pay what you want">
|
|
|
|
<div class="input-group-text">
|
|
|
|
<a class="js-cart-custom-amount-remove btn btn-danger" href="#"><i class="fa fa-times"></i></a>
|
|
|
|
</div>
|
2020-05-26 21:52:42 +02:00
|
|
|
</div>
|
2023-02-10 16:26:38 +01:00
|
|
|
</td>
|
2020-05-26 21:52:42 +02:00
|
|
|
</tr>
|
2023-02-10 16:26:38 +01:00
|
|
|
</script>
|
2020-05-26 21:52:42 +02:00
|
|
|
|
2023-02-10 16:26:38 +01:00
|
|
|
<script id="template-cart-extra" type="text/template">
|
|
|
|
@if (Model.ShowCustomAmount)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<th colspan="5" class="border-0 pb-0">
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-text"><i class="fa fa-shopping-cart fa-fw"></i></span>
|
|
|
|
<input class="js-cart-custom-amount form-control" type="number" min="0" step="@Model.Step" name="amount" value="{customAmount}" placeholder="Pay what you want">
|
|
|
|
<a class="js-cart-custom-amount-remove btn btn-danger" href="#"><i class="fa fa-times"></i></a>
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
@if (Model.ShowDiscount)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<th colspan="5" class="border-top-0">
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-text"><i class="fa fa-percent fa-fw"></i></span>
|
|
|
|
<input class="js-cart-discount form-control" type="number" min="0" step="@Model.Step" value="{discount}" name="discount" placeholder="Discount in %">
|
|
|
|
<a class="js-cart-discount-remove btn btn-danger" href="#"><i class="fa fa-times"></i></a>
|
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script id="template-cart-tip" type="text/template">
|
|
|
|
@if (Model.EnableTips)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<th colspan="5" class="border-top-0 pt-4 h5">@Model.CustomTipText</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th colspan="5" class="border-0">
|
|
|
|
<div class="input-group mb-2">
|
|
|
|
<span class="input-group-text"><i class="fa fa-money fa-fw"></i></span>
|
|
|
|
<input
|
|
|
|
class="js-cart-tip form-control form-control-lg"
|
|
|
|
type="number"
|
|
|
|
min="0"
|
|
|
|
step="@Model.Step"
|
|
|
|
value="{tip}"
|
|
|
|
name="tip"
|
|
|
|
placeholder="Tip in @(Model.CurrencyInfo.CurrencySymbol != null ? Model.CurrencyInfo.CurrencySymbol : Model.CurrencyCode)"
|
|
|
|
/>
|
|
|
|
<a class="js-cart-tip-remove btn btn-lg btn-danger" href="#"><i class="fa fa-times"></i></a>
|
|
|
|
</div>
|
|
|
|
<div class="row mb-1">
|
|
|
|
@if (customTipPercentages != null && customTipPercentages.Length > 0)
|
2020-05-26 21:52:42 +02:00
|
|
|
{
|
2023-02-10 16:26:38 +01:00
|
|
|
@for (int i = 0; i < customTipPercentages.Length; i++)
|
|
|
|
{
|
|
|
|
var percentage = customTipPercentages[i];
|
|
|
|
<div class="col">
|
|
|
|
<a class="js-cart-tip-btn btn btn-lg btn-light w-100 border mb-2" href="#" data-tip="@percentage">@percentage%</a>
|
|
|
|
</div>
|
|
|
|
}
|
2020-05-26 21:52:42 +02:00
|
|
|
}
|
|
|
|
|
2023-02-10 16:26:38 +01:00
|
|
|
</div>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</script>
|
2020-05-26 21:52:42 +02:00
|
|
|
|
2023-02-10 16:26:38 +01:00
|
|
|
<script id="template-cart-total" type="text/template">
|
|
|
|
<tr>
|
|
|
|
<th colspan="1" class="pb-4 h4">Total</th>
|
|
|
|
<th colspan="4" class="pb-4 h4 text-end">
|
|
|
|
<span class="js-cart-total">{total}</span>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</script>
|
|
|
|
}
|
2020-05-26 21:52:42 +02:00
|
|
|
<div id="cartModal" class="modal" tabindex="-1" role="dialog">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header bg-primary text-white border-0">
|
|
|
|
<h5 class="modal-title">Confirmation</h5>
|
2021-08-04 06:24:25 +02:00
|
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close" ref="close">
|
|
|
|
<vc:icon symbol="close" />
|
2020-05-26 21:52:42 +02:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body p-0">
|
2022-05-05 14:54:31 +03:00
|
|
|
<table id="js-cart-summary" class="table m-0">
|
2020-05-26 21:52:42 +02:00
|
|
|
<tbody class="my-3">
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" class="border-top-0 h5">Summary</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="border-0 pb-0 h6">Total products</td>
|
|
|
|
<td align="right" class="border-0 pb-0 h6">
|
|
|
|
<span class="js-cart-summary-products text-nowrap"></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
@if (Model.ShowDiscount)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<td class="border-0 pb-y h6">Discount</td>
|
|
|
|
<td align="right" class="border-0 pb-y h6">
|
|
|
|
<span class="js-cart-summary-discount text-nowrap"></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
@if (Model.EnableTips)
|
|
|
|
{
|
|
|
|
<tr>
|
|
|
|
<td class="border-top-0 pt-0 h6">Tip</td>
|
|
|
|
<td align="right" class="border-top-0 pt-0 h6">
|
|
|
|
<span class="js-cart-summary-tip text-nowrap"></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
<tr>
|
|
|
|
<td class="h3 table-light">Total</td>
|
2021-05-19 04:39:27 +02:00
|
|
|
<td class="h3 table-light text-end">
|
2020-05-26 21:52:42 +02:00
|
|
|
<span class="js-cart-summary-total text-nowrap"></span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer bg-light">
|
|
|
|
<form
|
|
|
|
id="js-cart-pay-form"
|
|
|
|
method="post"
|
|
|
|
asp-action="ViewPointOfSale"
|
|
|
|
asp-route-appId="@Model.AppId"
|
|
|
|
asp-antiforgery="false"
|
|
|
|
data-buy
|
|
|
|
>
|
|
|
|
<input id="js-cart-amount" class="form-control" type="hidden" name="amount">
|
|
|
|
<input id="js-cart-posdata" class="form-control" type="hidden" name="posdata">
|
|
|
|
<button id="js-cart-pay" class="btn btn-primary btn-lg" type="submit">
|
|
|
|
<b>@Model.CustomButtonText</b>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="wrapper">
|
|
|
|
<!-- Page Content -->
|
|
|
|
<div id="content">
|
|
|
|
<div class="p-2 p-sm-4">
|
2023-01-30 09:23:49 +01:00
|
|
|
<partial name="_StatusMessage" />
|
|
|
|
<div class="d-flex gap-3 mb-4">
|
|
|
|
<div class="flex-fill position-relative">
|
|
|
|
<input type="text" class="js-search form-control form-control-lg" placeholder="Find product">
|
|
|
|
<a class="js-search-reset btn btn-lg btn-link text-black" href="#">
|
|
|
|
<i class="fa fa-times-circle fa-lg"></i>
|
2020-05-26 21:52:42 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
2023-01-30 09:23:49 +01:00
|
|
|
<a class="js-cart btn btn-lg btn-outline-primary text-nowrap" href="#">
|
|
|
|
<i class="fa fa-shopping-basket"></i>
|
|
|
|
<span class="badge bg-light rounded-pill">
|
|
|
|
<span id="js-cart-items">0</span>
|
|
|
|
</span>
|
|
|
|
</a>
|
2020-05-26 21:52:42 +02:00
|
|
|
</div>
|
|
|
|
@if (!string.IsNullOrEmpty(Model.Description))
|
|
|
|
{
|
2023-01-30 09:23:49 +01:00
|
|
|
<div class="lead text-center mt-3">@Safe.Raw(Model.Description)</div>
|
2020-05-26 21:52:42 +02:00
|
|
|
}
|
|
|
|
</div>
|
2023-01-30 09:23:49 +01:00
|
|
|
<div id="js-pos-list" class="text-center mx-auto px-2 px-sm-4 py-4 py-sm-2">
|
|
|
|
<div class="card-deck">
|
2020-05-26 21:52:42 +02:00
|
|
|
@for (var index = 0; index < Model.Items.Length; index++)
|
|
|
|
{
|
|
|
|
var item = Model.Items[index];
|
|
|
|
var image = item.Image;
|
|
|
|
var description = item.Description;
|
|
|
|
|
2021-06-06 13:44:54 +02:00
|
|
|
<div class="js-add-cart card px-0 card-wrapper" data-index="@index">
|
2021-07-02 04:28:38 +02:00
|
|
|
@if (!string.IsNullOrWhiteSpace(image))
|
2020-05-26 21:52:42 +02:00
|
|
|
{
|
2023-03-21 15:31:54 +01:00
|
|
|
<img class="card-img-top" src="@image" alt="@Safe.Raw(item.Title)" asp-append-version="true">
|
2020-05-26 21:52:42 +02:00
|
|
|
}
|
|
|
|
<div class="card-body p-3">
|
2023-03-21 15:31:54 +01:00
|
|
|
<h6 class="card-title mb-0">@Safe.Raw(item.Title)</h6>
|
|
|
|
@if (!string.IsNullOrWhiteSpace(description))
|
2020-05-26 21:52:42 +02:00
|
|
|
{
|
2021-04-05 05:39:02 +02:00
|
|
|
<p class="card-text">@Safe.Raw(description)</p>
|
2020-05-26 21:52:42 +02:00
|
|
|
}
|
|
|
|
</div>
|
2021-06-06 13:44:54 +02:00
|
|
|
<div class="card-footer bg-transparent border-0 pt-0 pb-3">
|
2020-05-26 21:52:42 +02:00
|
|
|
|
2021-10-08 13:11:00 +02:00
|
|
|
<span class="text-muted small">
|
|
|
|
@{
|
2023-05-30 10:05:31 +02:00
|
|
|
var buttonText = string.IsNullOrEmpty(item.BuyButtonText) ? item.PriceType == ViewPointOfSaleViewModel.ItemPriceType.Topup ? Model.CustomButtonText : Model.ButtonText : item.BuyButtonText;
|
2023-05-23 02:18:57 +02:00
|
|
|
if (item.PriceType != ViewPointOfSaleViewModel.ItemPriceType.Topup)
|
2021-10-08 13:11:00 +02:00
|
|
|
{
|
2023-05-23 02:18:57 +02:00
|
|
|
var formatted = DisplayFormatter.Currency(item.Price ?? 0, Model.CurrencyCode, DisplayFormatter.CurrencyFormat.Symbol);
|
|
|
|
buttonText = buttonText.Replace("{0}",formatted)
|
|
|
|
?.Replace("{Price}",formatted);
|
2021-10-08 13:11:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
@Safe.Raw(buttonText)
|
|
|
|
</span>
|
2020-05-26 21:52:42 +02:00
|
|
|
@if (item.Inventory.HasValue)
|
|
|
|
{
|
|
|
|
|
|
|
|
<div class="w-100 pt-2 text-center text-muted">
|
|
|
|
@if (item.Inventory > 0)
|
|
|
|
{
|
|
|
|
<span>@item.Inventory left</span>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<span>Sold out</span>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
} else if (anyInventoryItems)
|
|
|
|
{
|
|
|
|
<div class="w-100 pt-2"> </div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Sidebar -->
|
2021-08-04 06:24:25 +02:00
|
|
|
<nav id="sidebar">
|
2023-01-30 09:23:49 +01:00
|
|
|
<div class="d-flex align-items-center pt-4 p-2">
|
|
|
|
<h3 class="text-white m-0 me-auto">Cart</h3>
|
2021-05-19 04:39:27 +02:00
|
|
|
<a class="js-cart btn btn-sm bg-white text-black pull-right ms-5" href="#">
|
2020-05-26 21:52:42 +02:00
|
|
|
<i class="fa fa-times fa-lg"></i>
|
|
|
|
</a>
|
|
|
|
<a class="js-cart-destroy btn btn-danger pull-right" href="#" style="display: none;">Empty cart <i class="fa fa-trash fa-fw fa-lg"></i></a>
|
|
|
|
</div>
|
|
|
|
|
2022-05-05 14:54:31 +03:00
|
|
|
<table id="js-cart-list" class="table table-responsive table-light mt-0 mb-0">
|
2020-05-26 21:52:42 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th colspan="3" width="55%">Product</th>
|
|
|
|
<th class="text-center" width="20%">
|
|
|
|
<div style="width: 84px">Quantity</div>
|
|
|
|
</th>
|
2021-05-19 04:39:27 +02:00
|
|
|
<th class="text-end" width="25%">
|
2020-05-26 21:52:42 +02:00
|
|
|
<div style="min-width: 50px">Price</div>
|
|
|
|
</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody></tbody>
|
|
|
|
</table>
|
|
|
|
|
2022-05-05 14:54:31 +03:00
|
|
|
<table id="js-cart-extra" class="table table-light mt-0 mb-0">
|
2020-05-26 21:52:42 +02:00
|
|
|
<thead></thead>
|
|
|
|
</table>
|
|
|
|
|
2023-01-30 09:23:49 +01:00
|
|
|
<button id="js-cart-confirm" data-bs-toggle="modal" data-bs-target="#cartModal" class="btn btn-primary btn-lg mx-2 mb-3 p-3" disabled="disabled" type="submit">
|
|
|
|
Confirm
|
2020-05-26 21:52:42 +02:00
|
|
|
</button>
|
|
|
|
|
2023-01-30 09:23:49 +01:00
|
|
|
<footer class="store-footer">
|
2023-03-08 13:39:03 +01:00
|
|
|
<a class="store-powered-by" href="https://btcpayserver.org" target="_blank" rel="noreferrer noopener">
|
2023-01-30 09:23:49 +01:00
|
|
|
Powered by <partial name="_StoreFooterLogo" />
|
|
|
|
</a>
|
|
|
|
</footer>
|
2020-05-26 21:52:42 +02:00
|
|
|
</nav>
|
|
|
|
</div>
|