diff --git a/app/controllers/settings/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb index 74f27c84..90e6a304 100644 --- a/app/controllers/settings/accounts_controller.rb +++ b/app/controllers/settings/accounts_controller.rb @@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController # Never trust parameters from the scary internet, only allow the white list through. def account_params - params.require(:account).permit(:title, :account_type) + params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate) end end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index a385806c..c729f255 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -23,6 +23,8 @@
  • <%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %>
  • <%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %>
  • <%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %>
  • +
    +
  • <%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %>
  • diff --git a/app/views/settings/accounts/_form.html.erb b/app/views/settings/accounts/_form.html.erb index 4231ad32..b2101a43 100644 --- a/app/views/settings/accounts/_form.html.erb +++ b/app/views/settings/accounts/_form.html.erb @@ -4,11 +4,14 @@
    <%= f.input :title %> <%= f.input :account_type, :collection => Lookup.collection_of("account_type") %> + <%= f.input :discount %> + <%= f.input :point %> + <%= f.input :bonus %> + <%= f.input :rebate %>
    <%= f.button :submit %>
    - -<% end %> +<% end %> diff --git a/app/views/settings/accounts/index.html.erb b/app/views/settings/accounts/index.html.erb index d8469a69..23cfb7eb 100644 --- a/app/views/settings/accounts/index.html.erb +++ b/app/views/settings/accounts/index.html.erb @@ -14,9 +14,14 @@ - - - + + + + + + + + @@ -25,10 +30,14 @@ + + + + <% end %> diff --git a/app/views/settings/accounts/show.html.erb b/app/views/settings/accounts/show.html.erb index 6ec1c80a..284bb602 100644 --- a/app/views/settings/accounts/show.html.erb +++ b/app/views/settings/accounts/show.html.erb @@ -17,6 +17,10 @@ + + + + @@ -25,10 +29,14 @@ - + + + + +
    TitleAccount TypeActionTitleAccount TypeCan get DiscountCan get PointsCan get BonusCan rebateAction
    <%= account.title %> <%= account.account_type %><%= account.discount %><%= account.point %><%= account.bonus %><%= account.rebate %> - <%= link_to 'Edit', edit_settings_account_path(account) %> | + <%= link_to 'Edit', edit_settings_account_path(account) %> | <%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %> - +
    Title Account typeCan get DiscountCan get PointsCan get BonusCan rebate Action
    <%= @settings_account.title %> <%= @settings_account.account_type %><%= @settings_account.discount %><%= @settings_account.point %><%= @settings_account.bonus %><%= @settings_account.rebate %><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %>
    - \ No newline at end of file + diff --git a/db/migrate/20170331024747_create_accounts.rb b/db/migrate/20170331024747_create_accounts.rb index 5816aace..4c4a7b74 100644 --- a/db/migrate/20170331024747_create_accounts.rb +++ b/db/migrate/20170331024747_create_accounts.rb @@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1] create_table :accounts do |t| t.string :title t.string :account_type + t.boolean :discount, :null => false, :default => false + t.boolean :point, :null => false, :default => false + t.boolean :bonus, :null => false, :default => false + t.boolean :rebate, :null => false, :default => false t.timestamps end