<div class="page-header">
 <ul class="breadcrumb">
  <li><a href="<%=  %>">Home</a></li>
  <li><a href="<%= settings_menu_categories_path %>">Menus Categories</a></li>

  <li>Menu Items</li>
  <span style="float: right">
    <%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_category_set_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
  </span>
 </ul>
</div>
<div class="card">
  <div class="card-block">
    <h4 class="card-title">Menu Category</h4>
    <table class="table">
      <thead>
        <tr>
          <th>Menu</th>
          <th>Name</th>
          <th>Alt name</th>
          <th>Order by</th>
          <th>Parent</th>
          <th colspan="3"></th>
        </tr>
      </thead>

      <tbody>
          <tr>
            <td><%= @category.menu.name %></td>
            <td><%= @category.name %></td>
            <td><%= @category.alt_name %></td>
            <td><%= @category.order_by %></td>
            <td><%= @category.parent.name rescue "-" %></td>
            <td><%= link_to 'Edit', edit_settings_menu_category_path(@category) %></td>
          </tr>
      </tbody>
    </table>
  </div>
</div>
<br/>
<div class="card">
  <div class="card-block">
    <h4 class="card-title">Menu Items
      <span style="float: right">
        <%= link_to "New Simple Menu Item",new_settings_menu_category_simple_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>
        <%= link_to "New Set Menu Item",new_settings_menu_category_set_menu_item_path(@category),:class => 'btn btn-primary btn-sm' %>

      </span>
    </h4>
    <table class="table">
      <thead>
        <tr>
          <th>Item code</th>
          <th>Name</th>
          <th>Alt name</th>
          <th>Type</th>
          <th>Parent Item</th>
          <th>Created by</th>
          <th>Created at</th>

          <th colspan="3"></th>
        </tr>
      </thead>

      <tbody>
        <% @settings_menu_items.each do |settings_menu_item| %>
          <tr>
            <td><%= settings_menu_item.item_code %></td>
            <td><%= settings_menu_item.name %></td>
            <td><%= settings_menu_item.alt_name %></td>
            <td><%= settings_menu_item.type %></td>
            <td><%= settings_menu_item.parent.name rescue "-" %></td>
            <td><%= settings_menu_item.created_by %></td>
            <td><%= settings_menu_item.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p")  %></td>

            <% if settings_menu_item.type == "SimpleMenuItem" %>
            <td><%= link_to 'Show', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ) %></td>
            <td><%= link_to 'Edit', edit_settings_menu_category_simple_menu_item_path(@category, settings_menu_item) %></td>
            <td><%= link_to 'Destroy', settings_menu_category_simple_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
            <% else %>
            <td><%= link_to 'Show', settings_menu_category_set_menu_item_path(@category, settings_menu_item ) %></td>
            <td><%= link_to 'Edit', edit_settings_menu_category_set_menu_item_path(@category, settings_menu_item) %></td>
            <td><%= link_to 'Destroy', settings_menu_category_set_menu_item_path(@category, settings_menu_item ), method: :delete, data: { confirm: 'Are you sure?' } %></td>
            <% end %>
          </tr>
        <% end %>
      </tbody>
    </table>

  </div>

</div>
 <%= paginate @settings_menu_items, param_name: :page, :outer_window => 3 %> 
