comable-core 0.7.0.beta1 → 0.7.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -2
  3. data/app/controllers/concerns/comable/permitted_attributes.rb +1 -0
  4. data/app/helpers/comable/application_helper.rb +4 -0
  5. data/app/models/comable/inventory/adjuster.rb +40 -0
  6. data/app/models/comable/inventory/coordinator.rb +56 -0
  7. data/app/models/comable/inventory/package.rb +47 -0
  8. data/app/models/comable/inventory/packer.rb +25 -0
  9. data/app/models/comable/inventory/unit.rb +22 -0
  10. data/app/models/comable/navigation.rb +2 -0
  11. data/app/models/comable/navigation_item.rb +29 -6
  12. data/app/models/comable/order/associations.rb +2 -2
  13. data/app/models/comable/order/deprecated_methods.rb +27 -0
  14. data/app/models/comable/order/validations.rb +1 -1
  15. data/app/models/comable/order.rb +25 -11
  16. data/app/models/comable/order_item.rb +12 -40
  17. data/app/models/comable/page.rb +3 -3
  18. data/app/models/comable/payment_method.rb +2 -0
  19. data/app/models/comable/product.rb +16 -12
  20. data/app/models/comable/shipment.rb +26 -5
  21. data/app/models/comable/shipment_item.rb +47 -0
  22. data/app/models/comable/shipment_method.rb +1 -0
  23. data/app/models/comable/stock.rb +13 -9
  24. data/app/models/comable/stock_location.rb +29 -0
  25. data/app/models/comable/theme.rb +2 -0
  26. data/app/models/comable/tracker.rb +3 -2
  27. data/app/models/comable/user.rb +1 -0
  28. data/app/models/comable/variant/quantifier.rb +27 -0
  29. data/app/models/comable/variant.rb +25 -12
  30. data/app/models/concerns/comable/cart_owner.rb +1 -5
  31. data/app/models/concerns/comable/checkout.rb +4 -7
  32. data/app/models/concerns/comable/linkable.rb +11 -22
  33. data/app/models/concerns/comable/product/search.rb +1 -1
  34. data/app/views/comable/order_mailer/complete.text.erb +2 -3
  35. data/config/locales/en.yml +14 -0
  36. data/config/locales/ja.yml +14 -0
  37. data/db/migrate/20150918065115_add_property_to_comable_products.rb +5 -0
  38. data/db/migrate/20150924010143_create_comable_stock_locations.rb +11 -0
  39. data/db/migrate/20150924102640_add_stock_location_id_to_comable_stocks.rb +10 -0
  40. data/db/migrate/20150924111838_add_stock_location_id_to_comable_shipments.rb +7 -0
  41. data/db/migrate/20150924114017_set_default_stock_location.rb +28 -0
  42. data/db/migrate/20151012143215_create_comable_shipment_items.rb +11 -0
  43. data/db/migrate/20151013082845_remove_null_option_of_shipment_method_id_on_comable_shipments.rb +10 -0
  44. data/db/migrate/20151013194926_add_guest_token_index_to_comable_orders.rb +5 -0
  45. metadata +20 -3
@@ -5,7 +5,6 @@ module Comable
5
5
  include Comable::Liquidable
6
6
  include Comable::Product::Search
7
7
  include Comable::Product::Csvable
8
- include Comable::Linkable
9
8
 
10
9
  has_many :variants, class_name: Comable::Variant.name, inverse_of: :product, dependent: :destroy
11
10
  has_many :images, class_name: Comable::Image.name, dependent: :destroy
@@ -15,6 +14,7 @@ module Comable
15
14
  accepts_nested_attributes_for :images, allow_destroy: true
16
15
 
17
16
  scope :published, -> (published_at = nil) { where('published_at <= ?', published_at || Time.now) }
17
+ scope :by_newest, -> { reorder(created_at: :desc) }
18
18
 
19
19
  validates :name, presence: true, length: { maximum: 255 }
20
20
 
@@ -22,8 +22,6 @@ module Comable
22
22
 
23
23
  ransack_options attribute_select: { associations: [:variants, :stocks, :option_types] }
