Sha256: 5b7e2d0fabfe690ba209d491a71efbc5ca02fd2c00a517e0d6b909c00cb80f06

Contents?: true

Size: 1.19 KB

Versions: 8

Compression:

Stored size: 1.19 KB

Contents

module Dorsale::BillingMachine::ApplicationHelper
  def billing_machine_quotation_states_for_select
    ::Dorsale::BillingMachine::Quotation::STATES.map do |e|
      [
        ::Dorsale::BillingMachine::Quotation.t("state.#{e}"),
        e,
      ]
    end
  end

  def billing_machine_quotation_states_for_filter_select
      [
        [::Dorsale::BillingMachine::Quotation.t("state.all"), ""],
        [::Dorsale::BillingMachine::Quotation.t("state.not_canceled"), "not_canceled"],
      ] + billing_machine_quotation_states_for_select
  end

  def billing_machine_payment_status_for_filter_select
    {
      ::Dorsale::BillingMachine::Invoice.t("payment_status.all")     => "",
      ::Dorsale::BillingMachine::Invoice.t("payment_status.unpaid")  => "unpaid",
      ::Dorsale::BillingMachine::Invoice.t("payment_status.pending") => "pending",
      ::Dorsale::BillingMachine::Invoice.t("payment_status.late")    => "late",
      ::Dorsale::BillingMachine::Invoice.t("payment_status.paid")    => "paid",
    }
  end

  def quotation_state_classes(quotation)
    if quotation.state == "pending" && quotation.date < 1.month.ago
      return "pending late"
    else
      return quotation.state
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dorsale-3.1.7 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.6 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.5 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.4 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.3 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.2 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.1 app/helpers/dorsale/billing_machine/application_helper.rb
dorsale-3.1.0 app/helpers/dorsale/billing_machine/application_helper.rb