Waiter app progress
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
class Waiter::SectionsController < Waiter::ApplicationController
|
||||
|
||||
def index
|
||||
sections = current_supplier.sections.include_relation(:tables)
|
||||
render json: sections, each_serializer: Waiter::SectionSerializer
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
class Waiter::SuppliersController < Waiter::ApplicationController
|
||||
def show
|
||||
@supplier = Supplier.find(params[:id])
|
||||
head 404 and return unless @supplier.employee_ids.include?(current_employee.id)
|
||||
render json: @supplier, serializer: Waiter::SupplierSerializer
|
||||
end
|
||||
end
|
||||
@@ -4,14 +4,6 @@ class WaiterController < ApplicationController
|
||||
|
||||
end
|
||||
|
||||
def sections
|
||||
sections = current_supplier.sections.include_relation(:tables)
|
||||
respond_to do |format|
|
||||
format.html { redirect_to '/waiter'}
|
||||
format.json { render json: sections, each_serializer: Waiter::SectionSerializer }
|
||||
end
|
||||
end
|
||||
|
||||
def product_categories
|
||||
respond_to do |format|
|
||||
format.html { redirect_to '/waiter'}
|
||||
@@ -25,12 +17,4 @@ class WaiterController < ApplicationController
|
||||
@list.place_order products: params[:order], employee: current_employee
|
||||
render nothing: true
|
||||
end
|
||||
|
||||
def current_supplier
|
||||
@current_supplier ||= Supplier.first
|
||||
end
|
||||
|
||||
def current_employee
|
||||
@current_employee ||= current_supplier.employees.first
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user