update commission and seed for font
This commit is contained in:
62
app/controllers/settings/assign_products_controller.rb
Normal file
62
app/controllers/settings/assign_products_controller.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
class Settings::AssignProductsController < ApplicationController
|
||||
before_action :set_settings_commission, only: [:show, :edit, :new, :update, :destroy]
|
||||
|
||||
# GET /settings/commissions
|
||||
# GET /settings/commissions.json
|
||||
def index
|
||||
@settings_commissions = Commission.all
|
||||
end
|
||||
|
||||
# GET /settings/commissions/1
|
||||
# GET /settings/commissions/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /settings/commissions/new
|
||||
def new
|
||||
#Load list of categories that has product assigned.
|
||||
@menu_categories = MenuCategory.where("id in (Select distinct menu_category_id from menu_items where menu_category_id is not null)")
|
||||
|
||||
end
|
||||
|
||||
# GET /settings/commissions/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /settings/commissions
|
||||
# POST /settings/commissions.json
|
||||
def create
|
||||
|
||||
end
|
||||
|
||||
# PATCH/PUT /settings/commissions/1
|
||||
# PATCH/PUT /settings/commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @settings_commission.update(settings_commission_params)
|
||||
format.html { redirect_to order_queue_station_path(@settings_commission), notice: 'Commission assign was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_commission }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @settings_commission.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /settings/commissions/1
|
||||
# DELETE /settings/commissions/1.json
|
||||
def destroy
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_settings_commission
|
||||
@commission = Commission.find(params[:commission_id])
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def settings_commission_params
|
||||
params.require(:commission).permit(:product_type,:name, :product_code, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
@@ -29,6 +29,7 @@ class Settings::CommissionsController < ApplicationController
|
||||
def create
|
||||
@commission = Commission.new(commission_params)
|
||||
@commission.product_type = 'menu_item'
|
||||
@commission.product_code = "[]"
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
@@ -45,6 +46,8 @@ class Settings::CommissionsController < ApplicationController
|
||||
# PATCH/PUT /commissions/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
puts commission_params.to_json
|
||||
puts "updddddddddddddddddddddd"
|
||||
if @commission.update(commission_params)
|
||||
format.html {redirect_to settings_commission_path(@commission), notice: 'Commission was successfully updated.'}
|
||||
format.json {render :show, status: :ok, location: @commission}
|
||||
@@ -73,6 +76,6 @@ class Settings::CommissionsController < ApplicationController
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def commission_params
|
||||
params.require(:commission).permit(:product_type, :product_code, :amount, :commission_type, :is_active)
|
||||
params.require(:commission).permit(:product_type,:name, :product_code, :amount, :commission_type, :is_active)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user