<h3 class="inline-block"><%= t('admin.budgets.show.groups', count: groups.count) %></h3>
<% if groups.blank? %>
  <div class="callout primary">
    <%= t("admin.budgets.form.no_groups") %>
    <strong><%= link_to t("admin.budgets.form.add_group"), "#",
                class: "js-toggle-link",
                data: { "toggle-selector" => "#new-group-form" } %></strong>
  </div>
<% else %>
  <%= link_to t("admin.budgets.form.add_group"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#new-group-form" } %>
<% end %>

<%= form_for [:admin, @budget, Budget::Group.new], html: {id: "new-group-form", style: "display:none"}, remote: true do |f| %>
  <div class="input-group">
    <span class="input-group-label">
      <label><%= f.label :name,t("admin.budgets.form.group") %></label>
    </span>
    <%= f.text_field :name,
                      label: false,
                      maxlength: 50,
                        placeholder: t("admin.budgets.form.group") %>
    <div class="input-group-button">
      <%= f.submit t("admin.budgets.form.create_group"), class: "button success" %>
    </div>
  </div>
<% end %>

<% groups.each do |group| %>
  <div id="<%= dom_id(group) %>">
    <%= render "admin/budgets/group", group: group, headings: group.headings %>
  </div>
<% end %>
