class WaiterController < ApplicationController
  layout 'waiter'
  def index

  end

  def product_categories
    respond_to do |format|
      format.html { redirect_to '/waiter'}
      format.json { render json: ProductCategory.all.include_relation(:product), root: 'product_categories', each_serializer: ProductCategorySerializer }
    end
  end

  def order_products
    @table= Table.find_by_supplier_id_and_id!(current_supplier.id, params[:table_id])
    @list = List.from_table_by_employee(@table, current_employee)
    @list.place_order products: params[:order], employee: current_employee
    render nothing: true
  end
end
