Sha256: d31c206d3123732bc3f41404a5290bdd5892b694ed4745423d56c4ef44a66620

Contents?: true

Size: 505 Bytes

Versions: 2

Compression:

Stored size: 505 Bytes

Contents

module Workarea
  decorate Admin::UserViewModel, with: :avatax do
    def avatax_usage_options
      Avatax::UsageType.all.map do |usage_type|
        [usage_type_display(usage_type), usage_type.code]
      end
    end

    private

    def usage_type_display(usage_type)
      countries =
        if usage_type.countries.empty?
          ""
        else
          "(#{usage_type.countries.map(&:local_name).join(', ')})"
        end
      [usage_type.name, countries].compact.join(' ')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-avatax-4.2.1 app/view_models/workarea/admin/user_view_model.decorator
workarea-avatax-4.2.0 app/view_models/workarea/admin/user_view_model.decorator