<%# locals: (family:, year:) %> <%= turbo_frame_tag "budget_picker" do %>
<% if year > family.oldest_entry_date.year %> <%= link_to picker_budgets_path(year: year - 1), data: { turbo_frame: "budget_picker" }, class: "p-2 flex items-center justify-center hover:bg-alpha-black-25 rounded-md" do %> <%= lucide_icon "chevron-left", class: "w-5 h-5 shrink-0 text-gray-500" %> <% end %> <% else %> <%= lucide_icon "chevron-left", class: "w-5 h-5 shrink-0 text-gray-400" %> <% end %> <%= year %> <% if year < Date.current.year %> <%= link_to picker_budgets_path(year: year + 1), data: { turbo_frame: "budget_picker" }, class: "p-2 flex items-center justify-center hover:bg-alpha-black-25 rounded-md" do %> <%= lucide_icon "chevron-right", class: "w-5 h-5 shrink-0 text-gray-500" %> <% end %> <% else %> <%= lucide_icon "chevron-right", class: "w-5 h-5 shrink-0 text-gray-400" %> <% end %>
<% Date::ABBR_MONTHNAMES.compact.each_with_index do |month_name, index| %> <% month_number = index + 1 %> <% start_date = Date.new(year, month_number) %> <% budget = family.budgets.for_date(start_date) %> <% if budget %> <%= link_to month_name, budget_path(budget), data: { turbo_frame: "_top" }, class: "block px-3 py-2 text-sm text-gray-900 hover:bg-gray-100 rounded-md" %> <% elsif start_date >= family.oldest_entry_date.beginning_of_month && start_date <= Date.current %> <%= button_to budgets_path(budget: { start_date: start_date }), data: { turbo_frame: "_top" }, class: "block w-full px-3 py-2 text-gray-900 hover:bg-gray-100 rounded-md" do %> <%= month_name %> <% end %> <% else %> <%= month_name %> <% end %> <% end %>
<% end %>