Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/+trupp-named-by-number.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A Trupp-Typ can be set to "Funkrufname aus Nummer" in the Stammdaten, so the Atemschutz form asks for a number instead of a Funkrufname and the Trupp is called "CSA-Trupp 1" rather than "1 · CSA-Trupp" (#995).
2 changes: 1 addition & 1 deletion docs/master-data.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
{ "name": "Angriffstrupp", "memberCount": 2, "maxDurationMinutes": 30 },
{ "name": "Wassertrupp", "memberCount": 2, "maxDurationMinutes": 30 },
{ "name": "Schlauchtrupp", "memberCount": 2, "maxDurationMinutes": 30 },
{ "name": "CSA-Trupp", "memberCount": 3, "maxDurationMinutes": 20 },
{ "name": "CSA-Trupp", "memberCount": 3, "maxDurationMinutes": 20, "namedByNumber": true },
{ "name": "Strahlenschutztrupp", "memberCount": 3, "maxDurationMinutes": 30 },
{ "name": "LPA-Trupp", "memberCount": 2, "maxDurationMinutes": 60 }
],
Expand Down
57 changes: 40 additions & 17 deletions src/LageBuch.App.Shared/Views/MasterDataEditorView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -1400,30 +1400,53 @@
HorizontalAlignment="Left" Margin="0,12,0,0" Command="{Binding AddCommand}" />
<!-- A fixed trailing width matching the row template's icon-btn button, as in the
Fahrzeuge template above: "Auto" would size to this Grid's own empty content. -->
<Grid DockPanel.Dock="Top" ColumnDefinitions="*,110,150,32" Margin="0,0,0,6">
<!-- The Funkgruppen layout: on a phone the three fields drop under the name,
which 350px of fixed columns would otherwise squeeze to nothing. The
empty Auto column stands where Funkgruppen have their note. -->
<Grid DockPanel.Dock="Top" Classes="pick-header" ColumnDefinitions="*,Auto,Auto,32" Margin="0,0,0,6">
<TextBlock Grid.Column="0" Text="TYP" Classes="overline" FontSize="10" />
<TextBlock Grid.Column="1" Text="STÄRKE" Classes="overline" FontSize="10"
ToolTip.Tip="Personen im Trupp: 2, oder 3 mit zweitem Truppmann" />
<TextBlock Grid.Column="2" Text="EINSATZZEIT" Classes="overline" FontSize="10"
ToolTip.Tip="Vorgeschlagene Einsatzzeit bei der Anmeldung" />
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock Width="110" Text="STÄRKE" Classes="overline" FontSize="10"
ToolTip.Tip="Personen im Trupp: 2, oder 3 mit zweitem Truppmann" />
<TextBlock Width="150" Text="EINSATZZEIT" Classes="overline" FontSize="10"
ToolTip.Tip="Vorgeschlagene Einsatzzeit bei der Anmeldung" />
<TextBlock Width="90" Text="NUMMER" Classes="overline" FontSize="10"
ToolTip.Tip="Funkrufname aus Nummer, z. B. „CSA-Trupp 1“" />
</StackPanel>
</Grid>
<ScrollViewer>
<ItemsControl ItemsSource="{Binding Rows}" b:FocusNewItem.IsEnabled="True">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:TruppTypeRow">
<Grid ColumnDefinitions="*,110,150,32" Margin="0,0,0,6">
<TextBox Grid.Column="0" Margin="0,0,6,0" Text="{Binding Name}"
<Grid Classes="pick-row" ColumnDefinitions="*,Auto,Auto,32" RowDefinitions="Auto,Auto,Auto,Auto" Margin="0,0,0,6">
<Border Grid.Row="3" Grid.ColumnSpan="4" Classes="row-rule" />
<TextBox Grid.Column="0" Classes="row-name" Margin="0,0,6,0" Text="{Binding Name}"
PlaceholderText="Angriffstrupp" />
<!-- Bounds are bound, not written in: a Trupp has as many positions as
TruppRole has, and the control must never drift from it. -->
<NumericUpDown Grid.Column="1" Width="90" Increment="1" FormatString="0"
Minimum="{Binding MinMemberCount}"
Maximum="{Binding MaxMemberCount}"
Value="{Binding MemberCount}" VerticalAlignment="Center" />
<NumericUpDown Grid.Column="2" Width="110" Minimum="1" Increment="1"
Maximum="{Binding MaxDurationLimitMinutes}"
FormatString="0" Value="{Binding MaxDurationMinutes}"
VerticalAlignment="Center" />
<WrapPanel Classes="row-extras">
<!-- Bounds are bound, not written in: a Trupp has as many positions as
TruppRole has, and the control must never drift from it. -->
<StackPanel Width="110" VerticalAlignment="Center">
<TextBlock Classes="overline narrow-label" FontSize="10" Text="STÄRKE" />
<NumericUpDown Width="90" HorizontalAlignment="Left" Increment="1" FormatString="0"
Minimum="{Binding MinMemberCount}"
Maximum="{Binding MaxMemberCount}"
Value="{Binding MemberCount}" />
</StackPanel>
<StackPanel Width="150" VerticalAlignment="Center">
<TextBlock Classes="overline narrow-label" FontSize="10" Text="EINSATZZEIT" />
<NumericUpDown Width="110" HorizontalAlignment="Left" Minimum="1" Increment="1"
Maximum="{Binding MaxDurationLimitMinutes}"
FormatString="0" Value="{Binding MaxDurationMinutes}" />
</StackPanel>
<!-- #995: the Trupp is called by a number, "CSA-Trupp 1", rather than
by a vehicle's Funkrufname. -->
<StackPanel Width="90" VerticalAlignment="Center">
<TextBlock Classes="overline narrow-label" FontSize="10" Text="NUMMER" />
<CheckBox IsChecked="{Binding NamedByNumber}"
ToolTip.Tip="Funkrufname aus Nummer, z. B. „CSA-Trupp 1“"
AutomationProperties.Name="Funkrufname aus Nummer" />
</StackPanel>
</WrapPanel>
<!-- ReflectionBinding: see the Fahrzeuge template for why a compiled
$parent path cannot resolve here. -->
<Button Grid.Column="3" Classes="icon-btn" Margin="4,0,0,0" ToolTip.Tip="Entfernen"
Expand Down
15 changes: 14 additions & 1 deletion src/LageBuch.App.Shared/Views/ScbaView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@
<!-- Suggestion list, not a closed set: an ad-hoc or mutual-aid call sign must stay
enterable, so this is an AutoCompleteBox rather than a ComboBox (#92). This is the
vehicle/unit the Trupp rides with, hence leading the form (#78). -->
<HeaderedContentControl Classes="field suggest" Header="FUNKRUFNAME">
<!-- Hidden for a Trupp-Art named by its number (#995): that Trupp is called "CSA-Trupp 1",
and the NUMMER box after TRUPP-ART takes this one's place. -->
<HeaderedContentControl Classes="field suggest" Header="FUNKRUFNAME" IsVisible="{Binding !IsNamedByNumber}">
<AutoCompleteBox x:Name="CallSignBox"
PlaceholderText="{x:Static md:AnonymizedExampleData.CallSignPlaceholder}"
ItemsSource="{Binding CallSignOptions}"
Expand All @@ -181,6 +183,17 @@
<ComboBox x:Name="TruppTypeBox" ItemsSource="{Binding TruppTypeOptions}"
SelectedItem="{Binding NewDesignation}" />
</HeaderedContentControl>
<!-- #995: a Trupp-Art the Stammdaten mark "Funkrufname aus Nummer" is called by its
number. Placed after TRUPP-ART, which is what makes it appear, so the Tab order
reaches it next instead of having passed its slot already. The next free number is
suggested; a taken one is refused on the press. Maximum 999, not 99: a returned
Trupp keeps its number, so the suggestion can pass 99 in a long Einsatz. -->
<HeaderedContentControl Classes="field required" Header="NUMMER" IsVisible="{Binding IsNamedByNumber}"
Classes.invalid="{Binding NewTypeNumberError, Converter={x:Static ObjectConverters.IsNotNull}}">
<NumericUpDown x:Name="TypeNumberBox" Width="90" Minimum="1" Maximum="999" Increment="1"
FormatString="0" Value="{Binding NewTypeNumber}"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
AutomationProperties.Name="Truppnummer" />
</HeaderedContentControl>
<!-- One box per position rather than a single free-text field: a Trupp is two people,
or three where its Stammdaten-Eintrag says so, and the third box only appears when the
selected Trupp-Typ calls for it (#398). Crew names
Expand Down
10 changes: 8 additions & 2 deletions src/LageBuch.AppLogic/LocalIncidentSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ public void UpdateTask(Guid taskId, string text, string? assignee, TaskImportanc
public void ExtendTaskTimer(Guid taskId, int minutes) =>
Mutate(() => Incident.ExtendTaskTimer(taskId, minutes, _clock));

public void AddScbaTrupp(
// Synchronous underneath: a duplicate throws before the caller's await, exactly as it did when
// this returned void, and nothing here waits on I/O the token could cancel.
public Task AddScbaTruppAsync(
string designation,
IEnumerable<TruppMember> members,
int entryPressure,
Expand All @@ -317,7 +319,9 @@ public void AddScbaTrupp(
string? task = null,
int maxDurationMinutes = AtemschutzTrupp.DefaultMaxDurationMinutes,
int returnPressureBar = AtemschutzTrupp.DefaultReturnPressureBar,
int pressureControlIntervalMinutes = AtemschutzTrupp.DefaultPressureControlIntervalMinutes) =>
int pressureControlIntervalMinutes = AtemschutzTrupp.DefaultPressureControlIntervalMinutes,
CancellationToken cancellationToken = default)
{
Mutate(() => Incident.AddScbaTrupp(
_clock,
designation,
Expand All @@ -329,6 +333,8 @@ public void AddScbaTrupp(
maxDurationMinutes,
returnPressureBar,
pressureControlIntervalMinutes));
return Task.CompletedTask;
}

public void StartScbaTrupp(Guid truppId) =>
Mutate(() => Incident.StartScbaTrupp(_clock, truppId));
Expand Down
10 changes: 8 additions & 2 deletions src/LageBuch.AppLogic/ViewModels/DomainRefusal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ namespace LageBuch.AppLogic.ViewModels;
public static class DomainRefusal
{
/// <summary>"Nicht möglich: " and the refusal's own sentence.</summary>
public static string Message(Exception exception)
public static string Message(Exception exception) => $"Nicht möglich: {Reason(exception)}";

/// <summary>
/// The refusal's own sentence, without the runtime's suffix. The host answers a peer's refused
/// command with this, so a joined device reads what the local one would.
/// </summary>
public static string Reason(Exception exception)
{
ArgumentNullException.ThrowIfNull(exception);

Expand All @@ -23,6 +29,6 @@ public static string Message(Exception exception)
}
}

return $"Nicht möglich: {message}";
return message;
}
}
Loading