<div class="page-header">
 <ul class="breadcrumb">
  <li><a href="<%= root_path %>">Home</a></li>
  <li><a href="<%= settings_menus_path %>">Menus</a></li>
  <li>Details</li>
  <span style="float: right">
  </span>
 </ul>
</div>

<br/>
<div class="card">
  <div class="card-block">
    <h4 class="card-title">Menu</h4>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Valid Days</th>
          <th>Valid Time From</th>
          <th>Valid Time To</th>
          <th>Created By</th>
          <th>Created At</th>
          <th>Action</th>
        </tr>
      </thead>

      <tbody>
          <tr>
            <td><%= @settings_menu.name %></td>
            <td><%= @settings_menu.valid_days %></td>
            <td><%= @settings_menu.valid_time_from.strftime("%H:%M") rescue "-" %></td>
            <td><%= @settings_menu.valid_time_to.strftime("%H:%M") rescue "-" %></td>
            <td><%= @settings_menu.created_by %></td>
            <td><%= @settings_menu.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
            <td><%= link_to 'Edit', edit_settings_menu_path(@settings_menu) %></td>
          </tr>
      </tbody>
    </table>
  </div>
</div>

<br>
<div class="card">
  <div class="card-block">
    <h4 class="card-title">Menu Categories
      <span style="float: right">
        <%= link_to t('.new', :default => t("helpers.links.new")),new_settings_menu_menu_category_path(@settings_menu),:class => 'btn btn-primary btn-sm' %>
      </span>

    </h4>
    <table class="table">
      <thead>
        <tr>
          <th>Name</th>
          <th>Sub-Cat Count</th>
          <th>Items Count</th>
          <th>Order By</th>
          <th>Created At</th>
          <th>Action</th>
        </tr>
      </thead>

      <tbody>
         <% @settings_menu_categories.each do |category|%>
          <tr>
            <td><%= link_to category.name, settings_menu_category_path(category) %></td>
            <td><%= category.children.count  rescue "-" %></td>
            <td><%= category.menu_items.count %></td>
            <td><%= category.order_by %></td>
            <td><%= category.created_at.utc.getlocal.strftime("%Y-%m-%d/%I:%M %p") %></td>
            <td><%= link_to 'Edit', edit_settings_menu_menu_category_path(@settings_menu, category) %></td>
          </tr>
          <% end %>
      </tbody>
    </table>
  </div>
</div>
<%= paginate @settings_menu_categories, param_name: :page, :outer_window => 3 %>
