2025-01-16 14:36:37 -05:00
|
|
|
<%= content_for :header_nav do %>
|
|
|
|
<%= render "budgets/budget_nav", budget: @budget %>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= content_for :previous_path, edit_budget_path(@budget) %>
|
|
|
|
<%= content_for :cancel_path, budget_path(@budget) %>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<div class="space-y-6">
|
|
|
|
<div class="text-center space-y-2">
|
|
|
|
<h1 class="text-3xl text-gray-900 font-medium">Edit your category budgets</h1>
|
|
|
|
<p class="text-gray-500 text-sm max-w-md mx-auto">
|
|
|
|
Adjust category budgets to set spending limits. Unallocated funds will be automatically assigned as uncategorized.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="mx-auto max-w-lg">
|
|
|
|
<% if @budget.family.categories.empty? %>
|
|
|
|
<div class="bg-white shadow-xs border border-gray-200 rounded-lg p-4">
|
|
|
|
<%= render "budget_categories/no_categories" %>
|
|
|
|
</div>
|
|
|
|
<% else %>
|
|
|
|
<div class="max-w-md mx-auto">
|
2025-02-05 09:09:38 -05:00
|
|
|
<%= render "budget_categories/allocation_progress", budget: @budget %>
|
2025-01-16 14:36:37 -05:00
|
|
|
|
|
|
|
<div class="space-y-4 mb-4">
|
2025-02-05 09:09:38 -05:00
|
|
|
<% BudgetCategory::Group.for(@budget_categories).sort_by(&:name).each do |group| %>
|
2025-01-16 14:36:37 -05:00
|
|
|
<div class="space-y-4">
|
|
|
|
<%= render "budget_categories/budget_category_form", budget_category: group.budget_category %>
|
|
|
|
|
|
|
|
<div class="space-y-4">
|
|
|
|
<% group.budget_subcategories.each do |budget_subcategory| %>
|
|
|
|
<div class="w-full flex items-center gap-4">
|
|
|
|
<div class="ml-4 flex items-center justify-center text-gray-400">
|
|
|
|
<%= lucide_icon "corner-down-right", class: "w-5 h-5 shrink-0" %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<%= render "budget_categories/budget_category_form", budget_category: budget_subcategory %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<%= render "budget_categories/uncategorized_budget_category_form", budget: @budget %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if @budget.allocations_valid? %>
|
|
|
|
<%= link_to "Confirm",
|
|
|
|
budget_path(@budget),
|
|
|
|
class: "block btn btn--primary w-full text-center" %>
|
|
|
|
<% else %>
|
|
|
|
<span class="block btn btn--secondary w-full text-center text-gray-400 cursor-not-allowed">
|
|
|
|
Confirm
|
|
|
|
</span>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|