24
24
 
25
- linkable_columns_keys use_index: true
26
-
27
25
  PREVIEW_SESSION_KEY = :preview_product
28
26
 
29
27
  # Add conditions for the images association.
@@ -39,7 +37,7 @@ module Comable
39
37
  end
40
38
 
41
39
  def stocked?
42
- stocks.stocked.exists?
40
+ variants.any?(&:can_supply?)
43
41
  end
44
42
 
45
43
  def unstocked?
@@ -58,6 +56,10 @@ module Comable
58
56
  option_types.empty?
59
57
  end
60
58
 
59
+ def as_json(options = nil)
60
+ super (options || {}).merge(methods: [:variants])
61
+ end
62
+
61
63
  def sku_h_item_name
62
64
  option_types.first.try(:name)
63
65
  end
@@ -85,22 +87,24 @@ module Comable
85
87
  has_many :stocks, class_name: Comable::Stock.name, through: :variants
86
88
 
87
89
  def stocks=(stocks)
88
- stocks.map { |stock| variants.build(stock: stock) }
89
- end
90
-
91
- def build_option_type
92
- Comable::OptionType.new
90
+ stocks.map { |stock| variants.build(stocks: [stock]) }
93
91
  end
94
92
 
95
93
  def option_types
96
- option_types = variants.map { |variant| variant.option_values.map(&:option_type) }.flatten.uniq
97
- option_types.singleton_class.send(:define_method, :build, -> { Comable::OptionType.new })
98
- option_types
94
+ variants.map { |variant| variant.option_values.map(&:option_type) }.flatten.uniq
99
95
  end
100
96
 
101
97
  def option_types_attributes=(_option_types_attributes)
102
98
  end
103
99
 
100
+ def properties
101
+ parse_property = JSON.parse(property) # propertyに不正な値が入っていた場合に例外発生する
102
+ return [] unless parse_property.is_a?(Array) && parse_property.all? { |prop| prop.is_a?(Hash) }
103
+ parse_property
104
+ rescue
105
+ []
106
+ end
107
+
104
108
  #
105
109
  # Deprecated methods
106
110
  #
@@ -2,18 +2,18 @@ module Comable
2
2
  class Shipment < ActiveRecord::Base
3
3
  include Comable::Ransackable
4
4
 
5
- belongs_to :order, class_name: Comable::Order.name, inverse_of: :shipment
5
+ belongs_to :order, class_name: Comable::Order.name, inverse_of: :shipments
6
6
  belongs_to :shipment_method, class_name: Comable::ShipmentMethod.name
7
+ belongs_to :stock_location, class_name: Comable::StockLocation.name
8
+ has_many :shipment_items, class_name: Comable::ShipmentItem.name, inverse_of: :shipment
7
9
 
8
10
  before_validation :copy_attributes_from_shipment_method, unless: :order_completed?
9
11
 
10
12
  validates :order, presence: true
11
- validates :shipment_method, presence: true
13
+ validates :shipment_method, presence: true, if: -> { stated?(:pending) && Comable::ShipmentMethod.activated.exists? }
12
14
  validates :fee, presence: true, numericality: { greater_than_or_equal_to: 0 }
13
15
  validates :tracking_number, length: { maximum: 255 }
14
16
 
15
- delegate :name, to: :shipment_method
16
-
17
17
  ransack_options ransackable_attributes: { except: [:order_id, :shipment_method_id] }
18
18
 
19
19
  # The #state attribute assigns the following values:
@@ -47,6 +47,7 @@ module Comable
47
47
  transition :canceled => :resumed
48
48
  end
49
49
 
50
+ before_transition to: :ready, do: -> (s) { s.ready! }
50
51
  before_transition to: :completed, do: -> (s) { s.complete! }
51
52
  end
52
53
 
@@ -66,10 +67,30 @@ module Comable
66
67
  completed_at?
67
68
  end
68
69
 
70
+ def ready!
71
+ shipment_items.each(&:ready!)
72
+ end
73
+
69
74
  def complete!
70
75
  touch :completed_at
71
76
  end
72
77
 
