btcpayserver/BTCPayServer/Views/AppsPublic/PointOfSale/Static.cshtml
d11n ed7031981b
Bootstrap v5 migration (#2490)
* Swap bootstrap asset files

* Update themes and color definitions

* Move general bootstrap customizations

* Theme updates

Theme updates

* Remove BuildBundlerMinifier

This lead to an error, because BuildBundlerMinifier and BundlerMinifier.Core seem to conflict here. Details: https://stackoverflow.com/a/61119586

* Rewplace btn-block class with w-100

* Update badge classes

* Remove old font family head variable

* Update margin classes

* Cleanups

* Update float classes

* Update text classes

* Update padding classes

* Update border classes

* UPdate dropdown classes

* Update select classes

* Update neutral custom props

* Update bootstrap and customizations

* Update ChromeDriver; disable smooth scroll

https://github.com/SeleniumHQ/selenium/issues/8295

* Improve alert messages

* Improve bootstrap customizations

* Disable reduced motion

See also 7358282f

* Update Bootstrap data attributes

* Update file inputs

* Update input groups

* Replace deprecated jumbotron class

* Update variables; re-add negative margin util classes

* Update cards

* Update form labels

* Debug alerts

* Fix aria-labelledby associations

* Dropdown-related test fixes

* Fix CanUseWebhooks test

* Test fixes

* Nav updates

* Fix nav usage in wallet send and payouts

* Update alert and modal close buttons

* Re-add backdrop properties

* Upgrade Bootstrap to v5 final

* Update screen reader classes

* Update font-weight classes

* Update monospace font classes

* Update accordians

* Update close icon usage

* Cleanup

* Update scripts and style integrations

* Update input group texts

* Update LN node setup page

* Update more form control classes

* Update inline forms

* Add js specific test

* Upgrade Vue.js

* Remove unused JS

* Upgrade Bootstrap to v5.0.1

* Try container related test updates

* Separate jQuery bundle

* Remove jQuery from LND seed backup page

* Remove unused code

* Refactor email autofill js

* Refactor camera scanner JS

* Re-add tests

* Re-add BuildBundlerMinifier

* Do not minify bundles containing Bootstrap

Details https://github.com/madskristensen/BundlerMinifier/issues/558

* Update bundles

* Cleanup JS test

* Cleanup tests involving dropdowns

* Cleanup tests involving collapses

* Cleanup locale additions in ConfigureCore

* Cleanup bundles

* Remove duplicate status message

* Cleanup formatting

* Fix missing validation scripts

* Remove unused unminified Bootstrap js files

* Fix classic theme

* Fix Casa theme

* Fix PoS validation
2021-05-19 11:39:27 +09:00

114 lines
5.1 KiB
Text

@model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel
@{
Layout = "_LayoutPos";
var anyInventoryItems = Model.Items.Any(item => item.Inventory.HasValue);
}
<div class="container d-flex h-100">
<div class="justify-content-center align-self-center text-center mx-auto px-2 py-3 w-100 m-auto">
<partial name="_StatusMessage" />
<h1 class="mb-4">@Model.Title</h1>
@if (!string.IsNullOrEmpty(Model.Description))
{
<div class="row">
<div class="overflow-hidden col-12">@Safe.Raw(Model.Description)</div>
</div>
}
<div class="row card-deck my-3 mx-auto">
@for (int x = 0; x < Model.Items.Length; x++)
{
var item = Model.Items[x];
var buttonText = (string.IsNullOrEmpty(item.BuyButtonText) ?
item.Custom?
Model.CustomButtonText :
Model.ButtonText
: item.BuyButtonText)
.Replace("{0}",item.Price.Formatted)
.Replace("{Price}",item.Price.Formatted);
<div class="card px-0 m-2" data-id="@x">
@if (!String.IsNullOrWhiteSpace(item.Image))
{
<img class="card-img-top" src="@item.Image" alt="Card image cap" asp-append-version="true">
}
@{CardBody(item.Title, item.Description);}
<div class="card-footer bg-transparent border-0">
@if (!item.Inventory.HasValue || item.Inventory.Value > 0)
{
@if (item.Custom)
{
<form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false" data-buy>
<input type="hidden" name="choicekey" value="@item.Id"/>
@{PayFormInputContent(item.BuyButtonText ?? Model.CustomButtonText, item.Price.Value, item.Price.Value);}
</form>
}
else
{
<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">
@buttonText
</button>
</form>
}
}
@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">&nbsp;</div>
}
</div>
</div>
}
@if (Model.ShowCustomAmount)
{
<div class="card px-0 m-2">
@{CardBody("Custom Amount", "Create invoice to pay custom amount");}
<div class="card-footer bg-transparent border-0">
<form method="post" asp-controller="AppsPublic" asp-action="ViewPointOfSale" asp-route-appId="@Model.AppId" asp-antiforgery="false" data-buy>
@{PayFormInputContent(Model.CustomButtonText);}
</form>
@if (anyInventoryItems)
{
<div class="w-100 pt-2">&nbsp;</div>
}
</div>
</div>
}
</div>
</div>
</div>
@functions {
private void PayFormInputContent(string buttonText, decimal? minPriceValue = null, decimal? priceValue = null)
{
<div class="input-group">
<span class="input-group-text">@Model.CurrencySymbol</span>
<input class="form-control" type="number" min="@(minPriceValue ?? 0)" step="@Model.Step" name="amount" placeholder="Amount" value="@priceValue">
<button class="btn btn-primary text-nowrap" type="submit">@buttonText</button>
</div>
}
private void CardBody(string title, string description)
{
<div class="card-body my-auto pb-0">
<h5 class="card-title">@title</h5>
@if (!String.IsNullOrWhiteSpace(description))
{
<p class="card-text">@Safe.Raw(description)</p>
}
</div>
}
}