<div class="container-fluid h-100" style="padding:0px 3px 0px 3px;">
 <% if current_login_employee.role != "cashier" && current_login_employee.role !="waiter"%>
  <% breadcrumb_add t('out_of_stock'), "", dashboard_path %>
 <%end%>
  <div class="row h-100">
    <div class="col-sm-12 col-xs-12 d-flex flex-column h-100">
      <div class="card h-100">
        <div class="card-header">
          <div class="row ">
            <div class="col-lg-4 col-md-4 col-sm-4" style="padding-left: 17px;">
              <%= form_tag inventory_path, :id => "filter_form", :method => :get do %>
              <input type="text" class="form-control" name="filter" id="Product" type="text" placeholder="Product" style="height: 32px;">
            </div>

            <div class="col-lg-2 col-md-2 col-sm-2 text-">
              <input type="submit" value="Filter" class='btn btn-primary'>
            </div>
              <% end %>

            <div class="col-lg-6 col-md-6 col-sm-6" style="padding-right: 15px;">
              <button type="button" id="reset_all" class="delete btn btn-danger btn-sm float-right waves-effect" style='margin-left:5px;' data-ref="<%= settings_reset_all_path %>" data-method="delete">
                <%= t("views.btn.reset_all") %>
              </button>
              <button id='new_out_of_stock' class='btn btn-primary float-right waves-effect' style='margin-left:5px;'><%= (t :new_out_of_stock) +"  " %> <%= t("views.right_panel.detail.item") %></button>
            </div>
          </div>
        </div>

        <div class="card-block d-flex flex-column h-100">
          <div class="card-text h-100" id="foodcourt-slimscroll">
            <%= render 'out_of_stock_list' %> 
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

<script>

  $(document).ready(function (){
    getAllMenu();
  });

  $('#new_out_of_stock').on('click',function(){
   window.location.href = '/settings/out_of_stock/new';
  });

  function getAllMenu(){
    $.ajax({
        type: "GET",
        url: '/foodcourt/get_all_menu',
        data: {},
        success:function(result){
          if (result != null ) {
            var menus = JSON.stringify(result);
            localStorage.setItem("menus", menus);
          }
        }
    });
  }

</script>
