Sha256: e9a25d95b9e3ee05f0a637cf5f141e5054cd06e2a8680b955bf741cbaa98deb6

Contents?: true

Size: 1.18 KB

Versions: 15

Compression:

Stored size: 1.18 KB

Contents

module Spree
  module Admin
    module StockTransfersHelper
      def handle_stock_transfer(stock_transfer)
        if can?(:show, stock_transfer)
          link_to stock_transfer.number, admin_stock_transfer_path(stock_transfer)
        else
          stock_transfer.number
        end
      end

      def stock_transfer_edit_or_ship_path(stock_transfer)
        if stock_transfer.finalized?
          tracking_info_admin_stock_transfer_path(stock_transfer)
        else
          edit_admin_stock_transfer_path(stock_transfer)
        end
      end

      def stock_transfer_status(stock_transfer)
        stock_transfer.closed? ? Spree.t(:closed) : Spree.t(:open)
      end

      def deleted_variant_admin_hint(variant)
        newer_variant_with_same_sku = Spree::Variant.find_by(sku: variant.sku)
        hint_type = newer_variant_with_same_sku ? :deleted_explanation_with_replacement : :deleted_explanation
        hint_text = I18n.t(
          hint_type,
          scope: [:spree, :hints, "spree/variant"],
          date: variant.deleted_at
        )
        admin_hint(
          I18n.t(:deleted, scope: [:spree, :hints, "spree/variant"]),
          hint_text
        )
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
solidus_backend-2.3.1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.2.2 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.1.1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.3.0 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.3.0.rc3 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.3.0.rc2 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.3.0.rc1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.3.0.beta1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.2.1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.2.0 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.2.0.rc1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.2.0.beta1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.1.0 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.1.0.rc1 app/helpers/spree/admin/stock_transfers_helper.rb
solidus_backend-2.1.0.beta1 app/helpers/spree/admin/stock_transfers_helper.rb