educode_sales 0.9.41 → 0.9.42
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/customers_controller.rb +53 -25
- data/app/controllers/educode_sales/staffs_controller.rb +23 -11
- data/app/models/ability.rb +1 -1
- data/app/models/educode_sales/staff.rb +9 -0
- data/app/models/educode_sales/staff_permission.rb +6 -0
- data/app/views/educode_sales/customers/edit.html.erb +14 -5
- data/app/views/educode_sales/staffs/edit.html.erb +81 -16
- data/db/migrate/20230209102302_create_educode_sales_staff_permissions.rb +10 -0
- data/lib/educode_sales/version.rb +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d635995859ce768ee96b28509c5094efbc03e8d98ca1b6fe59e52bc4696ef41e
|
4
|
+
data.tar.gz: 8010219ab35845df3329179cf6e8f2e56e224b5d60781a2ff4b80999efcc0c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3939a32d342b6ce49488569f52a67902fad404502dfae2262a1f4b37a3275ec63728e36a1d03feebba2cbf20590de4ceac237a09d5b053dc10510e5506eb20f5
|
7
|
+
data.tar.gz: 37ba20f22853d9cd00c82c5a1f472157fa37fbfe8cfac77cb868b707142ab6d36b8e93f1ecb4f9cd6dec9f478ed9b406cfb06a68115812b6e7dd0a3e67d40391
|
Binary file
|
@@ -6,38 +6,39 @@ module EducodeSales
|
|
6
6
|
def new_department
|
7
7
|
render layout: false
|
8
8
|
end
|
9
|
+
|
9
10
|
def create_department
|
10
|
-
|
11
|
-
|
11
|
+
department_name = params[:department_name].to_s.strip
|
12
|
+
school = School.find(params[:school_id])
|
12
13
|
|
13
|
-
|
14
|
+
return render_failure('部门名称重复') if school.departments.exists?(name: department_name)
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
ActiveRecord::Base.transaction do
|
17
|
+
department = school.departments.create!(name: department_name, is_auth: 1)
|
18
|
+
ApplyAddDepartment.create!(school_id: school.id, status: 1, name: department.name,
|
19
|
+
department_id: department.id, user_id: current_user.id)
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
+
render_success
|
22
23
|
end
|
23
24
|
|
24
25
|
def edit_department
|
25
26
|
@department = Department.find(params[:id])
|
26
27
|
render layout: false
|
27
28
|
end
|
29
|
+
|
28
30
|
def update_department
|
29
31
|
department = Department.find(params[:id])
|
30
32
|
department.update(name: params[:department_name])
|
31
33
|
render_success
|
32
34
|
end
|
33
35
|
|
34
|
-
|
35
36
|
def index
|
36
37
|
authorize! :read, Customer
|
37
38
|
respond_to do |format|
|
38
39
|
format.html do
|
39
40
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
40
|
-
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
41
|
+
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
|
41
42
|
end
|
42
43
|
format.json do
|
43
44
|
if @current_admin.is_admin?
|
@@ -46,11 +47,11 @@ module EducodeSales
|
|
46
47
|
level = @current_admin.role.role_areas.find_by(clazz: '客户管理').level
|
47
48
|
case level
|
48
49
|
when '自己'
|
49
|
-
school_ids = CustomerExtension.where(customer_staff_id:
|
50
|
+
school_ids = CustomerExtension.where(customer_staff_id: @current_admin.id).pluck(:school_id)
|
50
51
|
@customers = School.where(id: school_ids)
|
51
52
|
when '区域'
|
52
53
|
a_school_ids = School.where(province: @current_admin.areas.pluck(:name)).ids
|
53
|
-
b_school_ids = CustomerExtension.where(customer_staff_id:
|
54
|
+
b_school_ids = CustomerExtension.where(customer_staff_id: @current_admin.id).pluck(:school_id)
|
54
55
|
school_ids = a_school_ids + b_school_ids + StaffSchool.where(staff_id: @current_admin.id).pluck(:school_id)
|
55
56
|
@customers = School.where(id: school_ids)
|
56
57
|
else
|
@@ -59,7 +60,7 @@ module EducodeSales
|
|
59
60
|
end
|
60
61
|
part_a_ids = CustomerFollow.all.pluck(:school_id)
|
61
62
|
part_b_ids = Business.where(id: EducodeSales::FollowUp.pluck(:business_id)).pluck(:school_id)
|
62
|
-
ids = part_a_ids + part_b_ids
|
63
|
+
ids = part_a_ids + part_b_ids + CustomerAdd.all.pluck(:school_id)
|
63
64
|
@customers = @customers.where(id: ids)
|
64
65
|
if params[:q].present? && params[:q][:name].present?
|
65
66
|
@customers = @customers.where("schools.name like ?", "%#{params[:q][:name]}%")
|
@@ -77,19 +78,19 @@ module EducodeSales
|
|
77
78
|
property.each do |p|
|
78
79
|
case p
|
79
80
|
when 0
|
80
|
-
school_property_ids += SchoolProperty.where(
|
81
|
+
school_property_ids += SchoolProperty.where(project_985: true).ids
|
81
82
|
when 1
|
82
|
-
school_property_ids += SchoolProperty.where(
|
83
|
+
school_property_ids += SchoolProperty.where(project_211: true).ids
|
83
84
|
when 2
|
84
|
-
school_property_ids += SchoolProperty.where(
|
85
|
+
school_property_ids += SchoolProperty.where(regular_college: true).ids
|
85
86
|
when 3
|
86
|
-
school_property_ids += SchoolProperty.where(
|
87
|
+
school_property_ids += SchoolProperty.where(junior_college: true).ids
|
87
88
|
when 4
|
88
|
-
school_property_ids += SchoolProperty.where(
|
89
|
+
school_property_ids += SchoolProperty.where(secondary_school: true).ids
|
89
90
|
when 5
|
90
|
-
school_property_ids += SchoolProperty.where(
|
91
|
+
school_property_ids += SchoolProperty.where(military_school: true).ids
|
91
92
|
when 6
|
92
|
-
school_property_ids += SchoolProperty.where(
|
93
|
+
school_property_ids += SchoolProperty.where(enterprise: true).ids
|
93
94
|
else
|
94
95
|
end
|
95
96
|
end
|
@@ -99,7 +100,7 @@ module EducodeSales
|
|
99
100
|
if params[:q].present? && params[:q][:date].present?
|
100
101
|
ids = EducodeSales::CustomerFollow.all.pluck(:school_id)
|
101
102
|
@customers = @customers.where(id: ids)
|
102
|
-
school_ids =[]
|
103
|
+
school_ids = []
|
103
104
|
date = params[:q][:date].split(" - ")
|
104
105
|
@customers.each do |d|
|
105
106
|
business_ids = EducodeSales::Business.where(school_id: d.id).ids
|
@@ -127,7 +128,7 @@ module EducodeSales
|
|
127
128
|
|
128
129
|
def give
|
129
130
|
common = Common.find_by(clazz: 'staff_type', name: '销售')
|
130
|
-
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id]}
|
131
|
+
@staffs = Staff.joins(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id] }
|
131
132
|
render layout: false
|
132
133
|
end
|
133
134
|
|
@@ -154,7 +155,6 @@ module EducodeSales
|
|
154
155
|
@departments = @departments.page(params[:page]).per(params[:limit])
|
155
156
|
end
|
156
157
|
|
157
|
-
|
158
158
|
def new_follow_record
|
159
159
|
@school = School.find(params[:id])
|
160
160
|
render layout: false
|
@@ -215,17 +215,45 @@ module EducodeSales
|
|
215
215
|
junior_college: params[:junior_college].present? ? 1 : 0,
|
216
216
|
secondary_school: params[:secondary_school].present? ? 1 : 0,
|
217
217
|
military_school: params[:military_school].present? ? 1 : 0,
|
218
|
+
other: params[:other].present? ? 1 : 0,
|
219
|
+
mid_school: params[:mid_school].present? ? 1 : 0,
|
220
|
+
ele_school: params[:ele_school].present? ? 1 : 0,
|
218
221
|
enterprise: params[:enterprise].present? ? 1 : 0)
|
219
222
|
@school.attributes = school_params
|
220
223
|
@school.school_property = property
|
221
224
|
@school.save!
|
225
|
+
|
226
|
+
#先删除全部的标签,再添加标签
|
227
|
+
missions_school_tags = SchoolTag.where(for_missions: true)
|
228
|
+
SchoolTagMiddle.where(school_id: @school.id, school_tag_id: missions_school_tags.ids).destroy_all
|
229
|
+
#保存学校标签
|
230
|
+
|
231
|
+
keys = %w[regular_college junior_college secondary_school military_school other mid_school ele_school enterprise]
|
232
|
+
names = {
|
233
|
+
"regular_college" => "本科院校",
|
234
|
+
"junior_college" => "高职院校",
|
235
|
+
"secondary_school" => "中职院校",
|
236
|
+
"military_school" => "军事院校",
|
237
|
+
"other" => "其他",
|
238
|
+
"mid_school" => "中学",
|
239
|
+
"ele_school" => "小学",
|
240
|
+
"enterprise" => "企业"
|
241
|
+
}
|
242
|
+
property.attributes.each do |key, value|
|
243
|
+
next unless key.in?(keys)
|
244
|
+
next unless value.to_s == "true"
|
245
|
+
school_tag = SchoolTag.find_by_name(names[key])
|
246
|
+
if school_tag.present?
|
247
|
+
SchoolTagMiddle.create(school_id: @school.id, school_tag_id: school_tag.id)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
222
251
|
end
|
223
252
|
render_success
|
224
253
|
end
|
225
254
|
|
226
255
|
private
|
227
256
|
|
228
|
-
|
229
257
|
def school_property_params
|
230
258
|
params.permit(:project_985, :project_211, :regular_college, :junior_college, :secondary_school, :military_school, :enterprise)
|
231
259
|
end
|
@@ -45,6 +45,7 @@ module EducodeSales
|
|
45
45
|
|
46
46
|
def edit
|
47
47
|
@staff = Staff.find(params[:id])
|
48
|
+
@permissions = @staff.permissions.pluck(:id)
|
48
49
|
gon.area_ids = @staff.area_ids
|
49
50
|
gon.areas = Common.where(clazz: 'area').map { |d| { value: d.id, title: d.name } } #.unshift({value: -1, title: '全国'})
|
50
51
|
gon.school_ids = @staff.staff_schools.ids
|
@@ -53,7 +54,7 @@ module EducodeSales
|
|
53
54
|
# gon.schools = School.all.first(100).map { |d| { value: d.id, title: d.name } } #.unshift({value: -1, title: '全国'})
|
54
55
|
@staff_types = Common.where(clazz: 'staff_type').pluck(:name, :id)
|
55
56
|
tag_ids = @staff.staff_school_tags.pluck(:school_tag_id)
|
56
|
-
gon.school_properties = SchoolTag.where(
|
57
|
+
gon.school_properties = SchoolTag.where(for_missions: true).map { |d| { value: d.id, name: d.name, selected: tag_ids.include?(d.id) } }
|
57
58
|
render layout: false
|
58
59
|
end
|
59
60
|
|
@@ -67,8 +68,8 @@ module EducodeSales
|
|
67
68
|
impressionist(staff, params)
|
68
69
|
staff.update(deleted_at: Time.now, expired_at: Time.now.days_ago(1))
|
69
70
|
render_success
|
70
|
-
|
71
|
-
|
71
|
+
# rescue ActiveRecord::DeleteRestrictionError => e
|
72
|
+
# render_failure '该用户已有数据产生,暂不能删除'
|
72
73
|
end
|
73
74
|
|
74
75
|
def disable
|
@@ -84,13 +85,13 @@ module EducodeSales
|
|
84
85
|
staff.assign_attributes(role_id: params[:role_id], job_type: params[:job_type], enabled_at: params[:enabled_at])
|
85
86
|
staff.expired_at = staff.enabled_at.months_since(params[:month].to_i)
|
86
87
|
commons = []
|
87
|
-
params[:area_ids].each do |d|
|
88
|
+
params[:area_ids].to_s.split(",").each do |d|
|
88
89
|
commons << Common.find(d)
|
89
90
|
end
|
90
91
|
staff.areas = commons
|
91
92
|
if params[:school_ids].present?
|
92
93
|
schools = []
|
93
|
-
params[:school_ids].each do |d|
|
94
|
+
params[:school_ids].to_s.split(",").each do |d|
|
94
95
|
schools << EducodeSales::StaffSchool.find_or_initialize_by(staff_id: staff.id, school_id: d)
|
95
96
|
end
|
96
97
|
staff.staff_schools = schools
|
@@ -98,10 +99,22 @@ module EducodeSales
|
|
98
99
|
staff.staff_schools.destroy_all
|
99
100
|
end
|
100
101
|
tags = []
|
101
|
-
params[:school_tag_ids].each do |tag_id|
|
102
|
-
|
102
|
+
params[:school_tag_ids].to_s.split(",").each do |tag_id|
|
103
|
+
tags << EducodeSales::StaffSchoolTag.find_or_initialize_by(staff_id: staff.id, school_tag_id: tag_id)
|
104
|
+
end
|
105
|
+
#人员额外权限
|
106
|
+
permissions = []
|
107
|
+
if params[:permission].present?
|
108
|
+
params[:permission].each do |d|
|
109
|
+
d[1].each do |c|
|
110
|
+
permissions << Permission.find_by(subject: d[0], action: c[1])
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
staff.staff_permissions.delete_all
|
115
|
+
permissions.each do |permission|
|
116
|
+
staff.staff_permissions.create(staff_id:staff.id, permission_id:permission.id)
|
103
117
|
end
|
104
|
-
|
105
118
|
staff.staff_school_tags = tags
|
106
119
|
params[:current_admin] = @current_admin.id
|
107
120
|
impressionist(staff, params)
|
@@ -115,14 +128,13 @@ module EducodeSales
|
|
115
128
|
def follow_up_schools
|
116
129
|
staff = Staff.find(params[:id])
|
117
130
|
@schools = EducodeSales::Teacher.joins(:follow_up, :department).where("educode_sales_teacher_follows.staff_id = #{staff.id}").group("departments.school_id").select("departments.school_id, max(educode_sales_teacher_follows.updated_at) AS updated_at") + EducodeSales::Business.joins(:follow_ups, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("departments.school_id").select("departments.school_id, max(educode_sales_follow_ups.updated_at) AS updated_at")
|
118
|
-
@count =
|
131
|
+
@count = EducodeSales::Business.joins(:follow_ups, :department).where("educode_sales_follow_ups.staff_id = #{staff.id}").group("departments.school_id").count
|
119
132
|
end
|
120
133
|
|
121
134
|
def follow_up_departments
|
122
135
|
staff = Staff.find(params[:id])
|
123
|
-
@schools = (EducodeSales::Business.joins(:follow_ups, [department: :school]).where("educode_sales_follow_ups.staff_id = #{staff.id}").select("departments.id, departments.name, schools.name AS school, educode_sales_follow_ups.updated_at") + EducodeSales::Teacher.joins(:follow_up, [department: :school]).where("educode_sales_teacher_follows.staff_id = #{staff.id}").select("departments.id, departments.name, schools.name AS school, educode_sales_teacher_follows.updated_at")).uniq{|s| s.id}
|
136
|
+
@schools = (EducodeSales::Business.joins(:follow_ups, [department: :school]).where("educode_sales_follow_ups.staff_id = #{staff.id}").select("departments.id, departments.name, schools.name AS school, educode_sales_follow_ups.updated_at") + EducodeSales::Teacher.joins(:follow_up, [department: :school]).where("educode_sales_teacher_follows.staff_id = #{staff.id}").select("departments.id, departments.name, schools.name AS school, educode_sales_teacher_follows.updated_at")).uniq { |s| s.id }
|
124
137
|
end
|
125
138
|
|
126
|
-
|
127
139
|
end
|
128
140
|
end
|
data/app/models/ability.rb
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
if staff.is_admin
|
10
10
|
can :manage, :all
|
11
11
|
else
|
12
|
-
staff.
|
12
|
+
staff.all_permissions.each do |ps|
|
13
13
|
can ps.action.to_sym, "EducodeSales::#{ps.subject}".constantize
|
14
14
|
# level = @current_admin.role.role_areas.find_by(clazz: 'name')&.level
|
15
15
|
# if level == '自己'
|
@@ -5,6 +5,10 @@ module EducodeSales
|
|
5
5
|
|
6
6
|
is_impressionable
|
7
7
|
|
8
|
+
|
9
|
+
has_many :staff_permissions, dependent: :destroy
|
10
|
+
has_many :permissions, through: :staff_permissions
|
11
|
+
|
8
12
|
has_many :follow_ups, dependent: :destroy
|
9
13
|
has_many :operation_plans, dependent: :destroy
|
10
14
|
has_many :operation_reports, dependent: :destroy
|
@@ -31,6 +35,11 @@ module EducodeSales
|
|
31
35
|
"login_user_#{self.id}"
|
32
36
|
end
|
33
37
|
|
38
|
+
def all_permissions
|
39
|
+
ids = Array(self.role&.permissions&.ids) + self.permissions.ids
|
40
|
+
Permission.where(id: ids)
|
41
|
+
end
|
42
|
+
|
34
43
|
def check_login_status(request)
|
35
44
|
unless Rails.cache.data.get(self.last_login_key)
|
36
45
|
# 第二天还在线访问,记用户登录一次
|
@@ -32,21 +32,30 @@
|
|
32
32
|
<div class="layui-form-item">
|
33
33
|
<label class="layui-form-label required">学校性质:</label>
|
34
34
|
<div class="layui-input-block">
|
35
|
-
<input type="checkbox" name="project_985" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_985 %> title="985工程">
|
36
|
-
<input type="checkbox" name="project_211" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_211 %> title="211工程" >
|
37
35
|
<input type="checkbox" name="regular_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.regular_college %> title="本科院校">
|
36
|
+
<input type="checkbox" name="military_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.military_school %> title="军事院校">
|
37
|
+
<input type="checkbox" name="junior_college" lay-skin="primary" value="1" <%= 'checked' if @school_property&.junior_college %> title="高职院校">
|
38
|
+
|
38
39
|
</div>
|
39
40
|
</div>
|
40
41
|
<div class="layui-form-item">
|
41
42
|
<div class="layui-input-block">
|
42
|
-
<input type="checkbox" name="
|
43
|
-
<input type="checkbox" name="
|
44
|
-
<input type="checkbox" name="
|
43
|
+
<input type="checkbox" name="secondary_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.secondary_school %> title="中职院校" >
|
44
|
+
<input type="checkbox" name="mid_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.mid_school %> title="中学" >
|
45
|
+
<input type="checkbox" name="ele_school" lay-skin="primary" value="1" <%= 'checked' if @school_property&.ele_school %> title="小学" >
|
46
|
+
|
45
47
|
</div>
|
46
48
|
</div>
|
47
49
|
<div class="layui-form-item">
|
48
50
|
<div class="layui-input-block">
|
49
51
|
<input type="checkbox" name="enterprise" lay-skin="primary" value="1" <%= 'checked' if @school_property&.enterprise %> title="企业">
|
52
|
+
<input type="checkbox" name="other" lay-skin="primary" value="1" <%= 'checked' if @school_property&.other %> title="其他">
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
<div class="layui-form-item" style="display: none;">
|
56
|
+
<div class="layui-input-block">
|
57
|
+
<input type="checkbox" style="display: none;" name="project_985" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_985 %> title="985工程">
|
58
|
+
<input type="checkbox" style="display: none;" name="project_211" lay-skin="primary" value="1" <%= 'checked' if @school_property&.project_211 %> title="211工程" >
|
50
59
|
</div>
|
51
60
|
</div>
|
52
61
|
<div class="layui-inline" style="padding-left: 120px">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= Gon::Base.render_data %>
|
2
2
|
<div class="layuimini-main" style="height: 100%;">
|
3
|
-
<
|
3
|
+
<form class="layui-form " action="">
|
4
4
|
<h4>编辑人员</h4>
|
5
5
|
<div class="layui-form-item">
|
6
6
|
<label class="layui-form-label required">姓名</label>
|
@@ -59,13 +59,37 @@
|
|
59
59
|
@staff.month), { 'lay-filter': 'month' } %>
|
60
60
|
</div>
|
61
61
|
</div>
|
62
|
-
|
63
|
-
<hr>
|
64
62
|
<div class="layui-form-item">
|
63
|
+
<label class="layui-form-label required">额外权限:</label>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<!-- <form class="layui-form " action="">-->
|
67
|
+
<% id = 0 %>
|
68
|
+
<% EducodeSales::Permission.all.order(position: :asc).group_by{ |d| d.clazz}.each do |k, d| %>
|
69
|
+
<div class="layui-form-item">
|
70
|
+
<label class="layui-form-label"><%= k %></label>
|
71
|
+
<div class="layui-input-block">
|
72
|
+
<% d.each do |p| %>
|
73
|
+
<% id += 1 %>
|
74
|
+
<%= check_box_tag "permission[#{p.subject}][]", p.action, @permissions.include?(p.id), {title: p.name, id: "#{id}_" } %>
|
75
|
+
<% end %>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
<% end %>
|
79
|
+
|
80
|
+
<!-- <div class="m-t-20">-->
|
81
|
+
<!-- <div class="layui-input-block">-->
|
82
|
+
<!-- <button type="submit" class="layui-btn" lay-submit="" lay-filter="role">提交</button>-->
|
83
|
+
<!-- </div>-->
|
84
|
+
<!-- </div>-->
|
85
|
+
<!-- </form>-->
|
86
|
+
<div class="m-t-20">
|
65
87
|
<div class="layui-input-block">
|
66
|
-
<button class="layui-btn
|
88
|
+
<button type="submit" class="layui-btn" lay-submit="" lay-filter="role">提交</button>
|
67
89
|
</div>
|
68
90
|
</div>
|
91
|
+
</form>
|
92
|
+
|
69
93
|
</div>
|
70
94
|
</div>
|
71
95
|
<script type="text/html" id="edit_currentTableBar">
|
@@ -141,7 +165,7 @@
|
|
141
165
|
sales_list.setValue(gon.schools)
|
142
166
|
|
143
167
|
//监听提交
|
144
|
-
form.on('submit(
|
168
|
+
form.on('submit(role)', function (data) {
|
145
169
|
var area_ids = []
|
146
170
|
layui.each(transfer.getData('area_list'), function (i, v) {
|
147
171
|
area_ids.push(v.value)
|
@@ -156,22 +180,63 @@
|
|
156
180
|
tag_ids.push(d.value);
|
157
181
|
})
|
158
182
|
}
|
159
|
-
data.field['school_ids'] = schools;
|
160
|
-
data.field['area_ids'] = area_ids;
|
161
|
-
data.field['school_tag_ids'] = tag_ids;
|
162
|
-
request.authPut("missions/staffs/" + parent.staff_id, data.field, function (res) {
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
183
|
+
data.field['school_ids'] = schools.join(",");
|
184
|
+
data.field['area_ids'] = area_ids.join(",");
|
185
|
+
data.field['school_tag_ids'] = tag_ids.join(",");
|
186
|
+
// request.authPut("missions/staffs/" + parent.staff_id, data.field, function (res) {
|
187
|
+
// console.log(res.success == false)
|
188
|
+
// if (res.success == false) {
|
189
|
+
// layer.alert(res.msg)
|
190
|
+
// } else {
|
191
|
+
// layer.close(parent.index);
|
192
|
+
// parent.layer.close(parent.layer.getFrameIndex(window.name))
|
193
|
+
// parent.table.reload('staff_filter')
|
194
|
+
// }
|
195
|
+
// })
|
196
|
+
Rails.ajax({
|
197
|
+
url: '/missions/staffs/'+ parent.staff_id,
|
198
|
+
type: 'PUT',
|
199
|
+
headers: {
|
200
|
+
'Content-Type': 'application/json',
|
201
|
+
'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
|
202
|
+
},
|
203
|
+
data: $.param(data.field, true),
|
204
|
+
success: function (res) {
|
205
|
+
if (res.success == false) {
|
206
|
+
layer.alert(res.msg)
|
207
|
+
} else {
|
208
|
+
layer.close(parent.index);
|
209
|
+
parent.layer.close(parent.layer.getFrameIndex(window.name))
|
210
|
+
parent.table.reload('staff_filter')
|
211
|
+
}
|
170
212
|
}
|
171
213
|
})
|
172
214
|
return false;
|
173
215
|
});
|
174
216
|
|
217
|
+
// form.render();
|
218
|
+
// form.on('submit(role)', function (data) {
|
219
|
+
// Rails.ajax({
|
220
|
+
// url: '/missions/roles/'+ parent.role_id,
|
221
|
+
// type: 'PUT',
|
222
|
+
// headers: {
|
223
|
+
// 'Content-Type': 'application/json',
|
224
|
+
// 'X-CSRF-Token': $('meta[name=csrf-token]').attr('content')
|
225
|
+
// },
|
226
|
+
// data: $.param(data.field, true),
|
227
|
+
// success: function (res) {
|
228
|
+
// if (res.success == false) {
|
229
|
+
// layer.alert(res.msg)
|
230
|
+
// } else {
|
231
|
+
// layer.close(parent.index);
|
232
|
+
// parent.layer.close(parent.layer.getFrameIndex(window.name))
|
233
|
+
// parent.table.reload('role')
|
234
|
+
// }
|
235
|
+
// }
|
236
|
+
// })
|
237
|
+
// return false;
|
238
|
+
// })
|
239
|
+
|
175
240
|
|
176
241
|
});
|
177
242
|
</script>
|
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.9.
|
4
|
+
version: 0.9.42
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -105,6 +105,7 @@ 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
|
108
109
|
- app/assets/images/educode_sales/loading-0.gif
|
109
110
|
- app/assets/images/educode_sales/loading-1.gif
|
110
111
|
- app/assets/images/educode_sales/loading-2.gif
|
@@ -220,6 +221,7 @@ files:
|
|
220
221
|
- app/models/educode_sales/sale_report.rb
|
221
222
|
- app/models/educode_sales/sale_trend.rb
|
222
223
|
- app/models/educode_sales/staff.rb
|
224
|
+
- app/models/educode_sales/staff_permission.rb
|
223
225
|
- app/models/educode_sales/staff_school.rb
|
224
226
|
- app/models/educode_sales/staff_school_tag.rb
|
225
227
|
- app/models/educode_sales/teacher.rb
|
@@ -491,6 +493,7 @@ files:
|
|
491
493
|
- db/migrate/20230115080730_add_origin_business_id_to_follow_ups.rb
|
492
494
|
- db/migrate/20230117144025_create_educode_sales_business_clazz_changes.rb
|
493
495
|
- db/migrate/20230206080303_create_educode_sales_staff_school_tags.rb
|
496
|
+
- db/migrate/20230209102302_create_educode_sales_staff_permissions.rb
|
494
497
|
- lib/educode_sales.rb
|
495
498
|
- lib/educode_sales/engine.rb
|
496
499
|
- lib/educode_sales/version.rb
|
@@ -499,7 +502,7 @@ homepage: https://www.educoder.net
|
|
499
502
|
licenses:
|
500
503
|
- MIT
|
501
504
|
metadata: {}
|
502
|
-
post_install_message:
|
505
|
+
post_install_message:
|
503
506
|
rdoc_options: []
|
504
507
|
require_paths:
|
505
508
|
- lib
|
@@ -514,8 +517,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
514
517
|
- !ruby/object:Gem::Version
|
515
518
|
version: '0'
|
516
519
|
requirements: []
|
517
|
-
rubygems_version: 3.0.
|
518
|
-
signing_key:
|
520
|
+
rubygems_version: 3.0.9
|
521
|
+
signing_key:
|
519
522
|
specification_version: 4
|
520
523
|
summary: Summary of EducodeSales.
|
521
524
|
test_files: []
|