<%= form_for(@credit, :url => {:action => :create}, :html => {:class => 'form-horizontal'}) do |f| %> <%= f.hidden_field :account_id %>
<% if @invoice.present? %> <%= f.hidden_field :invoice_id %> <%= hidden_field_tag :currency, @invoice.currency %>
<% end %>
<%= f.label :credit_amount, 'Credit amount', :class => 'control-label' %>
<%= f.text_field :credit_amount, :id => 'credit_amount', :class => 'input-small' %> <% if @invoice.present? %>

<%= @invoice.currency %>

<% end %>
<% unless @invoice.present? %>
<%= label_tag :currency, 'Currency', :class => 'control-label' %>
<%= select_tag :currency, options_for_select(currencies, :selected => 'USD'), :class => 'input-small' %>
<% end %>
<%= label_tag :reason, 'Reason', :class => 'control-label' %>
<%= select_tag :reason, options_for_select(Kaui::Credit::SAMPLE_REASON_CODES) %>
<%= label_tag :comment, 'Comment', :class => 'control-label' %>
<%= text_area_tag :comment, '', :rows => 3, :class => 'input-xlarge' %>
<%= button_tag 'Create credit', :class => 'btn btn-primary' %> <%= link_to 'Back', :back, :class => 'btn' %>
<% end %> <%= javascript_tag do %> $(document).ready(function() { $("#credit_amount").keydown(function(event) { preventNonNumericValues(event); }); }); <% end %>