SHA256
GuestLog - Added delete to GuestDocument list.
This commit is contained in:
@@ -57,11 +57,23 @@
|
||||
<CellTemplate>
|
||||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Info"
|
||||
OnClick="() => BtnViewDetails(context.Item)" />
|
||||
<MudIconButton Size="@Size.Small" Icon="@Icons.Material.Outlined.Delete"
|
||||
OnClick="() => BtnDeleteItem(context.Item)" />
|
||||
</CellTemplate>
|
||||
</TemplateColumn>
|
||||
</Columns>
|
||||
</MudDataGrid>
|
||||
|
||||
<MudMessageBox @ref="_msgBoxConfirmDelete" Title="Warning" CancelText="Cancel">
|
||||
<MessageContent>
|
||||
Deleting can <b><i>not</i></b> be undone!
|
||||
</MessageContent>
|
||||
<YesButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.DeleteForever">Delete!
|
||||
</MudButton>
|
||||
</YesButton>
|
||||
</MudMessageBox>
|
||||
|
||||
|
||||
@code {
|
||||
private IEnumerable<GuestDocumentDTO> guestDocList = [];
|
||||
@@ -70,7 +82,8 @@
|
||||
private HashSet<string> _moduleList = [];
|
||||
private HashSet<string> _selectedModuleList = [];
|
||||
|
||||
private MudDataGrid<GuestDocumentDTO>? _dataGrid;
|
||||
private MudDataGrid<GuestDocumentDTO> _dataGrid = null!;
|
||||
private MudMessageBox _msgBoxConfirmDelete = null!;
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
@@ -108,11 +121,6 @@
|
||||
|
||||
private async Task BtnConfigureColumnsClick(MouseEventArgs args)
|
||||
{
|
||||
if (_dataGrid is null)
|
||||
{
|
||||
Snackbar.Add("No ref to grid");
|
||||
return;
|
||||
}
|
||||
_dataGrid.ShowColumnsPanel(args);
|
||||
}
|
||||
|
||||
@@ -124,12 +132,32 @@
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = true,
|
||||
CloseOnEscapeKey = true,
|
||||
CloseOnEscapeKey = true,
|
||||
};
|
||||
|
||||
await DialogService.ShowAsync<GuestDocDetailsDialog>("GuestDoc Details", parameters, options);
|
||||
}
|
||||
|
||||
private async Task BtnDeleteItem(GuestDocumentDTO item)
|
||||
{
|
||||
bool? confirmDelete = await _msgBoxConfirmDelete.ShowAsync();
|
||||
|
||||
if (confirmDelete is null || confirmDelete.Value == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool deleted = await GuestDocService.DeleteDocumentAsync(item);
|
||||
if (!deleted)
|
||||
{
|
||||
Snackbar.Add($"Error deleting document {item.DocumentType}-{item.DocumentNum}", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
Snackbar.Add($"Document {item.DocumentType}-{item.DocumentNum} deleted!", Severity.Success);
|
||||
await LoadDataAsync();
|
||||
}
|
||||
|
||||
private void BtnNewGuest()
|
||||
{
|
||||
Navigation.NavigateTo(GuestConsts.Page_GuestDocs_New);
|
||||
|
||||
Reference in New Issue
Block a user