educode_sales 0.1.0 → 0.1.1

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/educode_sales/activities_controller.rb +7 -1
  3. data/app/controllers/educode_sales/application_controller.rb +0 -1
  4. data/app/controllers/educode_sales/businesses_controller.rb +3 -2
  5. data/app/controllers/educode_sales/operation_plans_controller.rb +155 -0
  6. data/app/controllers/educode_sales/operation_reports_controller.rb +125 -0
  7. data/app/controllers/educode_sales/places_controller.rb +1 -0
  8. data/app/controllers/educode_sales/plans_controller.rb +3 -1
  9. data/app/controllers/educode_sales/sale_reports_controller.rb +2 -1
  10. data/app/controllers/educode_sales/sales_controller.rb +4 -1
  11. data/app/controllers/educode_sales/teacher_follows_controller.rb +6 -0
  12. data/app/controllers/educode_sales/teachers_controller.rb +17 -5
  13. data/app/models/ability.rb +4 -1
  14. data/app/models/educode_sales/common.rb +1 -0
  15. data/app/models/educode_sales/staff.rb +2 -0
  16. data/app/views/educode_sales/activities/index.html.erb +17 -8
  17. data/app/views/educode_sales/businesses/index.html.erb +136 -140
  18. data/app/views/educode_sales/businesses/show_follow.html.erb +18 -3
  19. data/app/views/educode_sales/operation_plans/_monthPlan.html.erb +60 -76
  20. data/app/views/educode_sales/operation_plans/_monthly.html.erb +116 -95
  21. data/app/views/educode_sales/operation_plans/_weekPlan.html.erb +73 -74
  22. data/app/views/educode_sales/operation_plans/_weekly.html.erb +108 -86
  23. data/app/views/educode_sales/operation_plans/edit_month.html.erb +35 -32
  24. data/app/views/educode_sales/operation_plans/edit_week.html.erb +40 -39
  25. data/app/views/educode_sales/operation_plans/index.json.jbuilder +19 -0
  26. data/app/views/educode_sales/operation_plans/my_month.json.jbuilder +18 -0
  27. data/app/views/educode_sales/operation_plans/my_week.json.jbuilder +19 -0
  28. data/app/views/educode_sales/operation_plans/new_month.html.erb +5 -10
  29. data/app/views/educode_sales/operation_plans/new_monthly.html.erb +27 -43
  30. data/app/views/educode_sales/operation_plans/new_week.html.erb +7 -7
  31. data/app/views/educode_sales/operation_plans/new_weekly.html.erb +46 -53
  32. data/app/views/educode_sales/operation_plans/show_month.html.erb +4 -10
  33. data/app/views/educode_sales/operation_plans/show_week.html.erb +20 -25
  34. data/app/views/educode_sales/operation_plans/show_weekly.html.erb +6 -6
  35. data/app/views/educode_sales/operation_reports/audit.html.erb +214 -0
  36. data/app/views/educode_sales/operation_reports/edit.html.erb +237 -0
  37. data/app/views/educode_sales/operation_reports/index.json.jbuilder +17 -0
  38. data/app/views/educode_sales/operation_reports/plans.json.jbuilder +19 -0
  39. data/app/views/educode_sales/operation_reports/show.html.erb +139 -0
  40. data/app/views/educode_sales/operations/trends.html.erb +8 -0
  41. data/app/views/educode_sales/places/index.html.erb +6 -0
  42. data/app/views/educode_sales/plans/_monthPlan.html.erb +8 -0
  43. data/app/views/educode_sales/plans/_monthly.html.erb +8 -0
  44. data/app/views/educode_sales/plans/_weekPlan.html.erb +10 -3
  45. data/app/views/educode_sales/plans/_weekly.html.erb +8 -0
  46. data/app/views/educode_sales/plans/audit_weekly.html.erb +6 -0
  47. data/app/views/educode_sales/plans/edit_monthly.html.erb +8 -0
  48. data/app/views/educode_sales/plans/edit_weekly.html.erb +8 -0
  49. data/app/views/educode_sales/plans/new_monthly.html.erb +8 -0
  50. data/app/views/educode_sales/plans/new_weekly.html.erb +7 -1
  51. data/app/views/educode_sales/sale_trends/trends.html.erb +8 -0
  52. data/app/views/educode_sales/teachers/index.html.erb +3 -5
  53. data/app/views/layouts/educode_sales/application.html.erb +23 -2
  54. data/config/routes.rb +11 -4
  55. data/lib/educode_sales/version.rb +1 -1
  56. metadata +14 -5
