btcpayserver/BTCPayServer/Views/Apps/UpdatePointOfSale.cshtml
d11n 64a7abe53a
Bootstrap migration fixups (#2534)
* Remove xxl breakpoint

* Remove code bg

* Form updates

* Update PoS accordion

* Update forms

* Fix webhook password toggle

* Update highlight js styles

* Page updates

* Style unformatted checkboxes

* Fix typo

* Update accordions

* Update policies domain mapping

* Update toggles and checkboxes

* Update storage pages

* Fix specter logo filename casing

* Update checkout experience view

* Update webhook view

* Re-add used negative margins

* Update bootstrap

* POS layout fixes

* Decrease size of info icon in main headline

* Update BTCPayServer/Views/Stores/ModifyWebhook.cshtml

Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com>

Co-authored-by: britttttk <39231115+britttttk@users.noreply.github.com>
2021-06-06 20:44:54 +09:00

262 lines
17 KiB
Text

@using BTCPayServer.Services.Apps
@addTagHelper *, BundlerMinifier.TagHelpers
@model UpdatePointOfSaleViewModel
@{
ViewData.SetActivePageAndTitle(AppsNavPages.Update, "Update Point of Sale", Model.StoreName);
}
<section>
<div class="container">
<partial name="_StatusMessage" />
<h2 class="mb-4">@ViewData["PageTitle"]</h2>
<div class="row">
<div class="col-lg-12">
<form method="post">
<input type="hidden" asp-for="StoreId" />
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Title" class="form-label" data-required></label>
<input asp-for="Title" class="form-control" required />
<span asp-validation-for="Title" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Currency" class="form-label" data-required></label>
<input asp-for="Currency" class="form-control" required />
<span asp-validation-for="Currency" class="text-danger"></span>
</div>
<div class="form-group">
<div class="form-group">
<label asp-for="DefaultView" class="form-label" data-required></label>
<select asp-for="DefaultView" asp-items="@Html.GetEnumSelectList<PosViewType>()" class="form-select" required></select>
<span asp-validation-for="DefaultView" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="ShowCustomAmount" type="checkbox" class="form-check-input" />
<label asp-for="ShowCustomAmount" class="form-check-label"></label>
<span asp-validation-for="ShowCustomAmount" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="ShowDiscount" type="checkbox" class="form-check-input" />
<label asp-for="ShowDiscount" class="form-check-label"></label>
<span asp-validation-for="ShowDiscount" class="text-danger"></span>
</div>
<div class="form-check">
<input asp-for="EnableTips" type="checkbox" class="form-check-input" />
<label asp-for="EnableTips" class="form-check-label"></label>
<span asp-validation-for="EnableTips" class="text-danger"></span>
</div>
</div>
<div class="form-group">
<label asp-for="ButtonText" class="form-label" data-required></label>
<input asp-for="ButtonText" class="form-control" required />
<span asp-validation-for="ButtonText" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomButtonText" class="form-label" data-required></label>
<input asp-for="CustomButtonText" class="form-control" required />
<span asp-validation-for="CustomButtonText" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomTipText" class="form-label" data-required></label>
<input asp-for="CustomTipText" class="form-control" required />
<span asp-validation-for="CustomTipText" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomTipPercentages" class="form-label"></label>
<input asp-for="CustomTipPercentages" class="form-control" />
<span asp-validation-for="CustomTipPercentages" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="CustomCSSLink" class="form-label"></label>
<a href="https://docs.btcpayserver.org/Theme/#2-bootstrap-themes" target="_blank">
<span class="fa fa-question-circle-o text-secondary" title="More information..."></span>
</a>
<input asp-for="CustomCSSLink" class="form-control" />
<span asp-validation-for="CustomCSSLink" class="text-danger"></span>
</div>
<partial name="TemplateEditor" model="@(nameof(Model.Template), "Products")" />
<div class="form-group">
<label asp-for="Template" class="form-label"></label>
<textarea asp-for="Template" rows="10" cols="40" class="js-product-template form-control"></textarea>
<span asp-validation-for="Template" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="NotificationUrl" class="form-label"></label>
<input asp-for="NotificationUrl" class="form-control" />
<span asp-validation-for="NotificationUrl" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="RedirectUrl" class="form-label"></label>
<input asp-for="RedirectUrl" class="form-control" />
<span asp-validation-for="RedirectUrl" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="RedirectAutomatically" class="form-label"></label>
<select asp-for="RedirectAutomatically" asp-items="Model.RedirectAutomaticallySelectList" class="form-select"></select>
<span asp-validation-for="RedirectAutomatically" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="form-label"></label>
<textarea asp-for="Description" rows="10" cols="40" class="form-control richtext"></textarea>
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="EmbeddedCSS" class="form-label"></label>
<textarea asp-for="EmbeddedCSS" rows="10" cols="40" class="form-control"></textarea>
<span asp-validation-for="EmbeddedCSS" class="text-danger"></span>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary" id="SaveSettings">Save Settings</button>
<div class="btn-group">
<a class="btn btn-outline-primary" asp-action="ListInvoices" asp-controller="Invoice" asp-route-searchterm="@Model.SearchTerm">Invoices</a>
<a class="btn btn-outline-primary" asp-action="ListInvoices" asp-controller="Invoice" asp-route-searchterm="@Model.SearchTerm"
target="viewinvoices_@Model.Id"><span class="fa fa-external-link"></span></a>
</div>
<div class="btn-group">
<a class="btn btn-outline-primary" asp-action="ViewPointOfSale" asp-controller="AppsPublic" asp-route-appId="@Model.Id" id="ViewApp">View App</a>
<a class="btn btn-outline-primary" asp-action="ViewPointOfSale" asp-controller="AppsPublic" asp-route-appId="@Model.Id"
target="viewapp_@Model.Id"><span class="fa fa-external-link"></span></a>
</div>
<div class="btn-group">
<a class="btn btn-outline-primary" asp-action="ListApps">Back to the app list</a>
<a class="btn btn-outline-primary" asp-action="ListApps" target="viewapp_@Model.Id"><span class="fa fa-external-link"></span></a>
</div>
</div>
<div class="form-group">
<div class="accordion" id="accordion-dev-info">
<div class="accordion-item">
<h2 class="accordion-header" id="accordion-dev-info-embed-payment-button-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-dev-info-embed-payment-button" aria-expanded="false" aria-controls="accordion-dev-info-embed-payment-button">
Embed Payment Button linking to POS item
<vc:icon symbol="caret-down"/>
</button>
</h2>
<div id="accordion-dev-info-embed-payment-button" class="accordion-collapse collapse" aria-labelledby="accordion-dev-info-embed-payment-button-header" data-bs-parent="#accordion-dev-info">
<div class="accordion-body">
<p>You can host point of sale buttons in an external website with the following code.</p>
@if (Model.Example1 != null)
{
<span>For anything with a custom amount</span>
<pre><code class="html">@Model.Example1</code></pre>
}
@if (Model.Example2 != null)
{
<span>For a specific item of your template</span>
<pre><code class="html">@Model.Example2</code></pre>
}
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="accordion-dev-info-embed-pos-iframe-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-dev-info-embed-pos-iframe" aria-expanded="false" aria-controls="accordion-dev-info-embed-pos-iframe">
Embed POS with Iframe
<vc:icon symbol="caret-down"/>
</button>
</h2>
<div id="accordion-dev-info-embed-pos-iframe" class="accordion-collapse collapse" aria-labelledby="accordion-dev-info-embed-pos-iframe-header" data-bs-parent="#accordion-dev-info">
<div class="accordion-body">
You can embed the POS using an iframe
@{
var iframe = $"<iframe src='{(Url.Action("ViewPointOfSale", "AppsPublic", new { appId = Model.Id }, Context.Request.Scheme))}' style='max-width: 100%; border: 0;'></iframe>";
}
<pre><code class="html">@iframe</code></pre>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="accordion-dev-info-notification-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#accordion-dev-info-notification" aria-expanded="false" aria-controls="accordion-dev-info-notification">
Notification Url Callbacks
<vc:icon symbol="caret-down"/>
</button>
</h2>
<div id="accordion-dev-info-notification" class="accordion-collapse collapse" aria-labelledby="accordion-dev-info-notification-header" data-bs-parent="#accordion-dev-info">
<div class="accordion-body">
<p>A <code>POST</code> callback will be sent to notification with the following form will be sent to <code>notificationUrl</code> once the enough is paid and once again once there is enough confirmations to the payment:</p>
<pre><code class="json">@Model.ExampleCallback</code></pre>
<p><strong>Never</strong> trust anything but <code>id</code>, <strong>ignore</strong> the other fields completely, an attacker can spoof those, they are present only for backward compatibility reason:</p>
<p>
<ul>
<li>Send a <code>GET</code> request to <code>https://btcpay.example.com/invoices/{invoiceId}</code> with <code>Content-Type: application/json; Authorization: Basic YourLegacyAPIkey"</code>, Legacy API key can be created with Access Tokens in Store settings</li>
<li>Verify that the <code>orderId</code> is from your backend, that the <code>price</code> is correct and that <code>status</code> is either <code>confirmed</code> or <code>complete</code></li>
<li>You can then ship your order</li>
</ul>
</p>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
@section PageHeadContent {
<link rel="stylesheet" href="~/vendor/highlightjs/default.min.css" asp-append-version="true">
<bundle name="wwwroot/bundles/pos-admin-bundle.min.css" asp-append-version="true"></bundle>
}
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
<script src="~/vendor/highlightjs/highlight.min.js" asp-append-version="true"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script id="template-product-item" type="text/template">
<div class="col-sm-4 col-md-3 mb-3">
<div class="card">
{image}
<div class="card-body">
<h6 class="card-title">{title}</h6>
<a href="#" class="js-product-edit btn btn-primary" data-bs-toggle="modal" data-bs-target="#product-modal">Edit</a>
<a href="#" class="js-product-remove btn btn-danger"><i class="fa fa-trash"></i></a>
</div>
</div>
</div>
</script>
<script id="template-product-content" type="text/template">
<div class="mb-3">
<input class="js-product-id" type="hidden" name="id" value="{id}">
<input class="js-product-index" type="hidden" name="index" value="{index}">
<div class="form-group row">
<div class="col-sm-6">
<label class="form-label" data-required>Title</label>
<input type="text" class="js-product-title form-control mb-2" value="{title}" autofocus required />
</div>
<div class="col-sm-3">
<label class="form-label" data-required>Price</label>
<input class="js-product-price form-control mb-2"
inputmode="numeric"
pattern="\d*"
type="number"
value="{price}"
required />
</div>
<div class="col-sm-3">
<label class="form-label">Custom price</label>
<select class="js-product-custom form-select">
{custom}
</select>
</div>
</div>
<div class="form-group">
<label class="form-label">Image</label>
<input type="text" class="js-product-image form-control mb-2" value="{image}" />
</div>
<div class="form-group">
<label class="form-label">Description</label>
<textarea rows="3" cols="40" class="js-product-description form-control mb-2">{description}</textarea>
</div>
<div class="form-group">
<label class="form-label">Inventory (leave blank to not use inventory feature)</label>
<input type="number" step="1" class="js-product-inventory form-control mb-2" value="{inventory}" />
</div>
</div>
</script>
<bundle name="wwwroot/bundles/pos-admin-bundle.min.js" asp-append-version="true"></bundle>
}