77 lines
2.6 KiB
Plaintext
77 lines
2.6 KiB
Plaintext
@page "/robots"
|
|
@rendermode RobotNet10.Components.RenderMode.InteractiveWebAssemblyNoPrerender
|
|
|
|
<PageTitle>Robot Management</PageTitle>
|
|
|
|
@using RobotNet10.FleetManager.Client.Services
|
|
@using RobotNet10.FleetManager.Client.Components.RobotManager
|
|
@using RobotNet10.FleetManager.Client.Components.RobotManager.Dialogs
|
|
@using RobotNet10.FleetManager.Shared.DTOs.Robot
|
|
@inject RobotApiService RobotApiService
|
|
@inject RobotModelApiService RobotModelApiService
|
|
@inject IDialogService DialogService
|
|
@inject ISnackbar Snackbar
|
|
@inject NavigationManager NavigationManager
|
|
|
|
<MudContainer MaxWidth="MaxWidth.ExtraExtraLarge" Class="mt-4">
|
|
<!-- Header -->
|
|
<MudPaper Class="pa-4 mb-4 align-content-center" MinHeight="80px">
|
|
<MudStack Row="true" AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween" Spacing="3">
|
|
<MudText Typo="Typo.h5">Robot Management</MudText>
|
|
<MudButton StartIcon="@Icons.Material.Filled.Add"
|
|
Variant="Variant.Filled"
|
|
Color="Color.Success"
|
|
OnClick="HandleCreate">
|
|
Add Robot
|
|
</MudButton>
|
|
</MudStack>
|
|
</MudPaper>
|
|
|
|
<!-- Main Content -->
|
|
<RobotTable @ref="TableRef"
|
|
RobotApiService="@RobotApiService"
|
|
RobotModelApiService="@RobotModelApiService"
|
|
OnRobotDeleted="@HandleDeleted"
|
|
OnRobotUpdated="@HandleUpdated" />
|
|
</MudContainer>
|
|
|
|
<MudThemeProvider IsDarkMode />
|
|
<MudPopoverProvider />
|
|
<MudDialogProvider />
|
|
<MudSnackbarProvider />
|
|
|
|
@code {
|
|
private RobotTable? TableRef;
|
|
|
|
private async Task HandleCreate()
|
|
{
|
|
var parameters = new DialogParameters
|
|
{
|
|
["RobotApiService"] = RobotApiService,
|
|
["RobotModelApiService"] = RobotModelApiService
|
|
};
|
|
|
|
var dialog = await DialogService.ShowAsync<CreateRobotDialog>("Create Robot", parameters,
|
|
new DialogOptions { MaxWidth = MaxWidth.Medium, FullWidth = true });
|
|
var result = await dialog.Result;
|
|
|
|
if (result != null && !result.Canceled)
|
|
{
|
|
await TableRef?.LoadDataAsync()!;
|
|
Snackbar.Add("Robot created successfully", Severity.Success);
|
|
}
|
|
}
|
|
|
|
private async Task HandleDeleted()
|
|
{
|
|
await TableRef?.LoadDataAsync()!;
|
|
Snackbar.Add("Robot deleted successfully", Severity.Success);
|
|
}
|
|
|
|
private async Task HandleUpdated()
|
|
{
|
|
await TableRef?.LoadDataAsync()!;
|
|
Snackbar.Add("Robot updated successfully", Severity.Success);
|
|
}
|
|
}
|