78
+ def restock!
79
+ shipment_items.each(&:restock!)
80
+ end
81
+
82
+ def unstock!
83
+ shipment_items.each(&:unstock!)
84
+ end
85
+
86
+ def can_ship?
87
+ ready? && order.paid? && order.completed?
88
+ end
89
+
90
+ def name
91
+ shipment_method.try(:name) || Comable.t(:normal_shipment)
92
+ end
93
+
73
94
  private
74
95
 
75
96
  def order_completed?
@@ -78,7 +99,7 @@ module Comable
78
99
 
79
100
  def copy_attributes_from_shipment_method
80
101
  self.attributes = {
81
- fee: shipment_method.fee
102
+ fee: shipment_method.try(:fee) || 0
82
103
  }
83
104
  end
84
105
  end
@@ -0,0 +1,47 @@
1
+ module Comable
2
+ class ShipmentItem < ActiveRecord::Base
3
+ belongs_to :shipment, class_name: Comable::Shipment.name, inverse_of: :shipment_items
4
+ belongs_to :stock, class_name: Comable::Stock.name
5
+
6
+ validates :shipment, presence: true
7
+ validates :stock, presence: true
8
+
9
+ attr_accessor :variant
10
+
11
+ def ready!
12
+ decrement_stock!
13
+ end
14
+
15
+ def restock!
16
+ increment_stock!
17
+ end
18
+
19
+ def unstock!
20
+ decrement_stock!
21
+ end
22
+
23
+ private
24
+
25
+ def decrement_stock!
26
+ change_stock!(-1)
27
+ end
28
+
29
+ def increment_stock!
30
+ change_stock!(+1)
31
+ end
32
+
33
+ def change_stock!(required)
34
+ stock.lock!
35
+ stock.quantity += required
36
+ stock_save!
37
+ end
38
+
39
+ # Add the error to Order when fails #save! for compatibility
40
+ def stock_save!
41
+ stock.save!
42
+ rescue ActiveRecord::RecordInvalid => e
43
+ shipment.order.errors.add 'order_items.quantity', Comable.t('errors.messages.out_of_stock', name: stock.name_with_sku)
44
+ raise e, Comable.t('errors.messages.out_of_stock', name: stock.name_with_sku)
45
+ end
46
+ end
47
+ end
@@ -5,5 +5,6 @@ module Comable
5
5
  validates :traking_url, length: { maximum: 255 }
6
6
 
7
7
  scope :activated, -> { where(activated_flag: true) }
8
+ scope :by_newest, -> { reorder(created_at: :desc) }
8
9
  end
9
10
  end
@@ -10,7 +10,8 @@ module Comable
10
10
  include Comable::Liquidable
11
11
  include Comable::Stock::Csvable
12
12
 
13
- belongs_to :variant, class_name: Comable::Variant.name, inverse_of: :stock
13
+ belongs_to :variant, class_name: Comable::Variant.name, inverse_of: :stocks
14
+ belongs_to :stock_location, class_name: Comable::StockLocation.name
14
15
 
15
16
  #
16
17
  # @!group Scope
@@ -24,6 +25,10 @@ module Comable
24
25
  # 品切れの在庫インスタンスを返す
25
26
  scope :unstocked, -> { where('quantity <= ?', 0) }
26
27
 
28
+ # @!scope class
29
+ # returns sorted records by newest.
30
+ scope :by_newest, -> { reorder(created_at: :desc) }
31
+
27
32
  #
28
33
  # @!endgroup
29
34
  #
@@ -34,11 +39,14 @@ module Comable
34
39
  # TODO: Remove the columns for compatible
35
40
  delegate :product, to: :variant
36
41
  delegate :price, to: :variant
42
+ delegate :name, to: :variant
37
43
  delegate :sku_h_item_name, to: :product
38
44
  delegate :sku_v_item_name, to: :product
39
45
 
40
46
  ransack_options attribute_select: { associations: :variant }, ransackable_attributes: { only: :quantity }
41
47
 
48
+ before_validation :set_default_stock_location, unless: :stock_location
49
+
42
50
  # 在庫の有無を取得する
