Make lock time editable only for port authority and show it in the overview grid

This commit is contained in:
Daniel Schick 2024-04-23 12:01:50 +02:00
parent 2e3a957947
commit ef017eee61
3 changed files with 40 additions and 29 deletions

View File

@ -124,6 +124,8 @@ namespace BreCalClient
{ {
Extensions.ParticipantType pType = (Extensions.ParticipantType) this.Times.ParticipantType; Extensions.ParticipantType pType = (Extensions.ParticipantType) this.Times.ParticipantType;
// setting visibility
if (pType != Extensions.ParticipantType.MOORING) if (pType != Extensions.ParticipantType.MOORING)
{ {
this.labelATA.Visibility = Visibility.Hidden; this.labelATA.Visibility = Visibility.Hidden;
@ -145,40 +147,32 @@ namespace BreCalClient
} }
} }
// setting en/dis-abled
if (this.Times.ParticipantId != App.Participant.Id) if (this.Times.ParticipantId != App.Participant.Id)
{ {
this.buttonFixedOrder.IsEnabled = false; this.buttonFixedOrder.IsEnabled = false;
return; // if this is not "my" entry, there is no editing! return; // if this is not "my" entry, there is no editing!
} }
if(pType == Extensions.ParticipantType.MOORING) this.datePickerETABerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
{ this.datePickerETABerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerATA.IsEnabled = true; this.datePickerETDBerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerATD.IsEnabled = true; this.datePickerETDBerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
} this.textBoxRemarks.IsEnabled = true;
switch (pType) switch (pType)
{ {
case Extensions.ParticipantType.MOORING: case Extensions.ParticipantType.MOORING:
case Extensions.ParticipantType.PORT_ADMINISTRATION: this.datePickerATA.IsEnabled = true;
case Extensions.ParticipantType.TUG: this.datePickerATD.IsEnabled = true;
this.datePickerETABerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETABerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETDBerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerETDBerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerLockTime.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerZoneEntry.IsEnabled = false;
this.textBoxRemarks.IsEnabled = true;
break; break;
case Extensions.ParticipantType.PORT_ADMINISTRATION:
this.datePickerLockTime.IsEnabled = true;
break;
case Extensions.ParticipantType.TUG:
case Extensions.ParticipantType.PILOT: case Extensions.ParticipantType.PILOT:
this.datePickerETABerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETABerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.datePickerETDBerth.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerETDBerth_End.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Departure || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerLockTime.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival || ShipcallModel.Shipcall?.Type == ShipcallType.Shifting);
this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival); this.datePickerZoneEntry.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival);
this.textBoxRemarks.IsEnabled = true;
break; break;
} }
@ -204,8 +198,12 @@ namespace BreCalClient
private void CheckOKButton() private void CheckOKButton()
{ {
this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ? Extensions.ParticipantType pType = (Extensions.ParticipantType)this.Times.ParticipantType;
this.datePickerETABerth.Value.HasValue : this.datePickerETDBerth.Value.HasValue; if (pType != Extensions.ParticipantType.PORT_ADMINISTRATION)
this.buttonOK.IsEnabled = (ShipcallModel.Shipcall?.Type == ShipcallType.Arrival) ?
this.datePickerETABerth.Value.HasValue : this.datePickerETDBerth.Value.HasValue;
else
this.buttonOK.IsEnabled = true;
} }
#endregion #endregion

View File

@ -168,13 +168,16 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="20" /> <RowDefinition Height="20" />
<RowDefinition Height="0" x:Name="lockTimeRowDefinition" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" x:Name="labelETAETDPortAuthority" Content="ETA" Padding="0" VerticalContentAlignment="Center" /> <Label Grid.Row="0" Grid.Column="0" x:Name="labelETAETDPortAuthority" Content="ETA" Padding="0" VerticalContentAlignment="Center" />
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/> <Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Content="{x:Static p:Resources.textRemarks}" Padding="0" VerticalContentAlignment="Top" FontSize="9"/>
<Label Grid.Row="1" Grid.Column="0" Content="{x:Static p:Resources.textLockTime}" VerticalContentAlignment="Center" Padding="0"/>
<Label Grid.Row="1" Grid.Column="1" x:Name="labelPortAuthorityLockTime" VerticalContentAlignment="Center" Padding="0" />
<Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPortAuthorityETAETDValue" FontWeight="DemiBold"/> <Label Grid.Row="0" Grid.Column="1" Padding="0" VerticalContentAlignment="Center" x:Name="labelPortAuthorityETAETDValue" FontWeight="DemiBold"/>
<Image Grid.Row="1" Grid.Column="0" x:Name="imagePortAuthorityLocked" VerticalAlignment="Top" Margin="0 20 0 0" HorizontalAlignment="Left" Source="./Resources/lock.png" Width="16" Height="16" ToolTip="{x:Static p:Resources.textFixedOrder}"/> <Image Grid.Row="2" Grid.Column="0" x:Name="imagePortAuthorityLocked" VerticalAlignment="Top" Margin="0 20 0 0" HorizontalAlignment="Left" Source="./Resources/lock.png" Width="16" Height="16" ToolTip="{x:Static p:Resources.textFixedOrder}"/>
<TextBlock Grid.Row="1" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPortAuthorityRemarks"/> <TextBlock Grid.Row="2" Grid.Column="1" Padding="0" TextWrapping="Wrap" VerticalAlignment="Top" x:Name="textBlockPortAuthorityRemarks"/>
</Grid> </Grid>
</Border> </Border>
<!-- PILOT --> <!-- PILOT -->

View File

@ -28,6 +28,7 @@ namespace BreCalClient
private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl)); private static readonly ILog _log = LogManager.GetLogger(typeof(ShipcallControl));
bool ataAdded = false; bool ataAdded = false;
bool atdAdded = false; bool atdAdded = false;
bool lockTimeAdded = false;
#endregion #endregion
@ -351,7 +352,7 @@ namespace BreCalClient
{ {
ataRowDefinition.Height = new GridLength(15); ataRowDefinition.Height = new GridLength(15);
labelTimesMooringATA.Content = mooringTimes.Ata.Value.ToString("dd.MM.yyyy HH:mm"); ; labelTimesMooringATA.Content = mooringTimes.Ata.Value.ToString("dd.MM.yyyy HH:mm");
ataAdded = true; ataAdded = true;
} }
} }
@ -380,6 +381,15 @@ namespace BreCalClient
this.labelPortAuthorityETAETDValue.Content = portAuthorityTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival); this.labelPortAuthorityETAETDValue.Content = portAuthorityTimes.DisplayTime(this.ShipcallControlModel?.Shipcall?.Type == ShipcallType.Arrival);
this.textBlockPortAuthorityRemarks.Text = portAuthorityTimes.Remarks; this.textBlockPortAuthorityRemarks.Text = portAuthorityTimes.Remarks;
this.imagePortAuthorityLocked.Visibility = (portAuthorityTimes.EtaBerthFixed ?? false) ? Visibility.Visible : Visibility.Hidden; this.imagePortAuthorityLocked.Visibility = (portAuthorityTimes.EtaBerthFixed ?? false) ? Visibility.Visible : Visibility.Hidden;
if(portAuthorityTimes.LockTime.HasValue)
{
if(!lockTimeAdded)
{
lockTimeRowDefinition.Height = new GridLength(15);
labelPortAuthorityLockTime.Content = portAuthorityTimes.LockTime.Value.ToString("dd.MM.yyyy HH:mm");
lockTimeAdded = true;
}
}
} }
else else
{ {