Module: VouchersHelper
- Defined in:
- app/helpers/vouchers_helper.rb
Overview
== Schema Information
Table name: vouchers
id :integer not null, primary key
reference_number :string(255)
category :string(255)
company_id :integer
supplier_id :integer
invoice_number :string(255)
invoice_date :date
gl_date :date
currency :string(255)
exchange_rate :float
business_unit_id :integer
payment_terms :string(255)
state :string(255)
creator_id :integer
updater_id :integer
created_at :datetime
updated_at :datetime
order_id :integer
reversal_date :date
Instance Method Summary collapse
- #voucher_command_options(voucher) ⇒ Object
- #voucher_imported_actions(voucher, default_link_options = {}) ⇒ Object
Instance Method Details
#voucher_command_options(voucher) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/vouchers_helper.rb', line 28 def (voucher) links = [] links << fa_icon('shuffle', text: voucher.human_state_name.titleize) links << link_to("Edit", edit_voucher_path(voucher)) if voucher.draft? links << link_to("Delete", voucher_path(voucher), data: { turbo_confirm: "Are you sure you want to delete this voucher?", turbo_method: :delete }) links << link_to("GL Distribution", gl_distribution_voucher_path(voucher)) end if voucher.can_be_voided? links << link_to("Void", void_voucher_path(voucher), data: { turbo_confirm: "Are you sure you want to void this voucher?" }) links << link_to("Reverse", reverse_voucher_path(voucher)) end links end |
#voucher_imported_actions(voucher, default_link_options = {}) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'app/helpers/vouchers_helper.rb', line 43 def voucher_imported_actions(voucher, ={}) actions = [] actions << link_to(fa_icon('file', text: 'View'), voucher_path(voucher), target: '_blank', rel: "noopener noreferrer" ) if can?(:update, voucher) actions << link_to(fa_icon('pen-to-square', text: 'Edit'), edit_voucher_path(voucher, return_path: request.fullpath), target: '_blank', rel: "noopener noreferrer") end actions end |