vassago/WebInterface/Views/Users/Details.cshtml

63 lines
1.8 KiB
Plaintext
Raw Normal View History

2023-12-01 09:49:21 -05:00
@model User
2024-07-07 14:22:10 -04:00
@using System.Text
2023-12-01 09:49:21 -05:00
@{
ViewData["Title"] = "User details";
}
2024-07-07 14:22:10 -04:00
<table class="table">
<tbody>
<tr>
<th scope="row">Display Name</th>
<td>@Model.DisplayName</td>
</tr>
<tr>
<th scope="row">Accounts</th>
<td>
<div id="accountsTree"></div>
</td>
</tr>
<tr>
<th scope="row">Permission Tags</th>
<td>
<div id="tagsTree"></div>
</td>
</tr>
</tbody>
</table>
2023-12-01 09:49:21 -05:00
2024-07-07 14:22:10 -04:00
@section Scripts{
<script type="text/javascript">
var detailLink='<a asp-controller="Accounts" asp-action="Details" asp-route-id="accid">Details</a>;
@foreach (var acc in Model.Accounts)
{
<div class="account @acc.Protocol">
<div class="protocol-icon">&nbsp;</div>
@Html.DisplayFor(acc => acc.DisplayName)
<a asp-controller="Accounts" asp-action="Details" asp-route-id="@acc.Id">Details</a>
</div>
}
function getTree() {
@{
var sb = new StringBuilder();
sb.Append("[{text: \"accounts\", \"expanded\":true, nodes: [");
var first = true;
foreach (var acc in Model.Accounts)
{
if(!first)
sb.Append(',');
sb.Append($"{{text: \"<div class=\"account {acc.Protocol}\"><div class=\"protocol-icon\">&nbsp;</div>{Html.DisplayFor(acc => acc.DisplayName)}Details\"}}");
first=false;
}
sb.Append("}]");
}
var tree = @Html.Raw(sb.ToString());
console.log(tree);
return tree;
}
2023-12-01 09:49:21 -05:00
2024-07-07 14:22:10 -04:00
$('#accountsTree').bstreeview({ data: getTree() });
</script>
2023-12-01 09:49:21 -05:00
}