[#15] MailWindow: Small quality fixes

This commit is contained in:
2024-02-29 11:19:51 +01:00
parent 09a739d135
commit 624c9a6b34
2 changed files with 4 additions and 4 deletions

View File

@ -52,7 +52,7 @@ namespace Elwig.Windows {
CreditNote.Name,
];
protected readonly int? Year;
public readonly int? Year;
public ObservableCollection<SelectedDoc> SelectedDocs = [];
public IEnumerable<Member> Recipients = [];
@ -102,7 +102,7 @@ namespace Elwig.Windows {
public MailWindow(int? year = null) {
InitializeComponent();
Year = year ?? Context.Seasons.OrderBy(s => s.Year).LastOrDefault()?.Year;
Title = $"Rundschreiben {Year} - Elwig";
Title = $"Rundschreiben - Lese {Year} - Elwig";
AvaiableDocumentsList.ItemsSource = AvaiableDocuments;
SelectedDocumentsList.ItemsSource = SelectedDocs;
@ -559,7 +559,7 @@ namespace Elwig.Windows {
public void AddDeliveryConfirmation() {
AvaiableDocumentsList.SelectedIndex = 1;
if (AvaiableDocumentsList.SelectedItem is not string s)
if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
return;
SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, ((int)Year!, DocumentNonDeliverersInput.IsChecked == true)));
SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;