Class: Admin::PaymentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::PaymentsController
- Includes:
- AdminLayoutHelper, ApplicationHelper, ExtensibleObjectHelper
- Defined in:
- app/controllers/admin/payments_controller.rb
Instance Method Summary collapse
Methods included from ApplicationHelper
#define_application_layout_variables, #h_money, #money_for_input
Methods included from ExtensibleObjectHelper
Methods included from AdminLayoutHelper
append_features, #controller_url, #define_layout_variables, #index_with_admin_helper
Instance Method Details
#on_invoice_assignment_observation ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/admin/payments_controller.rb', line 43 def on_invoice_assignment_observation record_id = (/^[\d]+$/.match(params[:record_id])) ? params[:record_id].to_i : nil # TODO: if amount is no integer - highlight... render(:update) do |page| #TODO: We need to load the pre-existing payment here... # Let's do some (minimal) Amount input handling unless params[:amount].empty? begin record_amount_js_id = "record_amount_#{record_id}" new_amount = Money.new($1.to_f*100) if /^[ ]*([\d]+\.[\d]{0,2}|[\d]+)[ ]*$/.match params[:amount] raise StandardError unless new_amount page[record_amount_js_id].value = new_amount.to_s page.replace_html "record_unallocated_amount_#{record_id}", :text => h_money(new_amount) rescue page[record_amount_js_id].value = '' page[record_amount_js_id].focus page.visual_effect :highlight, record_amount_js_id, :duration => 3, :startcolor => "#FF0000" end end # TODO: Generate the invoices div... end end |