2020-12-16 09:15:33 +01:00
|
|
|
@model (Dictionary<string, object> Items, int Level)
|
2019-01-26 05:26:49 +01:00
|
|
|
|
2020-12-16 09:15:33 +01:00
|
|
|
@functions{
|
|
|
|
void DisplayValue(object value)
|
|
|
|
{
|
|
|
|
if (value is string str && str.StartsWith("http"))
|
|
|
|
{
|
|
|
|
<a href="@str" target="_blank">@str</a>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
<table class="table table-sm table-responsive-md removetopborder">
|
|
|
|
@foreach (var (key, value) in Model.Items)
|
2019-01-26 05:26:49 +01:00
|
|
|
{
|
|
|
|
<tr>
|
2020-12-16 09:15:33 +01:00
|
|
|
@if (value is string)
|
2019-01-26 05:26:49 +01:00
|
|
|
{
|
2020-12-16 09:15:33 +01:00
|
|
|
if (!string.IsNullOrEmpty(key))
|
|
|
|
{
|
|
|
|
<th class="w-150px">@key</th>
|
|
|
|
}
|
2019-01-26 05:26:49 +01:00
|
|
|
<td>
|
2020-12-16 09:15:33 +01:00
|
|
|
@{ DisplayValue(value); }
|
2019-01-26 05:26:49 +01:00
|
|
|
</td>
|
|
|
|
}
|
2020-12-16 09:15:33 +01:00
|
|
|
else if (value is Dictionary<string, object>subItems)
|
2019-01-26 05:26:49 +01:00
|
|
|
{
|
2020-12-16 09:15:33 +01:00
|
|
|
@* This is the array case *@
|
|
|
|
if (subItems.Count == 1 && subItems.First().Value is string)
|
|
|
|
{
|
|
|
|
<th class="w-150px">@key</th>
|
|
|
|
<td>
|
|
|
|
@{ DisplayValue(subItems.First().Value); }
|
|
|
|
</td>
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
<td colspan="2">
|
|
|
|
@Html.Raw($"<h{Model.Level + 3} class='mt-3'>{key}</h{Model.Level + 3}>")
|
|
|
|
<partial name="PosData" model="(subItems, Model.Level + 1)"/>
|
|
|
|
</td>
|
|
|
|
}
|
2019-01-26 05:26:49 +01:00
|
|
|
}
|
|
|
|
</tr>
|
|
|
|
}
|
|
|
|
</table>
|
2020-12-16 09:15:33 +01:00
|
|
|
|