Skip to content

Commit

Permalink
add collaborator to expense
Browse files Browse the repository at this point in the history
  • Loading branch information
baldarn committed Sep 10, 2024
1 parent 7f96c54 commit 3c98bde
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/expenses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ def send_receipt
private

def expense_params
params.require(:expense).permit(:amount, :expense_reason_id)
params.require(:expense).permit(:amount, :user_id, :expense_reason_id)
end
end
1 change: 1 addition & 0 deletions app/views/expenses/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<%= simple_form_for [@club, expense] do |f| %>
<%= f.association :user, label_method: :full_name, collection: @club.users %>
<%= f.input :amount, as: :integer %>
<%= f.association :expense_reason, required: true, label_method: :reason, collection: @club.expense_reasons %>
<%= f.button :submit, 'Salva spesa' %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/users/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<td><%= User.human_attribute_name("role.#{user.role}") %></td>
<td><%= user.blsd_expires_at %></td>
<td>
<%= link_to new_club_expense_path(@club, user), class: 'text-decoration-none' do %>
<%= image_tag "cash.svg", aria: { hidden: true }, size: 24 %>
<% end %>
<%= link_to edit_club_user_path(@club, user), class: 'text-decoration-none' do %>
<%= image_tag "edit.svg", aria: { hidden: true }, size: 24 %>
<% end %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ it:
expense:
amount: Quota
expense_reason: Causale
user: Collaboratore
created_at: Data
expense_reason:
reason: Causale

0 comments on commit 3c98bde

Please sign in to comment.