<% content_for :content_header do %>
<h1>
  Kategorie i Produkty
</h1>
<% end %>
<div class="row">
  <div class="col-md-12">
    <div class="box">
      <div class="box-header with-border">
        <h3 class="box-title">Kategorie:
          <strong>
            <% for ancestor in @category.ancestors.reverse! %>
              <%= raw "#{link_to(ancestor.name, {controller: '/ps_admin/category', action: 'index', parent_id: ancestor.id})} > " %>
            <% end %>
            <%= @category.blank? ? 'brak' : "#{@category.name}" %>
          </strong>
        </h3>
        <div class="box-tools"><%= link_to 'Dodaj', {controller: '/ps_admin/category', action: 'new', parent_id: @category.id}, class: 'btn btn-block btn-primary btn-sm', remote: true %>
      </div>
      <div class="box-body">
        <div id="categories_form"></div>
        <div id="categories_list">
          <%= render 'categories' %>
        </div>
      </div>
  </div>
</div>
<div class="row">
  <div class="col-md-12">
    <div class="box">
      <div class="box-header with-border">
        <h3 class="box-title">Produkty w <strong><%= @category.blank? ? 'brak' : "#{@category.name}" %></strong></h3>
        <div class="box-tools"><%= link_to 'Dodaj', {controller: '/ps_admin/product', action: 'new', category_id: @category.id}, class: 'btn btn-block btn-primary btn-sm', remote: true %>
      </div>
      <div class="box-body">
        <div id="products_form"></div>
        <div id="products_list">
          <%= render '/ps_admin/product/partials/products' %>
        </div>
      </div>
  </div>
</div>
