-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix budget allocation forms from resetting and clearing data on slow …
…networks (#1804) * First pass * Fix null constraint bug for budget category assignment * Fix autofocus reset when allocating budget * Lint fix
- Loading branch information
Showing
7 changed files
with
56 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,44 @@ | ||
<%# locals: (budget:) %> | ||
|
||
<div class="space-y-2 mb-6"> | ||
<div id="<%= dom_id(budget, :allocation_progress) %>" class="space-y-2 mb-6"> | ||
<div class="flex items-center gap-2"> | ||
<div class="rounded-full w-1.5 h-1.5 <%= budget.allocated_spending > 0 ? "bg-gray-900" : "bg-gray-100" %>"></div> | ||
<% if budget.available_to_allocate.negative? %> | ||
<div class="rounded-full w-1.5 h-1.5 bg-red-500"></div> | ||
<% else %> | ||
<div class="rounded-full w-1.5 h-1.5 <%= budget.allocated_spending > 0 ? "bg-gray-900" : "bg-gray-100" %>"></div> | ||
<% end %> | ||
|
||
<p class="text-gray-500 text-sm"> | ||
<%= number_to_percentage(budget.allocated_percent, precision: 0) %> set | ||
</p> | ||
<% if budget.available_to_allocate.negative? %> | ||
<p class="text-gray-900 text-sm">> 100% set</p> | ||
<% else %> | ||
<p class="text-gray-500 text-sm"> | ||
<%= number_to_percentage(budget.allocated_percent, precision: 0) %> set | ||
</p> | ||
<% end %> | ||
|
||
<p class="ml-auto text-sm space-x-1"> | ||
<span class="text-gray-900"><%= format_money(budget.allocated_spending_money) %></span> | ||
<span class="<%= budget.available_to_allocate.negative? ? "text-red-500" : "text-gray-900" %>"><%= format_money(budget.allocated_spending_money) %></span> | ||
<span class="text-gray-500"> / </span> | ||
<span class="text-gray-500"><%= format_money(budget.budgeted_spending_money) %></span> | ||
</p> | ||
</div> | ||
|
||
<div class="relative h-1.5 rounded-2xl bg-gray-100"> | ||
<div class="absolute inset-0 bg-gray-900 rounded-2xl" style="width: <%= budget.allocated_percent %>%;"></div> | ||
<% if budget.available_to_allocate.negative? %> | ||
<div class="absolute inset-0 bg-red-500 rounded-2xl" style="width: 100%;"></div> | ||
<% else %> | ||
<div class="absolute inset-0 bg-gray-900 rounded-2xl" style="width: <%= budget.allocated_percent %>%;"></div> | ||
<% end %> | ||
</div> | ||
|
||
<div class="text-sm"> | ||
<span class="text-gray-900"><%= format_money(budget.available_to_allocate_money) %></span> | ||
<span class="text-gray-500">left to allocate</span> | ||
<% if budget.available_to_allocate.negative? %> | ||
<p class="text-gray-500"> | ||
Budget exceeded by <span class="text-red-500"><%= format_money(budget.available_to_allocate_money.abs) %></span> | ||
</p> | ||
<% else %> | ||
<span class="text-gray-900"><%= format_money(budget.available_to_allocate_money) %></span> | ||
<span class="text-gray-500">left to allocate</span> | ||
<% end %> | ||
</div> | ||
</div> |
25 changes: 0 additions & 25 deletions
25
app/views/budget_categories/_allocation_progress_overage.html.erb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= turbo_stream.replace dom_id(@budget, :allocation_progress), partial: "budget_categories/allocation_progress", locals: { budget: @budget } %> |