tax profiles

This commit is contained in:
phyusin
2018-03-16 17:21:55 +06:30
parent acc5d737fa
commit b16483708a
4 changed files with 59 additions and 7 deletions

View File

@@ -7,7 +7,17 @@ class Settings::TaxProfilesController < ApplicationController
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
@@ -17,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
@@ -71,6 +89,16 @@ 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.