Manage the render of the price field on valuation investments section

This commit is contained in:
decabeza
2022-02-03 10:49:41 +01:00
committed by taitus
parent 4c0499d53b
commit 8c3b222c98
3 changed files with 73 additions and 38 deletions

View File

@@ -1,27 +1,29 @@
<p id="price">
<strong>
<%= t("valuation.budget_investments.show.price") %>
(<%= t("valuation.budget_investments.show.currency") %>):
</strong>
<% if @investment.price.present? %>
<%= @investment.price %>
<% else %>
<%= t("valuation.budget_investments.show.undefined") %>
<% end %>
</p>
<% if @budget.show_money? %>
<p id="price">
<strong>
<%= t("valuation.budget_investments.show.price") %>
(<%= t("valuation.budget_investments.show.currency") %>):
</strong>
<% if @investment.price.present? %>
<%= @investment.price %>
<% else %>
<%= t("valuation.budget_investments.show.undefined") %>
<% end %>
</p>
<p id="price_first_year">
<strong>
<%= t("valuation.budget_investments.show.price_first_year") %>
(<%= t("valuation.budget_investments.show.currency") %>):
</strong>
<p id="price_first_year">
<strong>
<%= t("valuation.budget_investments.show.price_first_year") %>
(<%= t("valuation.budget_investments.show.currency") %>):
</strong>
<% if @investment.price_first_year.present? %>
<%= @investment.price_first_year %>
<% else %>
<%= t("valuation.budget_investments.show.undefined") %>
<% end %>
</p>
<% if @investment.price_first_year.present? %>
<%= @investment.price_first_year %>
<% else %>
<%= t("valuation.budget_investments.show.undefined") %>
<% end %>
</p>
<% end %>
<%= explanation_field @investment.price_explanation %>

View File

@@ -38,25 +38,29 @@
<div id="feasible_fields">
<div class="row">
<div class="small-12 medium-6 column">
<%= f.number_field :price,
label: t("valuation.budget_investments.edit.price", currency: budget.currency_symbol),
max: 1000000000000000 %>
<% if budget.show_money? %>
<div class="row">
<div class="small-12 medium-6 column">
<%= f.number_field :price,
label: t("valuation.budget_investments.edit.price", currency: budget.currency_symbol),
max: 1000000000000000 %>
</div>
<div class="small-12 medium-6 column end">
<%= f.number_field :price_first_year,
label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol),
max: 1000000000000000 %>
</div>
</div>
<div class="small-12 medium-6 column end">
<%= f.number_field :price_first_year,
label: t("valuation.budget_investments.edit.price_first_year", currency: budget.currency_symbol),
max: 1000000000000000 %>
<div class="row">
<div class="small-12 column">
<%= f.text_area :price_explanation, rows: 3 %>
</div>
</div>
</div>
<div class="row">
<div class="small-12 column">
<%= f.text_area :price_explanation, rows: 3 %>
</div>
</div>
<% else %>
<%= f.hidden_field :price, value: 0 %>
<% end %>
<div class="row">
<div class="small-12 medium-6 column">