43
51
  #
44
52
  # @example
@@ -65,14 +73,6 @@ module Comable
65
73
  !stocked?(quantity: quantity)
66
74
  end
67
75
 
68
- def name
69
- if variant.options.any?
70
- "#{variant.product.name} (#{variant.options.map(&:value).join('/')})"
71
- else
72
- variant.product.name
73
- end
74
- end
75
-
76
76
  def sku_h_choice_name
77
77
  variant.option_values.first.try(:name)
78
78
  end
@@ -93,6 +93,10 @@ module Comable
93
93
  end
94
94
  end
95
95
 
96
+ def set_default_stock_location
97
+ self.stock_location = Comable::StockLocation.default
98
+ end
99
+
96
100
  #
97
101
  # Deprecated methods
98
102
  #
@@ -0,0 +1,29 @@
1
+ module Comable
2
+ class StockLocation < ActiveRecord::Base
3
+ has_many :shipments, class_name: Comable::Shipment.name
4
+ has_many :stocks, class_name: Comable::Stock.name, dependent: :destroy
5
+ belongs_to :address, class_name: Comable::Address.name
6
+
7
+ accepts_nested_attributes_for :address
8
+
9
+ validates :name, presence: true, length: { maximum: 255 }
10
+
11
+ scope :active, -> { where(active: true) }
12
+
13
+ class << self
14
+ def default
15
+ where(default: true).first_or_initialize do |stock_location|
16
+ stock_location.name = Comable.t(:deafult)
17
+ end
18
+ end
19
+ end
20
+
21
+ def as_json(_options = {})
22
+ { id: id, text: name }
23
+ end
24
+
25
+ def find_stock_item(variant)
26
+ stocks.find_by(variant: variant)
27
+ end
28
+ end
29
+ end
@@ -10,6 +10,8 @@ module Comable
10
10
  validates :homepage, length: { maximum: 255 }
11
11
  validates :author, length: { maximum: 255 }
12
12
 
13
+ scope :by_newest, -> { reorder(created_at: :desc) }
14
+
13
15
  class << self
14
16
  def dir
15
17
  Rails.root.join('themes')
@@ -7,11 +7,12 @@ module Comable
7
7
  validates :code, presence: true
8
8
  validates :place, presence: true, length: { maximum: 255 }
9
9
 
10
- scope :activated, -> { where(activated_flag: true) }
11
-
12
10
  enumerize :place, in: %i(
13
11
  everywhere
14
12
  checkout
15
13
  ), scope: true
14
+
15
+ scope :activated, -> { where(activated_flag: true) }
16
+ scope :by_newest, -> { reorder(created_at: :desc) }
16
17
  end
17
18
  end
@@ -17,6 +17,7 @@ module Comable
17
17
  scope :this_month, -> { where(created_at: Time.now.beginning_of_month..Time.now.end_of_month) }
18
18
  scope :this_week, -> { where(created_at: Time.now.beginning_of_week..Time.now.end_of_week) }
19
19
  scope :last_week, -> { where(created_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week) }
20
+ scope :by_newest, -> { reorder(created_at: :desc) }
20
21
 
21
22
  validates :email, presence: true, length: { maximum: 255 }
22
23
 
@@ -0,0 +1,27 @@
1
+ module Comable
2
+ class Variant < ActiveRecord::Base
3
+ module Quantifier
4
+ def total_quantity
5
+ if track_inventory?
6
+ stocks.to_a.sum(&:quantity)
7
+ else
8
+ Float::INFINITY
9
+ end
10
+ end
11
+
12
+ def can_supply?(required = 1)
13
+ quantity >= required || backorderable?
14
+ end
15
+
16
+ # TODO: Implement
17
+ def track_inventory?
18
+ true
19
+ end
20
+
21
+ # TODO: Implement
22
+ def backorderable?
23
+ false
24
+ end
25
+ end
26
+ end
27
+ end
@@ -1,31 +1,29 @@
1
1
  module Comable
2
2
  class Variant < ActiveRecord::Base
3
3
  include Comable::Ransackable
