You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.1 KiB

@using Infrastructure.Application.Entites.Settings
@using System.Security.Claims
@model PagedList<Setting>
@{
HtmlTitle = "配置";
var start = 0;
var entityName = "Setting";
var hasPermissions = (User.Identity as ClaimsIdentity).Claims.Any(o => o.Value.EndsWith($"-{entityName}"));
}
<form action="" method="post" class="form-horizontal">
@if (hasPermissions)
{
<div class="card">
<div class="card-header">
网站配置
</div>
<div class="card-body">
<div class="pull-left">
@if (User.IsInRole($"Add-{entityName}"))
{
<a class="btn btn-primary" href="@Url.Action("Add")">
新建
</a>
}
@*@if (User.IsInRole($"Edit-{entityName}"))
{
<button type="submit" class="confirm btn btn-primary" data-action="@Url.Action("Remove")">
移除
</button>
}
@if (User.IsInRole($"Edit-{entityName}"))
{
<button type="submit" class="confirm btn btn-primary" data-action="@Url.Action("Restore")">
还原
</button>
}*@
@if (User.IsInRole($"Delete-{entityName}"))
{
<button type="submit" class="confirm btn btn-danger" data-action="@Url.Action("Delete")">
删除
</button>}
</div>
</div>
</div>
}
<div class="card">
<div class="card-body">
<table class="table table-striped projects">
<tr>
<th><input type="checkbox" class="select_all" /></th>
<th>行号</th>
<th>属性名称</th>
<th>属性值</th>
<th>类型</th>
@if (User.IsInRole($"Edit-{entityName}"))
{
<th>编辑</th>
}
</tr>
@foreach (var item in Model.List)
{
<tr>
<td>
<input type="checkbox" name="list[]" value="@item.Id" />
</td>
<td>@(++start)</td>
<td>@item.Name</td>
<td>@Html.DisplayFor(o => item.Value, item.Type.ToString())</td>
<td>@item.Type.GetDisplayName()</td>
@if (User.IsInRole($"Edit-{entityName}"))
{
<td>
<a class="btn btn-info btn-sm" href="@Url.Action("Edit",new { id=item.Id})">编辑</a>
</td>
}
</tr>
}
</table>
</div>
</div>
</form>