Add extra fields to accounts
This commit is contained in:
@@ -68,6 +68,6 @@ class Settings::AccountsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def account_params
|
def account_params
|
||||||
params.require(:account).permit(:title, :account_type)
|
params.require(:account).permit(:title, :account_type,:discount,:point,:bonus,:rebate)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Payment Method", settings_payment_method_settings_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||||
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
<li><%= link_to "Print Setting", print_settings_path, :tabindex =>"-1" %></li>
|
||||||
|
<hr>
|
||||||
|
<li><%= link_to "Accounts", settings_accounts_path, :tabindex =>"-1" %></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :title %>
|
<%= f.input :title %>
|
||||||
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
|
<%= f.input :account_type, :collection => Lookup.collection_of("account_type") %>
|
||||||
|
<%= f.input :discount %>
|
||||||
|
<%= f.input :point %>
|
||||||
|
<%= f.input :bonus %>
|
||||||
|
<%= f.input :rebate %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
@@ -11,4 +15,3 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,14 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width:40%">Title</th>
|
<th>Title</th>
|
||||||
<th style="width:40%">Account Type</th>
|
<th>Account Type</th>
|
||||||
<th style="width:20%">Action</th>
|
<th>Can get Discount</th>
|
||||||
|
<th>Can get Points</th>
|
||||||
|
<th>Can get Bonus</th>
|
||||||
|
<th>Can rebate</th>
|
||||||
|
|
||||||
|
<th style="">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@@ -25,6 +30,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= account.title %></td>
|
<td><%= account.title %></td>
|
||||||
<td><%= account.account_type %></td>
|
<td><%= account.account_type %></td>
|
||||||
|
<td><%= account.discount %></td>
|
||||||
|
<td><%= account.point %></td>
|
||||||
|
<td><%= account.bonus %></td>
|
||||||
|
<td><%= account.rebate %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= 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?' } %>
|
<%= link_to 'Destroy', settings_account_path(account), method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Title</th>
|
<th>Title</th>
|
||||||
<th>Account type</th>
|
<th>Account type</th>
|
||||||
|
<th>Can get Discount</th>
|
||||||
|
<th>Can get Points</th>
|
||||||
|
<th>Can get Bonus</th>
|
||||||
|
<th>Can rebate</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -25,6 +29,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= @settings_account.title %></td>
|
<td><%= @settings_account.title %></td>
|
||||||
<td><%= @settings_account.account_type %></td>
|
<td><%= @settings_account.account_type %></td>
|
||||||
|
<td><%= @settings_account.discount %></td>
|
||||||
|
<td><%= @settings_account.point %></td>
|
||||||
|
<td><%= @settings_account.bonus %></td>
|
||||||
|
<td><%= @settings_account.rebate %></td>
|
||||||
|
|
||||||
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
|
<td><%= link_to 'Edit', edit_settings_account_path(@settings_account, @settings_account) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ class CreateAccounts < ActiveRecord::Migration[5.1]
|
|||||||
create_table :accounts do |t|
|
create_table :accounts do |t|
|
||||||
t.string :title
|
t.string :title
|
||||||
t.string :account_type
|
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
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user