rails_finance 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +20 -0
- data/Rakefile +32 -0
- data/app/controllers/finance/admin/assessments_controller.rb +55 -0
- data/app/controllers/finance/admin/base_controller.rb +4 -0
- data/app/controllers/finance/admin/budgets_controller.rb +83 -0
- data/app/controllers/finance/admin/expense_members_controller.rb +59 -0
- data/app/controllers/finance/admin/expenses_controller.rb +71 -0
- data/app/controllers/finance/admin/financial_taxons_controller.rb +67 -0
- data/app/controllers/finance/admin/fund_incomes_controller.rb +59 -0
- data/app/controllers/finance/admin/funds_controller.rb +58 -0
- data/app/controllers/finance/admin/home_controller.rb +8 -0
- data/app/controllers/finance/admin/stocks_controller.rb +60 -0
- data/app/controllers/finance/me/base_controller.rb +4 -0
- data/app/controllers/finance/me/budgets_controller.rb +111 -0
- data/app/controllers/finance/me/expense_members_controller.rb +73 -0
- data/app/controllers/finance/me/expenses_controller.rb +129 -0
- data/app/controllers/finance_controller/me.rb +14 -0
- data/app/models/budget/finance/fund_budget.rb +5 -0
- data/app/models/budget/finance/stock_budget.rb +5 -0
- data/app/models/expense/finance/payable_expense.rb +5 -0
- data/app/models/expense/finance/prepay_expense.rb +5 -0
- data/app/models/finance/application_record.rb +5 -0
- data/app/models/finance/assessment.rb +5 -0
- data/app/models/finance/budget.rb +7 -0
- data/app/models/finance/expense.rb +7 -0
- data/app/models/finance/expense_item.rb +5 -0
- data/app/models/finance/expense_member.rb +6 -0
- data/app/models/finance/ext/financial.rb +24 -0
- data/app/models/finance/ext/member.rb +13 -0
- data/app/models/finance/financial_taxon.rb +7 -0
- data/app/models/finance/fund.rb +6 -0
- data/app/models/finance/fund_income.rb +5 -0
- data/app/models/finance/model/assessment.rb +26 -0
- data/app/models/finance/model/budget/fund_budget.rb +5 -0
- data/app/models/finance/model/budget/stock_budget.rb +10 -0
- data/app/models/finance/model/budget.rb +152 -0
- data/app/models/finance/model/expense/payable_expense.rb +5 -0
- data/app/models/finance/model/expense/prepay_expense.rb +5 -0
- data/app/models/finance/model/expense.rb +168 -0
- data/app/models/finance/model/expense_item.rb +36 -0
- data/app/models/finance/model/expense_member.rb +130 -0
- data/app/models/finance/model/financial_taxon.rb +27 -0
- data/app/models/finance/model/fund.rb +36 -0
- data/app/models/finance/model/fund_income.rb +30 -0
- data/app/models/finance/model/stock.rb +33 -0
- data/app/models/finance/stock.rb +5 -0
- data/app/models/finance.rb +12 -0
- data/app/pdfs/borrow_expense_pdf.rb +70 -0
- data/app/pdfs/payout_expense_pdf.rb +70 -0
- data/app/pdfs/prepay_expense_pdf.rb +70 -0
- data/app/records/borrow_expense_record.rb +10 -0
- data/app/records/prepay_expense_record.rb +16 -0
- data/app/views/admin/_finance_nav.html.erb +14 -0
- data/app/views/admin/_nav_expense.html.erb +4 -0
- data/app/views/finance/admin/assessments/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/assessments/_filter_form.html.erb +9 -0
- data/app/views/finance/admin/assessments/_form.html.erb +2 -0
- data/app/views/finance/admin/assessments/_index_tbody.html.erb +2 -0
- data/app/views/finance/admin/assessments/_index_thead.html.erb +3 -0
- data/app/views/finance/admin/assessments/_index_tr.html.erb +19 -0
- data/app/views/finance/admin/assessments/_new_form.html.erb +4 -0
- data/app/views/finance/admin/assessments/_show_table.html.erb +4 -0
- data/app/views/finance/admin/assessments/index.html.erb +5 -0
- data/app/views/finance/admin/base/_nav.html.erb +3 -0
- data/app/views/finance/admin/budgets/_breadcrumb.html.erb +9 -0
- data/app/views/finance/admin/budgets/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/budgets/_filter_form.html.erb +10 -0
- data/app/views/finance/admin/budgets/_filter_table.html.erb +11 -0
- data/app/views/finance/admin/budgets/_form.html.erb +7 -0
- data/app/views/finance/admin/budgets/_index_tbody.html.erb +13 -0
- data/app/views/finance/admin/budgets/_index_thead.html.erb +6 -0
- data/app/views/finance/admin/budgets/_item_form.html.erb +17 -0
- data/app/views/finance/admin/budgets/_items.html.erb +16 -0
- data/app/views/finance/admin/budgets/_new_form.html.erb +4 -0
- data/app/views/finance/admin/budgets/_show/_breadcrumb.html.erb +6 -0
- data/app/views/finance/admin/budgets/_show_table.html.erb +62 -0
- data/app/views/finance/admin/budgets/index.html.erb +5 -0
- data/app/views/finance/admin/budgets/next.turbo_stream.erb +1 -0
- data/app/views/finance/admin/budgets/show.htmlx.erb +35 -0
- data/app/views/finance/admin/budgets/trigger.js.erb +1 -0
- data/app/views/finance/admin/expense_members/_edit_form.html.erb +3 -0
- data/app/views/finance/admin/expense_members/_form.html.erb +5 -0
- data/app/views/finance/admin/expense_members/_index_tbody.html.erb +53 -0
- data/app/views/finance/admin/expense_members/_index_thead.html.erb +12 -0
- data/app/views/finance/admin/expense_members/index.html.erb +8 -0
- data/app/views/finance/admin/expenses/_breadcrumb.html.erb +9 -0
- data/app/views/finance/admin/expenses/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/expenses/_filter_form.html.erb +10 -0
- data/app/views/finance/admin/expenses/_filter_table.html.erb +11 -0
- data/app/views/finance/admin/expenses/_form.html.erb +12 -0
- data/app/views/finance/admin/expenses/_index_tbody.html.erb +13 -0
- data/app/views/finance/admin/expenses/_index_thead.html.erb +6 -0
- data/app/views/finance/admin/expenses/_item_form.html.erb +18 -0
- data/app/views/finance/admin/expenses/_items.html.erb +20 -0
- data/app/views/finance/admin/expenses/_member_form.html.erb +16 -0
- data/app/views/finance/admin/expenses/_new_form.html.erb +4 -0
- data/app/views/finance/admin/expenses/index.html.erb +5 -0
- data/app/views/finance/admin/expenses/next.turbo_stream.erb +1 -0
- data/app/views/finance/admin/expenses/show.html.erb +121 -0
- data/app/views/finance/admin/expenses/trigger.turbo_stream.erb +1 -0
- data/app/views/finance/admin/financial_taxons/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/financial_taxons/_filter_form.html.erb +10 -0
- data/app/views/finance/admin/financial_taxons/_form.html.erb +5 -0
- data/app/views/finance/admin/financial_taxons/_index_tbody.html.erb +36 -0
- data/app/views/finance/admin/financial_taxons/_index_thead.html.erb +5 -0
- data/app/views/finance/admin/financial_taxons/_index_tr.html.erb +13 -0
- data/app/views/finance/admin/financial_taxons/_new_form.html.erb +4 -0
- data/app/views/finance/admin/financial_taxons/index.html.erb +6 -0
- data/app/views/finance/admin/fund_incomes/_breadcrumb.html.erb +7 -0
- data/app/views/finance/admin/fund_incomes/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/fund_incomes/_filter_form.html.erb +9 -0
- data/app/views/finance/admin/fund_incomes/_form.html.erb +4 -0
- data/app/views/finance/admin/fund_incomes/_index_tbody.html.erb +5 -0
- data/app/views/finance/admin/fund_incomes/_index_thead.html.erb +4 -0
- data/app/views/finance/admin/fund_incomes/_new_form.html.erb +4 -0
- data/app/views/finance/admin/fund_incomes/_show_table.html.erb +12 -0
- data/app/views/finance/admin/fund_incomes/index.html.erb +5 -0
- data/app/views/finance/admin/funds/_edit_form.html.erb +3 -0
- data/app/views/finance/admin/funds/_filter_form.html.erb +9 -0
- data/app/views/finance/admin/funds/_form.html.erb +5 -0
- data/app/views/finance/admin/funds/_index_tbody.html.erb +14 -0
- data/app/views/finance/admin/funds/_index_thead.html.erb +8 -0
- data/app/views/finance/admin/funds/_new_form.html.erb +3 -0
- data/app/views/finance/admin/funds/_show_table.html.erb +16 -0
- data/app/views/finance/admin/funds/index.html.erb +5 -0
- data/app/views/finance/admin/home/index.html.erb +6 -0
- data/app/views/finance/admin/stocks/_breadcrumb.html.erb +7 -0
- data/app/views/finance/admin/stocks/_edit_form.html.erb +4 -0
- data/app/views/finance/admin/stocks/_filter_form.html.erb +9 -0
- data/app/views/finance/admin/stocks/_form.html.erb +4 -0
- data/app/views/finance/admin/stocks/_index_tbody.html.erb +6 -0
- data/app/views/finance/admin/stocks/_index_thead.html.erb +7 -0
- data/app/views/finance/admin/stocks/_new_form.html.erb +4 -0
- data/app/views/finance/admin/stocks/_show_table.html.erb +16 -0
- data/app/views/finance/admin/stocks/index.html.erb +5 -0
- data/app/views/finance/me/budgets/_breadcrumb.html.erb +6 -0
- data/app/views/finance/me/budgets/_filter_form.html.erb +8 -0
- data/app/views/finance/me/budgets/_filter_table.html.erb +11 -0
- data/app/views/finance/me/budgets/_index_tbody.html.erb +23 -0
- data/app/views/finance/me/budgets/_index_thead.html.erb +4 -0
- data/app/views/finance/me/budgets/_items.html.erb +22 -0
- data/app/views/finance/me/budgets/_show/_breadcrumb.html.erb +6 -0
- data/app/views/finance/me/budgets/admin.html.erb +5 -0
- data/app/views/finance/me/budgets/financial_taxons.js.erb +7 -0
- data/app/views/finance/me/budgets/index.html.erb +5 -0
- data/app/views/finance/me/budgets/index.js +45 -0
- data/app/views/finance/me/budgets/submit.turbo_stream.erb +1 -0
- data/app/views/finance/me/budgets/transfer.turbo_stream.erb +1 -0
- data/app/views/finance/me/expense_members/_breadcrumb.html.erb +6 -0
- data/app/views/finance/me/expense_members/_button.html.erb +0 -0
- data/app/views/finance/me/expense_members/_filter_form.html.erb +10 -0
- data/app/views/finance/me/expense_members/_form.html.erb +9 -0
- data/app/views/finance/me/expense_members/_index_tbody.html.erb +8 -0
- data/app/views/finance/me/expense_members/_index_thead.html.erb +7 -0
- data/app/views/finance/me/expense_members/_show_items.html.erb +1 -0
- data/app/views/finance/me/expense_members/admin.html.erb +3 -0
- data/app/views/finance/me/expense_members/index.html.erb +6 -0
- data/app/views/finance/me/expense_members/items.js.erb +1 -0
- data/app/views/finance/me/expense_members/show.html.erb +62 -0
- data/app/views/finance/me/expenses/_breadcrumb.html.erb +7 -0
- data/app/views/finance/me/expenses/_edit_form.html.erb +3 -0
- data/app/views/finance/me/expenses/_filter_form.html.erb +8 -0
- data/app/views/finance/me/expenses/_filter_table.html.erb +11 -0
- data/app/views/finance/me/expenses/_index_tbody.html.erb +16 -0
- data/app/views/finance/me/expenses/_index_thead.html.erb +6 -0
- data/app/views/finance/me/expenses/_index_tr.html.erb +14 -0
- data/app/views/finance/me/expenses/_new_form.html.erb +4 -0
- data/app/views/finance/me/expenses/_show/_breadcrumb.html.erb +6 -0
- data/app/views/finance/me/expenses/_show_table.html.erb +124 -0
- data/app/views/finance/me/expenses/admin.html.erb +5 -0
- data/app/views/finance/me/expenses/confirm.html.erb +27 -0
- data/app/views/finance/me/expenses/financial_taxons.js.erb +44 -0
- data/app/views/finance/me/expenses/index.html.erb +5 -0
- data/app/views/finance/me/expenses/index.js +42 -0
- data/app/views/finance/me/expenses/show.html.erb +3 -0
- data/app/views/me/_finance_nav.html.erb +11 -0
- data/config/locales/en.attributes.yml +6 -0
- data/config/locales/en.controller.yml +21 -0
- data/config/locales/en.enum.yml +18 -0
- data/config/locales/zh.attributes.yml +65 -0
- data/config/locales/zh.controller.yml +57 -0
- data/config/locales/zh.enum.yml +38 -0
- data/config/routes.rb +63 -0
- data/lib/rails_finance/config.rb +11 -0
- data/lib/rails_finance/engine.rb +26 -0
- data/lib/rails_finance/version.rb +3 -0
- data/lib/rails_finance.rb +2 -0
- metadata +259 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= render layout: 'index_tree_table', locals: { cache_key: Finance::FinancialTaxon.column_names.hash } do %>
|
2
|
+
<%= render partial: 'index_tbody', layout: 'index_tr', collection: @financial_taxons, as: :model %>
|
3
|
+
<%# draw_tree(partial: 'financial_taxon', layout: 'index_tr', object: financial_taxon, locals: { model: financial_taxon }) %>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%= paginate @financial_taxons %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="breadcrumb has-succeeds-separator">
|
2
|
+
<ul>
|
3
|
+
<li><%= link_to t('finance.admin.funds.index.title'), { controller: 'funds', action: 'index' } %></li>
|
4
|
+
<li><%= link_to @fund.name, { controller: 'funds', action: 'index', id: @fund.id } %></li>
|
5
|
+
<li class="is-active"><%= t('.title') %></li>
|
6
|
+
</ul>
|
7
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= form_with theme: 'search', model: Finance::FundIncome.new do |f| %>
|
2
|
+
<div class="field-body">
|
3
|
+
<%= f.text_field :name %>
|
4
|
+
<div class="field is-narrow">
|
5
|
+
<%= f.submit %>
|
6
|
+
<%= link_to t('.clear'), filter_params(except: [:name]), class: 'button is-light' %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<tr>
|
2
|
+
<td class="has-text-right"><%= Finance::FundIncome.human_attribute_name(:amount) %></td>
|
3
|
+
<td><%= @fund_income.amount %></td>
|
4
|
+
</tr>
|
5
|
+
<tr>
|
6
|
+
<td class="has-text-right"><%= Finance::FundIncome.human_attribute_name(:user_id) %></td>
|
7
|
+
<td><%= @fund_income.user_id %></td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Finance::FundIncome.human_attribute_name(:proof) %></td>
|
11
|
+
<td><%= @fund_income.proof %></td>
|
12
|
+
</tr>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= form_with theme: 'search', model: Finance::Fund.new do |f| %>
|
2
|
+
<div class="field-body">
|
3
|
+
<%= f.text_field :name %>
|
4
|
+
<div class="field is-narrow">
|
5
|
+
<%= f.submit %>
|
6
|
+
<%= link_to t('.clear'), filter_params(except: [:name]), class: 'button is-light' %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<td><%= model.name %></td>
|
2
|
+
<td><%= link_to model.budget_amount, { controller: 'budgets', fund_id: model.id }, text: true %></td>
|
3
|
+
<td>
|
4
|
+
<% model.budget_detail.each do |financial_type, amount| %>
|
5
|
+
<p>
|
6
|
+
<span><%= Finance::FundBudget.enum_i18n(:financial_type, financial_type) %>:</span>
|
7
|
+
<%= link_to amount, { controller: 'budgets', fund_id: model.id, financial_type: financial_type }, text: true %>
|
8
|
+
</p>
|
9
|
+
<% end %>
|
10
|
+
</td>
|
11
|
+
<td><%= link_to model.amount, { controller: 'fund_incomes', fund_id: model.id }, text: true %></td>
|
12
|
+
<td><%= link_to model.expense_amount, { controller: 'expenses', fund_id: model.id }, text: true %></td>
|
13
|
+
<td><%= simple_format model.expense_detail %></td>
|
14
|
+
<td><%= model.note %></td>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<th><%= Finance::Fund.human_attribute_name(:name) %></th>
|
2
|
+
<th><%= Finance::Fund.human_attribute_name(:budget_amount) %></th>
|
3
|
+
<th><%= Finance::Fund.human_attribute_name(:budget_detail) %></th>
|
4
|
+
<th><%= Finance::Fund.human_attribute_name(:amount) %></th>
|
5
|
+
<th><%= Finance::Fund.human_attribute_name(:expense_amount) %></th>
|
6
|
+
<th><%= Finance::Fund.human_attribute_name(:expense_detail) %></th>
|
7
|
+
<th><%= Finance::Fund.human_attribute_name(:note) %></th>
|
8
|
+
<th></th>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<tr>
|
2
|
+
<td class="has-text-right"><%= Finance::Fund.human_attribute_name(:name) %></td>
|
3
|
+
<td><%= @fund.name %></td>
|
4
|
+
</tr>
|
5
|
+
<tr>
|
6
|
+
<td class="has-text-right"><%= Finance::Fund.human_attribute_name(:budget_amount) %></td>
|
7
|
+
<td><%= @fund.budget_amount %></td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Finance::Fund.human_attribute_name(:amount) %></td>
|
11
|
+
<td><%= @fund.amount %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Finance::Fund.human_attribute_name(:note) %></td>
|
15
|
+
<td><%= @fund.note %></td>
|
16
|
+
</tr>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<div class="breadcrumb has-succeeds-separator">
|
2
|
+
<ul>
|
3
|
+
<li><%= link_to t('finance.admin.assessments.index.title'), { controller: 'assessments' } %></li>
|
4
|
+
<li class="is-active"><%= @assessment.amount %></li>
|
5
|
+
<li class="is-active"><%= t('.title') %></li>
|
6
|
+
</ul>
|
7
|
+
</div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= form_with theme: 'search', model: Finance::Stock.new do |f| %>
|
2
|
+
<div class="field-body">
|
3
|
+
<%= f.text_field :name %>
|
4
|
+
<div class="field is-narrow">
|
5
|
+
<%= f.submit %>
|
6
|
+
<%= link_to t('.clear'), filter_params(except: [:name]), class: 'button is-light' %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<th><%= Finance::Stock.human_attribute_name(:ratio) %></th>
|
2
|
+
<th><%= Finance::Stock.human_attribute_name(:assess_amount) %></th>
|
3
|
+
<th><%= Finance::Stock.human_attribute_name(:amount) %></th>
|
4
|
+
<th><%= Finance::Stock.human_attribute_name(:expense_amount) %></th>
|
5
|
+
<th><%= Finance::Stock.human_attribute_name(:note) %></th>
|
6
|
+
<th><%= Finance::Stock.human_attribute_name(:member_id) %></th>
|
7
|
+
<th></th>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<tr>
|
2
|
+
<td class="has-text-right"><%= Finance::Stock.human_attribute_name(:ratio) %></td>
|
3
|
+
<td><%= @stock.ratio %></td>
|
4
|
+
</tr>
|
5
|
+
<tr>
|
6
|
+
<td class="has-text-right"><%= Finance::Stock.human_attribute_name(:amount) %></td>
|
7
|
+
<td><%= @stock.amount %></td>
|
8
|
+
</tr>
|
9
|
+
<tr>
|
10
|
+
<td class="has-text-right"><%= Finance::Stock.human_attribute_name(:expense_amount) %></td>
|
11
|
+
<td><%= @stock.expense_amount %></td>
|
12
|
+
</tr>
|
13
|
+
<tr>
|
14
|
+
<td class="has-text-right"><%= Finance::Stock.human_attribute_name(:note) %></td>
|
15
|
+
<td><%= @stock.note %></td>
|
16
|
+
</tr>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li class="<%= active_helper('finance/me/budgets': ['index'], active: 'is-active') %>"><%= link_to t('finance.me.budgets.index.title'), { action: 'index' } %></li>
|
4
|
+
<li class="<%= active_helper('finance/me/budgets': ['admin'], active: 'is-active') %>"><%= link_to t('finance.me.budgets.admin.title'), { action: 'admin' } %></li>
|
5
|
+
</ul>
|
6
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<table class="as-search">
|
2
|
+
<tr>
|
3
|
+
<th><%= Finance::Budget.human_attribute_name(:state) %></th>
|
4
|
+
<td>
|
5
|
+
<%= link_to t('.all'), filter_params(except: [:state]), class: active_params(state: '', active: 'button is-info', item: 'button is-light') %>
|
6
|
+
<% Finance::Budget.states.keys.each do |state| %>
|
7
|
+
<%= link_to Finance::Budget.enum_i18n(:state, state), filter_params(state: state), class: active_params(state: state, active: 'button is-info', item: 'button is-light') %>
|
8
|
+
<% end %>
|
9
|
+
</td>
|
10
|
+
</tr>
|
11
|
+
</table>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<td><%= link_to budget.subject, { action: 'show', id: budget.id } %></td>
|
2
|
+
<td><%= budget.amount %></td>
|
3
|
+
<td>
|
4
|
+
<span class="tag"><%= budget.state_i18n %></span>
|
5
|
+
<% budget.all_verifications.each do |verification| %>
|
6
|
+
<p>
|
7
|
+
<%= verification.job_title&.name %>
|
8
|
+
<%= verification.member&.name %>
|
9
|
+
<span class="tag"><%= verification.confirmed_i18n %></span>
|
10
|
+
</p>
|
11
|
+
<% end %>
|
12
|
+
</td>
|
13
|
+
<td>
|
14
|
+
<%= link_to 'History', audits_path(budget.class.base_class.name, budget.id), class: 'button is-small is-rounded is-light' %>
|
15
|
+
<% if ['init', 'rejected'].include? budget.state %>
|
16
|
+
<%= link_to({ action: 'edit', id: budget.id }, { aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light' }) do %>
|
17
|
+
<i class="fas fa-pencil-alt"></i>
|
18
|
+
<% end %>
|
19
|
+
<%= link_to({ action: 'destroy', id: budget.id }, { method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' }) do %>
|
20
|
+
<i class="fas fa-trash"></i>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</td>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<table class="table">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th><%= ExpenseItem.human_attribute_name(:financial_taxon_id) %></th>
|
5
|
+
<th><%= ExpenseItem.human_attribute_name(:note) %></th>
|
6
|
+
<th><%= ExpenseItem.human_attribute_name(:budget_amount) %></th>
|
7
|
+
<th><%= ExpenseItem.human_attribute_name(:amount) %></th>
|
8
|
+
<th></th>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% expense_items.each do |item| %>
|
13
|
+
<tr>
|
14
|
+
<td><%= item.financial_taxon&.name %></td>
|
15
|
+
<td><%= item.note %></td>
|
16
|
+
<td><%= item.budget_amount %></td>
|
17
|
+
<td><%= item.amount %></td>
|
18
|
+
<td></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<% form_object = form_object(@budget) %>
|
2
|
+
|
3
|
+
<% params.fetch('budget', {}).fetch('expense_items_attributes', {}).each do |index, item| %>
|
4
|
+
var template = document.createElement('div')
|
5
|
+
template.innerHTML = '<%= j(render partial: 'item_field', locals: { f: form_object, index: index }) %>'
|
6
|
+
document.getElementById('budget_expense_items_wrapper_<%= ef.index %>').parentNode.replaceChild(input, template)
|
7
|
+
<% end %>
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import { Controller } from 'stimulus'
|
2
|
+
|
3
|
+
class BudgetController extends Controller {
|
4
|
+
static targets = ['quantity', 'budget', 'price']
|
5
|
+
|
6
|
+
connect() {
|
7
|
+
console.debug(this.identifier, 'contented!')
|
8
|
+
}
|
9
|
+
|
10
|
+
updatePrice(event) {
|
11
|
+
let price = event.currentTarget
|
12
|
+
let quantity = document.getElementById(price.id.replace('price', 'quantity'))
|
13
|
+
let result = (price.value * quantity.value).toFixed(2)
|
14
|
+
|
15
|
+
let budget = document.getElementById(price.id.replace('price', 'budget_amount'))
|
16
|
+
if (budget) {
|
17
|
+
budget.value = result
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
updateQuantity(event) {
|
22
|
+
let quantity = event.currentTarget
|
23
|
+
let price = document.getElementById(quantity.id.replace('quantity', 'price'))
|
24
|
+
let result = (price.value * quantity.value).toFixed(2)
|
25
|
+
|
26
|
+
let budget = document.getElementById(quantity.id.replace('quantity', 'budget_amount'))
|
27
|
+
if (budget) {
|
28
|
+
budget.value = result
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
updateBudgetAmount(event) {
|
33
|
+
let budget = event.currentTarget
|
34
|
+
let quantity = document.getElementById(budget.id.replace('budget_amount', 'quantity'))
|
35
|
+
let result = (budget.value / quantity.value).toFixed(2)
|
36
|
+
|
37
|
+
let price = document.getElementById(budget.id.replace('budget_amount', 'price'))
|
38
|
+
if (price) {
|
39
|
+
price.value = result
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
44
|
+
|
45
|
+
application.register('budget', BudgetController)
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'visit' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render 'visit' %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<div class="tabs">
|
2
|
+
<ul>
|
3
|
+
<li class="<%= active_helper(controllers: 'expense_members', active: 'is-active') %>"><%= link_to t('finance.me.expense_members.index.title'), me_expense_members_path %></li>
|
4
|
+
<li><%# link_to 'My Payment Methods', me_payment_methods_path, class: active_helper(controllers: 'payment_methods') %></li>
|
5
|
+
</ul>
|
6
|
+
</div>
|
File without changes
|