sale receipt generation and bill api
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
class Api::ApiController < ActionController::API
|
||||
include TokenVerification
|
||||
helper_method :current_token
|
||||
helper_method :current_token, :current_login_employee
|
||||
|
||||
|
||||
private
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
@@ -10,4 +12,8 @@ class Api::ApiController < ActionController::API
|
||||
return token
|
||||
end
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(current_token)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
class Api::Restaurant::BillController < Api::ApiController
|
||||
|
||||
class Api::BillController < Api::ApiController
|
||||
|
||||
#Create invoice based on booking
|
||||
#Output and invoice
|
||||
def create
|
||||
@status = false
|
||||
@error_message = "Order ID or Booking ID is require to request for a bill."
|
||||
|
||||
#create Bill by Booking ID
|
||||
if (params[:booking_id])
|
||||
@sale = Sale.new
|
||||
@sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name)
|
||||
|
||||
elsif (params[:order_id])
|
||||
@sale = Sale.new
|
||||
@sale.generate_invoice_from_order(params[:order_id], current_login_employee.name)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user