From 41575b01ec501702b7409a880c04d7798c3094cd Mon Sep 17 00:00:00 2001 From: martent Date: Thu, 10 Jan 2019 12:32:46 +0100 Subject: [PATCH] Added PORate to refugee view --- app/helpers/refugees_helper.rb | 5 +++++ app/views/refugees/_extra_contributions.html.haml | 1 + config/locales/simple_form.sv.yml | 1 + 3 files changed, 7 insertions(+) diff --git a/app/helpers/refugees_helper.rb b/app/helpers/refugees_helper.rb index 12efba8..2271534 100644 --- a/app/helpers/refugees_helper.rb +++ b/app/helpers/refugees_helper.rb @@ -27,4 +27,9 @@ def add_ssns_button(name, form) name end end + + def po_extra(cost) + po_cost = Economy::CostWithPoRate.new(cost).as_array.sum { |x| x[:po_cost] } + number_to_currency(po_cost || 0, delimiter: ' ') + end end diff --git a/app/views/refugees/_extra_contributions.html.haml b/app/views/refugees/_extra_contributions.html.haml index 90a1bb3..e59b377 100644 --- a/app/views/refugees/_extra_contributions.html.haml +++ b/app/views/refugees/_extra_contributions.html.haml @@ -9,6 +9,7 @@ = show_attribute('extra_contribution.period_start', extra_contribution.period_start) = show_attribute('extra_contribution.period_end', extra_contribution.period_end) = show_attribute('extra_contribution.fee', number_to_currency(extra_contribution.fee.to_s, delimiter: ' ')) + = show_attribute('extra_contribution.po_extra', po_extra(extra_contribution)) = show_attribute('extra_contribution.expense', number_to_currency(extra_contribution.expense.to_s, delimiter: ' ')) = show_attribute('extra_contribution.contractor_name', extra_contribution.contractor_name) = show_attribute('extra_contribution.contractor_birthday', extra_contribution.contractor_birthday) diff --git a/config/locales/simple_form.sv.yml b/config/locales/simple_form.sv.yml index 1f75c62..29264b6 100644 --- a/config/locales/simple_form.sv.yml +++ b/config/locales/simple_form.sv.yml @@ -170,6 +170,7 @@ sv: period_start: Startdatum period_end: Slutdatum fee: Arvode per månad + po_extra: PO-pålägg expense: Omkostnad per månad contractor_name: Uppdragstagare contractor_birthday: Uppdragstagares födelsedag