# encoding: utf-8
class ProductWarn < ActiveRecord::Base
  has_paper_trail
  self.table_name = "product_warns"
  validates :happen_time,:product_id,:sale_90,presence: true
  TYPE_ENUM = [["直营","direct_sale"],["店铺专区","shop_sale"],["积分专区","cent_sale"]]

  rails_admin do
    navigation_label '商品管理'
    parent Product
    weight -500
    list do
      filters [:happen_time,:product_id,:recommend_count]
      field :id
      field :happen_time
      field :product_id
      field :product_name
      # field :product_type
      field :product_type, :enum do
        enum do
          TYPE_ENUM
        end
      end
      #field :product_size
      field :sale_90
      field :sale_30
      field :sale_10
      field :now_count
      field :product_cycle
      field :stock_cycle
      field :min_purchase
      field :history_day_sales
      field :recommend_count
      #field :created_at
      # field :updated_at
    end
    show do
      field :id
      field :happen_time
      field :product_id
      field :product_name
      field :product_type, :enum do
        enum do
          TYPE_ENUM
        end
      end
      #field :product_size
      field :sale_90
      field :sale_30
      field :sale_10
      field :now_count
      field :product_cycle
      field :stock_cycle
      field :min_purchase
      field :history_day_sales
      field :recommend_count
        # field :created_at
      # field :updated_at
    end
    edit do
      field :happen_time
      field :product_id
      field :product_name
      field :sale_90
      field :sale_30
      field :sale_10
      field :now_count
      field :product_cycle
      field :stock_cycle
      field :min_purchase
      field :history_day_sales
      field :recommend_count
    end

  end

end
