educode_sales 0.9.62 → 0.9.63

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: 15485a9308608796320e988b7095196d7747dffb82c6ac7478e146ca9a3034c4
4
- data.tar.gz: b436c683fd104c2a599979a505e3507e6f117e98f7e525b51b1f3b1977aedb94
3
+ metadata.gz: aadc92f524887e60e288e34449257df71ec8649c217836481a2a3af62a69e6c8
4
+ data.tar.gz: 256153b8488e50aad457a407e35e31451b31610325590de79305d335c921739e
5
5
  SHA512:
6
- metadata.gz: 04b502321a7d5fd2136d97577802d45d502645651d26b59b0b2d7474c06e1e959a489d9c5930ff1e45b24b80d676f4b804570d7b58af7edd09d031e036b95ec2
7
- data.tar.gz: 2daf5753d3ed08580c758f097751ae59a352159b2542c8b31fcafc30c6866becc7b56563a76a4de493efb1f1c4a0804e2b09618210a66c009184b7f86555f8f5
6
+ metadata.gz: e707698f7149b22d1f776783dbbfd16065be5626ce1213c3d01d096d8b68791c3af28144d07642d6e8f8446f33fc85658ce10d64b915e11a4f0b4ed720819d28
7
+ data.tar.gz: fad659d669624a2abd61b6db7d29c1954c6b9372ea4e3bf6c1a36dc6956cf4cfab70dc46e207b2ab80ef2b7fcb8e311e2e7449d78700511c4aa2248cb638bc6a
@@ -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
 
@@ -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
- else
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
- @teachers = @teachers.joins(:activity_teachers).where("educode_sales_activity_teachers.activity_id = ?", params[:activity_id])
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
- totalRow:true,
155
+ totalRow:true,
147
156
  templet: '#teachers_count'
148
157
  },
149
158
  {
150
159
  field: 'students_count',
151
160
  title: '学生数',
152
- totalRow:'{{ parseInt(d.TOTAL_NUMS) }}',
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>
@@ -0,0 +1,12 @@
1
+ json.data do
2
+ json.array! @data do |d|
3
+ json.id d.id
4
+ json.school_id d.school_id
5
+ json.school d['school']
6
+ json.department d['department']
7
+ json.teachers_count d['teachers_count']
8
+ end
9
+ end
10
+
11
+ json.code 0
12
+ json.count @data.total_count
@@ -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 style="margin-bottom: 30px;">二、本月已组织会议</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" %>
@@ -84,6 +84,9 @@
84
84
 
85
85
 
86
86
  var dataCustom = [
87
+ { "n": '',
88
+ "s": []
89
+ },
87
90
  {
88
91
  "n": "北京",
89
92
  "s": [
data/config/routes.rb CHANGED
@@ -266,6 +266,9 @@ EducodeSales::Engine.routes.draw do
266
266
  collection do
267
267
  get :show_teachers
268
268
  end
269
+ member do
270
+ get :show_schools
271
+ end
269
272
  end
270
273
 
271
274
  resources :sales do
@@ -1,3 +1,3 @@
1
1
  module EducodeSales
2
- VERSION = '0.9.62'
2
+ VERSION = '0.9.63'
3
3
  end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: educode_sales
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.62
4
+ version: 0.9.63
5
5
  platform: ruby
6
6
  authors:
7
7
  - anke1460
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-03-24 00:00:00.000000000 Z
@@ -105,7 +105,6 @@ files:
105
105
  - app/assets/images/educode_sales/icon-login.png
106
106
  - app/assets/images/educode_sales/icon.png
107
107
  - app/assets/images/educode_sales/indexLogo.png
108
- - app/assets/images/educode_sales/indexlogo.png
109
108
  - app/assets/images/educode_sales/loading-0.gif
110
109
  - app/assets/images/educode_sales/loading-1.gif
111
110
  - app/assets/images/educode_sales/loading-2.gif
@@ -237,6 +236,8 @@ files:
237
236
  - app/views/educode_sales/activities/index.html.erb
238
237
  - app/views/educode_sales/activities/index.json.jbuilder
239
238
  - app/views/educode_sales/activities/new.html.erb
239
+ - app/views/educode_sales/activities/show_schools.html.erb
240
+ - app/views/educode_sales/activities/show_schools.json.jbuilder
240
241
  - app/views/educode_sales/activities/show_teachers.html.erb
241
242
  - app/views/educode_sales/assessments/_finished.html.erb
242
243
  - app/views/educode_sales/assessments/_progress.html.erb
@@ -574,7 +575,7 @@ homepage: https://www.educoder.net
574
575
  licenses:
575
576
  - MIT
576
577
  metadata: {}
577
- post_install_message:
578
+ post_install_message:
578
579
  rdoc_options: []
579
580
  require_paths:
580
581
  - lib
@@ -589,8 +590,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
589
590
  - !ruby/object:Gem::Version
590
591
  version: '0'
591
592
  requirements: []
592
- rubygems_version: 3.0.9
593
- signing_key:
593
+ rubygems_version: 3.0.0
594
+ signing_key:
594
595
  specification_version: 4
595
596
  summary: Summary of EducodeSales.
596
597
  test_files: []