Merge pull request #1325 from consul/budgets-gaspar
Budgets - several fixes
This commit is contained in:
@@ -2,12 +2,16 @@ class Valuation::BudgetsController < Valuation::BaseController
|
||||
include FeatureFlags
|
||||
feature_flag :budgets
|
||||
|
||||
has_filters %w{current finished}, only: :index
|
||||
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@budgets = Budget.send(@current_filter).order(created_at: :desc).page(params[:page])
|
||||
@budgets = @budgets.current.order(created_at: :desc).page(params[:page])
|
||||
@investments_with_valuation_open = {}
|
||||
@budgets.each do |b|
|
||||
@investments_with_valuation_open[b.id] = b.investments
|
||||
.by_valuator(current_user.valuator.try(:id))
|
||||
.valuation_open
|
||||
.count
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -46,7 +46,7 @@ module Abilities
|
||||
can [:read, :create, :update, :destroy], Budget::Group
|
||||
can [:read, :create, :update, :destroy], Budget::Heading
|
||||
can [:hide, :update, :toggle_selection], Budget::Investment
|
||||
can :valuate, Budget::Investment, budget: { phase: 'valuating' }
|
||||
can :valuate, Budget::Investment
|
||||
can :create, Budget::ValuatorAssignment
|
||||
|
||||
can [:search, :edit, :update, :create, :index, :destroy], Banner
|
||||
|
||||
@@ -5,7 +5,8 @@ module Abilities
|
||||
def initialize(user)
|
||||
valuator = user.valuator
|
||||
can [:read, :update, :valuate], SpendingProposal
|
||||
can [:read, :update, :valuate], Budget::Investment, id: valuator.investment_ids, budget: { phase: 'valuating' }
|
||||
can [:read, :update, :valuate], Budget::Investment, id: valuator.investment_ids
|
||||
cannot [:update, :valuate], Budget::Investment, budget: { phase: 'finished' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -36,14 +36,17 @@ class Budget
|
||||
self.groups.include?(group)
|
||||
end
|
||||
|
||||
def wrong_budget?(heading)
|
||||
heading.budget_id != budget_id
|
||||
end
|
||||
|
||||
def different_heading_assigned?(heading)
|
||||
other_heading_ids = heading.group.heading_ids - [heading.id]
|
||||
lines.where(heading_id: other_heading_ids).exists?
|
||||
end
|
||||
|
||||
def valid_heading?(heading)
|
||||
group = heading.group
|
||||
return false if group.budget_id != budget_id
|
||||
|
||||
line = lines.where(heading_id: group.heading_ids).first
|
||||
return false if line.present? && line.heading_id != heading.id
|
||||
|
||||
true
|
||||
!wrong_budget?(heading) && !different_heading_assigned?(heading)
|
||||
end
|
||||
|
||||
def has_lines_with_no_heading?
|
||||
|
||||
@@ -9,28 +9,24 @@ class Budget
|
||||
|
||||
validates :ballot_id, :investment_id, :heading_id, :group_id, :budget_id, presence: true
|
||||
|
||||
validate :insufficient_funds
|
||||
#needed? validate :different_geozone, :if => :district_proposal?
|
||||
validate :unselected
|
||||
validate :check_selected
|
||||
validate :check_sufficient_funds
|
||||
validate :check_valid_heading
|
||||
|
||||
before_validation :set_denormalized_ids
|
||||
|
||||
def insufficient_funds
|
||||
def check_sufficient_funds
|
||||
errors.add(:money, "insufficient funds") if ballot.amount_available(investment.heading) < investment.price.to_i
|
||||
end
|
||||
|
||||
def different_geozone
|
||||
errors.add(:heading, "different heading assigned") if (ballot.heading.present? && investment.heading != ballot.heading)
|
||||
def check_valid_heading
|
||||
errors.add(:heading, "This heading's budget is invalid, or a heading on the same group was already selected") unless ballot.valid_heading?(self.heading)
|
||||
end
|
||||
|
||||
def unselected
|
||||
def check_selected
|
||||
errors.add(:investment, "unselected investment") unless investment.selected?
|
||||
end
|
||||
|
||||
def heading_proposal?
|
||||
investment.heading_id.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_denormalized_ids
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
class Budget
|
||||
class Heading < ActiveRecord::Base
|
||||
belongs_to :group
|
||||
belongs_to :geozone
|
||||
|
||||
has_many :investments
|
||||
|
||||
@@ -11,13 +10,7 @@ class Budget
|
||||
|
||||
scope :order_by_group_name, -> { includes(:group).order('budget_groups.name', 'budget_headings.name') }
|
||||
|
||||
def budget
|
||||
group.budget
|
||||
end
|
||||
|
||||
def budget=(resource)
|
||||
group.budget = resource
|
||||
end
|
||||
delegate :budget, :budget_id, to: :group, allow_nil: true
|
||||
|
||||
def name_scoped_by_group
|
||||
"#{group.name}: #{name}"
|
||||
|
||||
@@ -26,7 +26,7 @@ class Budget
|
||||
validates :heading_id, presence: true
|
||||
validates_presence_of :unfeasibility_explanation, if: :unfeasibility_explanation_required?
|
||||
|
||||
validates :title, length: { in: 4 .. Budget::Investment.title_max_length }
|
||||
validates :title, length: { in: 4..Budget::Investment.title_max_length }
|
||||
validates :description, length: { maximum: Budget::Investment.description_max_length }
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||
|
||||
@@ -53,7 +53,7 @@ class Budget
|
||||
scope :by_tag, -> (tag_name) { tagged_with(tag_name) }
|
||||
scope :by_valuator, -> (valuator_id) { where("budget_valuator_assignments.valuator_id = ?", valuator_id).joins(:valuator_assignments) }
|
||||
|
||||
scope :for_render, -> { includes(heading: :geozone) }
|
||||
scope :for_render, -> { includes(:heading) }
|
||||
|
||||
before_save :calculate_confidence_score
|
||||
before_validation :set_responsible_name
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
<%= f.text_field :name, maxlength: Budget.title_max_length %>
|
||||
|
||||
<% Budget::PHASES.each do |phase| %>
|
||||
<%= f.cktext_area "description_#{phase}", maxlength: Budget.description_max_length, ckeditor: { language: I18n.locale } %>
|
||||
<div class="margin-top">
|
||||
<%= f.cktext_area "description_#{phase}", maxlength: Budget.description_max_length, ckeditor: { language: I18n.locale } %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="row margin-top">
|
||||
<div class="small-12 medium-9 column">
|
||||
<%= f.select :phase, budget_phases_select_options %>
|
||||
</div>
|
||||
|
||||
@@ -1,76 +1,67 @@
|
||||
<div class="small-12 column">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="with-button">
|
||||
<%= group.name %>
|
||||
<%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %>
|
||||
</th>
|
||||
</tr>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="with-button">
|
||||
<%= group.name %>
|
||||
<%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<% if headings.blank? %>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_heading") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.form.table_heading") %></th>
|
||||
<th><%= t("admin.budgets.form.table_amount") %></th>
|
||||
<th><%= t("admin.budgets.form.table_geozone") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% end %>
|
||||
|
||||
<!-- new heading form -->
|
||||
<tr id="group-<%= group.id %>-new-heading-form" style="display:none">
|
||||
<td colspan="3">
|
||||
<%= form_for [:admin, @budget, group, Budget::Heading.new], remote: true do |f| %>
|
||||
<label><%= t("admin.budgets.form.heading") %></label>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.heading") %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.amount") %></label>
|
||||
<%= f.text_field :price,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budgets.form.amount") %>
|
||||
</div>
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.geozone") %></label>
|
||||
<%= f.select :geozone_id, geozone_select_options, {include_blank: t("geozones.none"), label: false} %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /. new heading form -->
|
||||
<!-- headings list -->
|
||||
<% headings.each do |heading| %>
|
||||
<% if headings.blank? %>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
<td>
|
||||
<%= geozone_name_from_id heading.geozone_id %>
|
||||
<td colspan="3">
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_heading") %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.form.table_heading") %></th>
|
||||
<th><%= t("admin.budgets.form.table_amount") %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% end %>
|
||||
|
||||
<!-- new heading form -->
|
||||
<tr id="group-<%= group.id %>-new-heading-form" style="display:none">
|
||||
<td colspan="3">
|
||||
<%= form_for [:admin, @budget, group, Budget::Heading.new], remote: true do |f| %>
|
||||
<label><%= t("admin.budgets.form.heading") %></label>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.heading") %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-6 column">
|
||||
<label><%= t("admin.budgets.form.amount") %></label>
|
||||
<%= f.text_field :price,
|
||||
label: false,
|
||||
maxlength: 8,
|
||||
placeholder: t("admin.budgets.form.amount") %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= f.submit t("admin.budgets.form.save_heading"), class: "button success" %>
|
||||
<% end %>
|
||||
<!-- /. headings list -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- /. new heading form -->
|
||||
<!-- headings list -->
|
||||
<% headings.each do |heading| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= heading.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= heading.price %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<!-- /. headings list -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,34 +1,32 @@
|
||||
<div class="small-12 column">
|
||||
<h3 class="inline-block"><%= t('admin.budgets.show.groups') %></h3>
|
||||
<% if groups.blank? %>
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_groups") %>
|
||||
<strong><%= link_to t("admin.budgets.form.add_group"), "#",
|
||||
class: "js-toggle-link",
|
||||
data: { "toggle-selector" => "#new-group-form" } %></strong>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= link_to t("admin.budgets.form.add_group"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#new-group-form" } %>
|
||||
<% end %>
|
||||
<h3 class="inline-block"><%= t('admin.budgets.show.groups', count: groups.count) %></h3>
|
||||
<% if groups.blank? %>
|
||||
<div class="callout primary">
|
||||
<%= t("admin.budgets.form.no_groups") %>
|
||||
<strong><%= link_to t("admin.budgets.form.add_group"), "#",
|
||||
class: "js-toggle-link",
|
||||
data: { "toggle-selector" => "#new-group-form" } %></strong>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= link_to t("admin.budgets.form.add_group"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#new-group-form" } %>
|
||||
<% end %>
|
||||
|
||||
<%= form_for [:admin, @budget, Budget::Group.new], html: {id: "new-group-form", style: "display:none"}, remote: true do |f| %>
|
||||
<div class="input-group">
|
||||
<span class="input-group-label">
|
||||
<label><%= f.label :name,t("admin.budgets.form.group") %></label>
|
||||
</span>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.group") %>
|
||||
<div class="input-group-button">
|
||||
<%= f.submit t("admin.budgets.form.create_group"), class: "button success" %>
|
||||
</div>
|
||||
<%= form_for [:admin, @budget, Budget::Group.new], html: {id: "new-group-form", style: "display:none"}, remote: true do |f| %>
|
||||
<div class="input-group">
|
||||
<span class="input-group-label">
|
||||
<label><%= f.label :name,t("admin.budgets.form.group") %></label>
|
||||
</span>
|
||||
<%= f.text_field :name,
|
||||
label: false,
|
||||
maxlength: 50,
|
||||
placeholder: t("admin.budgets.form.group") %>
|
||||
<div class="input-group-button">
|
||||
<%= f.submit t("admin.budgets.form.create_group"), class: "button success" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% groups.each do |group| %>
|
||||
<div class="row" id="<%= dom_id(group) %>">
|
||||
<%= render "admin/budgets/group", group: group, headings: group.headings %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% groups.each do |group| %>
|
||||
<div id="<%= dom_id(group) %>">
|
||||
<%= render "admin/budgets/group", group: group, headings: group.headings %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
<%= link_to admin_budgets_path do %>
|
||||
<span class="icon-angle-left"></span>
|
||||
<%= t('shared.back') %>
|
||||
<% end %>
|
||||
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<h2><%= t("admin.budgets.edit.title") %></h2>
|
||||
|
||||
@@ -6,23 +6,39 @@
|
||||
|
||||
<%= render 'shared/filter_subnav', i18n_namespace: "admin.budgets.index" %>
|
||||
|
||||
|
||||
<h3><%= page_entries_info @budgets %></h3>
|
||||
|
||||
<table>
|
||||
<% @budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td>
|
||||
<%= link_to budget.name, admin_budget_budget_investments_path(budget_id: budget.id) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= t("budget.phase.#{budget.phase}") %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("admin.budgets.index.info_link"), admin_budget_path(budget) %>
|
||||
</td>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("admin.budgets.index.table_name") %></th>
|
||||
<th><%= t("admin.budgets.index.table_phase") %></th>
|
||||
<th><%= t("admin.budgets.index.table_investments") %></th>
|
||||
<th><%= t("admin.budgets.index.table_edit_groups") %></th>
|
||||
<th><%= t("admin.budgets.index.table_edit_budget") %></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td>
|
||||
<%= budget.name %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= t("budget.phase.#{budget.phase}") %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("admin.budgets.index.budget_investments"), admin_budget_budget_investments_path(budget_id: budget.id) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("admin.budgets.index.edit_groups"), admin_budget_path(budget) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("admin.budgets.index.edit_budget"), edit_admin_budget_path(budget) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @budgets %>
|
||||
@@ -1,16 +1,10 @@
|
||||
<div class="row">
|
||||
<div class="small-12 medium-9 column">
|
||||
<h2><%= @budget.name %> <small><%= link_to(t('shared.edit'), edit_admin_budget_path(@budget)) %></small></h2>
|
||||
<%= link_to admin_budgets_path do %>
|
||||
<span class="icon-angle-left"></span>
|
||||
<%= t('shared.back') %>
|
||||
<% end %>
|
||||
|
||||
<%= @budget.description %>
|
||||
<h2><%= @budget.name %></h2>
|
||||
|
||||
<p>
|
||||
<strong><%= t('admin.budgets.show.phase') %>:</strong> <%= t("budget.phase.#{@budget.phase}") %> |
|
||||
<strong><%= t('admin.budgets.show.currency') %>:</strong> <%= @budget.currency_symbol %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="<%= dom_id @budget %>_groups" class="row">
|
||||
<div id="<%= dom_id @budget %>_groups">
|
||||
<%= render "groups", groups: @budget.groups %>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="row progress-votes">
|
||||
<div class="small-12 column">
|
||||
<div class="progress-bar-nav" data-fixed-bar>
|
||||
<h1 class="inline-block"><%= @filter_geozone_name %></h1>
|
||||
<h1 class="inline-block"><%= @heading.name %></h1>
|
||||
<div id="check-ballot" style="display: none;">
|
||||
<% if can? :show, @ballot %>
|
||||
<%= link_to t("budget.investments.header.check_ballot"),
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
method: "post",
|
||||
remote: true,
|
||||
"aria-hidden" => css_for_aria_hidden(reason) do %>
|
||||
<%= t("budget.investments.investment.vote") %>
|
||||
<%= t("budget.investments.investment.give_support") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<%= link_to "#{t('valuation.budget_investments.show.title')} #{@investment.id}", valuation_budget_budget_investment_path(@budget, @investment), class: 'back' %>
|
||||
<%= link_to valuation_budget_budget_investment_path(@budget, @investment), class: 'back' do %>
|
||||
<span class="icon-angle-left"></span>
|
||||
<%= "#{t('valuation.budget_investments.show.title')} #{@investment.id}"%>
|
||||
<% end %>
|
||||
|
||||
<h2><%= t("valuation.budget_investments.edit.dossier") %></h2>
|
||||
|
||||
<%= form_for(@investment, url: valuate_valuation_budget_budget_investment_path(@budget, @investment), html: {id: "valuation_budget_investment_edit_form"}) do |f| %>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<h2><%= @budget.name %> - <%= t("valuation.budget_investments.index.title") %></h2>
|
||||
<h2>
|
||||
<%= @budget.name %> - <%= t("valuation.budget_investments.index.title") %>
|
||||
<small><%= t('valuation.budget_investments.index.assigned_to', valuator: current_user.name) %></small>
|
||||
</h2>
|
||||
|
||||
<div class="row collapse">
|
||||
<% @heading_filters.each_slice(8) do |slice| %>
|
||||
@@ -18,25 +21,34 @@
|
||||
<h3><%= page_entries_info @investments %></h3>
|
||||
|
||||
<table>
|
||||
<% @investments.each do |investment| %>
|
||||
<tr id="<%= dom_id(investment) %>">
|
||||
<td>
|
||||
<strong><%= investment.id %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to investment.title, valuation_budget_budget_investment_path(@budget, investment) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("valuation.budget_investments.index.edit"), edit_valuation_budget_budget_investment_path(@budget, investment) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= assigned_valuators_info(investment.valuators) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= investment.heading.name %>
|
||||
</td>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("valuation.budget_investments.index.table_id") %></th>
|
||||
<th><%= t("valuation.budget_investments.index.table_title") %></th>
|
||||
<th><%= t("valuation.budget_investments.index.table_heading_name") %></th>
|
||||
<th><%= t("valuation.budget_investments.index.table_actions") %></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @investments.each do |investment| %>
|
||||
<tr id="<%= dom_id(investment) %>">
|
||||
<td>
|
||||
<strong><%= investment.id %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to investment.title, valuation_budget_budget_investment_path(@budget, investment) %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= investment.heading.name %>
|
||||
</td>
|
||||
<td class="small">
|
||||
<%= link_to t("valuation.budget_investments.index.edit"),
|
||||
edit_valuation_budget_budget_investment_path(@budget, investment),
|
||||
class: "button hollow expanded" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @investments %>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<%= render "shared/back_link" %>
|
||||
<%= link_to valuation_budget_budget_investments_path do %>
|
||||
<span class="icon-angle-left"></span>
|
||||
<%= t('shared.back') %>
|
||||
<% end %>
|
||||
|
||||
<h2><%= t("valuation.budget_investments.show.title") %> <%= @investment.id %> </h2>
|
||||
<h1><%= @investment.title %></h1>
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
<h2 class="inline-block"><%= t("valuation.budgets.index.title") %></h2>
|
||||
|
||||
<%= render 'shared/filter_subnav', i18n_namespace: "valuation.budgets.index" %>
|
||||
|
||||
<h3><%= page_entries_info @budgets %></h3>
|
||||
|
||||
<table>
|
||||
<% @budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td>
|
||||
<%= link_to budget.name, valuation_budget_budget_investments_path(budget_id: budget.id) %>
|
||||
</td>
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= t("valuation.budgets.index.table_name") %></th>
|
||||
<th><%= t("valuation.budgets.index.table_phase") %></th>
|
||||
<th><%= t("valuation.budgets.index.table_assigned_investments_valuation_open") %></th>
|
||||
<th><%= t("valuation.budgets.index.table_actions") %></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td>
|
||||
<%= budget.name %>
|
||||
</td>
|
||||
<td>
|
||||
<%= t("budget.phase.#{budget.phase}") %>
|
||||
</td>
|
||||
<td>
|
||||
<%= @investments_with_valuation_open[budget.id] %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("valuation.budgets.index.evaluate"),
|
||||
valuation_budget_budget_investments_path(budget_id: budget.id),
|
||||
class: "button hollow expanded" %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @budgets %>
|
||||
<%= paginate @budgets %>
|
||||
|
||||
Reference in New Issue
Block a user