Add code to delete processors.

This commit is contained in:
2020-05-24 21:55:23 +01:00
parent f6f80465c8
commit 5322b1d7f1
5 changed files with 93 additions and 214 deletions

View File

@@ -31,7 +31,6 @@
}
@page "/admin/processors"
@using Marechai.Database.Models
@inherits OwningComponentBase<ProcessorsService>
@inject IStringLocalizer<ProcessorsService> L
@attribute [Authorize(Roles = "UberAdmin, Admin")]
@@ -94,21 +93,26 @@
<span class="btn btn-secondary">
@L["Edit"]
</span>
<span class="btn btn-danger">
@L["Delete"]
</span>
<Button Color="Color.Danger" Clicked="() => {ShowModal(item.Id);}">@L["Delete"]</Button>
</td>
</tr>
}
</tbody>
</table>
@code
{
List<ProcessorViewModel> _processors;
protected override async Task OnInitializedAsync()
{
_processors = await Service.GetAsync();
}
}
<Modal @ref="_frmDelete" IsCentered="true" Closing="@ModalClosing">
<ModalBackdrop/>
<ModalContent Centered="true">
<ModalHeader>
<ModalTitle>@L["Delete processor"]</ModalTitle>
<CloseButton Clicked="@HideModal"/>
</ModalHeader>
<ModalBody>
<Text>@string.Format(@L["Are you sure you want to delete {0}?"], _processor?.Name)</Text>
</ModalBody>
<ModalFooter>
<Button Color="Color.Primary" Clicked="@HideModal" Disabled="@_deleteInProgress">@L["Cancel"]</Button>
<Button Color="Color.Danger" Clicked="@ConfirmDelete" Disabled="@_deleteInProgress">@L["Delete"]</Button>
</ModalFooter>
</ModalContent>
</Modal>