educode_sales 1.10.49 → 1.10.58
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 +4 -4
- data/app/assets/stylesheets/educode_sales/modules/easyeditor/easyeditor.css +1 -1
- data/app/controllers/educode_sales/application_controller.rb +10 -0
- data/app/controllers/educode_sales/business_courses_controller.rb +58 -33
- data/app/controllers/educode_sales/businesses_controller.rb +43 -7
- data/app/controllers/educode_sales/contracts_controller.rb +6 -0
- data/app/controllers/educode_sales/money_plan_records_controller.rb +6 -2
- data/app/controllers/educode_sales/money_plans_controller.rb +3 -0
- data/app/controllers/educode_sales/sale_trends_controller.rb +1 -1
- data/app/controllers/educode_sales/shixun_dectects_controller.rb +77 -16
- data/app/controllers/educode_sales/shixuns_controller.rb +65 -4
- data/app/controllers/educode_sales/subject_trends_controller.rb +99 -892
- data/app/controllers/educode_sales/subjects_controller.rb +29 -18
- data/app/helpers/educode_sales/application_helper.rb +3 -1
- data/app/helpers/educode_sales/business_courses_helper.rb +29 -6
- data/app/helpers/educode_sales/sale_trends_helper.rb +52 -52
- data/app/helpers/educode_sales/subject_helper.rb +5 -1
- data/app/models/educode_sales/business.rb +5 -5
- data/app/models/educode_sales/business_deliver_subject.rb +3 -2
- data/app/models/educode_sales/business_subject.rb +9 -3
- data/app/models/educode_sales/business_subject_shixun.rb +37 -8
- data/app/models/educode_sales/business_subject_staff.rb +1 -0
- data/app/views/educode_sales/business_courses/edit.html.erb +30 -4
- data/app/views/educode_sales/business_courses/index.html.erb +34 -12
- data/app/views/educode_sales/business_courses/index.json.jbuilder +2 -2
- data/app/views/educode_sales/business_courses/list_shixuns.html.erb +132 -64
- data/app/views/educode_sales/business_courses/list_shixuns.json.jbuilder +12 -6
- data/app/views/educode_sales/business_courses/list_subjects.html.erb +29 -34
- data/app/views/educode_sales/business_courses/list_subjects.json.jbuilder +7 -2
- data/app/views/educode_sales/business_courses/new.html.erb +45 -20
- data/app/views/educode_sales/businesses/index.html.erb +11 -9
- data/app/views/educode_sales/contracts/_list.html.erb +16 -1
- data/app/views/educode_sales/contracts/index.html.erb +5 -2
- data/app/views/educode_sales/contracts/list.js.erb +4 -1
- data/app/views/educode_sales/money_plan_records/_index.html.erb +21 -5
- data/app/views/educode_sales/money_plan_records/index.js.erb +4 -1
- data/app/views/educode_sales/money_plans/list.html.erb +6 -2
- data/app/views/educode_sales/sale_trends/_return_money_forecast.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/_user_stat.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/_visit_analysis.html.erb +1 -1
- data/app/views/educode_sales/sale_trends/return_money_forecast.js.erb +1 -1
- data/app/views/educode_sales/sale_trends/trends.html.erb +6 -6
- data/app/views/educode_sales/sale_trends/user_stat.js.erb +1 -1
- data/app/views/educode_sales/sale_trends/visit_analysis.js.erb +1 -1
- data/app/views/educode_sales/shixun_dectects/index.html.erb +97 -47
- data/app/views/educode_sales/shixun_dectects/index.json.jbuilder +4 -3
- data/app/views/educode_sales/shixun_dectects/markdown.html.erb +1 -1
- data/app/views/educode_sales/shixuns/edit.html.erb +35 -13
- data/app/views/educode_sales/shixuns/index.html.erb +348 -138
- data/app/views/educode_sales/shixuns/index.json.jbuilder +9 -5
- data/app/views/educode_sales/shixuns/new.html.erb +22 -12
- data/app/views/educode_sales/subject_trends/trends.html.erb +177 -575
- data/app/views/educode_sales/subjects/edit.html.erb +4 -4
- data/app/views/educode_sales/subjects/index.html.erb +50 -12
- data/app/views/educode_sales/subjects/index.json.jbuilder +3 -3
- data/app/views/educode_sales/subjects/list_shixuns.html.erb +143 -17
- data/app/views/educode_sales/subjects/list_shixuns.json.jbuilder +9 -4
- data/app/views/educode_sales/subjects/new.html.erb +4 -4
- data/app/views/layouts/educode_sales/application.html.erb +1 -1
- data/lib/educode_sales/version.rb +1 -1
- metadata +6 -7
- data/app/assets/images/educode_sales/indexlogo.png +0 -0
@@ -1,16 +1,50 @@
|
|
1
|
-
# frozen_string_literal:
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# 实践项目管理
|
4
4
|
module EducodeSales
|
5
5
|
class ShixunsController < ApplicationController
|
6
|
-
before_action :subject_members, :subject_staffs, :create_filter
|
6
|
+
before_action :subject_members, :subject_staffs, :create_filter, :subject_url
|
7
7
|
def index
|
8
8
|
|
9
|
+
authorize! :shixun, BusinessDeliverSubject
|
10
|
+
|
9
11
|
# 判断类型是否存在 1 管培 2 全职 3 专职 如果不存在就默认为1
|
10
12
|
category = params[:q].present? ? params[:q][:category].to_i : BusinessSubjectShixun::CATEGORY_TYPE::TRAINING
|
11
|
-
|
13
|
+
trends_category = params[:trends_category]
|
14
|
+
|
15
|
+
gon.category = trends_category.present? ? trends_category.to_i : 1
|
16
|
+
gon.is_admin = is_commissioner_above?
|
17
|
+
|
18
|
+
business_subject_shixuns = BusinessSubjectShixun
|
19
|
+
|
20
|
+
# 根据身份获取对应数据
|
21
|
+
business_subject_shixuns = if is_commissioner_above?
|
22
|
+
business_subject_shixuns
|
23
|
+
else
|
24
|
+
# 实训本身的成员
|
25
|
+
smembers_ids = business_subject_shixuns.joins(shixun_members: :staff).where("educode_sales_staffs.id = #{@current_admin.id} ")
|
26
|
+
.ids
|
27
|
+
|
28
|
+
# 父类课程经理
|
29
|
+
deliver_ids = business_subject_shixuns.joins(business_subject: [business_deliver_subject: [manages: :staff]])
|
30
|
+
.where("educode_sales_staffs.id = #{@current_admin.id} ")
|
31
|
+
.ids
|
32
|
+
|
33
|
+
subject_ids = business_subject_shixuns.joins(business_subject: [manages: :staff])
|
34
|
+
.where("educode_sales_business_subjects.business_id is null and educode_sales_staffs.id = #{@current_admin.id} ")
|
35
|
+
.ids
|
36
|
+
|
37
|
+
business_subject_shixuns.where(id: smembers_ids + deliver_ids + subject_ids)
|
38
|
+
end
|
39
|
+
|
40
|
+
@shixuns = business_subject_shixuns.left_joins(:last_dectect)
|
41
|
+
.left_joins(:school, :shixun , business_subject: [:subject, business: :last_follow_up])
|
12
42
|
.where(category: category)
|
13
43
|
|
44
|
+
# if params[:q].present? && params[:q][:business_name].present?
|
45
|
+
# @shixuns = @shixuns.where("educode_sales_businesses.name like '%#{params[:q][:business_name]}%' ")
|
46
|
+
# end
|
47
|
+
|
14
48
|
# 项目级别 0 全部
|
15
49
|
if params[:q].present? && params[:q][:level].present? && params[:q][:level].to_i != 0
|
16
50
|
@shixuns = @shixuns.where(level: params[:q][:level])
|
@@ -32,18 +66,42 @@ module EducodeSales
|
|
32
66
|
if params[:q].present? && params[:q][:subject_name].present?
|
33
67
|
@shixuns = @shixuns.where("subjects.name like '%#{params[:q][:subject_name]}%'")
|
34
68
|
end
|
69
|
+
|
70
|
+
|
71
|
+
shixun_staffs = {}
|
72
|
+
BusinessSubjectShixun.includes(business_subject:[ business_deliver_subject: [:manages, business: [:school, last_follow_up: :assign_follow_ups]] ]).find_each do |d|
|
73
|
+
b_d_s = d.business_subject
|
74
|
+
if b_d_s.blank?
|
75
|
+
shixun_staffs.merge!({"#{d.id}": d.shixun_staff })
|
76
|
+
elsif b_d_s.present? && b_d_s.business_deliver_subject.present?
|
77
|
+
shixun_staffs.merge!({ "#{d.id}": b_d_s.business_deliver_subject.business.staff_name })
|
78
|
+
elsif b_d_s.present?
|
79
|
+
shixun_staffs.merge!({ "#{d.id}": b_d_s.staffs_name })
|
80
|
+
end
|
81
|
+
end
|
82
|
+
@shixun_staffs = shixun_staffs.stringify_keys
|
83
|
+
p @shixun_staffs
|
35
84
|
@shixuns = @shixuns.select("educode_sales_business_subject_shixuns.*,
|
36
85
|
educode_sales_follow_ups.reception_at,
|
37
86
|
schools.name as school_name,
|
38
87
|
subjects.name as subject_name,
|
88
|
+
subjects.identifier as subjects_identifier,
|
39
89
|
shixuns.name as shixun_name,
|
90
|
+
shixuns.identifier as s_identifier,
|
91
|
+
educode_sales_shixun_dectects.created_at as shixun_dectects_time,
|
92
|
+
educode_sales_shixun_dectects.content as dectects_content,
|
40
93
|
shixuns.identifier")
|
41
94
|
.page(params[:page])
|
42
95
|
.per(params[:limit])
|
43
96
|
end
|
44
97
|
|
45
98
|
def edit
|
99
|
+
authorize! :shixun, BusinessDeliverSubject
|
46
100
|
@item = BusinessSubjectShixun.find(params[:id])
|
101
|
+
@last_dectect = ''
|
102
|
+
if @item.last_dectect.present?
|
103
|
+
@last_dectect = @item.last_dectect.dectect_type
|
104
|
+
end
|
47
105
|
@producer_list = BusinessSubjectStaff.where(container_type: BusinessSubjectStaff::CONTAINER_TYPES::SHIXUN,
|
48
106
|
container_id: params[:id],
|
49
107
|
category: BusinessSubjectStaff::CATEGORY_TYPES::SHIXUN_PRODUCER)
|
@@ -60,6 +118,7 @@ module EducodeSales
|
|
60
118
|
end
|
61
119
|
|
62
120
|
def update
|
121
|
+
authorize! :shixun, BusinessDeliverSubject
|
63
122
|
ActiveRecord::Base.transaction do
|
64
123
|
|
65
124
|
if params[:id].present?
|
@@ -92,12 +151,14 @@ module EducodeSales
|
|
92
151
|
end
|
93
152
|
|
94
153
|
def new
|
154
|
+
authorize! :shixun, BusinessDeliverSubject
|
95
155
|
gon.manage = @manages
|
96
156
|
gon.staffs = @staffs
|
97
157
|
render layout: false
|
98
158
|
end
|
99
159
|
|
100
160
|
def create
|
161
|
+
authorize! :shixun, BusinessDeliverSubject
|
101
162
|
begin
|
102
163
|
ActiveRecord::Base.transaction do
|
103
164
|
|
@@ -115,7 +176,7 @@ module EducodeSales
|
|
115
176
|
|
116
177
|
if params[:shixun_type].to_i == 1
|
117
178
|
# 目前支持名称关联实训
|
118
|
-
origin_shixun = Shixun.
|
179
|
+
origin_shixun = Shixun.where(hidden: 0).find_by_name(params[:name].to_s)
|
119
180
|
attr = origin_shixun.blank? ? attr : attr.merge({shixun_id: origin_shixun.id})
|
120
181
|
end
|
121
182
|
shixun = BusinessSubjectShixun.create!(attr)
|