Merge branch 'august_spring' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-08-17 13:50:24 +06:30
29 changed files with 536 additions and 7 deletions

View File

@@ -97,6 +97,6 @@ class Settings::DiningChargesController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def dining_charge_params
# params.fetch(:dining_charge, {})
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id)
params.require(:dining_charge).permit(:item_code, :unit_price, :taxable, :charge_type,:minimum_free_time ,:charge_block,:time_rounding,:time_rounding_block, :zone_id, :time_rounding_block_price)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::ProductsController < ApplicationController
before_action :set_settings_product, only: [:show, :edit, :update, :destroy]
# GET /settings/products
# GET /settings/products.json
def index
@settings_products = Product.all
end
# GET /settings/products/1
# GET /settings/products/1.json
def show
end
# GET /settings/products/new
def new
@settings_product = Product.new
end
# GET /settings/products/1/edit
def edit
end
# POST /settings/products
# POST /settings/products.json
def create
@settings_product = Product.new(settings_product_params)
@settings_product.created_by = current_user.name
respond_to do |format|
if @settings_product.save
format.html { redirect_to settings_products_path, notice: 'Product was successfully created.' }
format.json { render :show, status: :created, location: @settings_product }
else
format.html { render :new }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /settings/products/1
# PATCH/PUT /settings/products/1.json
def update
respond_to do |format|
if @settings_product.update(settings_product_params)
format.html { redirect_to settings_product_path, notice: 'Product was successfully updated.' }
format.json { render :show, status: :ok, location: @settings_product }
else
format.html { render :edit }
format.json { render json: @settings_product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /settings/products/1
# DELETE /settings/products/1.json
def destroy
@settings_product.destroy
respond_to do |format|
format.html { redirect_to settings_products_path, notice: 'Product was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_settings_product
@settings_product = Product.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_product_params
params.require(:product).permit(:item_code, :name, :alt_name, :unit_price, :image_path, :description, :information, :taxable,:created_by)
end
end

View File

@@ -0,0 +1,76 @@
class Settings::PromotionsController < ApplicationController
before_action :set_promotion, only: [:show, :edit, :update, :destroy]
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all
end
# GET /promotions/1
# GET /promotions/1.json
def show
end
# GET /promotions/new
def new
@promotion = Promotion.new
@promotion.promo_start_date = DateTime.now
@promotion.promo_end_date = DateTime.now
end
# GET /promotions/1/edit
def edit
end
# POST /promotions
# POST /promotions.json
def create
@promotion = Promotion.new(promotion_params)
@promotion.created_by = current_login_employee.id
respond_to do |format|
if @promotion.save
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully created.' }
format.json { render :show, status: :created, location: @promotion }
else
format.html { render :new }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /promotions/1
# PATCH/PUT /promotions/1.json
def update
respond_to do |format|
if @promotion.update(promotion_params)
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully updated.' }
format.json { render :show, status: :ok, location: @promotion }
else
format.html { render :edit }
format.json { render json: @promotion.errors, status: :unprocessable_entity }
end
end
end
# DELETE /promotions/1
# DELETE /promotions/1.json
def destroy
@promotion.destroy
respond_to do |format|
format.html { redirect_to settings_promotions_path, notice: 'Promotion was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_promotion
@promotion = Promotion.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def promotion_params
params.require(:promotion).permit(:promo_code, :promo_start_date, :promo_end_date, :promo_start_hour,:promo_end_hour ,:promo_day, :promo_type,:original_product ,:min_qty ,:created_by)
end
end