MailWindow: Add feature to change location

This commit is contained in:
2024-03-09 15:46:32 +01:00
parent 0629f4eb1b
commit 34ebc8fa34
3 changed files with 18 additions and 5 deletions

View File

@ -119,6 +119,8 @@ namespace Elwig.Windows {
PostalSender1.Text = App.Client.Sender1;
PostalSender2.Text = App.Client.Sender2;
PostalLocation.Text = App.BranchLocation;
PostalDate.Text = $"{Utils.Today:dd.MM.yyyy}";
EmailSubjectInput.Text = App.Client.TextEmailSubject ?? "Rundschreiben";
EmailBodyInput.Text = App.Client.TextEmailBody ?? "Sehr geehrtes Mitglied,\n\nim Anhang finden Sie das aktuelle Rundschreiben.\n\nIhre Winzergenossenschaft\n";
}
@ -375,6 +377,7 @@ namespace Elwig.Windows {
await UpdateTextParameters();
var doublePaged = DoublePagedInput.IsChecked == true;
var location = PostalLocation.Text.Trim();
var docs = SelectedDocs.OrderByDescending(d => d.Type).ToList();
IEnumerable<Member> recipients = Recipients;
@ -497,8 +500,10 @@ namespace Elwig.Windows {
var docs = m.Docs.Select(d => d.Doc).ToList();
foreach (var doc in docs) {
doc!.DoublePaged = false;
if (doc is BusinessDocument b)
if (doc is BusinessDocument b) {
b.IncludeSender = false;
b.Location = location;
}
};
return docs;
});
@ -529,7 +534,11 @@ namespace Elwig.Windows {
if (docs.Count == 0 || m.Docs[0].Type == DocType.Custom) {
docs.Insert(0, new Letterhead(m.Member));
}
docs.ForEach(doc => doc.DoublePaged = doublePaged);
docs.ForEach(doc => {
doc.DoublePaged = doublePaged;
if (doc is BusinessDocument b)
b.Location = location;
});
if (docs.Count > 0 && docs[0] is BusinessDocument b)
b.IncludeSender = true;
return docs;