educode_sales 0.9.42 → 0.9.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d635995859ce768ee96b28509c5094efbc03e8d98ca1b6fe59e52bc4696ef41e
4
- data.tar.gz: 8010219ab35845df3329179cf6e8f2e56e224b5d60781a2ff4b80999efcc0c1c
3
+ metadata.gz: e3b8eeaf96172e79bdd5ecd470826d1b1509e27aa51650992fea9573124c03a8
4
+ data.tar.gz: 448e73b86222666fa76163427cacf66d25dcb3afff0186dac870da2096f701ec
5
5
  SHA512:
6
- metadata.gz: 3939a32d342b6ce49488569f52a67902fad404502dfae2262a1f4b37a3275ec63728e36a1d03feebba2cbf20590de4ceac237a09d5b053dc10510e5506eb20f5
7
- data.tar.gz: 37ba20f22853d9cd00c82c5a1f472157fa37fbfe8cfac77cb868b707142ab6d36b8e93f1ecb4f9cd6dec9f478ed9b406cfb06a68115812b6e7dd0a3e67d40391
6
+ metadata.gz: d33d493129ce919f40d3ba640312a2b32b8965e269f013c9fac9cd8972576fd5cae0ce6c3099c691ff5b993263f36f61ab2f2f5298c6051c51df74c4c4d6c5dd
7
+ data.tar.gz: ab38c5526bec3b5eae9b4109b705298f8a5b8a2d932845bf70fc1b45b0d29ef9395b3d6865b840703bda9184b754ebc6411efee484d78160ea3b74dda998977b
@@ -39,6 +39,7 @@ module EducodeSales
39
39
  format.html do
40
40
  common = Common.find_by(clazz: 'staff_type', name: '销售')
41
41
  @staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
42
+ gon.school_tags = SchoolTag.where(for_missions: true).map { |d| {value: d.id, name: d.name } }
42
43
  end
43
44
  format.json do
44
45
  if @current_admin.is_admin?
@@ -73,28 +74,34 @@ module EducodeSales
73
74
  @customers = @customers.where(id: school_ids)
74
75
  end
75
76
  if params[:q].present? && params[:q][:property].present?
76
- school_property_ids = []
77
77
  property = params[:q][:property].split(",").map(&:to_i)
78
- property.each do |p|
79
- case p
80
- when 0
81
- school_property_ids += SchoolProperty.where(project_985: true).ids
82
- when 1
83
- school_property_ids += SchoolProperty.where(project_211: true).ids
84
- when 2
85
- school_property_ids += SchoolProperty.where(regular_college: true).ids
86
- when 3
87
- school_property_ids += SchoolProperty.where(junior_college: true).ids
88
- when 4
89
- school_property_ids += SchoolProperty.where(secondary_school: true).ids
90
- when 5
91
- school_property_ids += SchoolProperty.where(military_school: true).ids
92
- when 6
93
- school_property_ids += SchoolProperty.where(enterprise: true).ids
94
- else
95
- end
96
- end
97
- @customers = @customers.where(school_property_id: school_property_ids)
78
+ # property.each do |p|
79
+ # case p
80
+ # when 0
81
+ # school_property_ids += SchoolProperty.where(project_985: true).ids
82
+ # when 1
83
+ # school_property_ids += SchoolProperty.where(project_211: true).ids
84
+ # when 2
85
+ # school_property_ids += SchoolProperty.where(regular_college: true).ids
86
+ # when 3
87
+ # school_property_ids += SchoolProperty.where(junior_college: true).ids
88
+ # when 4
89
+ # school_property_ids += SchoolProperty.where(secondary_school: true).ids
90
+ # when 5
91
+ # school_property_ids += SchoolProperty.where(military_school: true).ids
92
+ # when 6
93
+ # school_property_ids += SchoolProperty.where(enterprise: true).ids
94
+ # when 7
95
+ # school_property_ids += SchoolProperty.where(mid_school: true).ids
96
+ # when 8
97
+ # school_property_ids += SchoolProperty.where(ele_school: true).ids
98
+ # when 9
99
+ # school_property_ids += SchoolProperty.where(other: true).ids
100
+ # else
101
+ # end
102
+ # end
103
+ @customers = @customers.joins(:school_tags).where("school_tags.id in (?)", property).distinct
104
+ # @customers = @customers.where(school_property_id: school_property_ids)
98
105
  end
