<% verb = record.persisted? ? 'Update' : 'Create' %>
<div class="btn-group btn-states" data-behavior="btn-states">
  <%= button_tag :submit, class: 'btn btn-primary' do %>
    <%= "#{verb} #{record.model_name.human.titleize}" %> (<span data-behavior="state-button"><%= record.state.humanize %></span>)
  <% end %>
  <button type="button" class="btn btn-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    <span class="visually-hidden">Toggle Dropdown</span>
  </button>
  <div class="dropdown-menu">
    <%= f.collection_radio_buttons(:state, record.class.states, :first, :first) do |b| %>
      <%= b.label class: 'state', **label_options_for(b.value) do %>
        <%= radio_button_for(b) %>
        <i class="fa-solid fa-check fa-fw"></i>
        <div class="state-label">
          <p data-behavior="state-label"><%= b.text.humanize %></p>
          <span><%= button_text_for(b.value) %></span>
        </div>
      <% end %>
    <% end %>
  </div>
