<%= @user.username %>
<% current_credits = @user.unspent_credits_count %>
Available User Credits: <%= current_credits %>
<%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<%= f.number_field :add_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control" %>
<%= f.submit "Add Credits", class: "btn btn-primary" %>
<% end %>
<% if current_credits.positive? %>
<%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<%= f.number_field :remove_credits, in: 1..current_credits, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control" %>
<%= f.submit "Remove Credits", class: "btn btn-danger" %>
<% end %>
<% end %>
<% if @organizations.present? %>
Organizations
<%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<%= f.number_field :add_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control mr-3" %>
<%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %>
<%= f.submit "Add Org Credits", class: "btn btn-primary" %>
<% end %>
<%= form_with scope: :user, url: admin_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<%= f.number_field :remove_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control mr-3" %>
<%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %>
<%= f.submit "Remove Org Credits", class: "btn btn-danger" %>
<% end %>
<% end %>