From f0751499ea0d740b6e40d71e6feeda7b9213233b Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Mon, 16 Oct 2023 18:24:17 +0200 Subject: [PATCH] DeliveryConfirmation: Add user editable Text --- Elwig/Documents/DeliveryConfirmation.cshtml | 8 ++++++-- Elwig/Documents/DeliveryConfirmation.cshtml.cs | 2 ++ Elwig/Documents/DeliveryNote.cshtml | 2 +- Elwig/Helpers/ClientParameters.cs | 5 +++++ Elwig/Windows/BaseDataWindow.xaml | 11 +++++++++++ Elwig/Windows/BaseDataWindow.xaml.cs | 2 ++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/Elwig/Documents/DeliveryConfirmation.cshtml b/Elwig/Documents/DeliveryConfirmation.cshtml index 243ee82..8131765 100644 --- a/Elwig/Documents/DeliveryConfirmation.cshtml +++ b/Elwig/Documents/DeliveryConfirmation.cshtml @@ -29,7 +29,7 @@ Gradation Flächenbindung Gewicht - Davon
abwerten + Davon
abzuwerten [°Oe] @@ -90,5 +90,9 @@ - +
+ @if (Model.Text != null) { +

@Model.Text

+ } +
diff --git a/Elwig/Documents/DeliveryConfirmation.cshtml.cs b/Elwig/Documents/DeliveryConfirmation.cshtml.cs index c4aece8..19f9aaf 100644 --- a/Elwig/Documents/DeliveryConfirmation.cshtml.cs +++ b/Elwig/Documents/DeliveryConfirmation.cshtml.cs @@ -9,12 +9,14 @@ namespace Elwig.Documents { public int Year; public IEnumerable Deliveries; + public string? Text = App.Client.TextDeliveryConfirmation; public DeliveryConfirmation(AppDbContext ctx, int year, Member m) : base($"Anlieferungsbestätigung {year} – {((IAddress?)m.BillingAddress ?? m).Name}", m) { Year = year; ShowDateAndLocation = true; UseBillingAddress = true; + IncludeSender = true; // FIXME footer in merged documents //DocumentId = $"Anl.-Best. {Year}/{m.MgNr}"; Deliveries = ctx.DeliveryParts.FromSqlRaw($""" diff --git a/Elwig/Documents/DeliveryNote.cshtml b/Elwig/Documents/DeliveryNote.cshtml index 51cf053..bd73689 100644 --- a/Elwig/Documents/DeliveryNote.cshtml +++ b/Elwig/Documents/DeliveryNote.cshtml @@ -134,7 +134,7 @@ } @for (int i = 0; i < 2; i++) { -
+
@if (Model.Text != null) {

@Model.Text

} diff --git a/Elwig/Helpers/ClientParameters.cs b/Elwig/Helpers/ClientParameters.cs index 9a200ea..b68a1b0 100644 --- a/Elwig/Helpers/ClientParameters.cs +++ b/Elwig/Helpers/ClientParameters.cs @@ -58,6 +58,7 @@ namespace Elwig.Helpers { public int ModeDeliveryNoteStats; public string? TextDeliveryNote; + public string? TextDeliveryConfirmation; public ClientParameters(AppDbContext ctx) : this(ctx.ClientParameters.ToDictionary(e => e.Param, e => e.Value)) { } @@ -100,6 +101,9 @@ namespace Elwig.Helpers { Sender2 = parameters.GetValueOrDefault("DOCUMENT_SENDER") ?? ""; TextDeliveryNote = parameters.GetValueOrDefault("TEXT_DELIVERYNOTE"); + if (TextDeliveryNote == "") TextDeliveryNote = null; + TextDeliveryConfirmation = parameters.GetValueOrDefault("TEXT_DELIVERYCONFIRMATION"); + if (TextDeliveryConfirmation == "") TextDeliveryConfirmation = null; } catch { throw new KeyNotFoundException(); } @@ -138,6 +142,7 @@ namespace Elwig.Helpers { ("MODE_DELIVERYNOTE_STATS", deliveryNoteStats), ("DOCUMENT_SENDER", Sender2), ("TEXT_DELIVERYNOTE", TextDeliveryNote), + ("TEXT_DELIVERYCONFIRMATION", TextDeliveryConfirmation), }; } diff --git a/Elwig/Windows/BaseDataWindow.xaml b/Elwig/Windows/BaseDataWindow.xaml index 8eeccf1..690782e 100644 --- a/Elwig/Windows/BaseDataWindow.xaml +++ b/Elwig/Windows/BaseDataWindow.xaml @@ -241,6 +241,17 @@ + + + + + + + + + diff --git a/Elwig/Windows/BaseDataWindow.xaml.cs b/Elwig/Windows/BaseDataWindow.xaml.cs index ee40944..898b3f6 100644 --- a/Elwig/Windows/BaseDataWindow.xaml.cs +++ b/Elwig/Windows/BaseDataWindow.xaml.cs @@ -208,6 +208,7 @@ namespace Elwig.Windows { case 2: ModeDeliveryNoteShort.IsChecked = true; break; case 3: ModeDeliveryNoteFull.IsChecked = true; break; } + TextElementDeliveryConfirmation.Text = p.TextDeliveryConfirmation; FinishInputFilling(); } @@ -232,6 +233,7 @@ namespace Elwig.Windows { p.TextDeliveryNote = TextElementDeliveryNote.Text.Length > 0 ? TextElementDeliveryNote.Text : null; p.ModeDeliveryNoteStats = (ModeDeliveryNoteNone.IsChecked == true) ? 0 : (ModeDeliveryNoteGaOnly.IsChecked == true) ? 1 : (ModeDeliveryNoteShort.IsChecked == true) ? 2 : (ModeDeliveryNoteFull.IsChecked == true) ? 3 : 2; + p.TextDeliveryConfirmation = TextElementDeliveryConfirmation.Text.Length > 0 ? TextElementDeliveryConfirmation.Text : null; await p.UpdateValues(); }