<%= form_with model: @item, local: true do |f| %> <% if @item.errors.any? %>

<%= pluralize(@item.errors.count, "error") %> prohibited this item from being saved:

<% end %>
<%= f.label :name %> <%= f.text_field :name, required: true, style: "width: 100%;" %>
<%= f.label :sku %> <%= f.text_field :sku, style: "width: 100%;" %>
<%= f.label :description %> <%= f.text_area :description, rows: 3, style: "width: 100%;" %>
<%= f.label :unit_price %> <%= f.number_field :unit_price, step: 0.01, style: "width: 100%;" %>
<%= f.label :account %> <%= f.collection_select :account_id, Account.where(classification: 'Revenue').order(:name), :id, :name, { selected: @item.account_id || Account.get_default&.id }, { include_blank: true, style: "width: 100%;" } %>
<%= f.label :type %> <%= f.select :type, Quickbooks::Model::Item::ITEM_TYPES.map { |t| [t, t] }, { selected: @item.type || Quickbooks::Model::Item::NON_INVENTORY_TYPE }, { style: "width: 100%;" } %>
<%= f.label :active %> <%= f.check_box :active %>

<%= f.submit "Save Item", style: "padding: 6px 12px; font-weight: bold;" %>

<% end %>