2023-01-21 19:08:12 +01:00
@using BTCPayServer.Abstractions.Models
2023-05-26 16:49:32 +02:00
@using BTCPayServer.Services.Stores
@using BTCPayServer.Abstractions.Contracts
2024-03-14 10:25:40 +01:00
@using BTCPayServer.Client
@using Microsoft.AspNetCore.Mvc.TagHelpers
2022-07-15 05:38:33 +02:00
@model StoreUsersViewModel
2023-05-26 16:49:32 +02:00
@inject IScopeProvider ScopeProvider
@inject StoreRepository StoreRepository
2018-03-23 08:24:57 +01:00
@{
Layout = "../Shared/_NavLayout.cshtml";
2021-12-31 08:36:38 +01:00
ViewData.SetActivePage(StoreNavPages.Users, "Store Users", Context.GetStoreData().Id);
2023-05-26 16:49:32 +02:00
var roles = new SelectList(await StoreRepository.GetStoreRoles(ScopeProvider.GetCurrentStoreId()), nameof(StoreRepository.StoreRole.Id), nameof(StoreRepository.StoreRole.Role), Model.Role);
2018-03-23 08:24:57 +01:00
}
<div class="row">
2022-01-27 03:56:46 +01:00
<div class="col-xxl-constrain col-xl-8">
2021-12-16 11:17:02 +01:00
<h3 class="mb-3">@ViewData["Title"]</h3>
2021-04-08 15:32:42 +02:00
<p>
2021-11-18 09:56:25 +01:00
Give other registered BTCPay Server users access to your store.<br />
Guests will not be able to see or modify the store settings.
2021-04-08 15:32:42 +02:00
</p>
@if (!ViewContext.ModelState.IsValid)
{
2023-12-21 15:43:12 +01:00
<div asp-validation-summary="All"></div>
2021-04-08 15:32:42 +02:00
}
2024-03-14 10:25:40 +01:00
<form method="post" class="d-flex flex-wrap align-items-center gap-3" permission="@Policies.CanModifyStoreSettings">
<input asp-for="Email" type="text" class="form-control" placeholder="user@example.com" style="flex: 1 1 14rem">
<select asp-for="Role" class="form-select w-auto" asp-items="roles"></select>
<button type="submit" role="button" class="btn btn-primary text-nowrap flex-grow-1 flex-sm-grow-0" id="AddUser">Add User</button>
2021-05-19 04:39:27 +02:00
</form>
2024-03-14 10:25:40 +01:00
<table class="table table-hover table-responsive-md">
<thead>
<tr>
<th>Email</th>
<th>Role</th>
<th class="actions-col" permission="@Policies.CanModifyStoreSettings">Actions</th>
</tr>
</thead>
<tbody>
@foreach (var user in Model.Users)
{
2021-04-08 15:32:42 +02:00
<tr>
2024-03-14 10:25:40 +01:00
<td>@user.Email</td>
<td>@user.Role</td>
<td class="actions-col" permission="@Policies.CanModifyStoreSettings">
<a asp-action="DeleteStoreUser" asp-route-storeId="@Model.StoreId" asp-route-userId="@user.Id" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="This action will prevent <strong>@Html.Encode(user.Email)</strong> from accessing this store and its settings." data-confirm-input="REMOVE">Remove</a>
</td>
2021-04-08 15:32:42 +02:00
</tr>
2024-03-14 10:25:40 +01:00
}
</tbody>
</table>
2018-03-23 08:24:57 +01:00
</div>
</div>
2021-09-07 04:55:53 +02:00
2024-03-14 10:25:40 +01:00
<partial name="_Confirm" model="@(new ConfirmModel("Remove store user", "This action will prevent the user from accessing this store and its settings. Are you sure?", "Delete"))" permission="@Policies.CanModifyStoreSettings" />
2021-09-07 04:55:53 +02:00
@section PageFootContent {
<partial name="_ValidationScriptsPartial" />
2021-12-16 11:17:02 +01:00
}