From 7880db22cebe7f9923d0c65b88cdcccb4ec1ff66 Mon Sep 17 00:00:00 2001 From: Chris <76159444+hunchr@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:56:03 +0000 Subject: [PATCH] Add data quality to table display --- app/domain/table_displays/resolver.rb | 1 + app/helpers/sac_cas/people_helper.rb | 14 ++++++++++++++ config/locales/wagon.de.yml | 7 +++++++ lib/hitobito_sac_cas/wagon.rb | 1 + .../domain/table_displays/resolving_column_spec.rb | 11 +++++++++++ 5 files changed, 34 insertions(+) diff --git a/app/domain/table_displays/resolver.rb b/app/domain/table_displays/resolver.rb index 2d82a24d5..91413bbcd 100644 --- a/app/domain/table_displays/resolver.rb +++ b/app/domain/table_displays/resolver.rb @@ -18,6 +18,7 @@ class Resolver wiedereintritt: :show, self_registration_reason: :show_full, address_valid: :show, + data_quality: :show, sac_remark_national_office: :manage_national_office_remark, sac_remark_section_1: :manage_section_remarks, sac_remark_section_2: :manage_section_remarks, diff --git a/app/helpers/sac_cas/people_helper.rb b/app/helpers/sac_cas/people_helper.rb index 92c844067..ac2167f7e 100644 --- a/app/helpers/sac_cas/people_helper.rb +++ b/app/helpers/sac_cas/people_helper.rb @@ -36,6 +36,10 @@ def people_sac_membership_qr_code(person, html_options = {}) end end + def format_person_data_quality(person) + format_data_quality_icons(person.data_quality) + end + private def people_sac_membership_qr_code_clickable(verification_qr_code, image) @@ -44,4 +48,14 @@ def people_sac_membership_qr_code_clickable(verification_qr_code, image) image end end + + def format_data_quality_icons(status) + icons = { + ok: "check-circle", + info: "info-circle", + warning: "exclamation-triangle", + error: "times-circle" + } + icon(icons[status.to_sym], title: I18n.t("people.data_quality.#{status}")) + end end diff --git a/config/locales/wagon.de.yml b/config/locales/wagon.de.yml index 7d8ddfd31..abb40118e 100644 --- a/config/locales/wagon.de.yml +++ b/config/locales/wagon.de.yml @@ -303,6 +303,7 @@ de: sac_remark_section_3: Bemerkungen Sektion 3 sac_remark_section_4: Bemerkungen Sektion 4 sac_remark_section_5: Bemerkungen Sektion 5 + data_quality: Datenqualität correspondences: digital: Digital print: Physisch @@ -1110,6 +1111,12 @@ de: sac_remarks: Bemerkungen external_invoices: Rechnungen + data_quality: + ok: OK + info: Info + warning: Warnung + error: Fehler + show_right_z_sac_cas: section_sac_membership: SAC Mitgliedschaft qr_code_hint: Scannen um Mitgliedschaft zu verifizieren diff --git a/lib/hitobito_sac_cas/wagon.rb b/lib/hitobito_sac_cas/wagon.rb index 6edd7dc4e..d9b334203 100644 --- a/lib/hitobito_sac_cas/wagon.rb +++ b/lib/hitobito_sac_cas/wagon.rb @@ -186,6 +186,7 @@ class Wagon < Rails::Engine :wiedereintritt, :self_registration_reason, :address_valid, + :data_quality, :sac_remark_national_office, :sac_remark_section_1, :sac_remark_section_2, diff --git a/spec/domain/table_displays/resolving_column_spec.rb b/spec/domain/table_displays/resolving_column_spec.rb index 639d87252..80e0e72e1 100644 --- a/spec/domain/table_displays/resolving_column_spec.rb +++ b/spec/domain/table_displays/resolving_column_spec.rb @@ -60,6 +60,17 @@ let(:person) { people(:admin).tap { |p| allow(p).to receive(:membership_years).and_return(3) } } end + it_behaves_like "table display", { + column: :data_quality, + header: "Datenqualität", + value: "", # is icon + permission: :show + } do + let(:person) do + people(:admin).tap { |p| allow(p).to receive(:data_quality).and_return("info") } + end + end + it_behaves_like "table display", { column: :sac_remark_national_office, header: "Bemerkungen Geschäftsstelle",