tax profiles

This commit is contained in:
phyusin
2018-03-16 10:57:32 +06:30
parent 8cea60ec02
commit acc5d737fa
9 changed files with 36 additions and 4 deletions

View File

@@ -6,6 +6,8 @@ class Settings::TaxProfilesController < ApplicationController
# GET /settings/tax_profiles.json
def index
@settings_tax_profiles = TaxProfile.all
tax_profiles = Lookup.collection_of("tax_profiles")
end
# GET /settings/tax_profiles/1
@@ -73,6 +75,6 @@ class Settings::TaxProfilesController < ApplicationController
# 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

View File

@@ -1,5 +1,5 @@
class TaxProfile < ApplicationRecord
default_scope { order('order_by asc') }
# validations
validates_presence_of :name, :rate
validates_presence_of :name, :rate, :group_type
end

View File

@@ -8,6 +8,7 @@
<%= f.error_notification %>
<div class="form-inputs p-l-15">
<%= f.input :group_type, :collection => Lookup.collection_of("tax_profiles"),:input_html=>{:class=>"col-md-10"},:required=>true %>
<%= f.input :name %>
<%= f.input :rate %>
<%= f.input :inclusive %>

View File

@@ -17,6 +17,7 @@
<table class="table">
<thead>
<tr>
<th><%= t("views.right_panel.detail.group_type") %></th>
<th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.rate") %></th>
<th><%= t("views.right_panel.detail.inclusive") %></th>
@@ -29,6 +30,9 @@
<tbody>
<% @settings_tax_profiles.each do |settings_tax_profile| %>
<tr>
<td>
<%= settings_tax_profile.group_type %>
</td>
<td><%= settings_tax_profile.name %></td>
<td><%= settings_tax_profile.rate %></td>
<td><%= settings_tax_profile.inclusive %></td>