rails_finance 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +20 -0
  3. data/README.md +20 -0
  4. data/Rakefile +32 -0
  5. data/app/controllers/finance/admin/assessments_controller.rb +55 -0
  6. data/app/controllers/finance/admin/base_controller.rb +4 -0
  7. data/app/controllers/finance/admin/budgets_controller.rb +83 -0
  8. data/app/controllers/finance/admin/expense_members_controller.rb +59 -0
  9. data/app/controllers/finance/admin/expenses_controller.rb +71 -0
  10. data/app/controllers/finance/admin/financial_taxons_controller.rb +67 -0
  11. data/app/controllers/finance/admin/fund_incomes_controller.rb +59 -0
  12. data/app/controllers/finance/admin/funds_controller.rb +58 -0
  13. data/app/controllers/finance/admin/home_controller.rb +8 -0
  14. data/app/controllers/finance/admin/stocks_controller.rb +60 -0
  15. data/app/controllers/finance/me/base_controller.rb +4 -0
  16. data/app/controllers/finance/me/budgets_controller.rb +111 -0
  17. data/app/controllers/finance/me/expense_members_controller.rb +73 -0
  18. data/app/controllers/finance/me/expenses_controller.rb +129 -0
  19. data/app/controllers/finance_controller/me.rb +14 -0
  20. data/app/models/budget/finance/fund_budget.rb +5 -0
  21. data/app/models/budget/finance/stock_budget.rb +5 -0
  22. data/app/models/expense/finance/payable_expense.rb +5 -0
  23. data/app/models/expense/finance/prepay_expense.rb +5 -0
  24. data/app/models/finance/application_record.rb +5 -0
  25. data/app/models/finance/assessment.rb +5 -0
  26. data/app/models/finance/budget.rb +7 -0
  27. data/app/models/finance/expense.rb +7 -0
  28. data/app/models/finance/expense_item.rb +5 -0
  29. data/app/models/finance/expense_member.rb +6 -0
  30. data/app/models/finance/ext/financial.rb +24 -0
  31. data/app/models/finance/ext/member.rb +13 -0
  32. data/app/models/finance/financial_taxon.rb +7 -0
  33. data/app/models/finance/fund.rb +6 -0
  34. data/app/models/finance/fund_income.rb +5 -0
  35. data/app/models/finance/model/assessment.rb +26 -0
  36. data/app/models/finance/model/budget/fund_budget.rb +5 -0
  37. data/app/models/finance/model/budget/stock_budget.rb +10 -0
  38. data/app/models/finance/model/budget.rb +152 -0
  39. data/app/models/finance/model/expense/payable_expense.rb +5 -0
  40. data/app/models/finance/model/expense/prepay_expense.rb +5 -0
  41. data/app/models/finance/model/expense.rb +168 -0
  42. data/app/models/finance/model/expense_item.rb +36 -0
  43. data/app/models/finance/model/expense_member.rb +130 -0
  44. data/app/models/finance/model/financial_taxon.rb +27 -0
  45. data/app/models/finance/model/fund.rb +36 -0
  46. data/app/models/finance/model/fund_income.rb +30 -0
  47. data/app/models/finance/model/stock.rb +33 -0
  48. data/app/models/finance/stock.rb +5 -0
  49. data/app/models/finance.rb +12 -0
  50. data/app/pdfs/borrow_expense_pdf.rb +70 -0
  51. data/app/pdfs/payout_expense_pdf.rb +70 -0
  52. data/app/pdfs/prepay_expense_pdf.rb +70 -0
  53. data/app/records/borrow_expense_record.rb +10 -0
  54. data/app/records/prepay_expense_record.rb +16 -0
  55. data/app/views/admin/_finance_nav.html.erb +14 -0
  56. data/app/views/admin/_nav_expense.html.erb +4 -0
  57. data/app/views/finance/admin/assessments/_edit_form.html.erb +4 -0
  58. data/app/views/finance/admin/assessments/_filter_form.html.erb +9 -0
  59. data/app/views/finance/admin/assessments/_form.html.erb +2 -0
  60. data/app/views/finance/admin/assessments/_index_tbody.html.erb +2 -0
  61. data/app/views/finance/admin/assessments/_index_thead.html.erb +3 -0
  62. data/app/views/finance/admin/assessments/_index_tr.html.erb +19 -0
  63. data/app/views/finance/admin/assessments/_new_form.html.erb +4 -0
  64. data/app/views/finance/admin/assessments/_show_table.html.erb +4 -0
  65. data/app/views/finance/admin/assessments/index.html.erb +5 -0
  66. data/app/views/finance/admin/base/_nav.html.erb +3 -0
  67. data/app/views/finance/admin/budgets/_breadcrumb.html.erb +9 -0
  68. data/app/views/finance/admin/budgets/_edit_form.html.erb +4 -0
  69. data/app/views/finance/admin/budgets/_filter_form.html.erb +10 -0
  70. data/app/views/finance/admin/budgets/_filter_table.html.erb +11 -0
  71. data/app/views/finance/admin/budgets/_form.html.erb +7 -0
  72. data/app/views/finance/admin/budgets/_index_tbody.html.erb +13 -0
  73. data/app/views/finance/admin/budgets/_index_thead.html.erb +6 -0
  74. data/app/views/finance/admin/budgets/_item_form.html.erb +17 -0
  75. data/app/views/finance/admin/budgets/_items.html.erb +16 -0
  76. data/app/views/finance/admin/budgets/_new_form.html.erb +4 -0
  77. data/app/views/finance/admin/budgets/_show/_breadcrumb.html.erb +6 -0
  78. data/app/views/finance/admin/budgets/_show_table.html.erb +62 -0
  79. data/app/views/finance/admin/budgets/index.html.erb +5 -0
  80. data/app/views/finance/admin/budgets/next.turbo_stream.erb +1 -0
  81. data/app/views/finance/admin/budgets/show.htmlx.erb +35 -0
  82. data/app/views/finance/admin/budgets/trigger.js.erb +1 -0
  83. data/app/views/finance/admin/expense_members/_edit_form.html.erb +3 -0
  84. data/app/views/finance/admin/expense_members/_form.html.erb +5 -0
  85. data/app/views/finance/admin/expense_members/_index_tbody.html.erb +53 -0
  86. data/app/views/finance/admin/expense_members/_index_thead.html.erb +12 -0
  87. data/app/views/finance/admin/expense_members/index.html.erb +8 -0
  88. data/app/views/finance/admin/expenses/_breadcrumb.html.erb +9 -0
  89. data/app/views/finance/admin/expenses/_edit_form.html.erb +4 -0
  90. data/app/views/finance/admin/expenses/_filter_form.html.erb +10 -0
  91. data/app/views/finance/admin/expenses/_filter_table.html.erb +11 -0
  92. data/app/views/finance/admin/expenses/_form.html.erb +12 -0
  93. data/app/views/finance/admin/expenses/_index_tbody.html.erb +13 -0
  94. data/app/views/finance/admin/expenses/_index_thead.html.erb +6 -0
  95. data/app/views/finance/admin/expenses/_item_form.html.erb +18 -0
  96. data/app/views/finance/admin/expenses/_items.html.erb +20 -0
  97. data/app/views/finance/admin/expenses/_member_form.html.erb +16 -0
  98. data/app/views/finance/admin/expenses/_new_form.html.erb +4 -0
  99. data/app/views/finance/admin/expenses/index.html.erb +5 -0
  100. data/app/views/finance/admin/expenses/next.turbo_stream.erb +1 -0
  101. data/app/views/finance/admin/expenses/show.html.erb +121 -0
  102. data/app/views/finance/admin/expenses/trigger.turbo_stream.erb +1 -0
  103. data/app/views/finance/admin/financial_taxons/_edit_form.html.erb +4 -0
  104. data/app/views/finance/admin/financial_taxons/_filter_form.html.erb +10 -0
  105. data/app/views/finance/admin/financial_taxons/_form.html.erb +5 -0
  106. data/app/views/finance/admin/financial_taxons/_index_tbody.html.erb +36 -0
  107. data/app/views/finance/admin/financial_taxons/_index_thead.html.erb +5 -0
  108. data/app/views/finance/admin/financial_taxons/_index_tr.html.erb +13 -0
  109. data/app/views/finance/admin/financial_taxons/_new_form.html.erb +4 -0
  110. data/app/views/finance/admin/financial_taxons/index.html.erb +6 -0
  111. data/app/views/finance/admin/fund_incomes/_breadcrumb.html.erb +7 -0
  112. data/app/views/finance/admin/fund_incomes/_edit_form.html.erb +4 -0
  113. data/app/views/finance/admin/fund_incomes/_filter_form.html.erb +9 -0
  114. data/app/views/finance/admin/fund_incomes/_form.html.erb +4 -0
  115. data/app/views/finance/admin/fund_incomes/_index_tbody.html.erb +5 -0
  116. data/app/views/finance/admin/fund_incomes/_index_thead.html.erb +4 -0
  117. data/app/views/finance/admin/fund_incomes/_new_form.html.erb +4 -0
  118. data/app/views/finance/admin/fund_incomes/_show_table.html.erb +12 -0
  119. data/app/views/finance/admin/fund_incomes/index.html.erb +5 -0
  120. data/app/views/finance/admin/funds/_edit_form.html.erb +3 -0
  121. data/app/views/finance/admin/funds/_filter_form.html.erb +9 -0
  122. data/app/views/finance/admin/funds/_form.html.erb +5 -0
  123. data/app/views/finance/admin/funds/_index_tbody.html.erb +14 -0
  124. data/app/views/finance/admin/funds/_index_thead.html.erb +8 -0
  125. data/app/views/finance/admin/funds/_new_form.html.erb +3 -0
  126. data/app/views/finance/admin/funds/_show_table.html.erb +16 -0
  127. data/app/views/finance/admin/funds/index.html.erb +5 -0
  128. data/app/views/finance/admin/home/index.html.erb +6 -0
  129. data/app/views/finance/admin/stocks/_breadcrumb.html.erb +7 -0
  130. data/app/views/finance/admin/stocks/_edit_form.html.erb +4 -0
  131. data/app/views/finance/admin/stocks/_filter_form.html.erb +9 -0
  132. data/app/views/finance/admin/stocks/_form.html.erb +4 -0
  133. data/app/views/finance/admin/stocks/_index_tbody.html.erb +6 -0
  134. data/app/views/finance/admin/stocks/_index_thead.html.erb +7 -0
  135. data/app/views/finance/admin/stocks/_new_form.html.erb +4 -0
  136. data/app/views/finance/admin/stocks/_show_table.html.erb +16 -0
  137. data/app/views/finance/admin/stocks/index.html.erb +5 -0
  138. data/app/views/finance/me/budgets/_breadcrumb.html.erb +6 -0
  139. data/app/views/finance/me/budgets/_filter_form.html.erb +8 -0
  140. data/app/views/finance/me/budgets/_filter_table.html.erb +11 -0
  141. data/app/views/finance/me/budgets/_index_tbody.html.erb +23 -0
  142. data/app/views/finance/me/budgets/_index_thead.html.erb +4 -0
  143. data/app/views/finance/me/budgets/_items.html.erb +22 -0
  144. data/app/views/finance/me/budgets/_show/_breadcrumb.html.erb +6 -0
  145. data/app/views/finance/me/budgets/admin.html.erb +5 -0
  146. data/app/views/finance/me/budgets/financial_taxons.js.erb +7 -0
  147. data/app/views/finance/me/budgets/index.html.erb +5 -0
  148. data/app/views/finance/me/budgets/index.js +45 -0
  149. data/app/views/finance/me/budgets/submit.turbo_stream.erb +1 -0
  150. data/app/views/finance/me/budgets/transfer.turbo_stream.erb +1 -0
  151. data/app/views/finance/me/expense_members/_breadcrumb.html.erb +6 -0
  152. data/app/views/finance/me/expense_members/_button.html.erb +0 -0
  153. data/app/views/finance/me/expense_members/_filter_form.html.erb +10 -0
  154. data/app/views/finance/me/expense_members/_form.html.erb +9 -0
  155. data/app/views/finance/me/expense_members/_index_tbody.html.erb +8 -0
  156. data/app/views/finance/me/expense_members/_index_thead.html.erb +7 -0
  157. data/app/views/finance/me/expense_members/_show_items.html.erb +1 -0
  158. data/app/views/finance/me/expense_members/admin.html.erb +3 -0
  159. data/app/views/finance/me/expense_members/index.html.erb +6 -0
  160. data/app/views/finance/me/expense_members/items.js.erb +1 -0
  161. data/app/views/finance/me/expense_members/show.html.erb +62 -0
  162. data/app/views/finance/me/expenses/_breadcrumb.html.erb +7 -0
  163. data/app/views/finance/me/expenses/_edit_form.html.erb +3 -0
  164. data/app/views/finance/me/expenses/_filter_form.html.erb +8 -0
  165. data/app/views/finance/me/expenses/_filter_table.html.erb +11 -0
  166. data/app/views/finance/me/expenses/_index_tbody.html.erb +16 -0
  167. data/app/views/finance/me/expenses/_index_thead.html.erb +6 -0
  168. data/app/views/finance/me/expenses/_index_tr.html.erb +14 -0
  169. data/app/views/finance/me/expenses/_new_form.html.erb +4 -0
  170. data/app/views/finance/me/expenses/_show/_breadcrumb.html.erb +6 -0
  171. data/app/views/finance/me/expenses/_show_table.html.erb +124 -0
  172. data/app/views/finance/me/expenses/admin.html.erb +5 -0
  173. data/app/views/finance/me/expenses/confirm.html.erb +27 -0
  174. data/app/views/finance/me/expenses/financial_taxons.js.erb +44 -0
  175. data/app/views/finance/me/expenses/index.html.erb +5 -0
  176. data/app/views/finance/me/expenses/index.js +42 -0
  177. data/app/views/finance/me/expenses/show.html.erb +3 -0
  178. data/app/views/me/_finance_nav.html.erb +11 -0
  179. data/config/locales/en.attributes.yml +6 -0
  180. data/config/locales/en.controller.yml +21 -0
  181. data/config/locales/en.enum.yml +18 -0
  182. data/config/locales/zh.attributes.yml +65 -0
  183. data/config/locales/zh.controller.yml +57 -0
  184. data/config/locales/zh.enum.yml +38 -0
  185. data/config/routes.rb +63 -0
  186. data/lib/rails_finance/config.rb +11 -0
  187. data/lib/rails_finance/engine.rb +26 -0
  188. data/lib/rails_finance/version.rb +3 -0
  189. data/lib/rails_finance.rb +2 -0
  190. metadata +259 -0
