mirror of
https://github.com/we-promise/sure.git
synced 2026-05-07 12:54:04 +00:00
* Initial account sharing changes * Update schema.rb * Update schema.rb * Change sharing UI to modal * UX fixes and sharing controls * Scope include in finances better * Update totals.rb * Update totals.rb * Scope reports to finance account scope * Update impersonation_sessions_controller_test.rb * Review fixes * Update schema.rb * Update show.html.erb * FIX db validation * Refine edit permissions * Review items * Review * Review * Add application level helper * Critical review * Address remaining review items * Fix modals * more scoping * linter * small UI fix * Fix: Sync broadcasts push unscoped balance sheet to all users * Update sync_complete_event.rb The fix removes the sidebar broadcasts (which rendered unscoped account groups using family.balance_sheet without user context) along with the now-unused sidebar_targets, account_group, and family_balance_sheet private methods. The sidebar will still update correctly — when the sync completes, Family::SyncCompleteEvent#broadcast fires family.broadcast_refresh, which triggers a morph-based page refresh for each user with their own authenticated session, rendering properly scoped sidebar content.
233 lines
10 KiB
Plaintext
233 lines
10 KiB
Plaintext
<%= render DS::Dialog.new do |dialog| %>
|
|
<% dialog.with_header(title: t(".title"), subtitle: t(".description")) %>
|
|
|
|
<% dialog.with_body do %>
|
|
<% has_accounts = accessible_accounts.any? %>
|
|
<% requires_account_message = t(".requires_account") %>
|
|
|
|
<% if @pending_import.present? && params[:type].nil? %>
|
|
<div class="rounded-xl bg-container-inset p-1 mb-4">
|
|
<ul class="bg-container shadow-border-xs rounded-lg">
|
|
<li>
|
|
<%= link_to import_path(@pending_import), class: "flex items-center justify-between p-4 group cursor-pointer", data: { turbo: false } do %>
|
|
<div class="flex items-center gap-2">
|
|
<div class="bg-orange-500/5 rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="text-orange-500">
|
|
<%= icon("loader", color: "current") %>
|
|
</span>
|
|
</div>
|
|
<span class="text-sm text-primary group-hover:text-secondary">
|
|
<%= t(".resume", type: @pending_import.type.titleize) %>
|
|
</span>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<%
|
|
import_type = params[:type].presence || @pending_import&.type
|
|
active_tab = import_type.present? && !import_type.in?(%w[MintImport QifImport SureImport DocumentImport PdfImport]) ? "raw_data" : "financial_tools"
|
|
%>
|
|
<%= render DS::Tabs.new(active_tab: active_tab) do |tabs| %>
|
|
<% tabs.with_nav do |nav| %>
|
|
<% nav.with_btn(id: "financial_tools", label: t(".tab_financial_tools")) %>
|
|
<% nav.with_btn(id: "raw_data", label: t(".tab_raw_data")) %>
|
|
<% end %>
|
|
|
|
<% tabs.with_panel(tab_id: "financial_tools") do %>
|
|
<div class="rounded-xl bg-container-inset p-1">
|
|
<ul class="bg-container shadow-border-xs rounded-lg">
|
|
<% if @pending_import.present? && params[:type].present? && params[:type].in?(%w[MintImport QifImport SureImport DocumentImport PdfImport]) %>
|
|
<li>
|
|
<%= link_to import_path(@pending_import), class: "flex items-center justify-between p-4 group cursor-pointer", data: { turbo: false } do %>
|
|
<div class="flex items-center gap-2">
|
|
<div class="bg-orange-500/5 rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="text-orange-500">
|
|
<%= icon("loader", color: "current") %>
|
|
</span>
|
|
</div>
|
|
<span class="text-sm text-primary group-hover:text-secondary">
|
|
<%= t(".resume", type: @pending_import.type.titleize) %>
|
|
</span>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "SureImport" %>
|
|
<li>
|
|
<%= styled_form_with url: imports_path, scope: :import, multipart: true, class: "w-full", data: { turbo: false } do |form| %>
|
|
<%= form.hidden_field :type, value: "SureImport" %>
|
|
<label class="flex items-center justify-between p-4 group cursor-pointer w-full">
|
|
<div class="flex items-center gap-2">
|
|
<div class="bg-cyan-500/5 rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="text-cyan-500">
|
|
<%= icon("file-braces", color: "current") %>
|
|
</span>
|
|
</div>
|
|
<div class="text-left">
|
|
<span class="text-sm text-primary group-hover:text-secondary block">
|
|
<%= t(".import_sure") %>
|
|
</span>
|
|
<span class="text-xs text-secondary">
|
|
<%= t(".import_sure_description") %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<%= form.file_field :import_file, accept: ".ndjson,.json", class: "hidden", onchange: "this.form.submit()" %>
|
|
</label>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "MintImport" || params[:type] == "TransactionImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "MintImport",
|
|
image: "mint-logo.jpeg",
|
|
label: t(".import_mint"),
|
|
enabled: true %>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "QifImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "QifImport",
|
|
icon_name: "file-clock",
|
|
icon_bg_class: "bg-teal-500/5",
|
|
icon_text_class: "text-teal-500",
|
|
label: t(".import_qif"),
|
|
enabled: true %>
|
|
<% end %>
|
|
|
|
<%= render "imports/import_option",
|
|
type: "TransactionImport",
|
|
icon_name: "bar-chart-2",
|
|
icon_bg_class: "bg-gray-500/5",
|
|
icon_text_class: "text-gray-400",
|
|
label: t(".import_ynab"),
|
|
enabled: false,
|
|
disabled_message: t(".coming_soon") %>
|
|
|
|
<% if (params[:type].nil? || params[:type].in?(%w[DocumentImport PdfImport])) && @document_upload_extensions.any? %>
|
|
<li>
|
|
<%= styled_form_with url: imports_path, scope: :import, multipart: true, class: "w-full", data: { turbo: false } do |form| %>
|
|
<%= form.hidden_field :type, value: "DocumentImport" %>
|
|
<label class="flex items-center justify-between p-4 group cursor-pointer w-full">
|
|
<div class="flex items-center gap-2">
|
|
<div class="bg-red-500/5 rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="text-red-500">
|
|
<%= icon("file-text", color: "current") %>
|
|
</span>
|
|
</div>
|
|
<div class="text-left">
|
|
<span class="text-sm text-primary group-hover:text-secondary block">
|
|
<%= t(".import_file") %>
|
|
</span>
|
|
<span class="text-xs text-secondary">
|
|
<%= t(".import_file_description") %>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<%= form.file_field :import_file, accept: @document_upload_extensions.join(","), class: "hidden", onchange: "this.form.submit()" %>
|
|
</label>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% tabs.with_panel(tab_id: "raw_data") do %>
|
|
<div class="rounded-xl bg-container-inset p-1">
|
|
<ul class="bg-container shadow-border-xs rounded-lg">
|
|
<% if @pending_import.present? && params[:type].present? && !params[:type].in?(%w[MintImport QifImport SureImport DocumentImport PdfImport]) %>
|
|
<li>
|
|
<%= link_to import_path(@pending_import), class: "flex items-center justify-between p-4 group cursor-pointer", data: { turbo: false } do %>
|
|
<div class="flex items-center gap-2">
|
|
<div class="bg-orange-500/5 rounded-md w-8 h-8 flex items-center justify-center">
|
|
<span class="text-orange-500">
|
|
<%= icon("loader", color: "current") %>
|
|
</span>
|
|
</div>
|
|
<span class="text-sm text-primary group-hover:text-secondary">
|
|
<%= t(".resume", type: @pending_import.type.titleize) %>
|
|
</span>
|
|
</div>
|
|
<%= icon("chevron-right") %>
|
|
<% end %>
|
|
|
|
<%= render "shared/ruler" %>
|
|
</li>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "TransactionImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "TransactionImport",
|
|
icon_name: "file-spreadsheet",
|
|
icon_bg_class: "bg-indigo-500/5",
|
|
icon_text_class: "text-indigo-500",
|
|
label: t(".import_transactions"),
|
|
enabled: has_accounts,
|
|
disabled_message: requires_account_message %>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "TradeImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "TradeImport",
|
|
icon_name: "square-percent",
|
|
icon_bg_class: "bg-yellow-500/5",
|
|
icon_text_class: "text-yellow-500",
|
|
label: t(".import_portfolio"),
|
|
enabled: has_accounts,
|
|
disabled_message: requires_account_message %>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "AccountImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "AccountImport",
|
|
icon_name: "building",
|
|
icon_bg_class: "bg-violet-500/5",
|
|
icon_text_class: "text-violet-500",
|
|
label: t(".import_accounts"),
|
|
enabled: true %>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "CategoryImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "CategoryImport",
|
|
icon_name: "shapes",
|
|
icon_bg_class: "bg-blue-500/5",
|
|
icon_text_class: "text-blue-500",
|
|
label: t(".import_categories"),
|
|
enabled: true %>
|
|
<% end %>
|
|
|
|
<% if params[:type].nil? || params[:type] == "RuleImport" %>
|
|
<%= render "imports/import_option",
|
|
type: "RuleImport",
|
|
icon_name: "workflow",
|
|
icon_bg_class: "bg-green-500/5",
|
|
icon_text_class: "text-green-500",
|
|
label: t(".import_rules"),
|
|
enabled: true %>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|