Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d54bd749a | ||
|
|
cbda6d6563 | ||
|
|
6ed8c0e231 | ||
|
|
59ea707007 | ||
|
|
0cce15a8f6 | ||
|
|
5f200fbeef |
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ namespace Logof_Client;
|
|||||||
public static class SchemaMigration
|
public static class SchemaMigration
|
||||||
{
|
{
|
||||||
// Current schema version - increment when you make breaking changes
|
// Current schema version - increment when you make breaking changes
|
||||||
public const int CURRENT_SCHEMA_VERSION = 3;
|
public const int CURRENT_SCHEMA_VERSION = 4;
|
||||||
|
|
||||||
// Dictionary of migration functions, keyed by the version they migrate TO
|
// Dictionary of migration functions, keyed by the version they migrate TO
|
||||||
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
||||||
@@ -22,7 +23,7 @@ public static class SchemaMigration
|
|||||||
// { 2, MigrateV1ToV2 },
|
// { 2, MigrateV1ToV2 },
|
||||||
|
|
||||||
// Example: Migration from v2 to v3
|
// Example: Migration from v2 to v3
|
||||||
// { 3, MigrateV2ToV3 },
|
{ 4, MigrateV3ToV4 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -93,12 +94,12 @@ public static class SchemaMigration
|
|||||||
/// Example migration function: from v2 to v3.
|
/// Example migration function: from v2 to v3.
|
||||||
/// Add a new required field with a default value.
|
/// Add a new required field with a default value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static JObject MigrateV2ToV3(JObject obj)
|
private static JObject MigrateV3ToV4(JObject obj)
|
||||||
{
|
{
|
||||||
// Example: Add a new field that didn't exist before
|
// Example: Add a new field that didn't exist before
|
||||||
if (!obj.ContainsKey("new_required_field"))
|
if (!obj.ContainsKey("moduleConfig"))
|
||||||
{
|
{
|
||||||
obj["new_required_field"] = "default_value";
|
obj["moduleConfig"] = JToken.FromObject(new ModuleConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ public class Settings
|
|||||||
public Customers customers = new();
|
public Customers customers = new();
|
||||||
public PdfExportSettings pdfExport { get; set; } = new();
|
public PdfExportSettings pdfExport { get; set; } = new();
|
||||||
|
|
||||||
|
public ModuleConfig moduleConfig { get; set; } = new ModuleConfig();
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
@@ -70,6 +73,29 @@ public class Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ModuleConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains enabled modules and whether it's password-protected or not (non-existing-feature but soon)
|
||||||
|
/// </summary>
|
||||||
|
public List<(LCModule, bool)> EnabledModules = new();
|
||||||
|
public ModuleConfig()
|
||||||
|
{
|
||||||
|
EnabledModules = new List<(LCModule,bool)>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LCModule
|
||||||
|
{
|
||||||
|
Addressmanagement,
|
||||||
|
Pricemanagement,
|
||||||
|
Wiki,
|
||||||
|
Staffmanagement,
|
||||||
|
UnifiedEndpointManagement,
|
||||||
|
Financemanagement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class PdfExportSettings
|
public class PdfExportSettings
|
||||||
{
|
{
|
||||||
public double cellPaddingTopMm { get; set; } = 4;
|
public double cellPaddingTopMm { get; set; } = 4;
|
||||||
|
|||||||
+62
-6
@@ -21,8 +21,45 @@
|
|||||||
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<TabControl Grid.Row="1">
|
<TabControl Grid.Row="1" x:Name="TcMain">
|
||||||
<TabItem>
|
<TabItem x:Name="Home">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="House" Width="32" Height="32" Size="32" />
|
||||||
|
<!-- <Label FontSize="20" Content="Addressverwaltung" VerticalContentAlignment="Center" /> -->
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<Grid RowDefinitions="3*,*,100">
|
||||||
|
<StackPanel Orientation="Vertical" Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" > <!-- ColumnDefinitions="*,*" -->
|
||||||
|
<Label Content="Welcome to Logofclient!" HorizontalAlignment="Center" FontSize="32" ></Label>
|
||||||
|
<Label Content="Version 1.0.1" FontSize="16" HorizontalAlignment="Center"></Label>
|
||||||
|
<!-- <Image Source="assets/calc_man.png" MaxHeight="350" VerticalAlignment="Center" HorizontalAlignment="Center" /> -->
|
||||||
|
</StackPanel>
|
||||||
|
<Grid Grid.Row="1" Margin="20" IsVisible="True" x:Name="GrdHMCalcMan">
|
||||||
|
<Image Source="assets/calc_man.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
<!-- <Grid ColumnDefinitions="*,*,*" Grid.Row="1"> -->
|
||||||
|
<StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="10" HorizontalAlignment="Center"
|
||||||
|
Margin="0,0,5,0">
|
||||||
|
<Button Width="250" HorizontalContentAlignment="Center"
|
||||||
|
Margin="0,0,0,10" IsEnabled="True" VerticalAlignment="Stretch"
|
||||||
|
x:Name="BtnAdmgmt" Click="BtnAdmgmt_OnClick">
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="MapPinHouse" Width="36" Height="36" />
|
||||||
|
<Label Content="Addressverwaltung" VerticalContentAlignment="Center" FontSize="15"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock TextWrapping="Wrap" FontSize="9" Text="Strukturierte Verwaltung von Adressen für Pressepost-Printmailings inkl. Erstellung von Bundleitzetteln." HorizontalAlignment="Stretch" TextAlignment="Left"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
<!-- </Grid> -->
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsVisible="False" x:Name="Addressmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
||||||
@@ -396,7 +433,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Staffmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
||||||
@@ -404,7 +441,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Financemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -412,7 +449,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Pricemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -420,7 +457,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="True">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="UnifiedEndpointManagement">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="MonitorCog" Width="32" Height="32" Size="32" />
|
||||||
|
<Label FontSize="20" Content="UEM" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsEnabled="True" IsVisible="False" x:Name="Wiki">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
||||||
@@ -540,6 +585,17 @@
|
|||||||
<!-- </Grid> -->
|
<!-- </Grid> -->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem>
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Puzzle" Width="16" Height="16" Size="16" />
|
||||||
|
<Label FontSize="16" Content="Module" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<StackPanel Orientation="Vertical" Spacing="10" x:Name="StpSettingsModules">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
<TabItem>
|
<TabItem>
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
|||||||
@@ -85,8 +85,92 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach(var module in Enum.GetValues<LCModule>())
|
||||||
|
{
|
||||||
|
CheckBox b = new CheckBox
|
||||||
|
{
|
||||||
|
IsChecked = false
|
||||||
|
};
|
||||||
|
b.Click += (object sender, RoutedEventArgs e) => {
|
||||||
|
RenewModuleSettings(module, b.IsChecked);
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == module)
|
||||||
|
{
|
||||||
|
b.IsChecked = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label l = new Label()
|
||||||
|
{
|
||||||
|
Content = module.ToString(),
|
||||||
|
};
|
||||||
|
StpSettingsModules.Children.Add(new StackPanel()
|
||||||
|
{
|
||||||
|
Orientation = Avalonia.Layout.Orientation.Horizontal,
|
||||||
|
Children = {b,l}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
Logger.Log($"Enabling module: {conf.Item1}");
|
||||||
|
switch (conf.Item1)
|
||||||
|
{
|
||||||
|
case LCModule.Addressmanagement:
|
||||||
|
Addressmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Pricemanagement:
|
||||||
|
Pricemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Staffmanagement:
|
||||||
|
Staffmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Financemanagement:
|
||||||
|
Financemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Wiki:
|
||||||
|
Wiki.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.UnifiedEndpointManagement:
|
||||||
|
UnifiedEndpointManagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log($"Error while applying module configuration: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RenewModuleSettings(LCModule value, bool? enabled = true)
|
||||||
|
{
|
||||||
|
if (enabled == true)
|
||||||
|
{
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.Add((value,false));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == value)
|
||||||
|
{
|
||||||
|
index = Settings._instance.moduleConfig.EnabledModules.IndexOf(conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(index != -1)
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.RemoveAt(index);
|
||||||
|
}
|
||||||
|
Settings.Save();
|
||||||
|
}
|
||||||
private async void StartAddressCheck(int addresSetID)
|
private async void StartAddressCheck(int addresSetID)
|
||||||
{
|
{
|
||||||
var progressWindow = new ProgressWindow();
|
var progressWindow = new ProgressWindow();
|
||||||
@@ -1387,4 +1471,12 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnAdmgmt_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (Addressmanagement.IsVisible && Addressmanagement.IsVisible)
|
||||||
|
{
|
||||||
|
TcMain.SelectedIndex = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-10
@@ -121,17 +121,18 @@ public class PdfBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// national addresses
|
// national addresses
|
||||||
for (var i = 0; i < addressSet.KasPersons.Count; i++)
|
foreach (var person in addressSet.KasPersons
|
||||||
|
.Where(person => person.IsGermany())
|
||||||
|
.OrderBy(person => person.used_plz))
|
||||||
{
|
{
|
||||||
string senderLineID = senderLine;
|
string senderLineID = senderLine;
|
||||||
if (!addressSet.KasPersons[i].IsGermany()) continue;
|
var addr = AddressCreator.CreateFinalMarkdownString(person.id);
|
||||||
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
|
|
||||||
if (string.IsNullOrWhiteSpace(addr)) continue;
|
if (string.IsNullOrWhiteSpace(addr)) continue;
|
||||||
if (pvst)
|
if (pvst)
|
||||||
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
||||||
|
|
||||||
if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0)
|
if (person.refsid != null || person.refsid != 0)
|
||||||
senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n</font6>";
|
senderLineID += $"ID: {person.refsid}\n</font6>";
|
||||||
else
|
else
|
||||||
senderLineID += "\n</font6>";
|
senderLineID += "\n</font6>";
|
||||||
if (!string.IsNullOrEmpty(senderLineID))
|
if (!string.IsNullOrEmpty(senderLineID))
|
||||||
@@ -141,17 +142,19 @@ public class PdfBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
// international addresses
|
// international addresses
|
||||||
for (var i = 0; i < addressSet.KasPersons.Count; i++)
|
foreach (var person in addressSet.KasPersons
|
||||||
|
.Where(person => !person.IsGermany())
|
||||||
|
.OrderBy(person => person.land)
|
||||||
|
.ThenBy(person => person.used_plz))
|
||||||
{
|
{
|
||||||
string senderLineID = senderLine;
|
string senderLineID = senderLine;
|
||||||
if (addressSet.KasPersons[i].IsGermany()) continue;
|
var addr = AddressCreator.CreateFinalMarkdownString(person.id);
|
||||||
var addr = AddressCreator.CreateFinalMarkdownString(addressSet.KasPersons[i].id);
|
|
||||||
if (string.IsNullOrWhiteSpace(addr)) continue;
|
if (string.IsNullOrWhiteSpace(addr)) continue;
|
||||||
if (pvst)
|
if (pvst)
|
||||||
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
senderLineID += $"</font6>**PvSt, DP AG, Entgelt bezahlt, ZKZ {Settings._instance.pdfExport.rsZKZ}**\n<font6>";
|
||||||
|
|
||||||
if (addressSet.KasPersons[i].refsid != null || addressSet.KasPersons[i].refsid != 0)
|
if (person.refsid != null || person.refsid != 0)
|
||||||
senderLineID += $"ID: {addressSet.KasPersons[i].refsid}\n</font6>";
|
senderLineID += $"ID: {person.refsid}\n</font6>";
|
||||||
else
|
else
|
||||||
senderLineID += "\n</font6>";
|
senderLineID += "\n</font6>";
|
||||||
if (!string.IsNullOrEmpty(senderLineID))
|
if (!string.IsNullOrEmpty(senderLineID))
|
||||||
|
|||||||
Reference in New Issue
Block a user