Added Filter flag (checkbox) to select only shipcalls the users participant is assigned to

This commit is contained in:
Daniel Schick 2024-03-29 11:05:48 +01:00
parent 32296f7d15
commit 0ca8e1f916
7 changed files with 56 additions and 2 deletions

View File

@ -675,6 +675,22 @@ namespace BreCalClient
});
}
if(sfm.MineOnly ?? false)
{
_ = _visibleControlModels.RemoveAll(x =>
{
bool contained = false;
foreach(ParticipantAssignment p in x.AssignedParticipants.Values)
{
if(p.ParticipantId.Equals(App.Participant.Id))
{
contained = true; break;
}
}
return !contained;
});
}
if(!_showCanceled ?? true) // canceled calls are filtered by default
{
_ = this._visibleControlModels.RemoveAll(x => x.Shipcall?.Canceled ?? false);

View File

@ -654,6 +654,15 @@ namespace BreCalClient.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to mine only.
/// </summary>
public static string textMineOnly {
get {
return ResourceManager.GetString("textMineOnly", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Moored in lock.
/// </summary>

View File

@ -457,6 +457,9 @@
<data name="textShowHistory" xml:space="preserve">
<value>Änderungshistorie der Anläufe anzeigen</value>
</data>
<data name="textMineOnly" xml:space="preserve">
<value>nur eigene</value>
</data>
<data name="textOperation" xml:space="preserve">
<value>Vorgang</value>
</data>

View File

@ -310,6 +310,9 @@
<data name="textLogin" xml:space="preserve">
<value>Login</value>
</data>
<data name="textMineOnly" xml:space="preserve">
<value>mine only</value>
</data>
<data name="textMooredLock" xml:space="preserve">
<value>Moored in lock</value>
</data>

View File

@ -74,8 +74,17 @@
<Label Grid.Column="1" Content="{x:Static p:Resources.textTo}" />
<xctk:DoubleUpDown x:Name="upDownShiplengthTo" Grid.Column="2" Margin="2" Minimum="0" Maximum="1000" ValueChanged="upDownShiplengthTo_ValueChanged" Value="{Binding Path=ShipLengthTo}"/>
</Grid>
<xctk:WatermarkTextBox x:Name="textBoxSearch" Grid.Column="2" Grid.Row="1" Margin="2" Watermark="{x:Static p:Resources.textEnterKeyword}" PreviewTextInput="textBoxSearch_PreviewTextInput"
<Grid Grid.Column="2" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".5*" />
<ColumnDefinition Width="30" />
<ColumnDefinition Width=".5*" />
</Grid.ColumnDefinitions>
<xctk:WatermarkTextBox x:Name="textBoxSearch" Grid.Column="0" Margin="2" Watermark="{x:Static p:Resources.textEnterKeyword}" PreviewTextInput="textBoxSearch_PreviewTextInput"
DataObject.Pasting="textBoxSearch_Pasting" TextChanged="textBoxSearch_TextChanged" />
<CheckBox x:Name="checkBoxOwn" VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Right" Margin="2" Checked="checkBoxOwn_Checked" Unchecked="checkBoxOwn_Checked" />
<Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="2" />
</Grid>
<xctk:CheckComboBox x:Name="comboBoxBerths" DisplayMemberPath="Name" Grid.Column="4" Grid.Row="1" Margin="2" ItemSelectionChanged="comboBoxBerths_ItemSelectionChanged" />
<xctk:CheckComboBox x:Name="comboBoxAgencies" DisplayMemberPath="Name" Grid.Column="6" Grid.Row="1" Margin="2" ItemSelectionChanged="comboBoxAgencies_ItemSelectionChanged" />
</Grid>

View File

@ -77,6 +77,7 @@ namespace BreCalClient
this.textBoxSearch.Clear();
this.upDownShiplengthFrom.Value = null;
this.upDownShiplengthTo.Value = null;
this.checkBoxOwn.IsChecked = false;
}
@ -108,6 +109,7 @@ namespace BreCalClient
this.upDownShiplengthTo.Value = sfm.ShipLengthTo;
this.datePickerETAFrom.SelectedDate = sfm.EtaFrom;
this.datePickerETATo.SelectedDate = sfm.EtaTo;
this.checkBoxOwn.IsChecked = sfm.MineOnly;
this._model = sfm;
SearchFilterChanged?.Invoke();
@ -194,6 +196,12 @@ namespace BreCalClient
SearchFilterChanged?.Invoke();
}
private void checkBoxOwn_Checked(object sender, System.Windows.RoutedEventArgs e)
{
this._model.MineOnly = this.checkBoxOwn.IsChecked;
SearchFilterChanged?.Invoke();
}
#endregion
}

View File

@ -31,8 +31,12 @@ namespace BreCalClient
public double? ShipLengthTo { get; set; }
public bool? MineOnly { get; set; }
#endregion
#region Serialisation
public static SearchFilterModel? Deserialize(string json)
{
return (SearchFilterModel?) JsonConvert.DeserializeObject(json, typeof(SearchFilterModel));
@ -43,5 +47,7 @@ namespace BreCalClient
return JsonConvert.SerializeObject(this, Formatting.Indented);
}
#endregion
}
}