Include duration in budgets table
This commit is contained in:
committed by
Javi Martín
parent
fe05bfe9ea
commit
d2871d7770
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user