educode_sales 0.9.62 → 0.9.64
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/controllers/educode_sales/activities_controller.rb +12 -0
- data/app/controllers/educode_sales/businesses_controller.rb +3 -0
- data/app/controllers/educode_sales/ideas_controller.rb +4 -4
- data/app/controllers/educode_sales/teachers_controller.rb +6 -2
- data/app/views/educode_sales/activities/index.html.erb +37 -4
- data/app/views/educode_sales/activities/index.json.jbuilder +5 -0
- data/app/views/educode_sales/activities/show_schools.html.erb +84 -0
- data/app/views/educode_sales/activities/show_schools.json.jbuilder +12 -0
- data/app/views/educode_sales/activities/show_teachers.html.erb +1 -1
- data/app/views/educode_sales/businesses/daily_paper.html.erb +9 -1
- data/app/views/educode_sales/customers/edit.html.erb +3 -0
- data/config/routes.rb +3 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e63a76d8b22ea7491a9ac03c2891cdf2e62d8fdfe902b2fa8b844cb4dbd79458
|
4
|
+
data.tar.gz: 77543a51348757e58029c047e0b2f42d620d618130024969b2f16e9ad3454942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917b3a02eb534a97c87f5c4f8933db9bb72b3f63e655024300f9aea82646dc06438d7ce5de36055c2eda9b98f1118e7748f3883ce1448c49c8fa77598f0a5368
|
7
|
+
data.tar.gz: 9426d2279d8f35de786ad0d0b0f1aba56f37393225eb5e187c1cdc22885fdc0e347d431691decf4570ca0f10e3fbee53146609b4a5a1e81c4a58bf9d0d964e1c
|
@@ -151,6 +151,18 @@ module EducodeSales
|
|
151
151
|
render layout: false
|
152
152
|
end
|
153
153
|
|
154
|
+
def show_schools
|
155
|
+
respond_to do |format|
|
156
|
+
format.html do
|
157
|
+
render layout: false
|
158
|
+
end
|
159
|
+
format.json do
|
160
|
+
@data = EducodeSales::ActivityTeacher.joins(teacher: [department: :school]).where(activity_id: params[:id]).select("count(teacher_id) AS teachers_count, departments.name AS department, schools.name AS school, school_id").group("school_id")
|
161
|
+
@data = @data.distinct.page(params[:page]).per(params[:limit])
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
154
166
|
private
|
155
167
|
|
156
168
|
def activity_params
|
@@ -346,6 +346,9 @@ module EducodeSales
|
|
346
346
|
@quarter = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_quarter).count("DISTINCT(educode_sales_follow_ups.business_id)")
|
347
347
|
@year = business.where("educode_sales_follow_ups.created_at >= ?", Time.now.beginning_of_year).count("DISTINCT(educode_sales_follow_ups.business_id)")
|
348
348
|
|
349
|
+
@activities = EducodeSales::Activity.where(staff_id: @current_admin.id).where("created_at >= ?", Time.now.beginning_of_month).count
|
350
|
+
@teachers = EducodeSales::Activity.joins(:teachers).where(staff_id: @current_admin.id).where("educode_sales_activities.created_at >= ?", Time.now.beginning_of_month).count
|
351
|
+
@schools = EducodeSales::Activity.joins(teachers: :department).where(staff_id: @current_admin.id).where("educode_sales_activities.created_at >= ?", Time.now.beginning_of_month).count("DISTINCT(departments.school_id)")
|
349
352
|
render layout: false
|
350
353
|
end
|
351
354
|
|
@@ -67,7 +67,7 @@ module EducodeSales
|
|
67
67
|
|
68
68
|
def create
|
69
69
|
idea = Idea.new(idea_params)
|
70
|
-
idea.school_id = Department.find_by_id(idea.department_id)&.school_id
|
70
|
+
# idea.school_id = Department.find_by_id(idea.department_id)&.school_id
|
71
71
|
idea.creator = current_user
|
72
72
|
assist_staff_ids = Array(params[:assist_staff_ids].to_s.split(","))
|
73
73
|
idea.assist_staff_ids = assist_staff_ids
|
@@ -85,7 +85,7 @@ module EducodeSales
|
|
85
85
|
|
86
86
|
def update
|
87
87
|
@idea.assign_attributes(idea_params)
|
88
|
-
@idea.school_id = Department.find_by_id(@idea.department_id)&.school_id
|
88
|
+
# @idea.school_id = Department.find_by_id(@idea.department_id)&.school_id
|
89
89
|
assist_staff_ids = Array(params[:assist_staff_ids].to_s.split(","))
|
90
90
|
@idea.assist_staff_ids = assist_staff_ids
|
91
91
|
check_changes
|
@@ -116,8 +116,8 @@ module EducodeSales
|
|
116
116
|
def idea_params
|
117
117
|
params.permit(:name, :level, :staff_id,
|
118
118
|
:status, :types, :model, :hardware, :project,
|
119
|
-
:money, :end_time, :content, :department_id,
|
120
|
-
:manager_name, :manager_phone
|
119
|
+
:money, :end_time, :content, :department_id, :school_id,
|
120
|
+
:manager_name, :manager_phone, :school_name, :department_name, :sale_staff_id, :attachment_id)
|
121
121
|
end
|
122
122
|
|
123
123
|
def find_idea
|
@@ -92,7 +92,7 @@ module EducodeSales
|
|
92
92
|
if params[:q].present? && params[:q][:status].present?
|
93
93
|
if params[:q][:status] == "1"
|
94
94
|
@teachers = @teachers.where("educode_sales_teachers.user_id is not null")
|
95
|
-
|
95
|
+
else
|
96
96
|
@teachers = @teachers.where("educode_sales_teachers.user_id is null")
|
97
97
|
end
|
98
98
|
end
|
@@ -120,7 +120,11 @@ module EducodeSales
|
|
120
120
|
").where("province = ?", p)
|
121
121
|
end
|
122
122
|
if params[:activity_id].present?
|
123
|
-
|
123
|
+
if params[:school_id].present?
|
124
|
+
@teachers = @teachers.joins(activity_teachers: [teacher: :department]).where("educode_sales_activity_teachers.activity_id = ? AND departments.school_id = ?", params[:activity_id], params[:school_id])
|
125
|
+
else
|
126
|
+
@teachers = @teachers.joins(:activity_teachers).where("educode_sales_activity_teachers.activity_id = ?", params[:activity_id])
|
127
|
+
end
|
124
128
|
end
|
125
129
|
if params[:q].present? && params[:q][:date].present?
|
126
130
|
date = params[:q][:date].split(" - ")
|
@@ -74,7 +74,9 @@
|
|
74
74
|
<script type="text/html" id="teachers_count">
|
75
75
|
<a href="javascript:void(0);" lay-event="teachers_count" class="layui-table-link">{{ d.teachers_count}}</a>
|
76
76
|
</script>
|
77
|
-
|
77
|
+
<script type="text/html" id="schools_count">
|
78
|
+
<a href="javascript:void(0);" lay-event="schools_count" class="layui-table-link">{{ d.schools_count}}</a>
|
79
|
+
</script>
|
78
80
|
<script>
|
79
81
|
layui.use(['form', 'table', 'miniPage', 'element', 'request'], function () {
|
80
82
|
var $ = layui.jquery,
|
@@ -139,17 +141,24 @@
|
|
139
141
|
title: '天数',
|
140
142
|
width: 200
|
141
143
|
},
|
144
|
+
{
|
145
|
+
field: 'schools_count',
|
146
|
+
title: '学校数',
|
147
|
+
width: 200,
|
148
|
+
totalRow: true,
|
149
|
+
templet: '#schools_count'
|
150
|
+
},
|
142
151
|
{
|
143
152
|
field: 'teachers_count',
|
144
153
|
title: '教师数',
|
145
154
|
width: 200,
|
146
|
-
|
155
|
+
totalRow:true,
|
147
156
|
templet: '#teachers_count'
|
148
157
|
},
|
149
158
|
{
|
150
159
|
field: 'students_count',
|
151
160
|
title: '学生数',
|
152
|
-
|
161
|
+
totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
|
153
162
|
width: 200
|
154
163
|
},
|
155
164
|
{
|
@@ -284,8 +293,32 @@
|
|
284
293
|
return false;
|
285
294
|
}
|
286
295
|
else if (obj.event === 'teachers_count') {
|
287
|
-
activity_id = obj.data.id
|
296
|
+
activity_id = obj.data.id;
|
297
|
+
school_id = '';
|
288
298
|
content = miniPage.getHrefContent('/missions/activities/show_teachers');
|
299
|
+
openWH = miniPage.getOpenWidthHeight();
|
300
|
+
index2 = layer.open({
|
301
|
+
title: '活动列表/' + data.name,
|
302
|
+
type: 1,
|
303
|
+
shade: 0.2,
|
304
|
+
maxmin: true,
|
305
|
+
shadeClose: true,
|
306
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
307
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
308
|
+
content: content,
|
309
|
+
success: function (layero, index) {
|
310
|
+
form.render('select');
|
311
|
+
},
|
312
|
+
});
|
313
|
+
$(window).on("resize", function () {
|
314
|
+
layer.full(index);
|
315
|
+
});
|
316
|
+
return false;
|
317
|
+
} else if (obj.event == 'schools_count') {
|
318
|
+
activity_id = obj.data.id;
|
319
|
+
activity_name = data.name;
|
320
|
+
school_id = '';
|
321
|
+
content = miniPage.getHrefContent('/missions/activities/' + obj.data.id +'/show_schools');
|
289
322
|
openWH = miniPage.getOpenWidthHeight();
|
290
323
|
index2 = layer.open({
|
291
324
|
title: '活动列表/' + data.name,
|
@@ -1,4 +1,5 @@
|
|
1
1
|
teachers_count = 0
|
2
|
+
schools_count = 0
|
2
3
|
json.data do
|
3
4
|
json.array! @activities do |d|
|
4
5
|
json.id d.id
|
@@ -15,11 +16,15 @@ json.data do
|
|
15
16
|
json.staff_manage d.manages.map { |d| d.staff.user.real_name}.uniq.join("、")
|
16
17
|
json.staff_assist d.assists.map { |d| d.staff.user.real_name}.uniq.join("、")
|
17
18
|
json.expert d.experts.pluck(:name).join("、")
|
19
|
+
|
20
|
+
json.schools_count EducodeSales::ActivityTeacher.joins(teacher: :department).where(activity_id: d.id).select("distinct(school_id)").count
|
21
|
+
schools_count += EducodeSales::ActivityTeacher.joins(teacher: :department).where(activity_id: d.id).select("distinct(school_id)").count
|
18
22
|
end
|
19
23
|
end
|
20
24
|
|
21
25
|
json.totalRow do
|
22
26
|
json.teachers_count teachers_count.to_s
|
27
|
+
json.schools_count schools_count.to_s
|
23
28
|
end
|
24
29
|
json.code 0
|
25
30
|
json.count @activities.total_count
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<div class="min-height-table">
|
2
|
+
<table class="layui-hide" id="show_school_table" style="min-height: 300px;" lay-filter="show_school_table"></table>
|
3
|
+
</div>
|
4
|
+
<script type="text/html" id="school_toolbar">
|
5
|
+
<div class="layui-btn-container">
|
6
|
+
<span class="table-label">教师列表</span>
|
7
|
+
</div>
|
8
|
+
</script>
|
9
|
+
|
10
|
+
<script type="text/html" id="teachers_count">
|
11
|
+
<a href="javascript:void(0);" lay-event="teachers_count" class="layui-table-link">{{ d.teachers_count}}</a>
|
12
|
+
</script>
|
13
|
+
<script>
|
14
|
+
|
15
|
+
layui.use(['form', 'table', 'miniPage', 'element', 'request'], function () {
|
16
|
+
var $ = layui.jquery,
|
17
|
+
form = layui.form,
|
18
|
+
request = layui.request,
|
19
|
+
miniPage = layui.miniPage;
|
20
|
+
|
21
|
+
table = layui.table;
|
22
|
+
table.render({
|
23
|
+
elem: '#show_school_table',
|
24
|
+
url: '/missions/activities/' + parent.activity_id + '/show_schools',
|
25
|
+
defaultToolbar: ['filter'],
|
26
|
+
toolbar: '#school_toolbar',
|
27
|
+
cols: [
|
28
|
+
[
|
29
|
+
{
|
30
|
+
field: 'id',
|
31
|
+
width: 60,
|
32
|
+
title:'序号',
|
33
|
+
type: 'numbers',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
field: 'school',
|
37
|
+
width: 300,
|
38
|
+
title: '单位',
|
39
|
+
},
|
40
|
+
{
|
41
|
+
field: 'department',
|
42
|
+
width: 200,
|
43
|
+
title: '部门'
|
44
|
+
},
|
45
|
+
{
|
46
|
+
field: 'teachers_count',
|
47
|
+
title: '教师数',
|
48
|
+
width: 120,
|
49
|
+
templet: "#teachers_count"
|
50
|
+
},
|
51
|
+
]
|
52
|
+
],
|
53
|
+
page: true,
|
54
|
+
});
|
55
|
+
|
56
|
+
|
57
|
+
table.on('tool(show_school_table)', function (obj) {
|
58
|
+
if (obj.event === 'teachers_count') {
|
59
|
+
activity_id = parent.activity_id;
|
60
|
+
school_id = obj.data.school_id;
|
61
|
+
content = miniPage.getHrefContent('/missions/activities/show_teachers');
|
62
|
+
openWH = miniPage.getOpenWidthHeight();
|
63
|
+
index2 = layer.open({
|
64
|
+
title: '活动列表/' + parent.activity_name,
|
65
|
+
type: 1,
|
66
|
+
shade: 0.2,
|
67
|
+
maxmin: true,
|
68
|
+
shadeClose: true,
|
69
|
+
area: [openWH[0] + 'px', openWH[1] + 'px'],
|
70
|
+
offset: [openWH[2] + 'px', openWH[3] + 'px'],
|
71
|
+
content: content,
|
72
|
+
success: function (layero, index) {
|
73
|
+
form.render('select');
|
74
|
+
},
|
75
|
+
});
|
76
|
+
$(window).on("resize", function () {
|
77
|
+
layer.full(index);
|
78
|
+
});
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
})
|
82
|
+
|
83
|
+
});
|
84
|
+
</script>
|
@@ -52,7 +52,7 @@
|
|
52
52
|
table = layui.table;
|
53
53
|
table.render({
|
54
54
|
elem: '#show_teachers_table',
|
55
|
-
url: '/missions/teachers?activity_id=' + parent.activity_id,
|
55
|
+
url: '/missions/teachers?activity_id=' + parent.activity_id + "&school_id=" + (parent.school_id ? parent.school_id : ''),
|
56
56
|
toolbar: '#teacher_toolbar',
|
57
57
|
defaultToolbar: ['filter'],
|
58
58
|
cols: [
|
@@ -9,7 +9,12 @@
|
|
9
9
|
本季-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @quarter %>, </span>
|
10
10
|
本年-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @year %></span>
|
11
11
|
</p>
|
12
|
-
<p
|
12
|
+
<p>二、本月已组织会议</p>
|
13
|
+
<p style="margin-bottom: 30px;">
|
14
|
+
活动-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @activities %>, </span>
|
15
|
+
学校-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @schools %>, </span>
|
16
|
+
教师-<span style="color: rgb(56, 150, 243);font-weight: bold;"><%= @teachers %></span>
|
17
|
+
</p>
|
13
18
|
<p>三、客户跟进情况</p>
|
14
19
|
<% text = "\n" %>
|
15
20
|
<% text += "一、AB类商机开拓情况\n" %>
|
@@ -17,6 +22,9 @@
|
|
17
22
|
<% text += "本季-#{@quarter }, "%>
|
18
23
|
<% text += "本年-#{@year }\n\n"%>
|
19
24
|
<% text += "二、本月已组织会议 \n\n"%>
|
25
|
+
<% text += "活动-#{@activities }, "%>
|
26
|
+
<% text += "学校-#{@schools }, "%>
|
27
|
+
<% text += "教师-#{@teachers }\n\n"%>
|
20
28
|
<% text += "三、客户跟进情况 \n"%>
|
21
29
|
<% @followups.each_with_index do |d, i| %>
|
22
30
|
<% text += "#{i+1}、#{d.business&.department&.school&.name}--**商机:#{d.description}\n" %>
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: educode_sales
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.64
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
@@ -237,6 +237,8 @@ files:
|
|
237
237
|
- app/views/educode_sales/activities/index.html.erb
|
238
238
|
- app/views/educode_sales/activities/index.json.jbuilder
|
239
239
|
- app/views/educode_sales/activities/new.html.erb
|
240
|
+
- app/views/educode_sales/activities/show_schools.html.erb
|
241
|
+
- app/views/educode_sales/activities/show_schools.json.jbuilder
|
240
242
|
- app/views/educode_sales/activities/show_teachers.html.erb
|
241
243
|
- app/views/educode_sales/assessments/_finished.html.erb
|
242
244
|
- app/views/educode_sales/assessments/_progress.html.erb
|