Entwicklung_BLAZOR/WerksverkaufScanner/WerksverkaufScanner/Pages/Einstellungen.razor

80 lines
2.6 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@page "/einstellungen"
@attribute [Authorize]
@inject NetworkInfoService NetInfo
<PageTitle>ScannerPilot - Einstellungen</PageTitle>
<h2>Einstellungen</h2>
@if (loading)
{
<p>Lade aktuelle Einstellungen …</p>
}
else
{
<dl class="row">
<dt class="col-sm-3">Aktuelle FilialID</dt>
<dd class="col-sm-9">@currentFilialId (@currentFilialName)</dd>
<dt class="col-sm-3">Angemeldeter Benutzer</dt>
<dd class="col-sm-9">@currentUser</dd>
<dt class="col-sm-3">ClientIP</dt>
<dd class="col-sm-9">@currentIp</dd>
<dt class="col-sm-3">MAC-Adresse</dt>
<dd class="col-sm-9">@macAdresse</dd>
</dl>
}
<div class="alert alert-light border mt-4">
<strong>Support:</strong>
Bei Fragen oder Problemen wenden Sie sich bitte an <br /><br />
<strong>Herrn Meinhold</strong> (📞 0175 / 35 31 462, ✉️ <a href="mailto:christopher.meinhold@lambertz.com">christopher.meinhold@lambertz.com</a>)<br />
oder<br />
<strong>Herrn Vossel</strong> (📞 02405 / 40804 188, ✉️ <a href="mailto:ruediger.vossel@lambertz.com">ruediger.vossel@lambertz.com</a>)
</div>
@code {
[Inject] private FilialService FilialService { get; set; } = default!;
[Inject] private AuthenticationStateProvider AuthProvider { get; set; } = default!;
[Inject] private IJSRuntime JS { get; set; } = default!;
[Inject] private IHttpContextAccessor HttpContextAccessor { get; set; } = default!;
@inject NetworkInfoService NetInfo
private string? currentUser;
private string? currentIp;
private string? macAdresse;
private int? currentFilialId;
private string? currentFilialName;
private bool loading = true;
protected override async Task OnInitializedAsync()
{
// Angemeldeten Benutzer ermitteln
var authState = await AuthProvider.GetAuthenticationStateAsync();
currentUser = authState.User.Identity?.Name;
// FilialID aus localStorage lesen
var filialStr = await JS.InvokeAsync<string?>("localStorage.getItem", "scannerpilot.filialId");
if (!string.IsNullOrWhiteSpace(filialStr) && int.TryParse(filialStr.Trim('"'), out var filialId))
{
currentFilialId = filialId;
// Filialname via DB laden
var filiale = await FilialService.GetFilialeAsync(filialId);
currentFilialName = filiale?.Bezeichnung;
}
// IP aus HttpContext/ForwardedHeaders
var ip = HttpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
currentIp = ip;
macAdresse = NetInfo.GetMacFromIp(currentIp);
loading = false;
}
}