<%# locals: (cta:) %>

<% message = "Updated to #{cta[:category_name]}" %>
<% description = "You can create a rule to automatically categorize transactions like this one" %>

<%= render "shared/notifications/cta", message: message, description: description do %>
  <%= form_with model: Current.user, url: rule_prompt_settings_user_path(Current.user), method: :patch do |f| %>
    <div class="flex gap-2 items-center mb-3 -mt-1">
      <%= f.check_box :rule_prompts_disabled, class: "checkbox checkbox--light" %>
      <%= f.label :rule_prompts_disabled, "Don't show this again", class: "text-xs text-secondary" %>
    </div>

    <%= f.hidden_field :rule_prompt_dismissed_at, value: Time.current %>

    <%= tag.div class:"flex gap-2 justify-end" do %>
      <%= render ButtonComponent.new(text: "Dismiss", variant: "secondary") %>
      <% rule_href = new_rule_path(resource_type: "transaction", action_type: "set_transaction_category", action_value: cta[:category_id]) %>
      <%= render LinkComponent.new(text: "Create rule", variant: "primary", href: rule_href, frame: :modal) %>
    <% end %>
  <% end %>
<% end %>
