Include duration in budgets table

This commit is contained in:
Julian Herrero
2020-03-16 12:54:00 +01:00
committed by Javi Martín
parent fe05bfe9ea
commit d2871d7770
10 changed files with 134 additions and 12 deletions

View File

@@ -9,4 +9,24 @@ class Admin::Budgets::IndexComponent < ApplicationComponent
def title
t("admin.budgets.index.title")
end
private
def phase_progress_text(budget)
t("admin.budgets.index.table_phase_progress",
current_phase_number: current_enabled_phase_number(budget),
total_phases: budget.phases.enabled.count)
end
def current_enabled_phase_number(budget)
budget.phases.enabled.order(:id).pluck(:kind).index(budget.phase) + 1
end
def dates(budget)
Admin::Budgets::DurationComponent.new(budget).dates
end
def duration(budget)
Admin::Budgets::DurationComponent.new(budget).duration
end
end