mirror of
https://github.com/we-promise/sure.git
synced 2026-04-13 00:57:22 +00:00
* feat: Add toggle on mobile to show/hide checkboxes in transaction page
* fix: Add multi-select toggle also in activities page. Make JS controller compatible also in this view.
* feat: Add category in mobile view
* feat: Add mobile layout for transaction categories
* feat: Add margin for pagination on mobile
* fix: Ensure category exists when displaying the name
* fix: Adjust mobile paddings
* fix: Display "uncategorized" label if no category is set
* fix: Expand transaction name/subtitle
* feat: Add merchant name on desktop view
* feat: Move merchant name before account name
* fix: Add class to hide merchant on mobile
* feat: Add merchant logo on mobile
* fix: add pointer-events-none to merchant image on mobile view
* feat: toggle header checkbox in transaction page when button is clicked
* Remove unnecessary CSS class
* Remove duplicate CSS class
* Remove wrong Enable Banking logo URL
* Update app/views/transactions/_transaction.html.erb
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>
* Revert "Update app/views/transactions/_transaction.html.erb"
This reverts commit 9766c50a1d.
* Add translation for Loan Payment/Transfer
* Apply review comments
* Add accessible name for toggle based on review comments
* Use border instead of border-1 class
* Apply review comments
* Missing l10n key
---------
Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
136 lines
6.1 KiB
Plaintext
136 lines
6.1 KiB
Plaintext
<%# locals: (entry:, balance_trend: nil, view_ctx: "global") %>
|
|
|
|
<% transaction = entry.entryable %>
|
|
|
|
<%= turbo_frame_tag dom_id(entry) do %>
|
|
<%= turbo_frame_tag dom_id(transaction) do %>
|
|
<div class="flex lg:grid lg:grid-cols-12 items-center text-primary text-sm font-medium p-3 lg:p-4 <%= entry.excluded ? "opacity-50 text-gray-400" : "" %>">
|
|
|
|
<div class="pr-4 lg:pr-10 flex items-center gap-3 lg:gap-4 col-span-8 min-w-0">
|
|
<%= check_box_tag dom_id(entry, "selection"),
|
|
disabled: transaction.transfer.present?,
|
|
class: "checkbox checkbox--light hidden lg:block",
|
|
data: {
|
|
id: entry.id,
|
|
"bulk-select-target": "row",
|
|
action: "bulk-select#toggleRowSelection",
|
|
checkbox_toggle_target: "selectionEntry"
|
|
} %>
|
|
|
|
<div class="max-w-full">
|
|
<%= content_tag :div, class: ["flex items-center gap-3 lg:gap-4"] do %>
|
|
<div class="hidden lg:flex">
|
|
<% if transaction.merchant&.logo_url.present? %>
|
|
<%= image_tag transaction.merchant.logo_url,
|
|
class: "w-9 h-9 rounded-full",
|
|
loading: "lazy" %>
|
|
<% else %>
|
|
<div class="hidden lg:flex">
|
|
<%= render DS::FilledIcon.new(
|
|
variant: :text,
|
|
text: entry.name,
|
|
size: "lg",
|
|
rounded: true
|
|
) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<div class="flex md:hidden items-center gap-1 col-span-2 relative">
|
|
<%= render "transactions/transaction_category", transaction: transaction %>
|
|
<% if transaction.merchant&.logo_url.present? %>
|
|
<%= image_tag transaction.merchant.logo_url,
|
|
class: "w-5 h-5 rounded-full absolute -bottom-1 -right-1 border border-secondary pointer-events-none",
|
|
loading: "lazy" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="truncate">
|
|
<div class="space-y-0.5">
|
|
<div class="flex items-center gap-1 min-w-0">
|
|
<div class="truncate flex-shrink">
|
|
<% if transaction.transfer? %>
|
|
<%= link_to(
|
|
entry.name,
|
|
transaction.transfer.present? ? transfer_path(transaction.transfer) : entry_path(entry),
|
|
data: {
|
|
turbo_frame: "drawer",
|
|
turbo_prefetch: false
|
|
},
|
|
class: "hover:underline"
|
|
) %>
|
|
<% else %>
|
|
<%= link_to(
|
|
entry.name,
|
|
entry_path(entry),
|
|
data: {
|
|
turbo_frame: "drawer",
|
|
turbo_prefetch: false
|
|
},
|
|
class: "hover:underline"
|
|
) %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-1 flex-shrink-0">
|
|
<% if transaction.one_time? %>
|
|
<span class="text-orange-500" title="One-time <%= entry.amount.negative? ? "income" : "expense" %> (excluded from averages)">
|
|
<%= icon "asterisk", size: "sm", color: "current" %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<%# Pending indicator %>
|
|
<% if transaction.pending? %>
|
|
<span class="inline-flex items-center gap-1 text-xs font-medium rounded-full px-1.5 py-0.5 border border-secondary text-secondary" title="Pending — may change when posted">
|
|
<%= icon "clock", size: "sm", color: "current" %>
|
|
Pending
|
|
</span>
|
|
<% end %>
|
|
|
|
<% if transaction.transfer.present? %>
|
|
<%= render "transactions/transfer_match", transaction: transaction %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="text-secondary text-xs font-normal">
|
|
<% if transaction.transfer? %>
|
|
<span class="text-secondary">
|
|
<%= transaction.loan_payment? ? t("transactions.show.loan_payment") : t("transactions.show.transfer") %> • <%= entry.account.name %>
|
|
</span>
|
|
<% else %>
|
|
<% if transaction.merchant&.present? %>
|
|
<span class="hidden lg:inline truncate"><%= transaction.merchant.name %> • </span>
|
|
<% end %>
|
|
<span class="text-secondary hidden lg:inline">
|
|
<%= link_to entry.account.name,
|
|
account_path(entry.account, tab: "transactions"),
|
|
data: { turbo_frame: "_top" },
|
|
class: "hover:underline" %>
|
|
</span>
|
|
<div class="flex items-center gap-1 truncate">
|
|
<%= render "categories/category_name_mobile", transaction: transaction %>
|
|
<% if transaction.merchant&.present? %>
|
|
<span class="lg:hidden truncate">• <%= transaction.merchant.name %></span>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="hidden md:flex items-center gap-1 col-span-2">
|
|
<%= render "transactions/transaction_category", transaction: transaction %>
|
|
</div>
|
|
|
|
<div class="shrink-0 col-span-4 lg:col-span-2 ml-auto text-right">
|
|
<%= content_tag :p,
|
|
transaction.transfer? && view_ctx == "global" ? "+/- #{format_money(entry.amount_money.abs)}" : format_money(-entry.amount_money),
|
|
class: ["text-green-600": entry.amount.negative?] %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|