2026-10-10 17:50:22 +02:00
|
|
|
@page "/persons/{Id:guid}"
|
|
|
|
|
@attribute [Authorize]
|
|
|
|
|
@layout MainLayout
|
|
|
|
|
@inject HeimdallApiClient Api
|
|
|
|
|
@inject ISnackbar Snackbar
|
|
|
|
|
@inject NavigationManager Nav
|
|
|
|
|
@using Heimdall.Web.Components.Shared
|
|
|
|
|
@using Heimdall.Web.Services
|
2026-10-25 05:59:18 +01:00
|
|
|
@inject UiLanguageService Language
|
|
|
|
|
@inject UiText Text
|
|
|
|
|
@implements IDisposable
|
2026-10-10 17:50:22 +02:00
|
|
|
|
|
|
|
|
@if (_loading)
|
|
|
|
|
{
|
|
|
|
|
<MudProgressCircular Indeterminate="true" />
|
|
|
|
|
}
|
|
|
|
|
else if (_person is null)
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudAlert Severity="Severity.Warning">@Text["PersonDetailPage_NotFound"]</MudAlert>
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div class="d-flex justify-space-between align-center mb-6">
|
|
|
|
|
<div class="d-flex align-center gap-4">
|
|
|
|
|
@if (!string.IsNullOrEmpty(_person.PhotoUrl))
|
|
|
|
|
{
|
|
|
|
|
<img src="@_person.PhotoUrl" alt="@_person.DisplayName"
|
|
|
|
|
style="width:80px; height:80px; border-radius:50%; object-fit:cover;" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div style="width:80px; height:80px; border-radius:50%; background: var(--mud-palette-primary);
|
|
|
|
|
display:flex; align-items:center; justify-content:center;">
|
|
|
|
|
<i class="fas fa-user" style="font-size:2rem; color:white;"></i>
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<div>
|
|
|
|
|
<MudText Typo="Typo.h1" Class="mb-1">@_person.DisplayName</MudText>
|
|
|
|
|
<MudText Typo="Typo.body2" Color="Color.Secondary">
|
2026-10-25 05:59:18 +01:00
|
|
|
@FormatCategory(_person.Category) · @string.Format(Text["PersonDetailPage_Created"], _person.CreatedAt.ToString("d", Language.Culture))
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudText>
|
|
|
|
|
@if (_person.IsWatchlisted)
|
|
|
|
|
{
|
|
|
|
|
<MudChip T="string" Size="Size.Small" Color="Color.Warning"
|
|
|
|
|
Icon="@Icons.Material.Filled.Warning" Class="mt-2">
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_Watchlisted"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudChip>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="d-flex gap-2">
|
|
|
|
|
<MudButton Variant="Variant.Outlined" Color="Color.Default" OnClick="@(() => _showForm = true)">
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Edit" Class="mr-1" /> @Text["PersonDetailPage_Edit"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudButton>
|
|
|
|
|
<MudButton Variant="Variant.Outlined" Color="Color.Error" OnClick="@ConfirmDelete">
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Delete" Class="mr-1" /> @Text["PersonDetailPage_Delete"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudButton>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@if (!string.IsNullOrEmpty(_person.Notes))
|
|
|
|
|
{
|
|
|
|
|
<MudPaper Elevation="2" Class="pa-6 mb-6" Style="border-radius: 12px;">
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudText Typo="Typo.h6" Class="mb-2">@Text["PersonDetailPage_Notes"]</MudText>
|
2026-10-10 17:50:22 +02:00
|
|
|
<MudText Typo="Typo.body1">@_person.Notes</MudText>
|
|
|
|
|
</MudPaper>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
<MudGrid>
|
|
|
|
|
@* ─── Faces ─── *@
|
|
|
|
|
<MudItem xs="12" md="6">
|
|
|
|
|
<MudPaper Elevation="2" Class="pa-6" Style="border-radius: 12px; height: 100%;">
|
|
|
|
|
<div class="d-flex justify-space-between align-center mb-4">
|
|
|
|
|
<MudText Typo="Typo.h6">
|
|
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Portrait" Class="mr-1" />
|
2026-10-25 05:59:18 +01:00
|
|
|
@string.Format(Text["PersonDetailPage_RegisteredFaces"], _faces.Count)
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudText>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@if (_facesLoading)
|
|
|
|
|
{
|
|
|
|
|
<MudProgressCircular Indeterminate="true" />
|
|
|
|
|
}
|
|
|
|
|
else if (_faces.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined">
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_NoFaces"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudAlert>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MudCarousel TData="KnownFaceClientItem" @bind-SelectedIndex="_faceIndex">
|
|
|
|
|
@foreach (var face in _faces)
|
|
|
|
|
{
|
|
|
|
|
<MudCarouselItem>
|
|
|
|
|
<div class="d-flex flex-column align-center gap-2" style="padding: 16px;">
|
|
|
|
|
@if (!string.IsNullOrEmpty(face.ThumbnailUrl))
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
<img src="@face.ThumbnailUrl" alt="@Text["PersonDetailPage_FaceAlt"]"
|
2026-10-10 17:50:22 +02:00
|
|
|
style="width: 200px; height: 200px; border-radius: 50%; object-fit:cover;
|
|
|
|
|
border: 4px solid var(--mud-palette-primary);" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div style="width: 200px; height: 200px; border-radius: 50%;
|
|
|
|
|
background: var(--mud-palette-grey-800);
|
|
|
|
|
display:flex; align-items:center; justify-content:center;">
|
|
|
|
|
<MudIcon Icon="@Icons.Material.Filled.Portrait" Size="Size.Large" Color="Color.Secondary" />
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
<MudText Typo="Typo.body2" Color="Color.Secondary">
|
|
|
|
|
@if (!string.IsNullOrEmpty(face.SourceEventId))
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
<text>@Text["PersonDetailPage_Event"]: @face.SourceEventId.Substring(0, Math.Min(8, face.SourceEventId.Length))…</text>
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
<text>@Text["PersonDetailPage_FaceNumber"] #@face.Id.ToString()[..8]</text>
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
</MudText>
|
|
|
|
|
</div>
|
|
|
|
|
</MudCarouselItem>
|
|
|
|
|
}
|
|
|
|
|
</MudCarousel>
|
|
|
|
|
<div class="d-flex justify-center gap-2 mt-4">
|
|
|
|
|
@for (int i = 0; i < _faces.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var idx = i;
|
|
|
|
|
<MudButton Size="Size.Small" Variant="@(i == _faceIndex ? Variant.Filled : Variant.Outlined)"
|
|
|
|
|
Color="Color.Primary" OnClick="@(() => _faceIndex = idx)"
|
|
|
|
|
Style="min-width: 32px; height: 32px; padding: 0; border-radius: 50%;">
|
|
|
|
|
@(i + 1)
|
|
|
|
|
</MudButton>
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
</MudPaper>
|
|
|
|
|
</MudItem>
|
|
|
|
|
|
|
|
|
|
@* ─── Vehicles ─── *@
|
|
|
|
|
<MudItem xs="12" md="6">
|
|
|
|
|
<MudPaper Elevation="2" Class="pa-6" Style="border-radius: 12px; height: 100%;">
|
|
|
|
|
<MudText Typo="Typo.h6" Class="mb-4">
|
|
|
|
|
<MudIcon Icon="@Icons.Material.Filled.ElectricCar" Class="mr-1" />
|
2026-10-25 05:59:18 +01:00
|
|
|
@string.Format(Text["PersonDetailPage_AssociatedVehicles"], _vehicles.Count)
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudText>
|
|
|
|
|
|
|
|
|
|
@if (_vehiclesLoading)
|
|
|
|
|
{
|
|
|
|
|
<MudProgressCircular Indeterminate="true" />
|
|
|
|
|
}
|
|
|
|
|
else if (_vehicles.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined">
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_NoVehicles"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudAlert>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MudTable Items="@_vehicles" Dense="true" Hover="true">
|
|
|
|
|
<HeaderContent>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudTh>@Text["PersonDetailPage_Plate"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Make"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Model"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Color"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Events"]</MudTh>
|
2026-10-10 17:50:22 +02:00
|
|
|
</HeaderContent>
|
|
|
|
|
<RowTemplate>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Plate"]"><code>@context.LicensePlate</code></MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Make"]">@context.Make</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Model"]">@context.Model</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Color"]">@context.Color</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Events"]">@context.EventCount</MudTd>
|
2026-10-10 17:50:22 +02:00
|
|
|
</RowTemplate>
|
|
|
|
|
</MudTable>
|
|
|
|
|
}
|
|
|
|
|
</MudPaper>
|
|
|
|
|
</MudItem>
|
|
|
|
|
</MudGrid>
|
|
|
|
|
|
|
|
|
|
@* ─── Event history (30 days) ─── *@
|
|
|
|
|
<MudPaper Elevation="2" Class="pa-6 mt-6" Style="border-radius: 12px;">
|
|
|
|
|
<MudText Typo="Typo.h6" Class="mb-4">
|
|
|
|
|
<MudIcon Icon="@Icons.Material.Filled.History" Class="mr-1" />
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_DetectionHistory"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudText>
|
|
|
|
|
|
|
|
|
|
@if (_eventsLoading)
|
|
|
|
|
{
|
|
|
|
|
<MudProgressCircular Indeterminate="true" />
|
|
|
|
|
}
|
|
|
|
|
else if (_events.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
<MudAlert Severity="Severity.Info" Variant="Variant.Outlined">
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_NoRecentDetections"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudAlert>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<MudTable Items="@_events" Dense="true" Hover="true">
|
|
|
|
|
<HeaderContent>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudTh>@Text["PersonDetailPage_Date"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Type"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Camera"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Confidence"]</MudTh>
|
|
|
|
|
<MudTh>@Text["PersonDetailPage_Snapshot"]</MudTh>
|
2026-10-10 17:50:22 +02:00
|
|
|
</HeaderContent>
|
|
|
|
|
<RowTemplate>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Date"]">@context.OccurredAt.ToLocalTime().ToString("g", Language.Culture)</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Type"]">
|
2026-10-10 17:50:22 +02:00
|
|
|
<MudChip T="string" Size="Size.Small" Color="Color.Success" Variant="Variant.Filled">
|
2026-10-25 05:59:18 +01:00
|
|
|
@Text["PersonDetailPage_Face"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudChip>
|
|
|
|
|
</MudTd>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Camera"]">@context.Label</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Confidence"]">@context.Confidence.ToString("P0", Language.Culture)</MudTd>
|
|
|
|
|
<MudTd DataLabel="@Text["PersonDetailPage_Snapshot"]">
|
2026-10-10 17:50:22 +02:00
|
|
|
@if (!string.IsNullOrEmpty(context.SnapshotUrl))
|
|
|
|
|
{
|
|
|
|
|
<MudIconButton Icon="@Icons.Material.Filled.Image" Size="Size.Small"
|
2026-10-25 05:59:18 +01:00
|
|
|
aria-label="@Text["PersonDetailPage_ViewSnapshot"]" OnClick="@(() => ShowSnapshot(context))" />
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
</MudTd>
|
|
|
|
|
</RowTemplate>
|
|
|
|
|
</MudTable>
|
2026-10-22 20:12:25 +02:00
|
|
|
@if (_events.Count < _eventsTotalCount)
|
|
|
|
|
{
|
|
|
|
|
<MudButton Variant="Variant.Text" Color="Color.Primary" Class="mt-2"
|
|
|
|
|
Disabled="@_eventsLoading" OnClick="@LoadMoreEvents">
|
2026-10-25 05:59:18 +01:00
|
|
|
@string.Format(Text["PersonDetailPage_LoadMore"], _events.Count, _eventsTotalCount)
|
2026-10-22 20:12:25 +02:00
|
|
|
</MudButton>
|
|
|
|
|
}
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
</MudPaper>
|
|
|
|
|
|
|
|
|
|
<MudButton Variant="Variant.Outlined" Color="Color.Default" Class="mt-4"
|
|
|
|
|
OnClick="@(() => Nav.NavigateTo("/persons"))">
|
2026-10-25 05:59:18 +01:00
|
|
|
← @Text["PersonDetailPage_BackToPersons"]
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudButton>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@* ─── Edit form ─── *@
|
|
|
|
|
<PersonFormDialog @bind-Visible="_showForm" Existing="_person" OnSaved="@OnPersonUpdated" />
|
|
|
|
|
|
|
|
|
|
@* ─── Confirm delete ─── *@
|
|
|
|
|
<MudOverlay Visible="_confirmDeleteShow" OnClick="@(() => _confirmDeleteShow = false)" />
|
|
|
|
|
<MudDialog @bind-Visible="_confirmDeleteShow">
|
2026-10-25 05:59:18 +01:00
|
|
|
<TitleContent><MudText Typo="Typo.h6">@Text["PersonDetailPage_ConfirmDelete"]</MudText></TitleContent>
|
2026-10-10 17:50:22 +02:00
|
|
|
<DialogContent>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudText>@string.Format(Text["PersonDetailPage_DeletePrompt"], _person?.DisplayName)</MudText>
|
2026-10-10 17:50:22 +02:00
|
|
|
<MudText Typo="Typo.body2" Color="Color.Secondary" Class="mt-2">
|
2026-10-25 05:59:18 +01:00
|
|
|
@string.Format(Text["PersonDetailPage_DeleteWarning"], _person?.FaceCount)
|
2026-10-10 17:50:22 +02:00
|
|
|
</MudText>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
<DialogActions>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudButton Variant="Variant.Text" OnClick="@(() => _confirmDeleteShow = false)">@Text["PersonDetailPage_Cancel"]</MudButton>
|
|
|
|
|
<MudButton Variant="Variant.Filled" Color="Color.Error" OnClick="@ExecuteDelete">@Text["PersonDetailPage_Delete"]</MudButton>
|
2026-10-10 17:50:22 +02:00
|
|
|
</DialogActions>
|
|
|
|
|
</MudDialog>
|
|
|
|
|
|
|
|
|
|
@* ─── Snapshot dialog ─── *@
|
|
|
|
|
<MudDialog @bind-Visible="_showSnapshot" Options="_dialogOptions">
|
|
|
|
|
<TitleContent>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudText Typo="Typo.h6">@Text["PersonDetailPage_SnapshotTitle"] — @_showSnapshotEvent?.Label</MudText>
|
2026-10-10 17:50:22 +02:00
|
|
|
</TitleContent>
|
|
|
|
|
<DialogContent>
|
2026-10-25 05:59:18 +01:00
|
|
|
<img src="@_showSnapshotEvent?.SnapshotUrl" alt="@Text["PersonDetailPage_SnapshotAlt"]" style="width:100%" class="rounded-lg" />
|
2026-10-10 17:50:22 +02:00
|
|
|
</DialogContent>
|
|
|
|
|
<DialogActions>
|
2026-10-25 05:59:18 +01:00
|
|
|
<MudButton Variant="Variant.Text" OnClick="@(() => _showSnapshot = false)">@Text["PersonDetailPage_Close"]</MudButton>
|
2026-10-10 17:50:22 +02:00
|
|
|
</DialogActions>
|
|
|
|
|
</MudDialog>
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
[Parameter] public Guid Id { get; set; }
|
|
|
|
|
|
|
|
|
|
private PersonClientItem? _person;
|
|
|
|
|
private List<KnownFaceClientItem> _faces = [];
|
|
|
|
|
private List<VehicleClientItem> _vehicles = [];
|
|
|
|
|
private List<EventItem> _events = [];
|
2026-10-22 20:12:25 +02:00
|
|
|
private int _eventsTotalCount;
|
|
|
|
|
private int _eventsPage = 1;
|
|
|
|
|
private const int EventsPageSize = 50;
|
2026-10-10 17:50:22 +02:00
|
|
|
|
|
|
|
|
private bool _loading = true;
|
|
|
|
|
private bool _facesLoading = true;
|
|
|
|
|
private bool _vehiclesLoading = true;
|
|
|
|
|
private bool _eventsLoading = true;
|
|
|
|
|
|
|
|
|
|
private bool _showForm;
|
|
|
|
|
private bool _confirmDeleteShow;
|
|
|
|
|
private bool _showSnapshot;
|
|
|
|
|
private int _faceIndex;
|
|
|
|
|
private EventItem? _showSnapshotEvent;
|
|
|
|
|
|
|
|
|
|
private readonly DialogOptions _dialogOptions = new()
|
|
|
|
|
{
|
|
|
|
|
FullWidth = true,
|
|
|
|
|
MaxWidth = MaxWidth.Large,
|
|
|
|
|
CloseButton = true
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private DateTime _eventsSince => DateTime.UtcNow.AddDays(-30);
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
Language.LanguageChanged += OnLanguageChanged;
|
2026-10-10 17:50:22 +02:00
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_person = await Api.GetPersonAsync(Id);
|
|
|
|
|
}
|
2026-11-08 13:02:38 +01:00
|
|
|
catch (HttpRequestException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound)
|
|
|
|
|
{
|
|
|
|
|
// La vue dédiée affiche l'état introuvable sans lancer les lectures associées.
|
|
|
|
|
}
|
2026-10-25 05:59:18 +01:00
|
|
|
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
|
2026-10-10 17:50:22 +02:00
|
|
|
finally { _loading = false; }
|
|
|
|
|
|
2026-11-08 13:02:38 +01:00
|
|
|
if (_person is not null)
|
|
|
|
|
{
|
|
|
|
|
await LoadFaces();
|
|
|
|
|
await LoadVehicles();
|
|
|
|
|
await LoadEvents();
|
|
|
|
|
}
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task LoadFaces()
|
|
|
|
|
{
|
|
|
|
|
_facesLoading = true;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_faces = (await Api.GetFacesAsync(Id)) ?? [];
|
|
|
|
|
}
|
2026-10-25 05:59:18 +01:00
|
|
|
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
|
2026-10-10 17:50:22 +02:00
|
|
|
finally { _facesLoading = false; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task LoadVehicles()
|
|
|
|
|
{
|
|
|
|
|
_vehiclesLoading = true;
|
|
|
|
|
try
|
|
|
|
|
{
|
2026-10-22 20:12:25 +02:00
|
|
|
_vehicles = await Api.GetVehiclesAsync(Id) ?? [];
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
2026-10-25 05:59:18 +01:00
|
|
|
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
|
2026-10-10 17:50:22 +02:00
|
|
|
finally { _vehiclesLoading = false; }
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-22 20:12:25 +02:00
|
|
|
private async Task LoadEvents(bool append = false)
|
2026-10-10 17:50:22 +02:00
|
|
|
{
|
|
|
|
|
_eventsLoading = true;
|
|
|
|
|
try
|
|
|
|
|
{
|
2026-10-22 20:12:25 +02:00
|
|
|
if (!append)
|
|
|
|
|
{
|
|
|
|
|
_eventsPage = 1;
|
|
|
|
|
_events = [];
|
|
|
|
|
}
|
|
|
|
|
var result = await Api.GetEventsAsync(null, null, page: _eventsPage, pageSize: EventsPageSize,
|
|
|
|
|
type: "FaceRecognized", from: _eventsSince, personId: Id);
|
|
|
|
|
if (result is not null)
|
|
|
|
|
{
|
|
|
|
|
_eventsTotalCount = result.TotalCount;
|
|
|
|
|
_events.AddRange(result.Items);
|
|
|
|
|
_eventsPage++;
|
|
|
|
|
}
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
2026-10-25 05:59:18 +01:00
|
|
|
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
|
2026-10-10 17:50:22 +02:00
|
|
|
finally { _eventsLoading = false; }
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-22 20:12:25 +02:00
|
|
|
private Task LoadMoreEvents() => LoadEvents(append: true);
|
|
|
|
|
|
2026-10-10 17:50:22 +02:00
|
|
|
private async Task OnPersonUpdated(PersonClientItem person)
|
|
|
|
|
{
|
|
|
|
|
_person = person;
|
|
|
|
|
await LoadFaces();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConfirmDelete() => _confirmDeleteShow = true;
|
|
|
|
|
|
|
|
|
|
private async Task ExecuteDelete()
|
|
|
|
|
{
|
|
|
|
|
_confirmDeleteShow = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (await Api.DeletePersonAsync(Id))
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
Snackbar.Add(string.Format(Text["PersonDetailPage_DeleteSuccess"], _person?.DisplayName), Severity.Success);
|
2026-10-10 17:50:22 +02:00
|
|
|
Nav.NavigateTo("/persons");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
Snackbar.Add(Text["PersonDetailPage_DeleteFailed"], Severity.Error);
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-25 05:59:18 +01:00
|
|
|
catch { Snackbar.Add(Text["PersonDetailPage_OperationFailed"], Severity.Error); }
|
2026-10-10 17:50:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShowSnapshot(EventItem ev)
|
|
|
|
|
{
|
|
|
|
|
_showSnapshotEvent = ev;
|
|
|
|
|
_showSnapshot = true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-25 05:59:18 +01:00
|
|
|
private string FormatCategory(string? category) => category switch
|
2026-10-10 17:50:22 +02:00
|
|
|
{
|
2026-10-25 05:59:18 +01:00
|
|
|
"family" => Text["PersonDetailPage_Family"],
|
|
|
|
|
"employee" => Text["PersonDetailPage_Employee"],
|
|
|
|
|
"watchlist" => Text["PersonDetailPage_Watchlist"],
|
|
|
|
|
"unknown" => Text["PersonDetailPage_Unknown"],
|
2026-10-10 17:50:22 +02:00
|
|
|
_ => "—"
|
|
|
|
|
};
|
2026-10-25 05:59:18 +01:00
|
|
|
|
|
|
|
|
private void OnLanguageChanged() => _ = InvokeAsync(StateHasChanged);
|
|
|
|
|
|
|
|
|
|
public void Dispose() => Language.LanguageChanged -= OnLanguageChanged;
|
2026-10-22 20:12:25 +02:00
|
|
|
}
|