<%= render DS::Dialog.new do |dialog| %> <% dialog.with_header(title: t("rules.apply_all.confirm_title")) %> <% dialog.with_body do %>

<%= t("rules.apply_all.confirm_message", count: @rules.count, transactions: @total_affected_count) %>

<% if @rules.any? { |r| r.actions.any? { |a| a.action_type == "auto_categorize" } } %>
<%= icon "info", class: "w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0" %>

<%= t("rules.apply_all.ai_cost_title") %>

<% if @estimated_cost.present? %>

<%= t("rules.apply_all.ai_cost_message", transactions: @total_affected_count) %> <%= t("rules.apply_all.estimated_cost", cost: sprintf("%.4f", @estimated_cost)) %>

<% else %>

<%= t("rules.apply_all.ai_cost_message", transactions: @total_affected_count) %> <% if @selected_model.present? %> <%= t("rules.apply_all.cost_unavailable_model", model: @selected_model) %> <% else %> <%= t("rules.apply_all.cost_unavailable_no_provider") %> <% end %> <%= t("rules.apply_all.cost_warning") %>

<% end %>

<%= link_to t("rules.apply_all.view_usage"), settings_llm_usage_path, class: "underline hover:text-blue-800" %>

<% end %> <%= render DS::Button.new( text: t("rules.apply_all.confirm_button"), href: apply_all_rules_path, method: :post, full_width: true, data: { turbo_frame: "_top" }) %> <% end %> <% end %>