Initial commit: Lagerbestand Blazor Projekt
This commit is contained in:
commit
cba9414e92
105 files changed
+36431
No files matched your search
@@ -0,0 +1,188 @@
|
||||
@using Lagerbestand.Models
|
||||
@using Lagerbestand.Services
|
||||
@inject ILocationCodeService LocationCodeService
|
||||
|
||||
@if (!string.IsNullOrEmpty(Code))
|
||||
{
|
||||
<div class="location-display @SizeClass @AreaClass @(IsOccupied ? "occupied" : "available")">
|
||||
@if (ShowIcon)
|
||||
{
|
||||
<span class="area-icon">@AreaIcon</span>
|
||||
}
|
||||
|
||||
<div class="location-content">
|
||||
@if (DisplayMode == LocationDisplayMode.Code)
|
||||
{
|
||||
<span class="location-code">@Code</span>
|
||||
}
|
||||
else if (DisplayMode == LocationDisplayMode.Full)
|
||||
{
|
||||
<span class="location-code">@Code</span>
|
||||
<span class="location-text">@DisplayText</span>
|
||||
}
|
||||
else if (DisplayMode == LocationDisplayMode.Text)
|
||||
{
|
||||
<span class="location-text">@DisplayText</span>
|
||||
}
|
||||
else if (DisplayMode == LocationDisplayMode.Compact)
|
||||
{
|
||||
<span class="location-compact">@ShortText</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (ShowStatus)
|
||||
{
|
||||
<span class="status-indicator @(IsOccupied ? "occupied" : "available")" title="@(IsOccupied ? "Belegt" : "Frei")">
|
||||
@(IsOccupied ? "?" : "?")
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span class="location-empty">-</span>
|
||||
}
|
||||
|
||||
<style>
|
||||
.location-display {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 6px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
/* Size variants */
|
||||
.location-display.size-sm {
|
||||
font-size: 0.8rem;
|
||||
padding: 0.15rem 0.35rem;
|
||||
gap: 0.3rem;
|
||||
}
|
||||
|
||||
.location-display.size-md {
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.location-display.size-lg {
|
||||
font-size: 1.1rem;
|
||||
padding: 0.35rem 0.65rem;
|
||||
}
|
||||
|
||||
/* Area color coding */
|
||||
.location-display.area-lager {
|
||||
background: rgba(52, 152, 219, 0.1);
|
||||
border: 1px solid rgba(52, 152, 219, 0.3);
|
||||
}
|
||||
|
||||
.location-display.area-werkstatt {
|
||||
background: rgba(155, 89, 182, 0.1);
|
||||
border: 1px solid rgba(155, 89, 182, 0.3);
|
||||
}
|
||||
|
||||
/* Occupancy styling */
|
||||
.location-display.occupied {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.area-icon {
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.location-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.1rem;
|
||||
}
|
||||
|
||||
.location-code {
|
||||
font-family: 'Monaco', 'Consolas', monospace;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
.location-text {
|
||||
font-size: 0.85em;
|
||||
color: var(--text-secondary, #666);
|
||||
}
|
||||
|
||||
.location-compact {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-indicator {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.status-indicator.available {
|
||||
color: var(--color-success, #28a745);
|
||||
}
|
||||
|
||||
.status-indicator.occupied {
|
||||
color: var(--color-error, #dc3545);
|
||||
}
|
||||
|
||||
.location-empty {
|
||||
color: var(--text-muted, #999);
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public string? Code { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public LocationDisplayMode DisplayMode { get; set; } = LocationDisplayMode.Full;
|
||||
|
||||
[Parameter]
|
||||
public LocationDisplaySize Size { get; set; } = LocationDisplaySize.Medium;
|
||||
|
||||
[Parameter]
|
||||
public bool ShowIcon { get; set; } = true;
|
||||
|
||||
[Parameter]
|
||||
public bool ShowStatus { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public bool IsOccupied { get; set; }
|
||||
|
||||
private ParsedLocationCode? _parsed;
|
||||
|
||||
private string SizeClass => Size switch
|
||||
{
|
||||
LocationDisplaySize.Small => "size-sm",
|
||||
LocationDisplaySize.Large => "size-lg",
|
||||
_ => "size-md"
|
||||
};
|
||||
|
||||
private string AreaClass => _parsed?.Area switch
|
||||
{
|
||||
AreaType.Lager => "area-lager",
|
||||
AreaType.Werkstatt => "area-werkstatt",
|
||||
_ => ""
|
||||
};
|
||||
|
||||
private string AreaIcon => _parsed?.Area switch
|
||||
{
|
||||
AreaType.Lager => "??",
|
||||
AreaType.Werkstatt => "??",
|
||||
_ => "??"
|
||||
};
|
||||
|
||||
private string DisplayText => _parsed != null
|
||||
? $"{_parsed.Area.GetDisplayName()}, Reihe {_parsed.Row}, {_parsed.Position.GetDisplayName()}, Platz {_parsed.SlotNumber}"
|
||||
: Code ?? "";
|
||||
|
||||
private string ShortText => _parsed != null
|
||||
? $"{_parsed.Area.GetDisplayName()} R{_parsed.Row} {_parsed.Position.GetShortName()} P{_parsed.SlotNumber}"
|
||||
: Code ?? "";
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
_parsed = null;
|
||||
if (!string.IsNullOrEmpty(Code) && LocationCodeService.TryParseLocationCode(Code, out var parsed))
|
||||
{
|
||||
_parsed = parsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user