From d8994de79f056b644e9b84a0b597f59c182b3e18 Mon Sep 17 00:00:00 2001 From: Adrian Hinz Date: Tue, 5 Apr 2022 17:12:39 +0200 Subject: [PATCH] added view on front for dot ammount --- app/models/dotation.rb | 6 ++++++ app/views/home/_show.html.erb | 22 ++++++++++++++++++++++ app/views/home/_show.pdf.erb | 28 +++++++++++++++++++++++++--- 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/app/models/dotation.rb b/app/models/dotation.rb index aa646b2..4b58d16 100644 --- a/app/models/dotation.rb +++ b/app/models/dotation.rb @@ -26,6 +26,12 @@ class Dotation < ApplicationRecord class_name: 'Currency' belongs_to :max_amount_curr, foreign_key: :max_amount_curr_id, class_name: 'Currency' + # dotation currency + belongs_to :min_dot_amount_curr, foreign_key: :min_dot_amount_curr_id, + class_name: 'Currency' + belongs_to :max_dot_amount_curr, foreign_key: :max_dot_amount_curr_id, + class_name: 'Currency' + has_and_belongs_to_many :expenses has_and_belongs_to_many :company_sizes has_and_belongs_to_many :projects diff --git a/app/views/home/_show.html.erb b/app/views/home/_show.html.erb index 1310b07..7588c2c 100644 --- a/app/views/home/_show.html.erb +++ b/app/views/home/_show.html.erb @@ -80,24 +80,46 @@ + <% unless @dotation.localization.blank? %> Miejsce realizacji projektu <%= @dotation.localization %> + <% end %> + <% unless @dotation.min_amount.blank? %> Minimalna wartość projektu (wydatków) <%= change_ammount(@dotation.min_amount) %> <%= @dotation.min_amount_curr.name %> + <% end %> + <% unless @dotation.max_amount.blank? %> Maksymalna wartość projektu (wydatków) <%= change_ammount(@dotation.max_amount) %> <%= @dotation.max_amount_curr.name %> + <% end %> + <% unless @dotation.min_dot_ammount.blank? %> + + + Minimalna wartość dotacji + + <%= change_ammount(@dotation.min_dot_ammount) %> <%= @dotation.min_dot_amount_curr.name %> + + <% end %> + <% unless @dotation.max_dot_ammount.blank? %> + + + Maksymalna wartość dotacji + + <%= change_ammount(@dotation.max_dot_ammount) %> <%= @dotation.max_dot_amount_curr.name %> + + <% end %> diff --git a/app/views/home/_show.pdf.erb b/app/views/home/_show.pdf.erb index 61ba52b..13e2ce1 100644 --- a/app/views/home/_show.pdf.erb +++ b/app/views/home/_show.pdf.erb @@ -77,24 +77,46 @@ + <% unless @dotation.localization.blank? %> Miejsce realizacji projektu - <%= dotation.localization %> + <%= @dotation.localization %> + <% end %> + <% unless @dotation.min_amount.blank? %> Minimalna wartość projektu (wydatków) - <%= change_ammount(dotation.min_amount) %> <%= dotation.min_amount_curr.name %> + <%= change_ammount(@dotation.min_amount) %> <%= @dotation.min_amount_curr.name %> + <% end %> + <% unless @dotation.max_amount.blank? %> Maksymalna wartość projektu (wydatków) - <%= change_ammount(dotation.max_amount) %> <%= dotation.max_amount_curr.name %> + <%= change_ammount(@dotation.max_amount) %> <%= @dotation.max_amount_curr.name %> + <% end %> + <% unless @dotation.min_dot_ammount.blank? %> + + + Minimalna wartość dotacji + + <%= change_ammount(@dotation.min_dot_ammount) %> <%= @dotation.min_dot_amount_curr.name %> + + <% end %> + <% unless @dotation.max_dot_ammount.blank? %> + + + Maksymalna wartość dotacji + + <%= change_ammount(@dotation.max_dot_ammount) %> <%= @dotation.max_dot_amount_curr.name %> + + <% end %>