@@ -0,0 +1,237 @@
1
+ <script type="text/html" id="newWeeklyToolbar">
2
+ <div class="layui-btn-container">
3
+ <span class="table-label">本周计划列表</span>
4
+ <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn pull-right" lay-event="add"> 添加计划</button>
5
+ </div>
6
+ </script>
7
+ <form class="layui-form layui-form-pane">
8
+ <div class="layui-form-item">
9
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
10
+ <label>完成率:</label>
11
+ <span><%= @sale_report.finish_rate %></span>
12
+ </div>
13
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
14
+ <label style="margin-left: 100px">运营教师:</label>
15
+ <span><%= @sale_report.client%></span>
16
+ </div>
17
+ </div>
18
+ <div class="layui-form-item" style="margin-left: 18px">
19
+ <div class="layui-form-item layui-form-text">
20
+ <label class="layui-form-label">个人总结</label>
21
+ <div class="layui-input-block">
22
+ <textarea name="content" placeholder="此处填写要点:
23
+ 1、一句话概括本周工作的主要成效和主要挫折;
24
+ 2、补充说明收获、经验;
25
+ 3、补充说明需要上级解决的问题和挑战。" class="layui-textarea"><%= @sale_report.content %></textarea>
26
+ </div>
27
+ </div>
28
+ <div class="layui-inline m-t-10">
29
+ <button type="submit" class="layui-btn layui-btn-normal" lay-submit lay-filter="update_weekly_report"
30
+ style="margin-left: 18px">提交
31
+ </button>
32
+ </div>
33
+ </div>
34
+ </form>
35
+
36
+ <!--表格-->
37
+ <table class="layui-hide" id="newWeeklyTable" lay-filter="newWeeklyTable"></table>
38
+ <!--<script type="text/html" id="show_follow">-->
39
+ <!-- <a href="javascript:void(0);" lay-event="show_follow" class="layui-table-link">{{ d.follow_ups_count }}</a>-->
40
+ <!--</script>-->
41
+ <script type="text/html" id="currentWeekly">
42
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
43
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
44
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
45
+ </script>
46
+ <script>
47
+ layui.use(['rate', 'table', 'request', 'form', 'miniPage', 'jquery'], function () {
48
+ var rate = layui.rate,
49
+ form = layui.form,
50
+ $ = layui.jquery,
51
+ miniPage = layui.miniPage,
52
+ request = layui.request;
53
+ table = layui.table;
54
+
55
+
56
+ form.on('submit(update_weekly_report)', function (data) {
57
+ request.authPut("educode_sales/operation_reports/<%= @sale_report.id%>", data.field, function (res) {
58
+ if (res.success == false) {
59
+ layer.alert(res.msg)
60
+ } else {
61
+ layer.close(parent.sindex);
62
+ parent.layer.close(parent.layer.getFrameIndex(window.name))
63
+ if (parent.from_edit_monthly) {
64
+ parent.table.reload('monthlyTable');
65
+ } else {
66
+ parent.table.reload('weeklyTable');
67
+ parent.table.reload('monthlyTable');
68
+ }
69
+
70
+ layer.alert('更改成功')
71
+ }
72
+ })
73
+ return false;
74
+ });
75
+
76
+ table.render({
77
+ elem: '#newWeeklyTable',
78
+ url: '/educode_sales/operation_plans/my_week',
79
+ toolbar: '#newWeeklyToolbar',
80
+ defaultToolbar: [],
81
+ cols: [
82
+ [{
83
+ field: 'id',
84
+ width: 80,
85
+ title: '序号'
86
+ },
87
+ {
88
+ field: 'staff',
89
+ width: 100,
90
+ title: '姓名'
91
+ },
92
+ {
93
+ field: 'teacher_name',
94
+ width: 100,
95
+ title: '教师姓名',
96
+ },
97
+ {
98
+ field: 'school',
99
+ width: 100,
100
+ title: '单位'
101
+ },
102
+ {
103
+ field: 'department',
104
+ width: 100,
105
+ title: '部门'
106
+ },
107
+ {
108
+ field: 'week',
109
+ width: 100,
110
+ title: '周次',
111
+ },
112
+ {
113
+ field: 'content',
114
+ width: 300,
115
+ title: '计划内容',
116
+ },
117
+ {
118
+ field: 'follow',
119
+ width: 100,
120
+ title: '跟进',
121
+ templet: '#show_follow'
122
+ },
123
+ {
124
+ field: 'rate',
125
+ width: 100,
126
+ title: '完成率',
127
+ },
128
+ {
129
+ field: 'updated_at',
130
+ width: 150,
131
+ title: '更新时间',
132
+ sort: true,
133
+ },
134
+ {
135
+ title: '操作',
136
+ minWidth: 190,
137
+ toolbar: '#currentWeekly',
138
+ align: "center",
139
+ fixed: 'right'
140
+ }
141
+ ]
142
+ ],
143
+ page: true
144
+ });
145
+
146
+ table.on('toolbar(newWeeklyTable)', function (obj) {
147
+ if (obj.event === 'add') { // 监听添加操作
148
+ from_weekly = true;
149
+ var content = miniPage.getHrefContent('/educode_sales/operation_plans/new_week');
150
+ var openWH = miniPage.getOpenWidthHeight();
151
+ sindex = layer.open({
152
+ title: '添加计划',
153
+ type: 1,
154
+ shade: 0.2,
155
+ maxmin: true,
156
+ shadeClose: true,
157
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
158
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
159
+ content: content,
160
+ success: function (layero, index) {
161
+ // 重新渲染弹层中的下拉选择框select
162
+ form.render('select');
163
+ }
164
+ });
165
+ $(window).on("resize", function () {
166
+ layer.full(sindex);
167
+ });
168
+ }
169
+ });
170
+ table.on('tool(newWeeklyTable)', function (obj) {
171
+ var data = obj.data;
172
+ id = data.id
173
+ if (obj.event === 'delete') {
174
+ layer.confirm('确定删除ID为' + id + " 的周计划", function (index) {
175
+ request.delete('educode_sales/operation_plans/' + id, {}, function (res) {
176
+ layer.close(index);
177
+ table.reload("newWeeklyTable")
178
+ })
179
+ });
180
+ } else if (obj.event === 'show') {
181
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/show_week?id=' + id);
182
+ openWH = miniPage.getOpenWidthHeight();
183
+ index = layer.open({
184
+ title: '查看',
185
+ type: 1,
186
+ shade: 0.2,
187
+ maxmin: true,
188
+ shadeClose: true,
189
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
190
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
191
+ content: content
192
+ });
193
+ $(window).on("resize", function () {
194
+ layer.full(index);
195
+ });
196
+ return false;
197
+ } else if (obj.event === 'edit') {
198
+ plan_id = id;
199
+ from_sales = true;
200
+ content = miniPage.getHrefContent('/educode_sales/operation_plans/edit_week?id=' + id);
201
+ openWH = miniPage.getOpenWidthHeight();
202
+ sindex = layer.open({
203
+ title: '编辑',
204
+ type: 1,
205
+ shade: 0.2,
206
+ maxmin: true,
207
+ shadeClose: true,
208
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
209
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
210
+ content: content
211
+ });
212
+ $(window).on("resize", function () {
213
+ layer.full(sindex);
214
+ });
215
+ return false;
216
+ } else if (obj.event === 'show_follow') {
217
+ id = data.business_id
218
+ content = miniPage.getHrefContent('/educode_sales/teacher/show_follow?id=' + data.business_id);
219
+ openWH = miniPage.getOpenWidthHeight();
220
+ index = layer.open({
221
+ title: '商机列表/' + data.business_name + '的跟进记录',
222
+ type: 1,
223
+ shade: 0.2,
224
+ maxmin: true,
225
+ shadeClose: true,
226
+ area: [openWH[0] + 'px', openWH[1] + 'px'],
227
+ offset: [openWH[2] + 'px', openWH[3] + 'px'],
228
+ content: content
229
+ });
230
+ $(window).on("resize", function () {
231
+ layer.full(index);
232
+ });
233
+ }
234
+ });
235
+
236
+ })
237
+ </script>
@@ -0,0 +1,17 @@
1
+ json.data do
2
+ json.array! @sale_reports do |d|
3
+ json.id d.id
4
+ json.staff d.staff.user.real_name
5
+ json.client d.client
6
+ # json.amount d.amount
7
+ json.content d.content.truncate(30)
8
+ json.finish_rate "#{d.finish_rate}%"
9
+ json.level1_score d.level1_score || 0
10
+ json.level2_score d.level2_score || 0
11
+ json.level3_score d.level3_score || 0
12
+ json.updated_at d.updated_at.to_s
13
+ end
14
+ end
15
+
16
+ json.code 0
17
+ json.count @sale_reports.count
@@ -0,0 +1,19 @@
1
+ json.data do
2
+ json.array! @sale_plans do |d|
3
+ json.id d.id
4
+ json.staff d.staff.user.real_name
5
+ json.teacher_name d.teacher.name
6
+ json.department d.teacher.department&.name
7
+ json.school d.teacher.department&.school&.name
8
+ json.month d.month.strftime("%Y-%m")
9
+ json.week d.weekly
10
+ json.teacher_id d.teacher_id
11
+ json.content d.content.truncate(30)
12
+ # json.follow_ups_count d.teacher.follow_ups_count
13
+ json.rate "#{d.finish_rate}%"
14
+ json.updated_at d.updated_at.to_s
15
+ end
16
+ end
17
+
18
+ json.code 0
19
+ json.count @sale_plans.count
@@ -0,0 +1,139 @@
1
+ <form class="layui-form layui-form-pane" action="">
2
+ <div class="layui-form-item">
3
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
4
+ <label>完成率:</label>
5
+ <span><%= @sale_report.finish_rate %></span>
6
+ </div>
7
+ <div class="layui-inline" style="margin:18px; font-weight: bold">
8
+ <label style="margin-left: 100px">运营教师:</label>
9
+ <span><%= @sale_report.client%></span>
10
+ </div>
11
+ </div>
12
+ <div class="layui-form-item" style="margin-left: 18px">
13
+ <div class="layui-form-item layui-form-text">
14
+ <label class="layui-form-label">个人总结</label>
15
+ <div class="layui-input-block">
16
+ <textarea name="desc" placeholder="此处填写要点:
17
+ 1、一句话概括本周工作的主要成效和主要挫折;
18
+ 2、补充说明收获、经验;
19
+ 3、补充说明需要上级解决的问题和挑战。" disabled class="layui-textarea"><%= @sale_report.content %></textarea>
20
+ </div>
21
+ </div>
22
+ <div class="layui-form-item layui-form-text">
23
+ <label class="layui-form-label">大区意见</label>
24
+ <div class="layui-input-block">
25
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
26
+ class="layui-textarea"><%= @sale_report.level1_opinion %></textarea>
27
+ </div>
28
+ </div>
29
+ <div id="weekStar4"></div>
30
+ <div class="layui-form-item layui-form-text">
31
+ <label class="layui-form-label">总监意见</label>
32
+ <div class="layui-input-block">
33
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
34
+ class="layui-textarea"><%= @sale_report.level2_opinion %></textarea>
35
+ </div>
36
+ </div>
37
+ <div id="weekStar5"></div>
38
+ <div class="layui-form-item layui-form-text">
39
+ <label class="layui-form-label">副总意见</label>
40
+ <div class="layui-input-block">
41
+ <textarea name="desc" placeholder="给出评价、提醒、建议、办法等。" disabled
42
+ class="layui-textarea"><%= @sale_report.level3_opinion %></textarea>
43
+ </div>
44
+ </div>
45
+ <div id="weekStar6"></div>
46
+ <br>
47
+ </div>
48
+ </form>
49
+
50
+ <!--表格-->
51
+ <table class="layui-hide" id="showWeeklyTable" lay-filter="currentShowWeekly"></table>
52
+ <script type="text/html" id="currentShowWeekly">
53
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="show">查看</a>
54
+ <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
55
+ <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
56
+ </script>
57
+ <script>
58
+ layui.use(['rate', 'table'], function () {
59
+ var rate = layui.rate;
60
+ table = layui.table
61
+ rate.render({
62
+ elem: '#weekStar4',
63
+ half: true,
64
+ readonly: true
65
+ })
66
+ rate.render({
67
+ elem: '#weekStar5',
68
+ half: true,
69
+ readonly: true
70
+ })
71
+ rate.render({
72
+ elem: '#weekStar6',
73
+ half: true,
74
+ readonly: true
75
+ })
76
+ })
77
+
78
+ table.render({
79
+ elem: '#showWeeklyTable',
80
+ // url: 'api/table.json',
81
+ defaultToolbar: [],
82
+ cols: [
83
+ [
84
+ {
85
+ field: 'id',
86
+ width: 80,
87
+ title: '序号'
88
+ },
89
+ {
90
+ field: 'username',
91
+ width: 100,
92
+ title: '姓名'
93
+ },
94
+ {
95
+ field: 'chance',
96
+ width: 300,
97
+ title: '商机名称',
98
+ },
99
+ {
100
+ field: 'company',
101
+ width: 100,
102
+ title: '单位'
103
+ },
104
+ {
105
+ field: 'dep',
106
+ width: 100,
107
+ title: '部门'
108
+ },
109
+ {
110
+ field: 'week',
111
+ width: 100,
112
+ title: '周次',
113
+ },
114
+ {
115
+ field: 'plan',
116
+ width: 300,
117
+ title: '计划内容',
118
+ },
119
+ {
120
+ field: 'follow',
121
+ width: 100,
122
+ title: '跟进',
123
+ },
124
+ {
125
+ field: 'rate',
126
+ width: 100,
127
+ title: '完成率',
128
+ },
129
+ {
130
+ field: 'updateTime',
131
+ width: 150,
132
+ title: '更新时间',
133
+ sort: true,
134
+ }
135
+ ]
136
+ ],
137
+ page: true
138
+ });
139
+ </script>
@@ -14,7 +14,9 @@
14
14
  <div class="panel layui-bg-number">
