merge with august_spring
This commit is contained in:
75
app/controllers/origami/commissioners_controller.rb
Normal file
75
app/controllers/origami/commissioners_controller.rb
Normal file
@@ -0,0 +1,75 @@
|
||||
class Origami::CommissionersController < BaseOrigamiController
|
||||
before_action :set_commissioner, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissioners
|
||||
# GET /commissioners.json
|
||||
def index
|
||||
@commissioners = Commissioner.all
|
||||
end
|
||||
|
||||
# GET /commissioners/1
|
||||
# GET /commissioners/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissioners/new
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissioners
|
||||
# POST /commissioners.json
|
||||
def create
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @commissioner }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissioners/1
|
||||
# PATCH/PUT /commissioners/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @commissioner.update(commissioner_params)
|
||||
format.html { redirect_to origami_commissioner_path(@commissioner) , notice: 'Commissioner was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @commissioner }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commissioner.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissioners/1
|
||||
# DELETE /commissioners/1.json
|
||||
def destroy
|
||||
@commissioner.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to origami_commissioners_path , notice: 'Commissioner was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_commissioner
|
||||
@commissioner = Commissioner.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commissioner_params
|
||||
params.require(:commissioner).permit(:name,:emp_id,:created_by,:commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
74
app/controllers/origami/commissions_controller.rb
Normal file
74
app/controllers/origami/commissions_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Origami::CommissionsController < BaseOrigamiController
|
||||
before_action :set_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /commissions
|
||||
# GET /commissions.json
|
||||
def index
|
||||
@commissions = Commission.all
|
||||
end
|
||||
|
||||
# GET /commissions/1
|
||||
# GET /commissions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /commissions/new
|
||||
def new
|
||||
@commission = Commission.new
|
||||
end
|
||||
|
||||
# GET /commissions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /commissions
|
||||
# POST /commissions.json
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
|
||||
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 }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /commissions/1
|
||||
# PATCH/PUT /commissions/1.json
|
||||
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 }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /commissions/1
|
||||
# DELETE /commissions/1.json
|
||||
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 }
|
||||
end
|
||||
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/product_commissions_controller.rb
Normal file
74
app/controllers/origami/product_commissions_controller.rb
Normal file
@@ -0,0 +1,74 @@
|
||||
class Origami::ProductCommissionsController < ApplicationController
|
||||
before_action :set_product_commission, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /product_commissions
|
||||
# GET /product_commissions.json
|
||||
def index
|
||||
@product_commissions = ProductCommission.all
|
||||
end
|
||||
|
||||
# GET /product_commissions/1
|
||||
# GET /product_commissions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /product_commissions/new
|
||||
def new
|
||||
@product_commission = ProductCommission.new
|
||||
end
|
||||
|
||||
# GET /product_commissions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /product_commissions
|
||||
# POST /product_commissions.json
|
||||
def create
|
||||
@product_commission = ProductCommission.new(product_commission_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @product_commission.save
|
||||
format.html { redirect_to @product_commission, notice: 'Product commission was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @product_commission }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /product_commissions/1
|
||||
# PATCH/PUT /product_commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @product_commission.update(product_commission_params)
|
||||
format.html { redirect_to @product_commission, notice: 'Product commission was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @product_commission }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @product_commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /product_commissions/1
|
||||
# DELETE /product_commissions/1.json
|
||||
def destroy
|
||||
@product_commission.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to product_commissions_url, notice: 'Product commission was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_product_commission
|
||||
@product_commission = ProductCommission.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def product_commission_params
|
||||
params.fetch(:product_commission, {})
|
||||
end
|
||||
end
|
||||
@@ -22,7 +22,7 @@ class Origami::VoucherController < BaseOrigamiController
|
||||
def create
|
||||
cash = params[:amount]
|
||||
sale_id = params[:sale_id]
|
||||
sale_id = params[:refnumber]
|
||||
voucher_no = params[:refnumber]
|
||||
if(Sale.exists?(sale_id))
|
||||
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
|
||||
if customer_data
|
||||
@@ -37,11 +37,12 @@ class Origami::VoucherController < BaseOrigamiController
|
||||
auth_token = member_actions.auth_token.to_s
|
||||
# membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
|
||||
# if membership_data["status"]==true
|
||||
# app_token: token,membership_id:membership_id,
|
||||
# campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
|
||||
# auth_token:auth_token
|
||||
begin
|
||||
response = HTTParty.get(url,
|
||||
:body => { app_token: token,membership_id:membership_id,
|
||||
campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,
|
||||
auth_token:auth_token
|
||||
:body => { voucher_no: voucher_no,membership_id:membership_id
|
||||
}.to_json,
|
||||
:headers => {
|
||||
'Content-Type' => 'application/json',
|
||||
|
||||
77
app/controllers/settings/promotion_products_controller.rb
Normal file
77
app/controllers/settings/promotion_products_controller.rb
Normal file
@@ -0,0 +1,77 @@
|
||||
class Settings::PromotionProductsController < ApplicationController
|
||||
before_action :set_promotion, only: [:show, :edit, :update, :destroy,:new]
|
||||
before_action :set_promotion_product, only: [:show, :edit, :update, :destroy]
|
||||
|
||||
# GET /promotion_products
|
||||
# GET /promotion_products.json
|
||||
def index
|
||||
@promotion_products = PromotionProduct.all
|
||||
end
|
||||
|
||||
# GET /promotion_products/1
|
||||
# GET /promotion_products/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /promotion_products/new
|
||||
def new
|
||||
@promotion_product = PromotionProduct.new
|
||||
end
|
||||
|
||||
# GET /promotion_products/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /promotion_products
|
||||
# POST /promotion_products.json
|
||||
def create
|
||||
@promotion_product = PromotionProduct.new(promotion_params)
|
||||
respond_to do |format|
|
||||
if @promotion_product.save
|
||||
format.html { redirect_to edit_settings_promotion_path(@promotion), notice: 'PromotionProduct was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @promotion_product }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @promotion_product.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /promotion_products/1
|
||||
# PATCH/PUT /promotion_products/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @promotion_product.update(promotion_params)
|
||||
format.html { redirect_to edit_settings_promotion_path(@promotion), notice: 'PromotionProduct was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @promotion_product }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @promotion_product.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /promotion_products/1
|
||||
# DELETE /promotion_products/1.json
|
||||
def destroy
|
||||
@promotion_product.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to edit_settings_promotion_path(@promotion) , notice: 'PromotionProduct 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[:promotion_id])
|
||||
end
|
||||
def set_promotion_product
|
||||
@promotion_product = PromotionProduct.find(params[:id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def promotion_params
|
||||
params.require(:promotion_product).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
|
||||
@@ -71,6 +71,7 @@ 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)
|
||||
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])
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user