Files
btcpayserver/BTCPayServer/Views/UIStores/StoreEmailRulesList.cshtml
wellingtonbalbo c6d5246720 - Removed the JS functions created by me
- Used the same logic as the StoreUsers.cshtml page to design the remove modal
- Removed the unit test part related to the deletion of email rules, since using this way of remove above is not possible to unit test, at least I didn't found an example to look at.
2025-04-17 22:32:07 -03:00

75 lines
3.1 KiB
Plaintext

@using BTCPayServer.Abstractions.Models
@using BTCPayServer.Client
@using BTCPayServer.TagHelpers
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model List<BTCPayServer.Controllers.UIStoresController.StoreEmailRule>
@{
var storeId = Context.GetStoreData().Id;
ViewData.SetActivePage(StoreNavPages.Emails, StringLocalizer["Email Rules"], storeId);
}
<div class="sticky-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a asp-action="StoreEmailSettings" asp-route-storeId="@storeId" text-translate="true">Emails</a>
</li>
<li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
</ol>
<h2>@ViewData["Title"]</h2>
</nav>
<form method="post" permission="@Policies.CanModifyStoreSettings">
<a id="CreateEmailRule" permission="@Policies.CanModifyStoreSettings" asp-action="StoreEmailRulesCreate" asp-route-storeId="@storeId"
class="btn btn-primary" role="button">
Create Email Rule
</a>
</form>
</div>
<partial name="_StatusMessage" />
<p text-translate="true">
Email rules allow BTCPay Server to send customized emails from your store based on events.
</p>
@if (Model.Any())
{
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Trigger</th>
<th>Customer Email</th>
<th>To</th>
<th>Subject</th>
<th class="actions-col" permission="@Policies.CanModifyStoreSettings"></th>
</tr>
</thead>
<tbody>
@foreach (var rule in Model.Select((value, index) => new { value, index }))
{
<tr>
<td>@rule.value.Trigger</td>
<td>@(rule.value.CustomerEmail ? "Yes" : "No")</td>
<td>@rule.value.To</td>
<td>@rule.value.Subject</td>
<td class="actions-col" permission="@Policies.CanModifyStoreSettings">
<div class="d-inline-flex align-items-center gap-3">
<a asp-action="StoreEmailRulesEdit" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index">Edit</a>
<a asp-action="StoreEmailRulesDelete" asp-route-storeId="@storeId" asp-route-ruleIndex="@rule.index" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="@StringLocalizer["This action will remove the rule with the trigger {0}.", Html.Encode(rule.value.Trigger)]" data-confirm-input="@StringLocalizer["REMOVE"]" text-translate="true">Remove</a>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
}
else
{
<p class="text-secondary" text-translate="true">
There are no rules yet.
</p>
}
<partial name="_Confirm" model="@(new ConfirmModel(StringLocalizer["Remove email rule"], StringLocalizer["This action will remove this rule. Are you sure?"], StringLocalizer["Delete"]))" permission="@Policies.CanModifyStoreSettings" />