4
+ include Comable::Variant::Quantifier
4
5
 
5
6
  belongs_to :product, class_name: Comable::Product.name, inverse_of: :variants
6
- has_one :stock, class_name: Comable::Stock.name, inverse_of: :variant, dependent: :destroy, autosave: true
7
+ has_many :stocks, class_name: Comable::Stock.name, inverse_of: :variant, dependent: :destroy
7
8
 
8
- has_and_belongs_to_many :option_values, class_name: Comable::OptionValue.name, join_table: :comable_variants_option_values
9
+ has_and_belongs_to_many :option_values, -> { order(:option_type_id, :created_at, :id) }, class_name: Comable::OptionValue.name, join_table: :comable_variants_option_values
9
10
 
11
+ accepts_nested_attributes_for :stocks, allow_destroy: true
10
12
  accepts_nested_attributes_for :option_values, allow_destroy: true
11
- accepts_nested_attributes_for :stock
12
13
 
13
14
  validates :product, presence: { message: Comable.t('admin.is_not_exists') }
14
15
  validates :price, presence: true, numericality: { greater_than_or_equal_to: 0 }
15
16
  validates :sku, length: { maximum: 255 }
16
17
 
17
- ransack_options attribute_select: { associations: [:product, :stock, :option_values] }, ransackable_attributes: { except: :product_id }
18
+ ransack_options attribute_select: { associations: [:product, :stocks, :option_values] }, ransackable_attributes: { except: :product_id }
18
19
 
19
- def quantity
20
- stock.try(:quantity) || build_stock.quantity
21
- end
20
+ scope :by_newest, -> { reorder(created_at: :desc) }
21
+
22
+ alias_method :quantity, :total_quantity
22
23
 
23
24
  def quantity=(quantity)
24
- if stock
25
- stock.quantity = quantity
26
- else
27
- build_stock(quantity: quantity)
28
- end
25
+ fail 'Stocks are already exists!' if stocks.any?
26
+ stocks.build(quantity: quantity)
29
27
  end
30
28
 
31
29
  def options
@@ -42,5 +40,20 @@ module Comable
42
40
  Comable::OptionValue.where(name: hash[:value], option_type: option_type).first_or_initialize(&:save!)
43
41
  end
44
42
  end
43
+
44
+ def name
45
+ if options.any?
46
+ "#{product.name} (#{options.map(&:value).join('/')})"
47
+ else
48
+ product.name
49
+ end
50
+ end
51
+
52
+ def as_json(options = nil)
53
+ super.merge(
54
+ 'quantity' => quantity,
55
+ 'options' => option_values.map(&:name)
56
+ )
57
+ end
45
58
  end
46
59
  end
@@ -51,22 +51,18 @@ module Comable
51
51
 
52
52
  private
53
53
 
54
- # rubocop:disable Metrics/MethodLength
55
54
  def process_cart_item(obj)
56
55
  case obj
57
- when Comable::Product
56
+ when Comable::Product, Comable::Variant
58
57
  yield obj.stocks.first
59
58
  when Comable::Stock
60
59
  yield obj
61
- when Comable::Variant
62
- yield obj.stock
63
60
  when Array
64
61
  obj.map { |item| yield item }
65
62
  else
66
63
  fail
67
64
  end
68
65
  end
69
- # rubocop:enable Metrics/MethodLength
70
66
 
71
67
  def add_stock_to_cart(stock, quantity)
72
68
  cart_item = find_cart_item_by(stock)
@@ -36,6 +36,7 @@ module Comable
36
36
  transition to: :resumed, from: :canceled
37
37
  end
38
38
 
39
+ before_transition to: :shipment, do: :assign_inventory_units_to_shipments
39
40
  before_transition to: :completed, do: :complete!
40
41
  before_transition to: :canceled, do: [:payment_cancel!, :restock!]
41
42
  before_transition to: :resumed, do: [:payment_resume!, :unstock!]
@@ -67,19 +68,15 @@ module Comable
67
68
  end
68
69
 
69
70
  def shipment_required?
70
- Comable::ShipmentMethod.activated.exists? && shipment.nil?
71
+ Comable::ShipmentMethod.activated.exists? && shipments.empty?
71
72
  end
