<%= render DS::Dialog.new(reload_on_close: params[:reload_on_close].present?) do |dialog| %> <% title = if @rule.name.present? "Confirm changes to \"#{@rule.name}\"" else "Confirm changes" end %> <% dialog.with_header(title: title) %> <% dialog.with_body do %>

You are about to apply this rule to <%= @rule.affected_resource_count %> <%= @rule.resource_type.pluralize %> that meet the specified rule criteria. Please confirm if you wish to proceed with this change.

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

AI Cost Estimation

<% if @estimated_cost.present? %>

This will use AI to categorize <%= affected_count %> transaction<%= "s" if affected_count != 1 %>. Estimated cost: ~$<%= sprintf("%.4f", @estimated_cost) %>

<% else %>

This will use AI to categorize <%= affected_count %> transaction<%= "s" if affected_count != 1 %>. <% if @selected_model.present? %> Cost estimation unavailable for model "<%= @selected_model %>". <% else %> Cost estimation unavailable (no LLM provider configured). <% end %> You may incur costs, please check with the model provider for the most up-to-date prices.

<% end %>

<%= link_to "View usage history", settings_llm_usage_path, class: "underline hover:text-blue-800" %>

<% end %> <%= render DS::Button.new( text: "Confirm changes", href: apply_rule_path(@rule), method: :post, full_width: true, data: { turbo_frame: "_top" }) %> <% end %> <% end %>