PaymentVariantsWindow: Add commit and revert buttons
This commit is contained in:
@ -85,6 +85,17 @@
|
|||||||
|
|
||||||
<GroupBox Header="Abschluss" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="10,0,10,10">
|
<GroupBox Header="Abschluss" Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Margin="10,0,10,10">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<Button x:Name="CommitButton" FontSize="12" Width="160" Height="40" Margin="0,0,10,55"
|
||||||
|
Click="CommitButton_Click"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||||
|
<TextBlock TextAlignment="Center">Traubengutschriften<LineBreak/>erstellen</TextBlock>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="RevertButton" FontSize="12" Width="160" Height="40" Margin="0,0,10,10"
|
||||||
|
Click="RevertButton_Click"
|
||||||
|
VerticalAlignment="Bottom" HorizontalAlignment="Right">
|
||||||
|
<TextBlock TextAlignment="Center">Traubengutschriften<LineBreak/>löschen</TextBlock>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<ProgressBar x:Name="ProgressBar" Margin="10,0,0,74" Height="27" Width="180"
|
<ProgressBar x:Name="ProgressBar" Margin="10,0,0,74" Height="27" Width="180"
|
||||||
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
VerticalAlignment="Bottom" HorizontalAlignment="Left"/>
|
||||||
<Button x:Name="ShowButton" Content="Vorschau" FontSize="14" Width="180" Margin="10,10,10,42" Height="27" Tag="Print" IsEnabled="False"
|
<Button x:Name="ShowButton" Content="Vorschau" FontSize="14" Width="180" Margin="10,10,10,42" Height="27" Tag="Print" IsEnabled="False"
|
||||||
|
@ -30,9 +30,11 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private void Update() {
|
private void Update() {
|
||||||
if (PaymentVariantList.SelectedItem is PaymentVar v) {
|
if (PaymentVariantList.SelectedItem is PaymentVar v) {
|
||||||
var locked = v.TransferDate != null || !v.TestVariant;
|
var locked = !v.TestVariant;
|
||||||
DeleteButton.IsEnabled = !locked;
|
DeleteButton.IsEnabled = !locked;
|
||||||
CalculateButton.IsEnabled = !locked;
|
CalculateButton.IsEnabled = !locked;
|
||||||
|
CommitButton.IsEnabled = !locked;
|
||||||
|
RevertButton.IsEnabled = locked;
|
||||||
CopyButton.IsEnabled = true;
|
CopyButton.IsEnabled = true;
|
||||||
EditButton.IsEnabled = true;
|
EditButton.IsEnabled = true;
|
||||||
ShowButton.IsEnabled = true;
|
ShowButton.IsEnabled = true;
|
||||||
@ -44,6 +46,8 @@ namespace Elwig.Windows {
|
|||||||
EditButton.IsEnabled = false;
|
EditButton.IsEnabled = false;
|
||||||
CopyButton.IsEnabled = false;
|
CopyButton.IsEnabled = false;
|
||||||
CalculateButton.IsEnabled = false;
|
CalculateButton.IsEnabled = false;
|
||||||
|
CommitButton.IsEnabled = false;
|
||||||
|
RevertButton.IsEnabled = false;
|
||||||
DeleteButton.IsEnabled = false;
|
DeleteButton.IsEnabled = false;
|
||||||
ShowButton.IsEnabled = false;
|
ShowButton.IsEnabled = false;
|
||||||
PrintButton.IsEnabled = false;
|
PrintButton.IsEnabled = false;
|
||||||
@ -94,6 +98,30 @@ namespace Elwig.Windows {
|
|||||||
await Generate(2);
|
await Generate(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void CommitButton_Click(object sender, RoutedEventArgs e) {
|
||||||
|
if (PaymentVariantList.SelectedValue is not PaymentVar v)
|
||||||
|
return;
|
||||||
|
CommitButton.IsEnabled = false;
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
var b = new BillingVariant(v.Year, v.AvNr);
|
||||||
|
await b.Commit();
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
RevertButton.IsEnabled = true;
|
||||||
|
await HintContextChange();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void RevertButton_Click(object sender, RoutedEventArgs e) {
|
||||||
|
if (PaymentVariantList.SelectedValue is not PaymentVar v)
|
||||||
|
return;
|
||||||
|
RevertButton.IsEnabled = false;
|
||||||
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
|
var b = new BillingVariant(v.Year, v.AvNr);
|
||||||
|
await b.Revert();
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
CommitButton.IsEnabled = true;
|
||||||
|
await HintContextChange();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task Generate(int mode) {
|
private async Task Generate(int mode) {
|
||||||
if (PaymentVariantList.SelectedItem is not PaymentVar v)
|
if (PaymentVariantList.SelectedItem is not PaymentVar v)
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user