99
106
 
100
107
  if params[:q].present? && params[:q][:date].present?
@@ -54,7 +54,8 @@ module EducodeSales
54
54
  # gon.schools = School.all.first(100).map { |d| { value: d.id, title: d.name } } #.unshift({value: -1, title: '全国'})
55
55
  @staff_types = Common.where(clazz: 'staff_type').pluck(:name, :id)
56
56
  tag_ids = @staff.staff_school_tags.pluck(:school_tag_id)
57
- gon.school_properties = SchoolTag.where(for_missions: true).map { |d| { value: d.id, name: d.name, selected: tag_ids.include?(d.id) } }
57
+ names = %w[本科院校 军事院校 高职院校 中职院校 中学 小学 企业 其他]
58
+ gon.school_properties = SchoolTag.where(for_missions: true).sort_by { |tag| names.index(tag.name) }.map { |d| { value: d.id, name: d.name, selected: tag_ids.include?(d.id) } }
58
59
  render layout: false
59
60
  end
60
61
 
@@ -113,7 +114,7 @@ module EducodeSales
113
114
  end
114
115
  staff.staff_permissions.delete_all
115
116
  permissions.each do |permission|
116
- staff.staff_permissions.create(staff_id:staff.id, permission_id:permission.id)
117
+ staff.staff_permissions.create(staff_id: staff.id, permission_id: permission.id)
117
118
  end
118
119
  staff.staff_school_tags = tags
119
120
  params[:current_admin] = @current_admin.id
@@ -496,6 +496,7 @@
496
496
  field: 'budget_amount',
497
497
  width: 105,
498
498
  title: '预算金额',
499
+ totalRow: true,
499
500
  sort: true,
500
501
  hide: gon.filter.budget_amount
501
502
  },
@@ -28,16 +28,21 @@ json.data do
28
28
  json.divide_money d.divide_amount.to_f.round(2)
29
29
  json.budget_amount d.budget_amount.to_f.round(2) #d.follow_ups.where(stage_id: @budget_stage_ids).order("created_at desc").first&.total_amount&.round(2) || 0
30
30
  json.area d.department.school.province
31
- school_property = d.department.school.school_property
32
- property = []
31
+ # school_property = d.department.school.school_property
32
+ # property = []
33
33
 
34
- if school_property.present?
35
- property << '本科地方院校' if school_property.regular_college || school_property.project_985 || school_property.project_211
36
- property << '高职' if school_property.junior_college || school_property.secondary_school
37
- property << '本科军校' if school_property.military_school
38
- property << '企业' if school_property.enterprise
34
+ # if school_property.present?
35
+ # property << '本科地方院校' if school_property.regular_college || school_property.project_985 || school_property.project_211
36
+ # property << '高职' if school_property.junior_college || school_property.secondary_school
37
+ # property << '本科军校' if school_property.military_school
38
+ # property << '企业' if school_property.enterprise
39
+ # end
40
+ if d.department.school
41
+ json.property d.department.school.school_tags.where(for_missions: true).pluck(:name).join("、")
42
+ else
43
+ json.property ''
39
44
  end
40
- json.property property.join("、")
45
+ # json.property d.school.school_property.school_tags.where(for_missions: true).pluck(:name).join("、")#property.join("、")
41
46
  json.sale_way d.last_follow_up&.place&.name.present? ? '渠道' : '直销'
42
47
  json.year d.last_follow_up&.year.to_s
43
48
  json.total_amount d.last_follow_up&.total_amount.to_f.round(2)