Dashboard warnings (attendance, homework, lateness) get a "Details" flyout with key figures, a list of dates and the compact month calendar from the class teacher overview, now extracted as a shared control. The calendar now aligns days under their weekday (Mo-So header, blank leading cells). Creating Vorgänge and documentation is supported by quick blocks with the current figures, dated standard phrases (e.g. "Klassenleitung informiert") and documentation templates (status snapshot, conversation, informing the class/subject teachers, parent call, parent letter). The class teacher Vorgänge tab uses WebUntis figures (absences across all subjects, class register) for the same blocks and templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f6cadc9c8
commit
aa326cf8b6
25 files changed
+1571
-75
No files matched your search
@@ -157,16 +157,20 @@ public partial class DocumentationDialogViewModel : ObservableObject
|
||||
|
||||
public string[] TypeOptions => DocumentationTypeDisplay.Options;
|
||||
public string[] SupportStatusOptions => SupportStatusDisplay.Options;
|
||||
public string DialogTitle => _editing is null ? "Dokumentation hinzufügen" : "Dokumentation bearbeiten";
|
||||
private readonly bool _isNewDraft;
|
||||
public string DialogTitle => _editing is null || _isNewDraft ? "Dokumentation hinzufügen" : "Dokumentation bearbeiten";
|
||||
public long MaxAttachmentSizeBytes => IAttachmentStorage.MaxSizeBytes;
|
||||
|
||||
public Documentation? Result { get; private set; }
|
||||
|
||||
public DocumentationDialogViewModel(Guid studentId, Documentation? editing, IAttachmentStorage attachmentStorage,
|
||||
List<StudentOption>? studentOptions = null, Guid? contextGroupId = null)
|
||||
List<StudentOption>? studentOptions = null, Guid? contextGroupId = null, bool isNewDraft = false)
|
||||
{
|
||||
_studentId = studentId;
|
||||
_editing = editing;
|
||||
// editing ist dann ein vorbefüllter, noch ungespeicherter Entwurf (z.B. aus einer
|
||||
// Vorgangs-Vorlage) — wird wie ein Bestandseintrag vorbelegt, aber als "hinzufügen" betitelt.
|
||||
_isNewDraft = isNewDraft;
|
||||
_attachmentStorage = attachmentStorage;
|
||||
_contextGroupId = contextGroupId;
|
||||
StudentOptions = studentOptions ?? [];
|
||||
|
||||
@@ -3,6 +3,7 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Desktop.Services;
|
||||
using LehrerApp.Desktop.ViewModels.ClassTeacher;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels.Students;
|
||||
@@ -21,8 +22,12 @@ public partial class StudentVorgaengeViewModel : ObservableObject
|
||||
private readonly IVorgangRepository _vorgaenge;
|
||||
private readonly IDocumentationRepository _documentation;
|
||||
private readonly IStudentRepository _students;
|
||||
private readonly StudentWarningEvidenceService? _evidence;
|
||||
|
||||
private Guid _studentId;
|
||||
// Id eines aus einer Vorlage erzeugten, noch ungespeicherten Dokumentations-Entwurfs — damit
|
||||
// der Dialog "hinzufügen" statt "bearbeiten" titelt (siehe IsNewDocumentationDraft).
|
||||
private Guid? _documentationDraftId;
|
||||
private string _studentName = "";
|
||||
private List<StudentOption> _studentOptions = [];
|
||||
|
||||
@@ -39,14 +44,29 @@ public partial class StudentVorgaengeViewModel : ObservableObject
|
||||
/// (siehe <see cref="HandleWarningNavigation"/>) — Parameter ist das gesuchte Tag.
|
||||
public Func<string, Task<bool>>? OnConfirmCreateForWarning { get; set; }
|
||||
|
||||
/// <param name="evidence">Quelle für Schnellbausteine/Vorlagen mit dem aktuellen Stand
|
||||
/// (Fehlquote, Hausaufgaben, Verspätungen). Optional, damit Tests ohne Mitarbeits-Repositories
|
||||
/// auskommen — ohne sie entfallen Bausteine und Vorlagen einfach.</param>
|
||||
public StudentVorgaengeViewModel(IVorgangRepository vorgaenge, IDocumentationRepository documentation,
|
||||
IStudentRepository students)
|
||||
IStudentRepository students, StudentWarningEvidenceService? evidence = null)
|
||||
{
|
||||
_vorgaenge = vorgaenge;
|
||||
_documentation = documentation;
|
||||
_students = students;
|
||||
_evidence = evidence;
|
||||
}
|
||||
|
||||
/// Frisch berechnet bei jedem Dialog-Aufruf statt beim Laden gecacht — der Tab kann lange offen
|
||||
/// bleiben, während im Unterricht weiter Anwesenheit erfasst wird.
|
||||
public IReadOnlyList<VorgangQuickBlock> BuildQuickBlocks() =>
|
||||
_evidence is null ? [] : StudentEvidenceText.QuickBlocks(_evidence.Build(_studentId));
|
||||
|
||||
/// Ob ein an OnEditVorgang übergebener Vorgang schon gespeichert ist oder nur ein vorbefüllter
|
||||
/// Entwurf (HandleWarningNavigation) — steuert den Dialogtitel "anlegen"/"bearbeiten".
|
||||
public bool IsPersisted(Vorgang vorgang) => _vorgaenge.GetById(vorgang.Id) is not null;
|
||||
|
||||
public bool IsNewDocumentationDraft(Documentation doc) => doc.Id == _documentationDraftId;
|
||||
|
||||
partial void OnOnlyOpenChanged(bool value) => Load(_studentId);
|
||||
|
||||
[RelayCommand] private void Refresh() => Load(_studentId);
|
||||
@@ -80,7 +100,10 @@ public partial class StudentVorgaengeViewModel : ObservableObject
|
||||
.Where(n => !string.IsNullOrEmpty(n)));
|
||||
var item = new VorgangItem(vorgang, names, LinkDocumentation, UnlinkDocumentation,
|
||||
RemoveClassRegisterEntry, EditDocumentation)
|
||||
{ IsRevealed = revealedIds.Contains(vorgang.Id) };
|
||||
{
|
||||
IsRevealed = revealedIds.Contains(vorgang.Id),
|
||||
OnCreateFromTemplate = _evidence is null ? null : CreateDocumentationFromTemplate,
|
||||
};
|
||||
|
||||
var linkedIds = vorgang.DocumentationIds.ToHashSet();
|
||||
foreach (var doc in ownDocs.Where(d => linkedIds.Contains(d.Id)))
|
||||
@@ -146,6 +169,27 @@ public partial class StudentVorgaengeViewModel : ObservableObject
|
||||
Load(_studentId);
|
||||
}
|
||||
|
||||
/// Erzeugt aus einer Vorlage (VorgangDocumentationTemplates) einen vorbefüllten Entwurf mit dem
|
||||
/// aktuellen Stand, öffnet ihn im normalen Dokumentations-Dialog und verknüpft ihn nach dem
|
||||
/// Speichern mit dem Vorgang — gleicher Abschluss wie CreateAndLinkDocumentation.
|
||||
private async Task CreateDocumentationFromTemplate(VorgangItem item, string key)
|
||||
{
|
||||
if (_evidence is null || OnEditDocumentation is null) return;
|
||||
var draft = VorgangDocumentationTemplates.Build(key, item.Model, _evidence.Build(_studentId));
|
||||
if (draft is null) return;
|
||||
_documentationDraftId = draft.Id;
|
||||
Documentation? result;
|
||||
try { result = await OnEditDocumentation(_studentId, draft); }
|
||||
finally { _documentationDraftId = null; }
|
||||
if (result is null) return;
|
||||
_documentation.Save(result);
|
||||
item.Model.DocumentationIds.Add(result.Id);
|
||||
_vorgaenge.Save(item.Model);
|
||||
Load(_studentId);
|
||||
var reloaded = Cases.FirstOrDefault(c => c.Model.Id == item.Model.Id);
|
||||
if (reloaded is not null) reloaded.IsRevealed = true;
|
||||
}
|
||||
|
||||
private async Task EditDocumentation(DocumentationItem doc)
|
||||
{
|
||||
if (OnEditDocumentation is null) return;
|
||||
@@ -199,7 +243,14 @@ public partial class StudentVorgaengeViewModel : ObservableObject
|
||||
if (OnConfirmCreateForWarning is null || OnEditVorgang is null) return;
|
||||
if (!await OnConfirmCreateForWarning(suggestedTag)) return;
|
||||
|
||||
var draft = new Vorgang { Title = suggestedTitle, StudentIds = [_studentId], Tags = [suggestedTag] };
|
||||
// Nutzer-Feedback: die Zahlen, die die Warnung ausgelöst haben, gleich als Beschreibung
|
||||
// mitgeben, statt sie im Dialog von Hand abzutippen — bleibt im Dialog frei editierbar.
|
||||
var description = _evidence is null ? ""
|
||||
: StudentEvidenceText.StatusBlockForTag(suggestedTag, _evidence.Build(_studentId)) ?? "";
|
||||
var draft = new Vorgang
|
||||
{
|
||||
Title = suggestedTitle, Description = description, StudentIds = [_studentId], Tags = [suggestedTag],
|
||||
};
|
||||
var result = await OnEditVorgang(_studentOptions, draft);
|
||||
if (result is null) return;
|
||||
_vorgaenge.Save(result);
|
||||
|
||||
@@ -0,0 +1,246 @@
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Desktop.Services;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels.Students;
|
||||
|
||||
/// <summary>Ein per Klick einfügbarer Textbaustein im Vorgang-Dialog (Nutzer-Feedback: Fehlquoten
|
||||
/// etc. nicht von Hand abtippen müssen).</summary>
|
||||
public sealed record VorgangQuickBlock(string Label, string Text);
|
||||
|
||||
/// <summary>
|
||||
/// Formuliert die Belege aus <see cref="StudentWarningEvidence"/> als deutschen Fließtext — für
|
||||
/// Schnellbausteine im Vorgang-Dialog, die Vorbelegung eines aus einer Dashboard-Warnung heraus
|
||||
/// angelegten Vorgangs und die Dokumentationsvorlagen (<see cref="VorgangDocumentationTemplates"/>).
|
||||
/// Jeder Block nennt das Stichtagsdatum, weil der Text eingefroren in Vorgang/Dokumentation landet,
|
||||
/// während die Zahlen dahinter weiterlaufen.
|
||||
/// </summary>
|
||||
public static class StudentEvidenceText
|
||||
{
|
||||
private static readonly CultureInfo De = new("de-DE");
|
||||
/// Die Terminlisten sollen den Beleg stützen, nicht die Beschreibung fluten.
|
||||
public const int MaxListedEvents = 15;
|
||||
|
||||
public static string AttendanceShort(StudentWarningEvidence e)
|
||||
{
|
||||
var b = e.Balance;
|
||||
var absent = b.Excused + b.Unexcused + b.ExcusePending;
|
||||
return $"Fehlquote {b.AbsenceRatePercent.ToString("0.#", De)} % im Schuljahr {e.SchoolYear} " +
|
||||
$"({absent} von {b.TotalChecked} erfassten Stunden; entschuldigt {b.Excused}, " +
|
||||
$"unentschuldigt {b.Unexcused}, Entschuldigung offen {b.ExcusePending})";
|
||||
}
|
||||
|
||||
public static string HomeworkShort(StudentWarningEvidence e) =>
|
||||
$"{e.MissingHomework.Count} nicht bzw. unvollständig erledigte Hausaufgabe{(e.MissingHomework.Count == 1 ? "" : "n")} im Schuljahr {e.SchoolYear}";
|
||||
|
||||
public static string LatenessShort(StudentWarningEvidence e) =>
|
||||
$"{e.Lateness.Count} Verspätung{(e.Lateness.Count == 1 ? "" : "en")} im Schuljahr {e.SchoolYear}" +
|
||||
(e.SignificantlyLateCount > 0 ? $" (davon {e.SignificantlyLateCount} erheblich)" : "");
|
||||
|
||||
public static string AttendanceBlock(StudentWarningEvidence e) =>
|
||||
$"Stand {e.AsOf:dd.MM.yyyy}: {AttendanceShort(e)}.";
|
||||
|
||||
public static string AbsenceListBlock(StudentWarningEvidence e) => ListBlock("Fehltermine", e.Absences);
|
||||
|
||||
public static string HomeworkBlock(StudentWarningEvidence e) =>
|
||||
$"Stand {e.AsOf:dd.MM.yyyy}: {HomeworkShort(e)}.\n" + ListBlock("Betroffene Termine", e.MissingHomework);
|
||||
|
||||
public static string LatenessBlock(StudentWarningEvidence e) =>
|
||||
$"Stand {e.AsOf:dd.MM.yyyy}: {LatenessShort(e)}.\n" + ListBlock("Betroffene Termine", e.Lateness);
|
||||
|
||||
private static string ListBlock(string header, IReadOnlyList<StudentEvidenceEvent> events)
|
||||
{
|
||||
var sb = new StringBuilder($"{header}:");
|
||||
foreach (var ev in events.Take(MaxListedEvents)) sb.Append("\n- ").Append(ev.ListLine);
|
||||
if (events.Count > MaxListedEvents) sb.Append($"\n- … und {events.Count - MaxListedEvents} weitere");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// Welcher Stand zu welchem Vorgangs-Schlagwort gehört — dieselben drei Tags, mit denen das
|
||||
/// Dashboard seine Warnungen an Vorgänge knüpft (DashboardViewModel.AbsentismusTag usw.).
|
||||
public static string? StatusBlockForTag(string tag, StudentWarningEvidence e) => tag.ToLowerInvariant() switch
|
||||
{
|
||||
"absentismus" => AttendanceBlock(e) + "\n" + AbsenceListBlock(e),
|
||||
"hausaufgaben" => HomeworkBlock(e),
|
||||
"verspätungen" => LatenessBlock(e),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// Kurzfassungen für die Tags eines Vorgangs, z.B. als Anlass eines Gesprächs. Ohne passendes
|
||||
/// Tag bleibt die Liste leer statt ungefragt alle Zahlen einzustreuen.
|
||||
public static List<string> ShortLinesForTags(IEnumerable<string> tags, StudentWarningEvidence e)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
foreach (var tag in tags.Select(t => t.ToLowerInvariant()).Distinct())
|
||||
{
|
||||
var line = tag switch
|
||||
{
|
||||
"absentismus" => AttendanceShort(e),
|
||||
"hausaufgaben" => HomeworkShort(e),
|
||||
"verspätungen" => LatenessShort(e),
|
||||
_ => null,
|
||||
};
|
||||
if (line is not null) lines.Add(line);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
||||
/// Schnellbausteine für den Vorgang-Dialog — nur solche mit tatsächlichem Inhalt, ein
|
||||
/// "0 Verspätungen"-Baustein wäre nur Rauschen.
|
||||
public static List<VorgangQuickBlock> QuickBlocks(StudentWarningEvidence e)
|
||||
{
|
||||
var blocks = new List<VorgangQuickBlock>();
|
||||
if (e.Balance.TotalChecked > 0) blocks.Add(new("Fehlquote", AttendanceBlock(e)));
|
||||
if (e.Absences.Count > 0) blocks.Add(new("Fehltermine", AbsenceListBlock(e)));
|
||||
if (e.MissingHomework.Count > 0) blocks.Add(new("Hausaufgaben", HomeworkBlock(e)));
|
||||
if (e.Lateness.Count > 0) blocks.Add(new("Verspätungen", LatenessBlock(e)));
|
||||
return blocks;
|
||||
}
|
||||
|
||||
/// Übersetzt die lokalen Mitarbeits-Belege in den neutralen Vorlagen-Kontext (die
|
||||
/// Klassenlehreransicht baut ihren Kontext stattdessen aus WebUntis-Daten, siehe
|
||||
/// ClassTeacherCaseFacts).
|
||||
public static VorgangTemplateContext TemplateContext(Vorgang vorgang, StudentWarningEvidence e) => new(
|
||||
e.StudentId, e.StudentNaturalName, e.AsOf, ShortLinesForTags(vorgang.Tags, e),
|
||||
new Dictionary<string, VorgangSnapshot>
|
||||
{
|
||||
[VorgangDocumentationTemplates.AttendanceStatus] = new($"Fehlzeiten-Stand {e.AsOf:dd.MM.yyyy}",
|
||||
AttendanceBlock(e) + "\n\n" + AbsenceListBlock(e)),
|
||||
[VorgangDocumentationTemplates.HomeworkStatus] = new($"Hausaufgaben-Stand {e.AsOf:dd.MM.yyyy}", HomeworkBlock(e)),
|
||||
[VorgangDocumentationTemplates.LatenessStatus] = new($"Verspätungs-Stand {e.AsOf:dd.MM.yyyy}", LatenessBlock(e)),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>Ein festhaltbarer Stand ("Fehlzeiten-Stand …") als fertiger Titel + Text.</summary>
|
||||
public sealed record VorgangSnapshot(string Title, string Content);
|
||||
|
||||
/// <summary>Neutraler Zahlen-Kontext für <see cref="VorgangDocumentationTemplates"/> — gespeist
|
||||
/// entweder aus den lokalen Mitarbeits-Einträgen (Schülerdetail, <see cref="StudentEvidenceText"/>)
|
||||
/// oder aus WebUntis (Klassenlehrer-Vorgänge, siehe ClassTeacherCaseFacts). So bleiben die
|
||||
/// Vorlagentexte an einer Stelle.</summary>
|
||||
/// <param name="SituationLines">Kurzfassungen passend zu den Tags des Vorgangs (Anlass).</param>
|
||||
/// <param name="Snapshots">Je Vorlagen-Schlüssel ein festhaltbarer Stand.</param>
|
||||
public sealed record VorgangTemplateContext(Guid StudentId, string StudentNaturalName, DateOnly AsOf,
|
||||
IReadOnlyList<string> SituationLines, IReadOnlyDictionary<string, VorgangSnapshot> Snapshots);
|
||||
|
||||
/// <summary>Standardformulierungen für den Vorgang-Dialog (Nutzer-Feedback: "den Klassenlehrer
|
||||
/// informiert" u.ä. nicht jedes Mal tippen). Datumsgestempelt, weil sie als Verlaufsnotiz in der
|
||||
/// Beschreibung landen. Getrennte Listen je Kontext: aus Sicht der Fachlehrkraft (Schülerdetail) wird
|
||||
/// die Klassenleitung informiert, aus Sicht der Klassenleitung die Fachlehrkräfte.</summary>
|
||||
public static class VorgangPhraseBlocks
|
||||
{
|
||||
public static IReadOnlyList<VorgangQuickBlock> ForStudent(DateOnly today) =>
|
||||
[
|
||||
new("Klassenleitung informiert", $"{today:dd.MM.yyyy}: Klassenleitung informiert."),
|
||||
new("Eltern informiert", $"{today:dd.MM.yyyy}: Erziehungsberechtigte informiert."),
|
||||
new("Gespräch geführt", $"{today:dd.MM.yyyy}: Gespräch mit der Schülerin/dem Schüler geführt."),
|
||||
new("Vereinbarung getroffen", $"{today:dd.MM.yyyy}: Vereinbarung getroffen: "),
|
||||
new("Weiter beobachten", $"{today:dd.MM.yyyy}: Weiter beobachten, Überprüfung am "),
|
||||
];
|
||||
|
||||
public static IReadOnlyList<VorgangQuickBlock> ForClassTeacher(DateOnly today) =>
|
||||
[
|
||||
new("Fachlehrkräfte informiert", $"{today:dd.MM.yyyy}: Fachlehrkräfte der Klasse informiert."),
|
||||
new("Eltern informiert", $"{today:dd.MM.yyyy}: Erziehungsberechtigte informiert."),
|
||||
new("Gespräch geführt", $"{today:dd.MM.yyyy}: Gespräch mit der Schülerin/dem Schüler geführt."),
|
||||
new("Attestpflicht angekündigt", $"{today:dd.MM.yyyy}: Attestpflicht angekündigt – Fehlzeiten gelten künftig nur mit ärztlichem Attest als entschuldigt."),
|
||||
new("Schulsozialarbeit eingebunden", $"{today:dd.MM.yyyy}: Schulsozialarbeit/Beratung eingebunden."),
|
||||
new("Schulleitung informiert", $"{today:dd.MM.yyyy}: Schulleitung informiert."),
|
||||
new("Vereinbarung getroffen", $"{today:dd.MM.yyyy}: Vereinbarung getroffen: "),
|
||||
new("Weiter beobachten", $"{today:dd.MM.yyyy}: Weiter beobachten, Überprüfung am "),
|
||||
];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Standardisierte Dokumentationseinträge für einen Vorgang (Nutzer-Feedback: nicht jeden Eintrag
|
||||
/// komplett von Hand anlegen). Erzeugt nur einen vorbefüllten, noch nicht gespeicherten Entwurf —
|
||||
/// der landet anschließend im normalen Dokumentations-Dialog, gespeichert wird erst nach bewusster
|
||||
/// Bestätigung dort.
|
||||
/// </summary>
|
||||
public static class VorgangDocumentationTemplates
|
||||
{
|
||||
// Stand festhalten — lokal (Schülerdetail) …
|
||||
public const string AttendanceStatus = "attendance";
|
||||
public const string HomeworkStatus = "homework";
|
||||
public const string LatenessStatus = "lateness";
|
||||
// … bzw. aus WebUntis (Klassenlehrer-Vorgänge)
|
||||
public const string UntisAbsenceStatus = "untisabsences";
|
||||
public const string ClassRegisterStatus = "classregister";
|
||||
|
||||
public const string Conversation = "conversation";
|
||||
public const string ParentCall = "parentcall";
|
||||
public const string ParentLetter = "parentletter";
|
||||
public const string InformClassTeacher = "informclassteacher";
|
||||
public const string InformSubjectTeachers = "informsubjectteachers";
|
||||
|
||||
public static Documentation? Build(string key, Vorgang vorgang, StudentWarningEvidence e) =>
|
||||
Build(key, vorgang, StudentEvidenceText.TemplateContext(vorgang, e));
|
||||
|
||||
public static Documentation? Build(string key, Vorgang vorgang, VorgangTemplateContext ctx)
|
||||
{
|
||||
var doc = new Documentation { StudentId = ctx.StudentId, Date = ctx.AsOf };
|
||||
if (ctx.Snapshots.TryGetValue(key, out var snapshot))
|
||||
{
|
||||
doc.Type = DocumentationType.Incident;
|
||||
doc.Title = snapshot.Title;
|
||||
doc.Content = snapshot.Content;
|
||||
doc.Tags = ["Beobachten"];
|
||||
return doc;
|
||||
}
|
||||
switch (key)
|
||||
{
|
||||
case Conversation:
|
||||
doc.Type = DocumentationType.Conversation;
|
||||
doc.Title = $"Gespräch: {vorgang.Title}";
|
||||
doc.Participants = [ctx.StudentNaturalName];
|
||||
doc.Content = "Anlass:\n" + Occasion(vorgang, ctx) +
|
||||
"\n\nSicht der Schülerin/des Schülers:\n\n\nVereinbarung:\n\n\nÜberprüfung am:\n";
|
||||
return doc;
|
||||
case InformClassTeacher:
|
||||
case InformSubjectTeachers:
|
||||
var who = key == InformClassTeacher ? "Klassenleitung" : "Fachlehrkräfte";
|
||||
doc.Type = DocumentationType.Conversation;
|
||||
doc.Title = $"{who} informiert: {vorgang.Title}";
|
||||
doc.Participants = [who];
|
||||
doc.Content = $"{who} am {ctx.AsOf:dd.MM.yyyy} informiert über:\n" + Occasion(vorgang, ctx) +
|
||||
"\n\nWeg (persönlich / Nachricht / E-Mail):\n\n\nRückmeldung / Absprache:\n";
|
||||
return doc;
|
||||
case ParentCall:
|
||||
doc.Type = DocumentationType.ParentCall;
|
||||
doc.Title = $"Elternanruf: {vorgang.Title}";
|
||||
var points = ctx.SituationLines.Select(l => $"Aktueller Stand: {l}").ToList();
|
||||
if (points.Count == 0) points.Add($"Anlass schildern: {vorgang.Title}");
|
||||
points.AddRange(["Sicht der Eltern / mögliche Gründe erfragen", "Unterstützung und Vereinbarung abstimmen",
|
||||
"Nächsten Kontakt vereinbaren"]);
|
||||
doc.ParentCallData = new ParentCallData
|
||||
{ Points = points.Select(p => new ParentCallPoint { Text = p }).ToList() };
|
||||
return doc;
|
||||
case ParentLetter:
|
||||
doc.Type = DocumentationType.ParentLetter;
|
||||
doc.Title = $"Elternbrief: {vorgang.Title}";
|
||||
doc.ParentLetterData = new ParentLetterData { DraftContent = LetterDraft(vorgang, ctx) };
|
||||
return doc;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string Occasion(Vorgang vorgang, VorgangTemplateContext ctx) =>
|
||||
ctx.SituationLines.Count == 0 ? $"- {vorgang.Title}"
|
||||
: string.Join("\n", ctx.SituationLines.Select(l => $"- {l} (Stand {ctx.AsOf:dd.MM.yyyy})"));
|
||||
|
||||
private static string LetterDraft(Vorgang vorgang, VorgangTemplateContext ctx)
|
||||
{
|
||||
var facts = ctx.SituationLines.Count == 0
|
||||
? $"es gibt Anlass zur Sorge ({vorgang.Title})."
|
||||
: $"mit Stand {ctx.AsOf:dd.MM.yyyy} ergibt sich folgendes Bild:\n" +
|
||||
string.Join("\n", ctx.SituationLines.Select(l => $"- {l}"));
|
||||
return $"Sehr geehrte Erziehungsberechtigte von {ctx.StudentNaturalName},\n\n" +
|
||||
$"ich möchte Sie darüber informieren, dass {facts}\n\n" +
|
||||
"Ich bitte Sie, mit Ihrem Kind darüber zu sprechen und sich bei Fragen mit mir in Verbindung zu setzen. " +
|
||||
"Für ein gemeinsames Gespräch stehe ich gerne zur Verfügung.\n\n" +
|
||||
"Mit freundlichen Grüßen";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user