DeliveryConfirmation: Add user editable Text

This commit is contained in:
2023-10-16 18:24:17 +02:00
parent d4dd84394b
commit f0751499ea
6 changed files with 27 additions and 3 deletions

View File

@ -29,7 +29,7 @@
<th colspan="2">Gradation</th>
<th colspan="2">Flächenbindung</th>
<th>Gewicht</th>
<th>Davon<br/>abwerten</th>
<th>Davon<br/>abzuwerten</th>
</tr>
<tr>
<th>[°Oe]</th>
@ -90,5 +90,9 @@
</tbody>
</table>
<!-- TODO add Gesamtlieferung tabelle -->
<!-- TODO add Freitext -->
<div class="text" style="margin-top: 2em;">
@if (Model.Text != null) {
<p class="comment" style="white-space: pre-wrap; break-inside: avoid;">@Model.Text</p>
}
</div>
</main>

View File

@ -9,12 +9,14 @@ namespace Elwig.Documents {
public int Year;
public IEnumerable<DeliveryPart> 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($"""

View File

@ -134,7 +134,7 @@
}
</main>
@for (int i = 0; i < 2; i++) {
<div class="@(i == 0 ? "hidden" : "bottom")">
<div class="text @(i == 0 ? "hidden" : "bottom")">
@if (Model.Text != null) {
<p class="comment">@Model.Text</p>
}

View File

@ -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),
};
}

View File

@ -241,6 +241,17 @@
</GroupBox>
</Grid>
</GroupBox>
<GroupBox Header="Anlieferungsbestätigung" Margin="10,10,10,10" Height="250">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBox x:Name="TextElementDeliveryConfirmation" TextWrapping="Wrap" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,10,10" Height="Auto"
TextChanged="TextBox_TextChanged"/>
</Grid>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>

View File

@ -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();
}