diff --git a/BTCPayServer/Views/Shared/PosData.cshtml b/BTCPayServer/Views/Shared/PosData.cshtml index d7f0296ab..708ec4dbf 100644 --- a/BTCPayServer/Views/Shared/PosData.cshtml +++ b/BTCPayServer/Views/Shared/PosData.cshtml @@ -1,14 +1,6 @@ @using Microsoft.AspNetCore.Mvc.TagHelpers @model (Dictionary 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.Any()) { @* Use titlecase and lowercase versions for backwards-compatibility *@ @@ -27,8 +19,7 @@ @foreach (var (key, value) in cartDict) { - @key - @value + } @@ -39,7 +30,7 @@ @foreach (var value in cartCollection) { - @value + } @@ -80,52 +71,7 @@ foreach (var (key, value) in Model.Items) { - @if (value is string str) - { - if (!string.IsNullOrEmpty(key)) - { - @key - } - @* Explicitely remove whitespace at front here *@@if (IsValidURL(str)){@str}else {@str.Trim()} - } - else if (value is Dictionary { Count: > 0 } subItems) - { - - @{ - @if (!string.IsNullOrEmpty(key)) - { - Write(Html.Raw($"")); - Write(key); - Write(Html.Raw($"")); - } - } - - - } - else if (value is IEnumerable valueArray) - { - - @{ - @if (!string.IsNullOrEmpty(key)) - { - Write(Html.Raw($"")); - Write(key); - Write(Html.Raw($"")); - } - } - @foreach (var item in valueArray) - { - @if (item is Dictionary { Count: > 0 } subItems2) - { - - } - else - { - - } - } - - } + } } diff --git a/BTCPayServer/Views/Shared/PosDataEntry.cshtml b/BTCPayServer/Views/Shared/PosDataEntry.cshtml new file mode 100644 index 000000000..c57468eb5 --- /dev/null +++ b/BTCPayServer/Views/Shared/PosDataEntry.cshtml @@ -0,0 +1,56 @@ +@model (string Key, object Value, 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.Value is string str) +{ + if (!string.IsNullOrEmpty(Model.Key)) + { + @Model.Key + } + @* Explicitely remove whitespace at front here *@@if (IsValidURL(str)){@str}else {@str.Trim()} +} +else if (Model.Value is Dictionary { Count: > 0 } subItems) +{ + + @{ + @if (!string.IsNullOrEmpty(Model.Key)) + { + Write(Html.Raw($"")); + Write(Model.Key); + Write(Html.Raw($"")); + } + } + + +} +else if (Model.Value is IEnumerable valueArray) +{ + + @{ + @if (!string.IsNullOrEmpty(Model.Key)) + { + Write(Html.Raw($"")); + Write(Model.Key); + Write(Html.Raw($"")); + } + } + @foreach (var item in valueArray) + { + @if (item is Dictionary { Count: > 0 } subItems2) + { + + } + else + { + + } + } + +}