72
73
 
73
74
  def allow_cancel?
74
- # TODO: Implement shipments
75
- # !shipments.exists?
76
- true
75
+ !shipments.with_state(:completed).exists?
77
76
  end
78
77
 
79
78
  def allow_return?
80
- # TODO: Implement shipments
81
- # shipments.exists?
82
- false
79
+ !allow_cancel?
83
80
  end
84
81
  end
85
82
  end
@@ -3,33 +3,22 @@ module Comable
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  module ClassMethods
6
- def linkable_columns_keys(options = {})
7
- if options.present?
8
- @_linkable_columns = default_columns_key.merge(options.slice(:name, :id))
9
- @use_index = options[:use_index]
10
- else
11
- @_linkable_columns
12
- end
13
- end
14
-
15
- def linkable_columns(*key)
16
- (@_linkable_columns || default_columns_key).slice(*key).values
17
- end
6
+ private
18
7
 
19
- def linkable_id_options
8
+ def calc_linkable_id_options(klass, column_options = {})
9
+ return [[]] unless klass
20
10
  # HACK: Rails3系のpluckでは複数フィールドを指定できないためselectとmapでカラムを取得する
21
- # options = pluck(*linkable_columns(:name, :id))
22
- columns = linkable_columns(:name, :id)
23
- records = select(columns)
24
- options = records.map(&columns.first).zip(records.map(&columns.last))
25
- @use_index ? options.unshift(index_option) : options
26
- end
11
+ # options = klass.pluck(*linkable_columns(column_options))
12
+ select_columns = linkable_columns(column_options)
13
+ records = klass.select(select_columns)
14
+ options = records.map(&select_columns.first).zip(records.map(&select_columns.last))
27
15
 
28
- def linkable_exists?
29
- @use_index || exists?
16
+ column_options[:use_index] ? options.unshift(index_option) : options
30
17
  end
31
18
 
32
- private
19
+ def linkable_columns(column_keys)
20
+ default_columns_key.merge(column_keys).slice(:name, :id).values
21
+ end
33
22
 
34
23
  def default_columns_key
