145 lines
4.6 KiB
Plaintext
145 lines
4.6 KiB
Plaintext
@*
|
||
Component: RobotModelDetailsPanel
|
||
Purpose: Displays detailed information about a selected robot model.
|
||
Shows image preview with navigation point, dimensions, and usage statistics.
|
||
*@
|
||
|
||
@using RobotNet10.FleetManager.Shared.DTOs.RobotModel
|
||
@using RobotNet10.FleetManager.Client.Services
|
||
@using RobotNet10.FleetManager.Client.Components.RobotModelManager.Dialogs
|
||
@using RobotNet10.MapEditor.Services.API
|
||
@using RobotNet10.MapEditor.Shared.DTOs.VehicleType
|
||
@inject IDialogService DialogService
|
||
@inject MapManagerApiService MapApiService
|
||
|
||
<!-- Image Preview -->
|
||
<RobotModelImagePreview RobotModel="@RobotModel" />
|
||
|
||
<!-- Details -->
|
||
<MudStack Class="mt-2">
|
||
<MudSimpleTable>
|
||
<tbody>
|
||
<tr>
|
||
<td><strong>Model Name:</strong></td>
|
||
<td>@RobotModel.ModelName</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Navigation Type:</strong></td>
|
||
<td>@RobotModel.NavigationType</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Vehicle Type:</strong></td>
|
||
<td>
|
||
@if (RobotModel.VehicleTypeId.HasValue)
|
||
{
|
||
@if (vehicleTypeName != null)
|
||
{
|
||
<MudChip T="string" Size="Size.Small" Color="Color.Info">@vehicleTypeName</MudChip>
|
||
}
|
||
else if (isLoadingVehicleType)
|
||
{
|
||
<MudProgressCircular Size="Size.Small" Indeterminate="true" />
|
||
}
|
||
else
|
||
{
|
||
<MudChip T="string" Size="Size.Small" Color="Color.Warning">@RobotModel.VehicleTypeId.Value.ToString("N")</MudChip>
|
||
}
|
||
}
|
||
else
|
||
{
|
||
<MudText Typo="Typo.body2" Style="color: gray;">Not assigned</MudText>
|
||
}
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Dimensions:</strong></td>
|
||
<td>@($"{RobotModel.Length}m × {RobotModel.Width}m")</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Image Size:</strong></td>
|
||
<td>@($"{RobotModel.ImageWidth} × {RobotModel.ImageHeight} px")</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Navigation Point:</strong></td>
|
||
<td>@($"X: {RobotModel.NavigationPointX}m, Y: {RobotModel.NavigationPointY}m")</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Robot Count:</strong></td>
|
||
<td>@RobotModel.RobotCount</td>
|
||
</tr>
|
||
<tr>
|
||
<td><strong>Created:</strong></td>
|
||
<td>@RobotModel.CreatedDate.ToString("g")</td>
|
||
</tr>
|
||
@if (RobotModel.UpdatedDate.HasValue)
|
||
{
|
||
<tr>
|
||
<td><strong>Updated:</strong></td>
|
||
<td>@RobotModel.UpdatedDate.Value.ToString("g")</td>
|
||
</tr>
|
||
}
|
||
</tbody>
|
||
</MudSimpleTable>
|
||
</MudStack>
|
||
|
||
@code {
|
||
[Parameter]
|
||
public RobotModelDto RobotModel { get; set; } = null!;
|
||
|
||
private string? vehicleTypeName;
|
||
private bool isLoadingVehicleType = false;
|
||
|
||
protected override async Task OnInitializedAsync()
|
||
{
|
||
if (RobotModel.VehicleTypeId.HasValue)
|
||
{
|
||
await LoadVehicleTypeNameAsync();
|
||
}
|
||
}
|
||
|
||
protected override async Task OnParametersSetAsync()
|
||
{
|
||
if (RobotModel.VehicleTypeId.HasValue)
|
||
{
|
||
await LoadVehicleTypeNameAsync();
|
||
}
|
||
else
|
||
{
|
||
vehicleTypeName = null;
|
||
}
|
||
}
|
||
|
||
private async Task LoadVehicleTypeNameAsync()
|
||
{
|
||
if (!RobotModel.VehicleTypeId.HasValue)
|
||
{
|
||
vehicleTypeName = null;
|
||
return;
|
||
}
|
||
|
||
isLoadingVehicleType = true;
|
||
StateHasChanged();
|
||
try
|
||
{
|
||
var vehicleType = await MapApiService.GetVehicleTypeAsync(RobotModel.VehicleTypeId.Value);
|
||
if (vehicleType != null)
|
||
{
|
||
vehicleTypeName = $"{vehicleType.VehicleTypeId} - {vehicleType.VehicleTypeName}";
|
||
}
|
||
else
|
||
{
|
||
vehicleTypeName = null;
|
||
}
|
||
}
|
||
catch (Exception)
|
||
{
|
||
vehicleTypeName = null;
|
||
}
|
||
finally
|
||
{
|
||
isLoadingVehicleType = false;
|
||
StateHasChanged();
|
||
}
|
||
}
|
||
}
|