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

This commit is contained in:
Aung Myo
2018-03-19 18:14:04 +06:30
39 changed files with 4403 additions and 159 deletions

View File

@@ -6,6 +6,18 @@ class Settings::TaxProfilesController < ApplicationController
# GET /settings/tax_profiles.json
def index
@settings_tax_profiles = TaxProfile.all
tax_profiles = Lookup.collection_of("tax_profiles")
if !@settings_tax_profiles.nil?
@settings_tax_profiles.each_with_index do |setting_tax_profile, tax_index|
if !tax_profiles.nil?
tax_profiles.each do |group|
if setting_tax_profile.group_type == group[1]
@settings_tax_profiles[tax_index].group_type = group[0]
end
end
end
end
end
end
# GET /settings/tax_profiles/1
@@ -15,11 +27,19 @@ class Settings::TaxProfilesController < ApplicationController
# GET /settings/tax_profiles/new
def new
@name = nil
@settings_tax_profile = TaxProfile.new
@tax_profiles = TaxProfile.all
end
# GET /settings/tax_profiles/1/edit
def edit
@settings_tax_profile = TaxProfile.find(params[:id])
@name = nil
if !@settings_tax_profile.nil?
@name = @settings_tax_profile.name
end
@tax_profiles = TaxProfile.all
end
# POST /settings/tax_profiles
@@ -69,10 +89,20 @@ class Settings::TaxProfilesController < ApplicationController
# Use callbacks to share common setup or constraints between actions.
def set_settings_tax_profile
@settings_tax_profile = TaxProfile.find(params[:id])
tax_profiles = Lookup.collection_of("tax_profiles")
if !@settings_tax_profile.nil?
if !tax_profiles.nil?
tax_profiles.each do |group|
if @settings_tax_profile.group_type == group[1]
@settings_tax_profile.group_type = group[0]
end
end
end
end
end
# Never trust parameters from the scary internet, only allow the white list through.
def settings_tax_profile_params
params.require(:tax_profile).permit(:name, :rate, :inclusive, :order_by, :created_by)
params.require(:tax_profile).permit(:name, :group_type, :rate, :inclusive, :order_by, :created_by)
end
end