From 31eda3efc9a881c6b5da860ee35ae3f6aa871835 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Sun, 3 Sep 2023 14:03:31 +0200 Subject: [PATCH] Show notice if form has no field to be used as procedure date This indicates that the form cannot be used as main form, but as subform only. --- src/model/data_form.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/model/data_form.rs b/src/model/data_form.rs index 027ce15..f01cdf0 100644 --- a/src/model/data_form.rs +++ b/src/model/data_form.rs @@ -192,13 +192,25 @@ impl FormEntryContainer for DataForm { impl Listable for DataForm { fn to_listed_string(&self) -> String { format!( - "Formular ({}) '{}' in Revision '{}'", + "Formular ({}) '{}' in Revision '{}' {}", match self.is_system_library_content() { true => style("S").yellow(), _ => style("u"), }, style(&self.name).yellow(), - style(&self.revision).yellow() + style(&self.revision).yellow(), + if self + .entries + .entry + .iter() + .filter(|entry| entry.procedure_date_status != "none") + .count() + == 0 + { + style("Formular hat keine Angabe zum Prozedurdatum!").red() + } else { + style("") + } ) } }