Schüler hinzufügen, Kompetenzen
This commit is contained in:
@@ -25,10 +25,15 @@
|
||||
<TextBox Text="{Binding Name}" PlaceholderText="{Binding NameHint}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Fach – nur bei Kurs relevant -->
|
||||
<!-- Fach – nur bei Kurs, AutoComplete aus bekannten Fächern -->
|
||||
<StackPanel Spacing="4" IsVisible="{Binding IsKurs}">
|
||||
<TextBlock Text="Fach (optional)" FontSize="12" Opacity="0.7"/>
|
||||
<TextBox Text="{Binding Subject}" PlaceholderText="z.B. Chemie, Mathematik"/>
|
||||
<AutoCompleteBox Text="{Binding Subject}"
|
||||
ItemsSource="{Binding KnownSubjectNames}"
|
||||
FilterMode="Contains"
|
||||
MinimumPrefixLength="0"
|
||||
PlaceholderText="z.B. Chemie, Mathematik"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,12,*">
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.AddStudentToGroupDialog"
|
||||
x:DataType="vm:AddStudentToGroupDialogViewModel"
|
||||
Title="Schüler hinzufügen"
|
||||
Width="420" Height="500"
|
||||
Width="420" Height="560"
|
||||
CanResize="False" WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid RowDefinitions="Auto,*,Auto" Margin="24">
|
||||
<Grid RowDefinitions="Auto,*,Auto,Auto" Margin="24">
|
||||
|
||||
<!-- Überschrift + Suche -->
|
||||
<StackPanel Grid.Row="0" Spacing="12" Margin="0,0,0,12">
|
||||
@@ -29,8 +29,32 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<!-- Zeitraum-Auswahl -->
|
||||
<Border Grid.Row="2"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="1" CornerRadius="6" Padding="14,10" Margin="0,10,0,0">
|
||||
<StackPanel Spacing="8">
|
||||
<TextBlock Text="Einschreibungszeitraum" FontSize="12" FontWeight="SemiBold" Opacity="0.7"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||
<RadioButton Content="Ganzes Jahr" IsChecked="{Binding IsFullYear}"/>
|
||||
<RadioButton Content="Nur H1" IsChecked="{Binding IsH1Only}"/>
|
||||
<RadioButton Content="Nur H2" IsChecked="{Binding IsH2Only}"/>
|
||||
<RadioButton Content="Datum" IsChecked="{Binding IsCustom}"/>
|
||||
</StackPanel>
|
||||
|
||||
<Grid ColumnDefinitions="*,12,*"
|
||||
IsVisible="{Binding IsCustomPeriod}">
|
||||
<TextBox Grid.Column="0" Text="{Binding JoinedAtText}"
|
||||
PlaceholderText="Eintr. TT.MM.JJJJ" FontSize="12"/>
|
||||
<TextBox Grid.Column="2" Text="{Binding LeftAtText}"
|
||||
PlaceholderText="Austr. TT.MM.JJJJ" FontSize="12"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Validation + Buttons -->
|
||||
<StackPanel Grid.Row="2" Spacing="12" Margin="0,16,0,0">
|
||||
<StackPanel Grid.Row="3" Spacing="12" Margin="0,16,0,0">
|
||||
<TextBlock Text="{Binding ValidationMessage}" Foreground="Red" FontSize="12"
|
||||
IsVisible="{Binding ValidationMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<Grid ColumnDefinitions="*,8,*">
|
||||
|
||||
@@ -53,9 +53,8 @@
|
||||
CanUserResizeColumns="True"
|
||||
Margin="0">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Name"
|
||||
Binding="{Binding FullName}"
|
||||
Width="*"/>
|
||||
<DataGridTextColumn Header="Name" Binding="{Binding FullName}" Width="*"/>
|
||||
<DataGridTextColumn Header="Zeitraum" Binding="{Binding PeriodLabel}" Width="90"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ContentPage>
|
||||
|
||||
@@ -1,3 +1,26 @@
|
||||
using Avalonia.Controls;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
public partial class GroupListView : UserControl { public GroupListView() => InitializeComponent(); }
|
||||
|
||||
public partial class GroupListView : UserControl
|
||||
{
|
||||
public GroupListView() => InitializeComponent();
|
||||
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
if (DataContext is GroupListViewModel vm)
|
||||
vm.OnAddGroup = ShowAddGroupDialog;
|
||||
}
|
||||
|
||||
private async Task ShowAddGroupDialog()
|
||||
{
|
||||
var dialogVm = App.Services.GetRequiredService<AddGroupDialogViewModel>();
|
||||
var dialog = new AddGroupDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
if (owner is not null)
|
||||
await dialog.ShowDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,15 +30,65 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Rechte Seite: Bewertungsraster (wird per Code-Behind aufgebaut) -->
|
||||
<Grid Grid.Column="1" RowDefinitions="Auto,*">
|
||||
<TextBlock Grid.Row="0"
|
||||
Text="{Binding SelectedSessionDisplay}"
|
||||
FontSize="13" FontWeight="SemiBold" Margin="12,10,12,4"
|
||||
IsVisible="{Binding SelectedSession, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||
<!-- Rechte Seite -->
|
||||
<Grid Grid.Column="1" RowDefinitions="Auto,Auto,*">
|
||||
|
||||
<!-- Header: Session-Titel + Toggle-Buttons -->
|
||||
<Grid Grid.Row="0" ColumnDefinitions="*,Auto" Margin="12,8,12,4"
|
||||
IsVisible="{Binding SelectedSession, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<TextBlock Grid.Column="0"
|
||||
Text="{Binding SelectedSessionDisplay}"
|
||||
FontSize="13" FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6"
|
||||
IsVisible="{Binding HasCompetencyCatalog}">
|
||||
<ToggleButton Content="◇ Kompetenzen"
|
||||
IsChecked="{Binding CompetencyTagsVisible}"
|
||||
FontSize="11" Padding="8,3"/>
|
||||
<ToggleButton Content="◈ Schüler-Ratings"
|
||||
IsChecked="{Binding StudentCompetencyRatingsVisible}"
|
||||
FontSize="11" Padding="8,3"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- Kompetenz-Tag-Panel -->
|
||||
<Border Grid.Row="1"
|
||||
IsVisible="{Binding CompetencyTagsVisible}"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1"
|
||||
Padding="12,8">
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" MaxHeight="200">
|
||||
<ItemsControl ItemsSource="{Binding CompetencyTagGroups}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:CompetencyTagGroup">
|
||||
<StackPanel Spacing="4" Margin="0,0,0,10">
|
||||
<TextBlock Text="{Binding DisplayName}"
|
||||
FontSize="11" FontWeight="SemiBold" Opacity="0.55"/>
|
||||
<ItemsControl ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:CompetencyTag">
|
||||
<ToggleButton IsChecked="{Binding IsSelected}"
|
||||
Content="{Binding Display}"
|
||||
FontSize="11"
|
||||
Padding="6,3"
|
||||
Margin="0,0,4,4"/>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<!-- DataGrid: Spalten werden in ParticipationTabView.axaml.cs dynamisch erzeugt -->
|
||||
<DataGrid Grid.Row="1"
|
||||
<DataGrid Grid.Row="2"
|
||||
x:Name="RatingGrid"
|
||||
ItemsSource="{Binding StudentRows}"
|
||||
AutoGenerateColumns="False"
|
||||
@@ -48,7 +98,7 @@
|
||||
CanUserResizeColumns="True"
|
||||
IsVisible="{Binding SelectedSession, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||
|
||||
<TextBlock Grid.Row="1"
|
||||
<TextBlock Grid.Row="2"
|
||||
Text="{Binding NoDataText}"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Opacity="0.35" FontSize="14"
|
||||
|
||||
@@ -21,6 +21,11 @@ public partial class ParticipationTabView : UserControl
|
||||
vm.OnAddSession = ShowAddSessionDialog;
|
||||
vm.OnQuickInput = ShowQuickInputDialog;
|
||||
vm.Aspects.CollectionChanged += (_, _) => BuildColumns();
|
||||
vm.PropertyChanged += (_, pe) =>
|
||||
{
|
||||
if (pe.PropertyName == nameof(ParticipationTabViewModel.RebuildColumnsSignal))
|
||||
BuildColumns();
|
||||
};
|
||||
BuildColumns();
|
||||
}
|
||||
}
|
||||
@@ -39,25 +44,43 @@ public partial class ParticipationTabView : UserControl
|
||||
Width = new DataGridLength(160, DataGridLengthUnitType.Pixel),
|
||||
});
|
||||
|
||||
// Aspekt-Spalten
|
||||
foreach (var (aspect, i) in _vm.Aspects.Select((a, i) => (a, i)))
|
||||
{
|
||||
var capturedIndex = i;
|
||||
var idx = i;
|
||||
grid.Columns.Add(new DataGridTemplateColumn
|
||||
{
|
||||
Header = $"{aspect.Label} [{AspectShortcut(i)}]",
|
||||
Width = new DataGridLength(1, DataGridLengthUnitType.Star),
|
||||
CellTemplate = BuildCellTemplate(capturedIndex),
|
||||
Header = $"{aspect.Label} [{AspectShortcut(i)}]",
|
||||
Width = new DataGridLength(1, DataGridLengthUnitType.Star),
|
||||
CellTemplate = BuildCellTemplate(idx, forCompetency: false),
|
||||
});
|
||||
}
|
||||
|
||||
// Kompetenz-Spalten (opt-in)
|
||||
if (_vm.StudentCompetencyRatingsVisible && _vm.ActiveCompetencyCodes.Count > 0)
|
||||
{
|
||||
foreach (var (code, i) in _vm.ActiveCompetencyCodes.Select((c, i) => (c, i)))
|
||||
{
|
||||
var idx = i;
|
||||
grid.Columns.Add(new DataGridTemplateColumn
|
||||
{
|
||||
Header = code,
|
||||
Width = new DataGridLength(80, DataGridLengthUnitType.Pixel),
|
||||
CellTemplate = BuildCellTemplate(idx, forCompetency: true),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IDataTemplate BuildCellTemplate(int aspectIndex)
|
||||
private static IDataTemplate BuildCellTemplate(int cellIndex, bool forCompetency)
|
||||
{
|
||||
return new FuncDataTemplate<ParticipationStudentRow>((row, _) =>
|
||||
{
|
||||
if (row is null) return new TextBlock();
|
||||
|
||||
var cell = row.Cells.ElementAtOrDefault(aspectIndex);
|
||||
var cell = forCompetency
|
||||
? row.CompetencyCells.ElementAtOrDefault(cellIndex)
|
||||
: row.Cells.ElementAtOrDefault(cellIndex);
|
||||
if (cell is null) return new TextBlock();
|
||||
|
||||
var panel = new StackPanel
|
||||
@@ -73,10 +96,10 @@ public partial class ParticipationTabView : UserControl
|
||||
{
|
||||
var btn = new Button
|
||||
{
|
||||
Content = label,
|
||||
Padding = new Avalonia.Thickness(5, 1),
|
||||
Content = label,
|
||||
Padding = new Avalonia.Thickness(5, 1),
|
||||
FontSize = 11,
|
||||
Opacity = cell.Value == val ? 1.0 : 0.3,
|
||||
Opacity = cell.Value == val ? 1.0 : 0.3,
|
||||
};
|
||||
var capturedVal = val;
|
||||
btn.Click += (_, _) => cell.SetValue(capturedVal);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
xmlns:vd="clr-namespace:LehrerApp.Desktop.Views.Dashboard"
|
||||
xmlns:vg="clr-namespace:LehrerApp.Desktop.Views.Groups"
|
||||
xmlns:vs="clr-namespace:LehrerApp.Desktop.Views.Students"
|
||||
xmlns:vset="clr-namespace:LehrerApp.Desktop.Views.Settings"
|
||||
xmlns:vmset="clr-namespace:LehrerApp.Desktop.ViewModels.Settings"
|
||||
x:Class="LehrerApp.Desktop.Views.MainWindow"
|
||||
x:DataType="vm:MainWindowViewModel"
|
||||
Title="LehrerApp"
|
||||
@@ -41,6 +43,9 @@
|
||||
<DataTemplate DataType="vms:StudentDetailViewModel">
|
||||
<vs:StudentDetailView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vmset:SettingsViewModel">
|
||||
<vset:SettingsView/>
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="vm:PlaceholderViewModel">
|
||||
<views:PlaceholderView/>
|
||||
</DataTemplate>
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Settings"
|
||||
x:Class="LehrerApp.Desktop.Views.Settings.SettingsView"
|
||||
x:DataType="vm:SettingsViewModel">
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel Margin="32,28" Spacing="32" MaxWidth="640">
|
||||
|
||||
<TextBlock Text="Einstellungen" FontSize="22" FontWeight="SemiBold"/>
|
||||
|
||||
<!-- ── FÄCHER ────────────────────────────────────────────────── -->
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock Text="FÄCHER" FontSize="10" FontWeight="Bold" Opacity="0.4"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding Subjects}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:SubjectListItem">
|
||||
<Border BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1" Padding="0,7">
|
||||
<Grid ColumnDefinitions="*,80,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Name}"
|
||||
VerticalAlignment="Center" FontSize="14"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding ShortName}"
|
||||
VerticalAlignment="Center" Opacity="0.5" FontSize="13"/>
|
||||
<Button Grid.Column="2" Content="Löschen" FontSize="12" Padding="10,4"
|
||||
Command="{Binding $parent[ItemsControl].((vm:SettingsViewModel)DataContext).DeleteSubjectCommand}"
|
||||
CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Border BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="1" CornerRadius="6" Padding="14,12">
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock Text="Neues Fach" FontSize="12" FontWeight="SemiBold" Opacity="0.7"/>
|
||||
<Grid ColumnDefinitions="*,12,100,12,Auto">
|
||||
<TextBox Grid.Column="0" Text="{Binding NewName}"
|
||||
PlaceholderText="Name (z.B. Chemie)"/>
|
||||
<TextBox Grid.Column="2" Text="{Binding NewShort}"
|
||||
PlaceholderText="Kürzel (z.B. Ch)"/>
|
||||
<Button Grid.Column="4" Content="Hinzufügen"
|
||||
Command="{Binding AddSubjectCommand}"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding ValidationMessage}" Foreground="Red" FontSize="12"
|
||||
IsVisible="{Binding ValidationMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ── KOMPETENZKATALOGE ─────────────────────────────────────── -->
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock Text="KOMPETENZKATALOGE" FontSize="10" FontWeight="Bold" Opacity="0.4"/>
|
||||
|
||||
<!-- Fach + Klassenstufe Auswahl + Import/Export -->
|
||||
<Grid ColumnDefinitions="*,12,120,12,Auto,8,Auto">
|
||||
<ComboBox Grid.Column="0"
|
||||
ItemsSource="{Binding Subjects}"
|
||||
SelectedItem="{Binding CatalogSubject}"
|
||||
PlaceholderText="Fach auswählen"
|
||||
HorizontalAlignment="Stretch">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="vm:SubjectListItem">
|
||||
<TextBlock Text="{Binding Name}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<NumericUpDown Grid.Column="2"
|
||||
Value="{Binding CatalogGradeLevel}"
|
||||
Minimum="1" Maximum="13" FormatString="0"/>
|
||||
<Button Grid.Column="4" Content="Import JSON" Click="OnImportClick"
|
||||
IsEnabled="{Binding CatalogSubject, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||
<Button Grid.Column="6" Content="Export JSON" Click="OnExportClick"
|
||||
IsEnabled="{Binding CatalogSubject, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Katalog-Validierungsmeldung -->
|
||||
<TextBlock Text="{Binding CatalogValidation}" Foreground="Red" FontSize="12"
|
||||
IsVisible="{Binding CatalogValidation, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
|
||||
<!-- Leerer Zustand -->
|
||||
<TextBlock Text="Kein Fach ausgewählt." Opacity="0.4" FontSize="13"
|
||||
IsVisible="{Binding CatalogSubject, Converter={x:Static ObjectConverters.IsNull}}"/>
|
||||
|
||||
<!-- Domain-Liste -->
|
||||
<ItemsControl ItemsSource="{Binding Domains}"
|
||||
IsVisible="{Binding CatalogSubject, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:DomainEditItem">
|
||||
<Border BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="1" CornerRadius="6" Margin="0,0,0,8" Padding="14,12">
|
||||
<StackPanel Spacing="8">
|
||||
|
||||
<!-- Bereichs-Header -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding DisplayName}"
|
||||
FontWeight="SemiBold" FontSize="14" VerticalAlignment="Center"/>
|
||||
<Button Grid.Column="1" Content="Bereich löschen" FontSize="12" Padding="10,4"
|
||||
Command="{Binding $parent[ItemsControl].((vm:SettingsViewModel)DataContext).DeleteDomainCommand}"
|
||||
CommandParameter="{Binding}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Kompetenz-Items -->
|
||||
<ItemsControl ItemsSource="{Binding Items}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="vm:CompetencyItemVm">
|
||||
<Grid ColumnDefinitions="*,Auto" Margin="0,3">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Display}"
|
||||
TextWrapping="Wrap" VerticalAlignment="Center"
|
||||
FontSize="13"/>
|
||||
<Button Grid.Column="1" Content="×" Padding="7,2" FontSize="13"
|
||||
Command="{Binding DeleteCommand}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- Kompetenz hinzufügen -->
|
||||
<Grid ColumnDefinitions="80,8,*,8,Auto">
|
||||
<TextBox Grid.Column="0" Text="{Binding NewItemCode}"
|
||||
PlaceholderText="EG1" FontSize="12"/>
|
||||
<TextBox Grid.Column="2" Text="{Binding NewItemDesc}"
|
||||
PlaceholderText="Kompetenz-Beschreibung" FontSize="12"/>
|
||||
<Button Grid.Column="4" Content="+"
|
||||
Command="{Binding AddItemCommand}"/>
|
||||
</Grid>
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<!-- Neuen Bereich hinzufügen -->
|
||||
<Border BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="1" CornerRadius="6" Padding="14,12"
|
||||
IsVisible="{Binding CatalogSubject, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<StackPanel Spacing="10">
|
||||
<TextBlock Text="Neuer Bereich" FontSize="12" FontWeight="SemiBold" Opacity="0.7"/>
|
||||
<Grid ColumnDefinitions="*,12,90,12,Auto">
|
||||
<TextBox Grid.Column="0" Text="{Binding NewDomainName}"
|
||||
PlaceholderText="Bereichsname (z.B. Erkenntnisgewinnung)"/>
|
||||
<TextBox Grid.Column="2" Text="{Binding NewDomainCode}"
|
||||
PlaceholderText="Kürzel (z.B. EG)"/>
|
||||
<Button Grid.Column="4" Content="Hinzufügen"
|
||||
Command="{Binding AddDomainCommand}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,45 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using LehrerApp.Desktop.ViewModels.Settings;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Settings;
|
||||
|
||||
public partial class SettingsView : UserControl
|
||||
{
|
||||
public SettingsView() => InitializeComponent();
|
||||
|
||||
private async void OnImportClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
if (topLevel is null || DataContext is not SettingsViewModel vm) return;
|
||||
|
||||
var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
{
|
||||
Title = "Kompetenzkatalog importieren",
|
||||
AllowMultiple = false,
|
||||
FileTypeFilter = [new FilePickerFileType("JSON-Dateien") { Patterns = ["*.json"] }],
|
||||
});
|
||||
|
||||
if (files.Count == 0) return;
|
||||
var json = await File.ReadAllTextAsync(files[0].Path.LocalPath);
|
||||
vm.ImportCatalog(json);
|
||||
}
|
||||
|
||||
private async void OnExportClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var topLevel = TopLevel.GetTopLevel(this);
|
||||
if (topLevel is null || DataContext is not SettingsViewModel vm) return;
|
||||
|
||||
var file = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Title = "Kompetenzkatalog exportieren",
|
||||
SuggestedFileName = $"Kompetenzkatalog_{vm.CatalogSubject?.Name}_{vm.CatalogGradeLevel}.json",
|
||||
FileTypeChoices = [new FilePickerFileType("JSON-Dateien") { Patterns = ["*.json"] }],
|
||||
});
|
||||
|
||||
if (file is null) return;
|
||||
var json = vm.ExportCatalog();
|
||||
await File.WriteAllTextAsync(file.Path.LocalPath, json);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user