@@ -0,0 +1,5 @@
1
+ <%= render 'error_messages', target: @expense_member %>
2
+ <%= f.number_field :advance %>
3
+ <%= f.number_field :amount %>
4
+ <%= f.text_area :note %>
5
+ <%= f.submit %>
@@ -0,0 +1,53 @@
1
+ <td>
2
+ <p><%= expense_member.expense_subject %></p>
3
+ <p><%= expense_member.member.name %></p>
4
+ <p><%= expense_member.member.department&.full_name %></p>
5
+ </td>
6
+ <td><%= expense_member.amount %></td>
7
+ <td>
8
+ <% if expense_member.advance %>
9
+ <p>
10
+ <%= expense_member.advance %>
11
+ <% if expense_member.advance_payout_id %>
12
+ <%= link_to finance_payout_path(expense_member.advance_payout_id) do %>
13
+ <i class="money bill alternate icon"></i>
14
+ <% end %>
15
+ <% else %>
16
+ <%= link_to to_advance_pay_finance_expense_member_path(expense_member), method: :patch, aria: { label: 'to pay', confirm: 'Are you sure?' } do %>
17
+ <i class="share icon"></i>
18
+ <% end %>
19
+ <% end %>
20
+ </p>
21
+ <% end %>
22
+ <p>
23
+ <%= expense_member.payout_amount %>
24
+ <% if expense_member.payout_id %>
25
+ <%= link_to finance_payout_path(expense_member.payout_id) do %>
26
+ <i class="money bill alternate icon"></i>
27
+ <% end %>
28
+ <% else %>
29
+ <%= link_to to_pay_finance_expense_member_path(expense_member), method: :patch, aria: { label: 'to pay', confirm: 'Are you sure?' } do %>
30
+ <i class="share icon"></i>
31
+ <% end %>
32
+ <% end %>
33
+ </p>
34
+ </td>
35
+ <td class="ui labels">
36
+ <span class="ui label"><%= expense_member.state_i18n %></span>
37
+ <% if expense_member.can_operate?(current_member) %>
38
+ <div class="ui mini buttons">
39
+ <%= link_to 'Approve', new_check_path('ExpenseMember', expense_member.id, state: expense_member.next_state(:state)), class: 'ui mini positive button' %>
40
+ <div class="or"></div>
41
+ <%= link_to ExpenseMember.enum_i18n(:state, 'rejected'), new_check_path('Expense', expense_member.id, state: 'rejected'), class: 'ui mini negative button' %>
42
+ </div>
43
+ <% end %>
44
+ </td>
45
+ <td>
46
+ <%= link_to 'items', items_my_expense_member_path(expense_member), class: 'button is-small is-rounded is-light' %>
47
+ <%= link_to edit_finance_expense_member_path(expense_member), aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light' do %>
48
+ <i class="fas fa-pencil-alt"></i>
49
+ <% end %>
50
+ <%= link_to finance_expense_member_path(expense_member), method: :delete, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light' do %>
51
+ <i class="fas fa-trash"></i>
52
+ <% end %>
53
+ </td>
@@ -0,0 +1,12 @@
1
+ <th>
2
+ <p><%= Finance::Expense.human_attribute_name(:subject) %></p>
3
+ <p><%= ExpenseMember.human_attribute_name(:member) %></p>
4
+ <p><%= Member.human_attribute_name(:department) %></p>
5
+ </th>
6
+ <th><%= Finance::ExpenseMember.human_attribute_name(:amount) %></th>
7
+ <th>
8
+ <p><%= Finance::ExpenseMember.human_attribute_name(:advance) %></p>
9
+ <p><%= Finance::ExpenseMember.human_attribute_name(:payout_amount) %></p>
10
+ </th>
11
+ <th><%= Finance::ExpenseMember.human_attribute_name(:state) %></th>
12
+ <th></th>
@@ -0,0 +1,8 @@
1
+ <div class="ui segment breadcrumb">
2
+ <%= link_to 'Back', finance_expenses_path(id: @expense.id), class: 'section' %>
3
+ <div class="divider"> / </div>
4
+ <div class="active section">Expense members</div>
5
+ </div>
6
+ <%= render 'nav_expense' %>
7
+
8
+ <%= render 'index_table' %>
@@ -0,0 +1,9 @@
1
+ <div class="breadcrumb has-succeeds-separator">
2
+ <ul>
3
+ <% if params[:fund_id] %>
4
+ <li><%= link_to t('finance.admin.funds.index.title'), { controller: 'funds' } %></li>
5
+ <li><%= link_to @fund.name, { controller: 'funds', action: 'index', id: @fund.id } %></li>
6
+ <% end %>
7
+ <li class="is-active"><%= t('.title') %></li>
8
+ </ul>
9
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= form_with model: @expense, scope: :expense, url: { action: 'update' } do |f| %>
2
+ <%= render partial: 'form', locals: { f: f } %>
3
+ <%= f.submit %>
4
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= form_with theme: 'search', model: Finance::Expense.new do |f| %>
2
+ <div class="field-body">
3
+ <%= f.text_field 'subject-like' %>
4
+ <%= f.number_field :amount %>
5
+ <div class="field is-narrow">
6
+ <%= f.submit %>
7
+ <%= link_to t('.clear'), filter_params(except: [:name]), class: 'button is-light' %>
8
+ </div>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <table class="as-search">
2
+ <tr>
3
+ <th><%= Finance::Expense.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::Expense.states.keys.each do |state| %>
7
+ <%= link_to Finance::Expense.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,12 @@
1
+ <%= render 'error_messages', target: f.object %>
2
+ <%= f.select :type, options_for_select(Finance::Expense.options_i18n(:type), f.object.type) %>
3
+ <%= f.text_field :subject, required: true %>
4
+ <%= f.collection_select :financial_taxon_id, @financial_taxons, :id, :name, include_blank: true %>
5
+ <%= f.fields :expense_items, wrap: { all: nil, input: 'field is-narrow' }, on: { label: false, placeholder: true } do |ef| %>
6
+ <%= render partial: 'item_form', locals: { ef: ef } %>
7
+ <% end %>
8
+ <%= f.fields :expense_members, wrap: { all: nil, input: 'field is-narrow' }, on: { label: false, placeholder: true } do |ef| %>
9
+ <%= render partial: 'member_form', locals: { ef: ef } %>
10
+ <% end %>
11
+ <%= f.text_area :note %>
12
+ <%= f.file_field :proof %>
@@ -0,0 +1,13 @@
1
+ <td><%= expense.subject %></td>
2
+ <td><%= expense.creator.name %></td>
3
+ <td><%= expense.amount %></td>
4
+ <td class="tags">
5
+ <span class="tag"><%= expense.state_i18n %></span>
6
+ <% if expense.can_operate?(current_member) %>
7
+ <div class="buttons has-addons">
8
+ <%= link_to 'Approve', new_admin_verification_path('Expense', expense.id), class: 'button is-primary' %>
9
+ <%= link_to Expense.enum_i18n(:state, 'rejected'), new_admin_verification_path('Expense', expense.id, state: 'rejected'), class: 'button is-danger' %>
10
+ </div>
11
+ <% end %>
12
+ </td>
13
+ <td><time data-controller="time"><%= expense.created_at.to_s(:rfc822) %></time></td>
@@ -0,0 +1,6 @@
1
+ <th><%= Finance::Expense.human_attribute_name(:subject) %></th>
2
+ <th><%= Finance::Expense.human_attribute_name(:creator) %></th>
3
+ <th><%= Finance::Expense.human_attribute_name(:amount) %></th>
4
+ <th><%= Finance::Expense.human_attribute_name(:state) %></th>
5
+ <th><%= Finance::Expense.human_attribute_name(:created_at) %></th>
6
+ <th></th>
@@ -0,0 +1,18 @@
1
+ <div class="field is-horizontal" data-controller="expense field" data-field-index-value="<%= ef.index %>">
2
+ <% if ef.index == 0 %>
3
+ <%= ef.options[:parent_builder].label :expense_items %>
4
+ <% else %>
5
+ <label class="field-label is-normal"></label>
6
+ <% end %>
7
+ <div class="field-body">
8
+ <%# ef.select :financial_taxon_id, options_for_select(@taxon_options, ef.object.financial_taxon_id), { include_blank: 'Select Taxon', css: { wrapper_input: 'three wide field' }}, {data: {title: 'expense_item_financial_taxon'}} %>
9
+ <%= ef.text_field :note %>
10
+ <%= ef.number_field :quantity, step: 1, data: { action: 'expense#updateQuantity' } %>
11
+ <%= ef.number_field :price, data: { action: 'expense#updatePrice' } %>
12
+ <%= ef.number_field :amount, data: { action: 'expense#updateAmount' } %>
13
+ <div class="field has-addons is-flex">
14
+ <i class="fas fa-plus" style="cursor: pointer" data-action="click->field#add"></i>
15
+ <i class="fas fa-minus" style="cursor: pointer" data-action="click->field#remove"></i>
16
+ </div>
17
+ </div>
18
+ </div>
@@ -0,0 +1,20 @@
1
+ <table class="table is-fullwidth">
2
+ <tr>
3
+ <th><%= Finance::ExpenseItem.human_attribute_name(:id) %></th>
4
+ <th><%= Finance::ExpenseItem.human_attribute_name(:financial_taxon) %></th>
5
+ <th><%= Finance::ExpenseItem.human_attribute_name(:note) %></th>
6
+ <th><%= Finance::ExpenseItem.human_attribute_name(:budget) %></th>
7
+ <th><%= Finance::ExpenseItem.human_attribute_name(:amount) %></th>
8
+ <th></th>
9
+ </tr>
10
+ <% expense_items.each do |item| %>
11
+ <tr>
12
+ <td><%= item.id %></td>
13
+ <td><%= item.financial_taxon&.name %></td>
14
+ <td><%= item.note %></td>
15
+ <td><%= item.budget %></td>
16
+ <td><%= item.amount %></td>
17
+ <td></td>
18
+ </tr>
19
+ <% end %>
20
+ </table>
@@ -0,0 +1,16 @@
1
+ <div class="field is-horizontal" data-controller="field" data-field-index-value="<%= ef.index %>">
2
+ <% if ef.index == 0 %>
3
+ <%= ef.options[:parent_builder].label :expense_members %>
4
+ <% else %>
5
+ <label class="field-label is-normal"></label>
6
+ <% end %>
7
+ <div class="field-body">
8
+ <%= ef.select :member_id, options_for_select([[ef.object.member&.name, ef.object.member_id]], ef.object.member_id), include_blank: true, wrap: { input: 'three wide field' }, disabled: ef.object.persisted? %>
9
+ <%= ef.number_field :advance, readonly: true %>
10
+ <%= ef.number_field :amount %>
11
+ <div class="field has-addons is-flex">
12
+ <i class="fas fa-plus" style="cursor: pointer" data-action="click->field#add"></i>
13
+ <i class="fas fa-minus" style="cursor: pointer" data-action="click->field#remove"></i>
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= form_with model: @expense, scope: :expense, url: { action: 'create' } do |f| %>
2
+ <%= render partial: 'form', locals: { f: f } %>
3
+ <%= f.submit %>
4
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= render layout: 'index_table', locals: { cache_key: Finance::Expense.column_names.hash } do %>
2
+ <%= render partial: 'index_tbody', collection: @expenses, as: :expense %>
3
+ <% end %>
4
+
5
+ <%= paginate @expenses %>
@@ -0,0 +1 @@
1
+ <%= render 'visit' %>
@@ -0,0 +1,121 @@
1
+ <% content_for :breadcrumb do %>
2
+ <div class="breadcrumb has-succeeds-separator">
3
+ <ul>
4
+ <li><%= link_to 'Back', admin_expenses_path(id: @expense.id) %></li>
5
+ <li class="is-active">Expense members</li>
6
+ </ul>
7
+ </div>
8
+ <% end %>
9
+
10
+ <%= render 'nav_expense' %>
11
+
12
+ <table class="ui attached basic large table">
13
+ <tbody>
14
+ <tr>
15
+ <td class="six wide has-text-right"><%= Expense.human_attribute_name(:subject) %></td>
16
+ <td><%= @expense.subject %></td>
17
+ </tr>
18
+ <tr>
19
+ <td class="has-text-right"><%= Expense.human_attribute_name(:checks) %></td>
20
+ <td>
21
+ <table class="ui very basic table">
22
+ <% @expense.checks.each do |check| %>
23
+ <tr>
24
+ <td><%= Expense.enum_i18n(:state, check.state) %></td>
25
+ <td><%= check.comment %></td>
26
+ <td><%= check.member.name %></td>
27
+ </tr>
28
+ <% end %>
29
+ </table>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td class="has-text-right"><%= Expense.human_attribute_name(:amount) %></td>
34
+ <td><%= @expense.amount %></td>
35
+ </tr>
36
+ <tr>
37
+ <td class="has-text-right"><%= Expense.human_attribute_name(:expense_items) %></td>
38
+ <td>
39
+ <%= render partial: 'finance/admin/expenses/items', locals: { expense_items: @expense_items } %>
40
+ </td>
41
+ </tr>
42
+ </tbody>
43
+ </table>
44
+
45
+ <table class="table is-hoverable is-fullwidth">
46
+ <thead>
47
+ <tr>
48
+ <th><%= ExpenseMember.human_attribute_name(:id) %></th>
49
+ <th>
50
+ <p><%= ExpenseMember.human_attribute_name(:member) %></p>
51
+ <p><%= Member.human_attribute_name(:department) %></p>
52
+ </th>
53
+ <th><%= ExpenseMember.human_attribute_name(:amount) %></th>
54
+ <th>
55
+ <p><%= ExpenseMember.human_attribute_name(:advance) %></p>
56
+ <p><%= ExpenseMember.human_attribute_name(:payout_amount) %></p>
57
+ </th>
58
+ <th><%= ExpenseMember.human_attribute_name(:state) %></th>
59
+ <th>Actions</th>
60
+ </tr>
61
+ </thead>
62
+ <tbody>
63
+ <% @expense_members.each do |expense_member| %>
64
+ <tr>
65
+ <td><%= expense_member.id %></td>
66
+ <td>
67
+ <p><%= expense_member.member.name %></p>
68
+ <p><%= expense_member.member.department&.full_name %></p>
69
+ </td>
70
+ <td><%= expense_member.amount %></td>
71
+ <td>
72
+ <% if expense_member.advance %>
73
+ <p>
74
+ <%= expense_member.advance %>
75
+ <% if expense_member.advance_payout_id %>
76
+ <%= link_to finance_payout_path(expense_member.advance_payout_id) do %>
77
+ <i class="money bill alternate icon"></i>
78
+ <% end %>
79
+ <% else %>
80
+ <%= link_to to_advance_pay_finance_expense_member_path(expense_member), method: :patch, aria: { label: 'to pay', confirm: 'Are you sure?' } do %>
81
+ <i class="share icon"></i>
82
+ <% end %>
83
+ <% end %>
84
+ </p>
85
+ <% end %>
86
+ <p>
87
+ <%= expense_member.payout_amount %>
88
+ <% if expense_member.payout_id %>
89
+ <%= link_to admin_payout_path(expense_member.payout_id) do %>
90
+ <i class="money bill alternate icon"></i>
91
+ <% end %>
92
+ <% else %>
93
+ <%= link_to to_pay_admin_expense_member_path(expense_member), method: :patch, aria: { label: 'to pay', confirm: 'Are you sure?' } do %>
94
+ <i class="share icon"></i>
95
+ <% end %>
96
+ <% end %>
97
+ </p>
98
+ </td>
99
+ <td class="ui labels">
100
+ <span class="ui label"><%= expense_member.state_i18n %></span>
101
+ <% if expense_member.can_operate?(current_member) %>
102
+ <div class="ui mini buttons">
103
+ <%= link_to 'Approve', new_check_path('ExpenseMember', expense_member.id, state: expense_member.next_state(:state)), class: 'ui mini positive button' %>
104
+ <div class="or"></div>
105
+ <%= link_to ExpenseMember.enum_i18n(:state, 'rejected'), new_check_path('Expense', expense_member.id, state: 'rejected'), class: 'ui mini negative button' %>
106
+ </div>
107
+ <% end %>
108
+ </td>
109
+ <td>
110
+ <%= link_to 'items', items_my_expense_member_path(expense_member), class: 'ui blue label' %>
111
+ <%= link_to edit_admin_expense_member_path(expense_member), class: 'ui pink mini icon button' do %>
112
+ <i class="pencil alternate icon"></i>
113
+ <% end %>
114
+ <%= link_to admin_expense_member_path(expense_member), method: :delete, data: { confirm: 'Are you sure?' }, class: 'ui red mini icon button' do %>
115
+ <i class="times icon"></i>
116
+ <% end %>
117
+ </td>
118
+ </tr>
119
+ <% end %>
120
+ </tbody>
121
+ </table>
@@ -0,0 +1 @@
1
+ <%= render 'visit' %>
@@ -0,0 +1,4 @@
1
+ <%= form_with model: @financial_taxon, url: { action: 'update' } do |f| %>
2
+ <%= render partial: 'form', locals: { f: f } %>
3
+ <%= f.submit %>
4
+ <% end %>
@@ -0,0 +1,10 @@
1
+ <%= form_with theme: 'search', model: Finance::FinancialTaxon.new do |f| %>
2
+ <div class="field-body">
3
+ <%= f.text_field :name %>
4
+ <div class="field is-narrow">
5
+ <%= f.submit %>
6
+ </div>
7
+ </div>
8
+ <% end %>
9
+
10
+
@@ -0,0 +1,5 @@
1
+ <%= render 'error_messages', target: f.object %>
2
+ <%= f.text_field :name %>
3
+ <%= render partial: 'com/nodes/siblings_select', locals: { f: f, node: @financial_taxon_root } %>
4
+ <%= f.check_box :take_stock %>
5
+ <%= f.check_box :individual %>
@@ -0,0 +1,36 @@
1
+ <td>
2
+ <span style="width: <%= model.depth * 1.43 %>em; display: inline-block"></span>
3
+ <% if !model.leaf? %>
4
+ <i class="fas fa-caret-down fa-fw" data-action="click->tree#collapse" style="cursor: pointer"></i>
5
+ <% else %>
6
+ <i class="fas fa-minus fa-fw"></i>
7
+ <% end %>
8
+ <span><%= model.name %></span>
9
+ <% if model.organ != current_organ %>
10
+ <span aria-label="<%= model.organ.name %>"><i class="fas fa-angle-double-up has-text-grey-light"></i></span>
11
+ <% end %>
12
+ </td>
13
+ <td>
14
+ <% model.verifiers.each do |verifier| %>
15
+ <p><%= verifier.job_title.name %><%= verifier.member&.name %></p>
16
+ <% end %>
17
+ <p>
18
+ <%= link_to({ controller: 'auditor/admin/verifiers', action: 'new', verifiable_type: 'Finance::FinancialTaxon', verifiable_id: model.id }, data: { turbo_frame: 'modal' }, class: 'button is-rounded is-small') do %>
19
+ <i class="fas fa-user-check"></i>
20
+ <% end %>
21
+ </p>
22
+ </td>
23
+ <td>
24
+ <%= form_with theme: nil, model: model, url: { action: 'update', id: model.id }, data: { controller: 'input' } do |f| %>
25
+ <%= f.check_box :take_stock, data: { input_target: 'checkbox' }, id: nil, class: 'switch is-rounded' %>
26
+ <label data-action="click->input#check"></label>
27
+ <%= f.submit nil, data: { input_target: 'submit' }, style: 'display: none' %>
28
+ <% end %>
29
+ </td>
30
+ <td>
31
+ <%= form_with theme: nil, model: model, url: { action: 'update', id: model.id }, data: { controller: 'input' } do |f| %>
32
+ <%= f.check_box :individual, data: { input_target: 'checkbox' }, id: nil, class: 'switch is-rounded' %>
33
+ <label data-action="click->input#check"></label>
34
+ <%= f.submit nil, data: { input_target: 'submit' }, style: 'display: none' %>
35
+ <% end %>
36
+ </td>
@@ -0,0 +1,5 @@
1
+ <th><%= Finance::FinancialTaxon.human_attribute_name(:name) %></th>
2
+ <th><%= Finance::FinancialTaxon.human_attribute_name(:verifiers) %></th>
3
+ <th><%= Finance::FinancialTaxon.human_attribute_name(:take_stock) %></th>
4
+ <th><%= Finance::FinancialTaxon.human_attribute_name(:individual) %></th>
5
+ <th></th>
@@ -0,0 +1,13 @@
1
+ <tr id="tr_<%= model.id %>" data-depth="<%= model.depth_str %>" data-controller="show" data-action="mouseenter->show#show mouseleave->show#hide">
2
+ <%= yield %>
3
+ <td>
4
+ <span data-show-target="item" style="visibility: hidden">
5
+ <%= link_to({ action: 'edit', id: model.id }, data: { turbo_frame: 'modal' }, aria: { label: t('.edit') }, class: 'button is-small is-rounded is-light') do %>
6
+ <i class="fas fa-pencil-alt"></i>
7
+ <% end %>
8
+ <%= button_to({ action: 'destroy', id: model.id }, method: :delete, aria: { label: t('.destroy') }, data: { confirm: t('.confirm') }, class: 'button is-small is-rounded is-light') do %>
9
+ <i class="fas fa-trash-alt"></i>
10
+ <% end %>
11
+ </span>
12
+ </td>
13
+ </tr>