Sha256: fcb560404a8ee12bb972776d19dcb1d6f327c7682ce64cf879c11c272d60fdc9

Contents?: true

Size: 1.03 KB

Versions: 6

Compression:

Stored size: 1.03 KB

Contents

module EducodeSales
  class Common < ApplicationRecord
    acts_as_list scope: [:clazz]

    XTYPE = "x_class"
    OTYPE = 'o_class'

    validates :name, uniqueness: {scope: :clazz, message: '已存在'}
    
    enum clazz: {
      '商机类型': 'business_type',
      '商机阶段': 'business_step',
      '关键人态度': 'key_attitude',
      '教师来源': 'teacher_source' ,
      '教师态度': 'teacher_attitude',
      '课堂建设': 'course_build',
      '跟进手段': 'contact',
      '人员类型': 'staff_type',
      '开课计划': 'course_plan',
      '区域': 'area'
    }

    def self.job_type_name
      self.where(clazz: 'staff_type', name: ['销售', '运营']).pluck(:id, :name).to_h
    end

    def self.teacher_source_name
      self.where(clazz: 'teacher_source').pluck(:id, :name).to_h
    end

    def self.key_attitude_name
      self.where(clazz: 'key_attitude').pluck(:id, :name).to_h
    end

    def self.teacher_attitude_name
      self.where(clazz: 'teacher_attitude').pluck(:id, :name).to_h
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
educode_sales-0.4.8 app/models/educode_sales/common.rb
educode_sales-0.4.7 app/models/educode_sales/common.rb
educode_sales-0.4.6 app/models/educode_sales/common.rb
educode_sales-0.4.5 app/models/educode_sales/common.rb
educode_sales-0.4.4 app/models/educode_sales/common.rb
educode_sales-0.4.3 app/models/educode_sales/common.rb