mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 14:40:36 +01:00
* Move POS assets * WIP * Refactor into common Vue mixin * Offcanvas updates * Unifications across POS views * POSData view fix * Number and test fixes * Update cart width * Fix test * More view unification * Hide cart when emptied * Validate cart * Header improvement * Increase remove icon size * Animate add to cart action * Offcanvas for mobile, sidebar for desktop * ui+pos: updates icon size + badge + label * Remove cart table headers * Use same size for Cart and Shop headlines * Update search placeholder * Bump horizontal input padding * Increase sidebar width * Bump badge font size * Fix manipulating the quantity of line items * Fix cart icon * Update cart display * updates empty button * Rounded search input * Remove cart button on desktop * Fix dark accent color * More accent fixes * Fix plus/minus alignment * Update BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml * Apply suggestions from code review --------- Co-authored-by: dstrukt <gfxdsign@gmail.com>
77 lines
2.9 KiB
Text
77 lines
2.9 KiB
Text
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
|
@model (Dictionary<string, object> Items, int Level)
|
|
|
|
@functions {
|
|
|
|
private bool IsValidURL(string source)
|
|
{
|
|
return Uri.TryCreate(source, UriKind.Absolute, out var uriResult) &&
|
|
(uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps);
|
|
}
|
|
|
|
}
|
|
|
|
@if (Model.Items.Count > 0)
|
|
{
|
|
<table class="table my-0" v-pre>
|
|
@foreach (var (key, value) in Model.Items)
|
|
{
|
|
<tr>
|
|
@if (value is string str)
|
|
{
|
|
if (!string.IsNullOrEmpty(key))
|
|
{
|
|
<th class="w-150px">@key</th>
|
|
}
|
|
<td style="white-space:pre-wrap">@* Explicitely remove whitespace at front here *@@if (IsValidURL(str))
|
|
{
|
|
<a href="@str" target="_blank" rel="noreferrer noopener">@str</a>
|
|
}
|
|
else
|
|
{
|
|
@str.Trim()
|
|
}
|
|
</td>
|
|
}
|
|
else if (value is Dictionary<string, object> {Count: > 0 } subItems)
|
|
{
|
|
<td colspan="2">
|
|
@{
|
|
@if (!string.IsNullOrEmpty(key))
|
|
{
|
|
Write(Html.Raw($"<h{Model.Level + 3} class=\"mt-4 mb-3\">"));
|
|
Write(key);
|
|
Write(Html.Raw($"</h{Model.Level + 3}>"));
|
|
}
|
|
}
|
|
<partial name="PosData" model="@((subItems, Model.Level + 1))" />
|
|
</td>
|
|
}
|
|
else if (value is IEnumerable<object> valueArray)
|
|
{
|
|
<td colspan="2">
|
|
@{
|
|
@if (!string.IsNullOrEmpty(key))
|
|
{
|
|
Write(Html.Raw($"<h{Model.Level + 3} class=\"mt-4 mb-3\">"));
|
|
Write(key);
|
|
Write(Html.Raw($"</h{Model.Level + 3}>"));
|
|
}
|
|
}
|
|
@foreach (var item in valueArray)
|
|
{
|
|
@if (item is Dictionary<string, object> {Count: > 0 } subItems2)
|
|
{
|
|
<partial name="PosData" model="@((subItems2, Model.Level + 1))" />
|
|
}
|
|
else
|
|
{
|
|
<partial name="PosData" model="@((new Dictionary<string, object>() {{"", item}}, Model.Level + 1))" />
|
|
}
|
|
}
|
|
</td>
|
|
}
|
|
</tr>
|
|
}
|
|
</table>
|
|
}
|