educode_sales 0.3.9 → 0.4.0
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/images/educode_sales/indexlogo.png +0 -0
- data/app/controllers/educode_sales/businesses_controller.rb +9 -2
- data/app/controllers/educode_sales/sale_trends_controller.rb +1 -1
- data/app/controllers/educode_sales/teachers_controller.rb +20 -8
- data/app/models/educode_sales/teacher_follow.rb +1 -0
- data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
- data/app/views/educode_sales/businesses/edit.html.erb +2 -2
- data/app/views/educode_sales/businesses/index.html.erb +2 -2
- data/app/views/educode_sales/businesses/new_follow_record.html.erb +2 -1
- data/app/views/educode_sales/operation_plans/new_month.html.erb +2 -0
- data/app/views/educode_sales/plans/new_month.html.erb +1 -0
- data/app/views/educode_sales/teachers/import.html.erb +1 -0
- data/app/views/educode_sales/teachers/index.html.erb +1 -1
- data/app/views/educode_sales/teachers/index.json.jbuilder +2 -1
- data/app/views/layouts/educode_sales/login.html.erb +1 -1
- data/lib/educode_sales/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beaaef9ad85e45c39ff91fc919a392c864872b7c3c6b5ad40cbff4ca931ab7b8
|
4
|
+
data.tar.gz: c99241524289cd79e31c992e85921aa706962253a60d08ecb10dece9215d9120
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7abc3483c8e33f0385e1a77edaed2c60b8db9dbf06ae41679cbd379a74a168a3f5869b2a5bd49e2e5e95dd0c90fea504668433841970239ca453031a1ba04bc5
|
7
|
+
data.tar.gz: fe192afb0f2a09d6b924c5901c2aac1bc1d83046ffe4cd3fe20152df2084b19afc5bba62dc71816f68d30418ca2b35c060037b7acf5ab44b3d86f5d45a647d9e
|
Binary file
|
@@ -29,10 +29,12 @@ module EducodeSales
|
|
29
29
|
level = @current_admin.role.role_areas.find_by(clazz: '商机管理').level
|
30
30
|
case level
|
31
31
|
when '自己'
|
32
|
-
|
32
|
+
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
33
|
+
@businesses = Business.where("educode_sales_businesses.staff_id = ? OR educode_sales_businesses.id in (?)", @current_admin.id, business_ids)
|
33
34
|
when '区域'
|
34
35
|
school_ids = School.where(province: @current_admin.areas.pluck(:name)).pluck(:id)
|
35
|
-
|
36
|
+
business_ids = Business.joins(last_follow_up: :assign_follow_ups).where("educode_sales_assign_follow_ups.staff_id = ?", @current_admin.id).pluck(:id)
|
37
|
+
@businesses = Business.joins("JOIN departments ON educode_sales_businesses.department_id = departments.id").where("departments.school_id in (?) OR educode_sales_businesses.staff_id = #{@current_admin.id} OR educode_sales_businesses.id in (?)", school_ids, business_ids)
|
36
38
|
else
|
37
39
|
@businesses = Business
|
38
40
|
end
|
@@ -179,6 +181,11 @@ module EducodeSales
|
|
179
181
|
@stages = Common.where(clazz: 'business_step').order("position").pluck(:name, :id)
|
180
182
|
@places = Place.order("created_at desc").pluck(:name, :id)
|
181
183
|
@last_follow_up = @business.last_follow_up
|
184
|
+
if @last_follow_up
|
185
|
+
gon.sales = @last_follow_up.assign_follow_ups.map do |d|
|
186
|
+
{value: d.staff_id, name: d.staff.user.full_name}
|
187
|
+
end
|
188
|
+
end
|
182
189
|
render layout: false
|
183
190
|
end
|
184
191
|
|
@@ -17,7 +17,7 @@ module EducodeSales
|
|
17
17
|
@goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.created_at >= ? AND educode_sales_follow_ups.stage_id IN (?)", year_time, stage_ids).sum(:total_amount).round(2)
|
18
18
|
s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单','已验收','回款中', '服务中','已结束']).pluck(:id)
|
19
19
|
@service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.created_at >= ? AND educode_sales_follow_ups.stage_id IN (?)", year_time, s_stage_ids).sum(:total_amount).round(2)
|
20
|
-
@return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_money_plans.date_at >= ?", year_time).sum(:
|
20
|
+
@return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_money_plans.date_at >= ?", year_time).sum(:amount).round(2)
|
21
21
|
a = Common.where(clazz: '商机类型', name: 'A类').pluck(:id)
|
22
22
|
@a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).sum(:total_amount).round(2)
|
23
23
|
b = Common.where(clazz: '商机类型', name: 'B类').pluck(:id)
|
@@ -61,7 +61,10 @@ module EducodeSales
|
|
61
61
|
@teachers = @teachers.where("educode_sales_teachers.regist_at like ?", "%#{params[:q][:regist_at]}%")
|
62
62
|
end
|
63
63
|
if params[:q].present? && params[:q][:attitude].present?
|
64
|
-
@teachers = @teachers.where("educode_sales_teachers.attitude_id = ?", "#{params[:q][:attitude]}")
|
64
|
+
# @teachers = @teachers.where("educode_sales_teachers.attitude_id = ?", "#{params[:q][:attitude]}")
|
65
|
+
@teachers = @teachers.joins("
|
66
|
+
JOIN educode_sales_teacher_follows ON educode_sales_teachers.follow_up_id = educode_sales_teacher_follows.id
|
67
|
+
").where("educode_sales_teacher_follows.attitude_id = ?", params[:q][:attitude])
|
65
68
|
end
|
66
69
|
if params[:q].present? && params[:q][:teacher_source].present?
|
67
70
|
@teachers = @teachers.where("educode_sales_teachers.source_id = ?", "#{params[:q][:teacher_source]}")
|
@@ -82,10 +85,10 @@ module EducodeSales
|
|
82
85
|
end
|
83
86
|
if params[:q].present? && params[:q][:date].present?
|
84
87
|
date = params[:q][:date].split(" - ")
|
85
|
-
@teachers = @teachers.where("created_at > ? AND created_at < ?", date[0], date[1])
|
88
|
+
@teachers = @teachers.where("educode_sales_teachers.created_at > ? AND educode_sales_teachers.created_at < ?", date[0], date[1])
|
86
89
|
end
|
87
90
|
|
88
|
-
@teachers = @teachers.order("created_at desc").page(params[:page]).per(params[:limit])
|
91
|
+
@teachers = @teachers.order("educode_sales_teachers.created_at desc").page(params[:page]).per(params[:limit])
|
89
92
|
|
90
93
|
end
|
91
94
|
end
|
@@ -111,15 +114,24 @@ module EducodeSales
|
|
111
114
|
teacher.regist_at = Time.now
|
112
115
|
end
|
113
116
|
|
114
|
-
|
117
|
+
unless params[:activity_id].present?
|
118
|
+
return render json: {msg: '该教师已存在', success: false } if EducodeSales::Teacher.find_by(department_id: params[:department_id],name: params[:name])
|
119
|
+
end
|
120
|
+
|
121
|
+
if params[:activity_id].present?
|
122
|
+
if params[:user_id].present?
|
115
123
|
# 把老师添加到活动列表,提取判断下老师列表是否存在
|
116
|
-
|
117
|
-
|
118
|
-
|
124
|
+
find_teacher = Teacher.find_by(user_id: params[:user_id])
|
125
|
+
if find_teacher
|
126
|
+
teacher = find_teacher
|
127
|
+
end
|
128
|
+
else
|
129
|
+
_teacher = EducodeSales::Teacher.find_by(department_id: params[:department_id],name: params[:name])
|
130
|
+
teacher = _teacher if _teacher.present?
|
119
131
|
end
|
132
|
+
return render json: {msg: '该教师已在活动中', success: false } if teacher && teacher.activity_teachers.find_by(activity_id: params[:activity_id]).present?
|
120
133
|
end
|
121
134
|
if params[:activity_id].present?
|
122
|
-
return render json: {msg: '该教师已在活动中', success: false } if teacher.activity_teachers.find_by(activity_id: params[:activity_id]).present?
|
123
135
|
teacher.activity_teachers.build(activity_id: params[:activity_id])
|
124
136
|
end
|
125
137
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
{{# if (d.login) { }}
|
16
16
|
<a href="<%= base_url%>/users/{{d.login}}" class="layui-table-link" target="_blank">{{ d.name }}</a>
|
17
17
|
{{# } else {}}
|
18
|
-
<a href="
|
18
|
+
<a href="javascript:;" class="">{{ d.name }}</a>
|
19
19
|
{{# }}}
|
20
20
|
</script>
|
21
21
|
<script type="text/html" id="courses">
|
@@ -2,9 +2,9 @@
|
|
2
2
|
<div class="layui-form layuimini-form">
|
3
3
|
<div class="layui-form-item" style="padding: 25px">
|
4
4
|
<div class="layui-inline">
|
5
|
-
<label class="layui-form-label required"
|
5
|
+
<label class="layui-form-label required">商机名称</label>
|
6
6
|
<div class="layui-input-block">
|
7
|
-
<input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input"
|
7
|
+
<input type="text" name="name" autocomplete="off" lay-verify="required" class="layui-input" value="<%= @business.name %>" style="width: 300px;">
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
<div class="layui-inline">
|
@@ -237,7 +237,7 @@
|
|
237
237
|
edit(id);
|
238
238
|
break;
|
239
239
|
case 'delete':
|
240
|
-
deleteBusiness(id, elem.data
|
240
|
+
deleteBusiness(id, elem.data('name'));
|
241
241
|
break;
|
242
242
|
}
|
243
243
|
}
|
@@ -300,7 +300,7 @@
|
|
300
300
|
}
|
301
301
|
|
302
302
|
function deleteBusiness(id, name) {
|
303
|
-
|
303
|
+
layer.confirm('确定删除' + name, function (index) {
|
304
304
|
request.delete('missions/businesses/' + id, {}, function (res) {
|
305
305
|
layer.close(index);
|
306
306
|
table.reload("businesses_table")
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<%= Gon::Base.render_data %>
|
1
2
|
<h1 class="m-t-20 text-center"><%= @business.name %></h1>
|
2
3
|
<div class="layui-form layuimini-form">
|
3
4
|
<div class="layui-form-item" style="padding: 25px">
|
@@ -162,7 +163,7 @@
|
|
162
163
|
}
|
163
164
|
})
|
164
165
|
|
165
|
-
|
166
|
+
sales_list.setValue(gon.sales);
|
166
167
|
form.render();
|
167
168
|
|
168
169
|
form.on('submit(add_follow_up)', function (data) {
|
@@ -73,8 +73,10 @@
|
|
73
73
|
layer.close(parent.new_monthly_index)
|
74
74
|
layer.close(parent.monthPlanIndex)
|
75
75
|
layer.close(parent.teacherindex2)
|
76
|
+
layer.close(parent.sindex)
|
76
77
|
table.reload('monthPlanTable')
|
77
78
|
table.reload("newMonthlyTable")
|
79
|
+
table.reload("newWeeklyTable")
|
78
80
|
}
|
79
81
|
})
|
80
82
|
return false;
|
@@ -13,7 +13,8 @@ json.data do
|
|
13
13
|
json.activities_count d.activity_teachers_count
|
14
14
|
json.source EducodeSales::Common.teacher_source_name[d.source_id]
|
15
15
|
# a_id = EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).present? ? EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id : 73
|
16
|
-
json.attitude EducodeSales::TeacherFollow.find_by(teacher_id: d.id).present? ? EducodeSales::Common.find(EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id).name : ''
|
16
|
+
# json.attitude EducodeSales::TeacherFollow.find_by(teacher_id: d.id).present? ? EducodeSales::Common.find(EducodeSales::TeacherFollow.order(created_at: :desc).find_by(teacher_id: d.id).attitude_id).name : ''
|
17
|
+
json.attitude d.follow_up&.attitude&.name
|
17
18
|
json.courses_count d.user_id ? Course.joins(:course_members).where(course_members: {user_id: d.user_id}).distinct("course_id").count : 0
|
18
19
|
json.actives d.actives
|
19
20
|
json.students d.students_count
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<title><%= @title || '头歌营销系统' %></title>
|
6
6
|
<%= csrf_meta_tags %>
|
7
7
|
<%= csp_meta_tag %>
|
8
|
-
<%= favicon_link_tag "educode_sales/
|
8
|
+
<%= favicon_link_tag "educode_sales/logo.png" %>
|
9
9
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
10
10
|
<%= stylesheet_link_tag "educode_sales/application", media: "all" %>
|
11
11
|
<%= javascript_include_tag "educode_sales/application" %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: educode_sales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|