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

This commit is contained in:
Nweni
2017-08-24 18:04:57 +06:30
25 changed files with 412 additions and 222 deletions

View File

@@ -76,6 +76,11 @@ class Origami::CommissionsController < BaseOrigamiController
sale_item_id = params[:sale_item_id]
@sale_item = SaleItem.find_by_sale_item_id(sale_item_id)
@commissioners = Commissioner.active.all
respond_to do |format|
format.json {render json: @commissioners}
# format.html {render @commissioners}
end
end
private

View File

@@ -28,7 +28,7 @@ class Origami::InJutiesController < BaseOrigamiController
respond_to do |format|
if @in_juty.save
format.html { redirect_to @in_juty, notice: 'In juty was successfully created.' }
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 }
@@ -42,7 +42,7 @@ class Origami::InJutiesController < BaseOrigamiController
def update
respond_to do |format|
if @in_juty.update(in_juty_params)
format.html { redirect_to @in_juty, notice: 'In juty was successfully updated.' }
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 }
@@ -56,7 +56,7 @@ class Origami::InJutiesController < BaseOrigamiController
def destroy
@in_juty.destroy
respond_to do |format|
format.html { redirect_to in_juties_url, notice: 'In juty was successfully destroyed.' }
format.html { redirect_to origami_in_juties_path, notice: 'In juty was successfully destroyed.' }
format.json { head :no_content }
end
end
@@ -69,6 +69,6 @@ class Origami::InJutiesController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through.
def in_juty_params
params.fetch(:in_juty, {})
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time)
end
end

View File

@@ -4,7 +4,7 @@ class Settings::PromotionsController < ApplicationController
# GET /promotions
# GET /promotions.json
def index
@promotions = Promotion.all
@promotions = Promotion.all.order("created_at asc")
end
# GET /promotions/1
@@ -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
@@ -72,6 +85,6 @@ class Settings::PromotionsController < ApplicationController
# 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,
:promotion_products_attributes => [:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
:promotion_products_attributes => [:id,:item_code, :min_qty, :net_off, :net_price, :percentage, :_destroy])
end
end