Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into addorder
This commit is contained in:
@@ -24,6 +24,7 @@ class Api::BillController < Api::ApiController
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee, get_cashier)
|
||||
end
|
||||
Promotion.promo_activate(@sale)
|
||||
else
|
||||
@status = false
|
||||
@error_message = "No Current Open Shift"
|
||||
|
||||
@@ -4,8 +4,25 @@ class Api::Restaurant::MenuController < Api::ApiController
|
||||
# Pull the default menu details and also other available (active) menus
|
||||
# Input Params - order_id
|
||||
def index
|
||||
@menus = Menu.all
|
||||
# @current_menu = Menu.current_menu
|
||||
param_checksum = params[:checksum]
|
||||
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
|
||||
|
||||
all_menu = Menu.all
|
||||
|
||||
# to hash
|
||||
menu_array = []
|
||||
all_menu.each do |m|
|
||||
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }}))
|
||||
end
|
||||
|
||||
#export Checksum file generate by md5
|
||||
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
|
||||
|
||||
if menu_checksum != param_checksum
|
||||
response.headers['CHECKSUM'] = menu_checksum
|
||||
@menus = all_menu
|
||||
end
|
||||
# @current_menu = Menu.current_menu
|
||||
end
|
||||
|
||||
#Description
|
||||
|
||||
@@ -4,7 +4,7 @@ class Origami::CommissionersController < BaseOrigamiController
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
def index
|
||||
@commissioners = Commissioner.all
|
||||
@commissioners = Commissioner.all.order("id asc")
|
||||
end
|
||||
|
||||
# GET /commissioners/1
|
||||
|
||||
@@ -15,10 +15,12 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
# GET /commissions/new
|
||||
def new
|
||||
@commission = Commission.new
|
||||
@products = MenuItem.all
|
||||
end
|
||||
|
||||
# GET /commissions/1/edit
|
||||
def edit
|
||||
@products = MenuItem.all
|
||||
end
|
||||
|
||||
# POST /commissions
|
||||
@@ -28,11 +30,11 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
format.html { redirect_to origami_commissions_path , notice: 'Commission was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commission }
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commission}
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
format.html {render :new}
|
||||
format.json {render json: @commission.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -42,11 +44,11 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commission.update(commission_params)
|
||||
format.html { redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commission }
|
||||
format.html {redirect_to origami_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commission}
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
format.html {render :edit}
|
||||
format.json {render json: @commission.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -56,19 +58,34 @@ class Origami::CommissionsController < BaseOrigamiController
|
||||
def destroy
|
||||
@commission.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
format.html {redirect_to origami_commissions_path, notice: 'Commission was successfully destroyed.'}
|
||||
format.json {head :no_content}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
@commission = Commission.find(params[:id])
|
||||
end
|
||||
def load_commissioners
|
||||
sale_id = params[:sale_id]
|
||||
@table_id = params[:table_id]
|
||||
@saleobj = Sale.find(sale_id)
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.require(:commission).permit(:product_id,:amount,:commission_type, :is_active)
|
||||
end
|
||||
@commissioners = []
|
||||
end
|
||||
|
||||
def select_sale_item
|
||||
# byebug
|
||||
sale_item_id = params[:sale_item_id]
|
||||
@sale_item = SaleItem.find_by_sale_item_id(sale_item_id)
|
||||
@commissioners = Commissioner.active.all
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commission
|
||||
@commission = Commission.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.require(:commission).permit(:product_id, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
|
||||
74
app/controllers/origami/in_juties_controller.rb
Normal file
74
app/controllers/origami/in_juties_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Origami::InJutiesController < BaseOrigamiController
|
||||
before_action :set_in_juty, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /in_juties
|
||||
# GET /in_juties.json
|
||||
def index
|
||||
@in_juties = InJuty.all
|
||||
end
|
||||
|
||||
# GET /in_juties/1
|
||||
# GET /in_juties/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /in_juties/new
|
||||
def new
|
||||
@in_juty = InJuty.new
|
||||
end
|
||||
|
||||
# GET /in_juties/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /in_juties
|
||||
# POST /in_juties.json
|
||||
def create
|
||||
@in_juty = InJuty.new(in_juty_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @in_juty.save
|
||||
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @in_juty }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /in_juties/1
|
||||
# PATCH/PUT /in_juties/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @in_juty.update(in_juty_params)
|
||||
format.html { redirect_to origami_in_juty_path(@in_juty), notice: 'In juty was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @in_juty }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /in_juties/1
|
||||
# DELETE /in_juties/1.json
|
||||
def destroy
|
||||
@in_juty.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_in_juty
|
||||
@in_juty = InJuty.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def in_juty_params
|
||||
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time)
|
||||
end
|
||||
end
|
||||
@@ -28,8 +28,14 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
respond_to do |format|
|
||||
if @promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
promo_pros.each do |promo_pro|
|
||||
promo_pro.save
|
||||
end
|
||||
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @promotion }
|
||||
else
|
||||
@@ -44,6 +50,13 @@ class Settings::PromotionsController < ApplicationController
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @promotion.update(promotion_params)
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
promo_pros.each do |promo_pro|
|
||||
promo_pro.save
|
||||
end
|
||||
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @promotion }
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user