<%# locals: (provider_merchant:) %>

<tr class="border-b border-subdued last:border-0 hover:bg-surface-hover">
  <td class="py-3 px-4 text-sm text-primary">
    <div class="flex w-full items-center gap-2.5">
      <% if provider_merchant.logo_url %>
        <div class="w-8 h-8 rounded-full flex justify-center items-center">
          <%= image_tag Setting.transform_brand_fetch_url(provider_merchant.logo_url), class: "w-8 h-8 rounded-full" %>
        </div>
      <% else %>
        <div class="w-8 h-8 rounded-full flex items-center justify-center bg-container-inset text-secondary text-sm font-medium">
          <%= provider_merchant.name&.first&.upcase || "?" %>
        </div>
      <% end %>

      <p class="font-medium truncate">
        <%= provider_merchant.name %>
      </p>
    </div>
  </td>
  <td class="py-3 px-4 text-sm text-secondary align-middle">
    <%= provider_merchant.source&.titleize %>
  </td>
  <td class="py-3 px-4 text-sm text-right align-middle">
    <%= render DS::Menu.new do |menu| %>
      <% menu.with_item(variant: "link", text: t(".edit"), href: edit_family_merchant_path(provider_merchant), icon: "pencil", data: { turbo_frame: "modal" }) %>
      <% menu.with_item(
        variant: "button",
        text: t(".remove"),
        href: family_merchant_path(provider_merchant),
        icon: "trash-2",
        method: :delete,
        confirm: CustomConfirm.new(
          destructive: true,
          title: t(".remove_confirm_title"),
          body: t(".remove_confirm_body", name: provider_merchant.name),
          btn_text: t(".remove")
        )) %>
    <% end %>
  </td>
</tr>
