2024-02-02 09:05:04 -06:00
|
|
|
class AccountsController < ApplicationController
|
2025-02-21 11:57:59 -05:00
|
|
|
before_action :set_account, only: %i[sync chart sparkline]
|
2024-02-02 10:39:16 -06:00
|
|
|
|
2024-04-18 07:56:51 -04:00
|
|
|
def index
|
2025-02-21 11:57:59 -05:00
|
|
|
@manual_accounts = family.accounts.manual.alphabetically
|
|
|
|
@plaid_items = family.plaid_items.ordered
|
2024-04-18 07:56:51 -04:00
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
render layout: "settings"
|
2024-04-29 14:56:38 +01:00
|
|
|
end
|
|
|
|
|
2024-03-21 13:39:10 -04:00
|
|
|
def sync
|
2024-06-13 17:03:38 -04:00
|
|
|
unless @account.syncing?
|
2024-05-20 16:34:48 +02:00
|
|
|
@account.sync_later
|
2024-03-21 13:39:10 -04:00
|
|
|
end
|
2024-11-15 13:49:37 -05:00
|
|
|
|
|
|
|
redirect_to account_path(@account)
|
2024-03-21 13:39:10 -04:00
|
|
|
end
|
|
|
|
|
2024-11-27 16:01:50 -05:00
|
|
|
def chart
|
|
|
|
render layout: "application"
|
|
|
|
end
|
|
|
|
|
2025-02-21 11:57:59 -05:00
|
|
|
def sparkline
|
|
|
|
render layout: false
|
|
|
|
end
|
|
|
|
|
2024-07-05 13:36:18 +02:00
|
|
|
def sync_all
|
2025-02-21 11:57:59 -05:00
|
|
|
unless family.syncing?
|
|
|
|
family.sync_later
|
2024-11-15 13:49:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
redirect_to accounts_path
|
2024-07-05 13:36:18 +02:00
|
|
|
end
|
|
|
|
|
2024-02-02 10:39:16 -06:00
|
|
|
private
|
2025-02-21 11:57:59 -05:00
|
|
|
def family
|
|
|
|
Current.family
|
|
|
|
end
|
|
|
|
|
2024-05-17 09:09:32 -04:00
|
|
|
def set_account
|
2025-02-21 11:57:59 -05:00
|
|
|
@account = family.accounts.find(params[:id])
|
2024-05-17 09:09:32 -04:00
|
|
|
end
|
2024-02-02 09:05:04 -06:00
|
|
|
end
|