1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 07:39:39 +02:00

Added more periods (#1714)

This commit is contained in:
Nikhil Badyal 2025-01-27 23:33:15 +05:30 committed by GitHub
parent d2a7aef6ef
commit 2a202576f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 36 additions and 6 deletions

View file

@ -18,9 +18,20 @@ module FormsHelper
end
def period_select(form:, selected:, classes: "border border-alpha-black-100 shadow-xs rounded-lg text-sm pr-7 cursor-pointer text-gray-900 focus:outline-none focus:ring-0")
periods_for_select = [ [ "7D", "last_7_days" ], [ "1M", "last_30_days" ], [ "1Y", "last_365_days" ] ]
periods_for_select = [
%w[CWD current_week], # Current Week to Date
%w[7D last_7_days],
%w[MTD current_month], # Month to Date
%w[1M last_30_days],
%w[CQD current_quarter], # Quarter to Date
%w[3M last_90_days],
%w[YTD current_year], # Year to Date
%w[1Y last_365_days]
]
form.select(:period, periods_for_select, { selected: selected }, class: classes, data: { "auto-submit-form-target": "auto" })
end
end
def currencies_for_select
Money::Currency.all_instances.sort_by { |currency| [ currency.priority, currency.name ] }