15
15
  <div class="panel-body">
16
16
  <div class="panel-title">
17
+ <% if can? :update, EducodeSales::OperationTrend %>
17
18
  <span class="layui-icon layui-icon-edit pull-right" id="users_count_edit"></span>
19
+ <% end %>
18
20
  <h5>新增用户目标</h5>
19
21
  </div>
20
22
  <div class="panel-content y-t-10">
@@ -30,7 +32,9 @@
30
32
  <div class="panel layui-bg-number">
31
33
  <div class="panel-body">
32
34
  <div class="panel-title">
35
+ <% if can? :update, EducodeSales::OperationTrend %>
33
36
  <span class="layui-icon layui-icon-edit pull-right" id="teachers_count_edit"></span>
37
+ <% end %>
34
38
  <h5>新增教师目标</h5>
35
39
  </div>
36
40
  <div class="panel-content y-t-10">
@@ -46,7 +50,9 @@
46
50
  <div class="panel layui-bg-number">
47
51
  <div class="panel-body">
48
52
  <div class="panel-title">
53
+ <% if can? :update, EducodeSales::OperationTrend %>
49
54
  <span class="layui-icon layui-icon-edit pull-right" id="courses_count_edit"></span>
55
+ <% end %>
50
56
  <h5>新增课堂目标</h5>
51
57
  </div>
52
58
  <div class="panel-content y-t-10">
@@ -62,7 +68,9 @@
62
68
  <div class="panel layui-bg-number">
63
69
  <div class="panel-body">
64
70
  <div class="panel-title">
71
+ <% if can? :update, EducodeSales::OperationTrend %>
65
72
  <span class="layui-icon layui-icon-edit pull-right" id="top_teachers_count_edit"></span>
73
+ <% end %>
66
74
  <h5>新增名师目标</h5>
67
75
  </div>
68
76
  <div class="panel-content y-t-10">