Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified process refund view to integrate customized method. #375

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/kaui/refunds/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<% bundle_result = @bundles.find { |bundle| bundle.bundle_id == ii.bundle_id } %>
<div class="col-sm-10">
<input type="checkbox" id=<%= "cb_adj_#{ii.invoice_item_id}" %>>
<%= "Item #{index + 1} : #{ii.description} #{"(bundle #{bundle_result.external_key})" unless bundle_result.nil?}" %>
<%= Kaui.refund_invoice_description.call(index, ii, bundle_result) %>
<%= text_field_tag "adjustments[#{ii.invoice_item_id}]", index, :id => "tf_adj_#{ii.invoice_item_id}", :value => ii.amount, :class => 'form-control' %>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions lib/kaui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Kaui
mattr_accessor :account_search_columns
mattr_accessor :invoice_search_columns
mattr_accessor :account_invoices_columns
mattr_accessor :refund_invoice_description

mattr_accessor :customer_invoice_link

Expand Down Expand Up @@ -97,6 +98,10 @@ module Kaui
]
end

self.refund_invoice_description = lambda { |index, ii, bundle_result|
"Item #{index + 1} : #{ii.description} #{"(bundle #{bundle_result.external_key})" unless bundle_result.nil?}"
}

self.customer_invoice_link = ->(invoice, ctx) { ctx.link_to 'View customer invoice html', ctx.kaui_engine.show_html_invoice_path(invoice.invoice_id), class: 'btn', target: '_blank' }

self.demo_mode = false
Expand Down