|
|
|
|
@@ -2,8 +2,92 @@
|
|
|
|
|
|
|
|
|
|
<div class="min-h-full flex flex-col justify-center items-center py-8">
|
|
|
|
|
<div class="space-y-6 max-w-lg w-full">
|
|
|
|
|
<% if import.pending? && import.rows_count > 0 %>
|
|
|
|
|
<%# Statement with rows ready for review %>
|
|
|
|
|
<% if import.respond_to?(:reconciliation_reportable?) && import.reconciliation_reportable? && (import.complete? || (import.pending? && import.rows_count > 0)) %>
|
|
|
|
|
<% recon = import.reconciliation_data %>
|
|
|
|
|
<% balance_matched = import.reconciliation_matched? %>
|
|
|
|
|
|
|
|
|
|
<div class="mx-auto h-8 w-8 rounded-full flex items-center justify-center <%= balance_matched ? "bg-success/10" : "bg-yellow-500/10" %>">
|
|
|
|
|
<%= icon balance_matched ? "check" : "alert-triangle", class: balance_matched ? "text-success" : "text-yellow-600" %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="text-center space-y-2">
|
|
|
|
|
<h1 class="font-medium text-primary text-center text-3xl"><%= t("imports.pdf_import.reconciliation_title") %></h1>
|
|
|
|
|
<p class="text-sm text-secondary"><%= balance_matched ? t("imports.pdf_import.reconciliation_description") : t("imports.pdf_import.reconciliation_mismatch_description") %></p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="bg-container border border-primary rounded-xl p-4 space-y-4">
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.document_type_label") %></h2>
|
|
|
|
|
<p class="text-sm text-secondary px-3 py-2 bg-gray-500/5 rounded-lg">
|
|
|
|
|
<%= t("imports.document_types.#{import.document_type}", default: import.document_type&.humanize || t("imports.pdf_import.unknown_document_type", default: "Unknown")) %>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.reconciliation_details_label") %></h2>
|
|
|
|
|
<div class="space-y-1 px-3 py-2 bg-gray-500/5 rounded-lg">
|
|
|
|
|
<% if recon["statement_closing_balance"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_statement_balance") %></span>
|
|
|
|
|
<span class="text-primary font-medium privacy-sensitive"><%= number_to_currency(recon["statement_closing_balance"], unit: import.extracted_data&.dig("currency") || "") %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["synced_closing_balance"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_synced_balance") %></span>
|
|
|
|
|
<span class="text-primary font-medium privacy-sensitive"><%= number_to_currency(recon["synced_closing_balance"], unit: import.extracted_data&.dig("currency") || "") %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_balance_match") %></span>
|
|
|
|
|
<% if balance_matched %>
|
|
|
|
|
<span class="text-success font-medium"><%= t("imports.pdf_import.reconciliation_balance_yes") %></span>
|
|
|
|
|
<% else %>
|
|
|
|
|
<span class="text-destructive font-medium"><%= t("imports.pdf_import.reconciliation_balance_no") %></span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% if recon["statement_transaction_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_statement_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["statement_transaction_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["synced_transaction_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_synced_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["synced_transaction_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["matched_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_matched_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["matched_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.summary_label") %></h2>
|
|
|
|
|
<p class="text-sm text-secondary px-3 py-2 bg-gray-500/5 rounded-lg whitespace-pre-wrap privacy-sensitive"><%= import.ai_summary %></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2 flex flex-col">
|
|
|
|
|
<% if !balance_matched && import.pending? && import.rows_count > 0 %>
|
|
|
|
|
<% if import.publishable? %>
|
|
|
|
|
<%= button_to t("imports.pdf_import.publish_transactions", default: "Publish %{count} Transactions", count: import.rows_count), publish_import_path(import), method: :post, class: "w-full font-medium text-sm px-3 py-2 rounded-lg text-inverse bg-inverse hover:bg-inverse-hover" %>
|
|
|
|
|
<%= render DS::Link.new(text: t("imports.pdf_import.review_transactions", default: "Review Transactions"), href: import_clean_path(import), variant: "secondary", full_width: true) %>
|
|
|
|
|
<% elsif import.account.present? %>
|
|
|
|
|
<%= render DS::Link.new(text: t("imports.pdf_import.review_transactions", default: "Review Transactions"), href: import_clean_path(import), variant: "primary", full_width: true) %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= render DS::Link.new(text: t("imports.pdf_import.back_to_imports"), href: imports_path, variant: balance_matched ? "primary" : "secondary", full_width: true) %>
|
|
|
|
|
<%= button_to t("imports.pdf_import.delete_import"), import_path(import), method: :delete, class: "w-full font-medium text-sm px-3 py-2 rounded-lg text-primary bg-gray-200 hover:bg-gray-300" %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% elsif import.pending? && import.rows_count > 0 %>
|
|
|
|
|
<%# Statement with rows ready for review (no reconciliation) %>
|
|
|
|
|
<div class="mx-auto bg-success/10 h-8 w-8 rounded-full flex items-center justify-center">
|
|
|
|
|
<%= icon "check", class: "text-success" %>
|
|
|
|
|
</div>
|
|
|
|
|
@@ -95,77 +179,6 @@
|
|
|
|
|
<%= button_to t("imports.pdf_import.delete_import"), import_path(import), method: :delete, class: "w-full font-medium text-sm px-3 py-2 rounded-lg text-primary bg-gray-200 hover:bg-gray-300" %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% elsif import.complete? && import.respond_to?(:reconciliation_matched?) && import.reconciliation_matched? %>
|
|
|
|
|
<% recon = import.reconciliation_data %>
|
|
|
|
|
|
|
|
|
|
<div class="mx-auto bg-success/10 h-8 w-8 rounded-full flex items-center justify-center">
|
|
|
|
|
<%= icon "check", class: "text-success" %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="text-center space-y-2">
|
|
|
|
|
<h1 class="font-medium text-primary text-center text-3xl"><%= t("imports.pdf_import.reconciliation_title") %></h1>
|
|
|
|
|
<p class="text-sm text-secondary"><%= t("imports.pdf_import.reconciliation_description") %></p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="bg-container border border-primary rounded-xl p-4 space-y-4">
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.document_type_label") %></h2>
|
|
|
|
|
<p class="text-sm text-secondary px-3 py-2 bg-gray-500/5 rounded-lg">
|
|
|
|
|
<%= t("imports.document_types.#{import.document_type}", default: import.document_type&.humanize || t("imports.pdf_import.unknown_document_type", default: "Unknown")) %>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.reconciliation_details_label") %></h2>
|
|
|
|
|
<div class="space-y-1 px-3 py-2 bg-gray-500/5 rounded-lg">
|
|
|
|
|
<% if recon["statement_closing_balance"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_statement_balance") %></span>
|
|
|
|
|
<span class="text-primary font-medium privacy-sensitive"><%= number_to_currency(recon["statement_closing_balance"], unit: import.extracted_data&.dig("currency") || "") %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["synced_closing_balance"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_synced_balance") %></span>
|
|
|
|
|
<span class="text-primary font-medium privacy-sensitive"><%= number_to_currency(recon["synced_closing_balance"], unit: import.extracted_data&.dig("currency") || "") %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_balance_match") %></span>
|
|
|
|
|
<span class="text-success font-medium"><%= t("imports.pdf_import.reconciliation_balance_yes") %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% if recon["statement_transaction_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_statement_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["statement_transaction_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["synced_transaction_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_synced_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["synced_transaction_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if recon["matched_count"].present? %>
|
|
|
|
|
<div class="flex justify-between text-sm">
|
|
|
|
|
<span class="text-secondary"><%= t("imports.pdf_import.reconciliation_matched_txns") %></span>
|
|
|
|
|
<span class="text-primary font-medium"><%= recon["matched_count"] %></span>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2">
|
|
|
|
|
<h2 class="font-medium text-primary"><%= t("imports.pdf_import.summary_label") %></h2>
|
|
|
|
|
<p class="text-sm text-secondary px-3 py-2 bg-gray-500/5 rounded-lg whitespace-pre-wrap privacy-sensitive"><%= import.ai_summary %></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="space-y-2 flex flex-col">
|
|
|
|
|
<%= render DS::Link.new(text: t("imports.pdf_import.back_to_imports"), href: imports_path, variant: "primary", full_width: true) %>
|
|
|
|
|
<%= button_to t("imports.pdf_import.delete_import"), import_path(import), method: :delete, class: "w-full font-medium text-sm px-3 py-2 rounded-lg text-primary bg-gray-200 hover:bg-gray-300" %>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<% elsif import.complete? && import.ai_processed? %>
|
|
|
|
|
<div class="mx-auto bg-success/10 h-8 w-8 rounded-full flex items-center justify-center">
|
|
|
|
|
<%= icon "check", class: "text-success" %>
|
|
|
|
|
|