Sha256: ad13a944618e76c556e3b39e06a9e9c274021c4ef8127b4774d17918499f4dbb

Contents?: true

Size: 843 Bytes

Versions: 5

Compression:

Stored size: 843 Bytes

Contents

area_ids = EducodeSales::Common.where(clazz: 'area').ids.sort.to_s
json.data do
  json.array! @staffs do |d|
    json.id d.id
    json.user_name d.user&.real_name
    json.name d.name
    json.role d.role&.name
    json.schools d.staff_schools.map(&:school).map(&:name).join("、")
    json.job_type EducodeSales::Common.job_type_name[d.job_type]
    json.month d.month
    json.enabled_at d.enabled_at ? d.enabled_at.to_s(:date) : ''
    json.expired_at d.enabled_at ? "#{d.enabled_at.to_s(:date)}-#{d.expired_at.to_s(:date)}" : ''
    json.enabled d.is_enabled ? '启用' : '禁用'
    if d.areas.present?
      if d.areas.ids.sort.to_s == area_ids
        json.area '全国'
      else
        json.area  d.areas.pluck(:name).join("、")
      end
    else
      json.area  ''
    end
  end
end


json.code 0
json.count @staffs.total_count

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
educode_sales-1.10.74 app/views/educode_sales/staffs/index.json.jbuilder
educode_sales-1.10.73 app/views/educode_sales/staffs/index.json.jbuilder
educode_sales-1.10.72 app/views/educode_sales/staffs/index.json.jbuilder
educode_sales-1.10.71 app/views/educode_sales/staffs/index.json.jbuilder
educode_sales-1.10.70 app/views/educode_sales/staffs/index.json.jbuilder