<%= form_with(model: product) do |form| %>
  <% if product.errors.any? %>
    <div style="color: red">
      <h2><%= pluralize(product.errors.count, "error") %> prohibited this product from being saved:</h2>

      <ul>
        <% product.errors.each do |error| %>
          <li><%= error.full_message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>
  <div class="mb-3">
    <%= form.label :name, class: 'form-label' %>
    <%= form.text_field :name, class: 'form-control' %>
  </div>

  <div class="mb-3">
    <%# form.label :category_id, class: 'form-label' %>
    <%# form.select :category_id, Category.all.map { |r| [r.name, r.id] }, {}, class: 'form-control' %>
    <%= form.combobox :category_id, searches_categories_path, label: "Category", placeholder: "Select an option" %>
  </div>

  <div class="mb-3">
    <%# form.label :brand_id, class: 'form-label' %>
    <%# form.select :brand_id, Brand.all.map { |r| [r.name, r.id] }, {}, class: 'form-control' %>
    <%= form.combobox :brand_id, searches_brands_path, label: "Brand", placeholder: "Select an option" %>
  </div>

  <div class="actions">
    <%= form.submit class: 'btn btn-primary' %>
  </div>
<% end %>