35
24
  {
@@ -3,7 +3,7 @@ module Comable
3
3
  module Search
4
4
  extend ActiveSupport::Concern
5
5
 
6
- SEARCH_COLUMNS = %i( code name caption )
6
+ SEARCH_COLUMNS = %i( name caption )
7
7
 
8
8
  module ClassMethods
9
9
  def search(query)
@@ -6,9 +6,8 @@
6
6
 
7
7
  <%= Comable.t('order_mailer.complete.introductions', store_name: current_store.name) %>
8
8
 
9
- <%- shipment = @order.shipment %>
10
- <%- if shipment %>
11
- <%= @order.class.human_attribute_name(:shipment_method) %>:
9
+ <%- @order.shipments.select(&:shipment_method).each.with_index(1) do |shipment, index| %>
10
+ <%= "#{@order.class.human_attribute_name(:shipment_method)} ##{index}" %>:
12
11
  <%= shipment.name %>
13
12
  <%- end %>
14
13
 
@@ -40,6 +40,8 @@ en:
40
40
  sample_subheader: 'This is sample text.'
41
41
  sample_text: 'Please write your message here.'
42
42
  default_store_name: 'K&B style'
43
+ default: 'Default'
44
+ normal_shipment: 'Normal shipment'
43
45
 
44
46
  price: &price
45
47
  'Price'
@@ -170,6 +172,7 @@ en:
170
172
  view: 'View'
171
173
  add_variants: 'Add variants'
172
174
  size: 'Size'
175
+ add_stocks: 'Add stocks'
173
176
  nav:
174
177
  dashboard: 'Dashboard'
175
178
  order: 'Orders'
@@ -185,12 +188,15 @@ en:
185
188
  payment_method: 'Payment methods'
186
189
  tracker: 'Tracker'
187
190
  theme: 'Theme'
191
+ stock_location: 'Stock locations'
188
192
  products:
189
193
  detail: 'Product details'
190
194
  list: 'Product list'
191
195
  visibility: 'publishing/closed'
192
196
  published: 'Published'
193
197
  unpublished: 'Unpublished'
198
+ property: 'Property'
199
+ add_property: 'Add Property'
194
200
  orders:
195
201
  detail: 'Order details'
196
202
  cart: 'Cart infomation'
@@ -358,6 +364,7 @@ en:
358
364
  name: 'Name'
359
365
  price: 'Price'
360
366
  caption: 'Caption'
367
+ property: 'Property'
361
368
  categories: 'Categories'
362
369
  sku_h_item_name: 'SKU Horizontal item name'
363
370
  sku_v_item_name: 'SKU Vertical item name'
@@ -461,6 +468,13 @@ en:
461
468
  id: 'ID'
462
469
  name: 'Name'
463
470
  <<: *timestamps
471
+ comable/stock_location:
472
+ id: 'ID'
473
+ name: 'Name'
474
+ address: 'Address'
475
+ active: 'Active'
476
+ default: 'Default'
477
+ <<: *timestamps
464
478
 
465
479
  enumerize:
466
480
  comable/user:
@@ -40,6 +40,8 @@ ja:
40
40
  sample_subheader: 'これはサンプルテキストです。'
41
41
  sample_text: 'ここにあなたのお好きなメッセージを埋め込むことができます。'
42
42
  default_store_name: 'K&B style'
43
+ default: 'デフォルト'
44
+ normal_shipment: '通常配送'
43
45
 
44
46
  price: &price
45
47
  '価格'
@@ -170,6 +172,7 @@ ja:
170
172
  view: '確認する'
171
173
  add_variants: 'バリエーションを追加する'
172
174
  size: 'サイズ'
175
+ add_stocks: '在庫を追加する'
173
176
  nav:
174
177
  dashboard: ダッシュボード
175
178
  order: 注文管理
@@ -185,12 +188,15 @@ ja:
185
188
  payment_method: 決済管理
186
189
  tracker: トラッキング情報
187
190
  theme: 'テーマ'
191
+ stock_location: '倉庫管理'
188
192
  products:
189
193
  detail: 商品詳細
190
194
  list: '商品一覧'
191
195
  visibility: 公開/非公開
192
196
  published: 公開
193
197
  unpublished: 非公開
198
+ property: プロパティ
199
+ add_property: プロパティ追加
194
200
  orders:
195
201
  detail: 注文明細
196
202
  cart: カート情報
@@ -358,6 +364,7 @@ ja:
358
364
  name: 商品名
359
365
  price: 価格
360
366
  caption: キャプション
367
+ property: プロパティ
361
368
  categories: カテゴリ
362
369
  sku_h_item_name: SKU横軸項目名
363
370
  sku_v_item_name: SKU縦軸項目名
@@ -461,6 +468,13 @@ ja:
461
468
  id: 'ID'
462
469
  name: '名称'
463
470
  <<: *timestamps
471
+ comable/stock_location:
472
+ id: 'ID'
473
+ name: '倉庫名'
474
+ address: '住所'
475
+ active: '有効'
476
+ default: 'デフォルト'
477
+ <<: *timestamps
464
478
 
465
479
  enumerize:
466
480
  comable/user:
@@ -0,0 +1,5 @@
1
+ class AddPropertyToComableProducts < ActiveRecord::Migration
2
+ def change
3
+ add_column :comable_products, :property, :text, after: :caption
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateComableStockLocations < ActiveRecord::Migration
2
+ def change
3
+ create_table :comable_stock_locations do |t|
4
+ t.string :name, null: false
5
+ t.boolean :default, null: false, default: false
6
+ t.boolean :active, null: false, default: true
7
+ t.references :address
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class AddStockLocationIdToComableStocks < ActiveRecord::Migration
2
+ def change
3
+ change_table :comable_stocks do |t|
4
+ t.references :stock_location
5
+ end
6
+
7
+ add_index :comable_stocks, :stock_location_id
8
+ add_index :comable_stocks, [:stock_location_id, :variant_id]
9
+ end
10
+ end