educode_sales 1.10.10 → 1.10.11
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/money_plan_records_controller.rb +15 -3
- data/app/controllers/educode_sales/teacher_follows_controller.rb +1 -1
- data/app/controllers/educode_sales/teachers_controller.rb +4 -4
- data/app/models/educode_sales/money_plan_claim.rb +2 -1
- data/app/views/educode_sales/money_plan_records/_index.html.erb +6 -0
- data/app/views/educode_sales/teachers/index.json.jbuilder +2 -2
- 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: 469c5f6e588ae73f973949a44953233eea096751b775081d061d371b9a7f5bb3
|
4
|
+
data.tar.gz: c0f32866986f7d507a8d391758a51fa8c32a50a47b55060911ff3a4044c82389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 494c27ee968e40dadbfb934a4f3afbb2ec87753fe345bb885e6f332c0e7863cf28ba52eec37b3a6d13b68494a0d29bb2a096df53268b69116dd6467c57fa74af
|
7
|
+
data.tar.gz: 7b0d19f85b0b399325db34baa74667f75806b407e94098faffdbdb010768aac4c84f595484ec75641790c9ac9d52c24fbad4b87a3471da2b138f7eec9072ee45
|
@@ -32,6 +32,10 @@ module EducodeSales
|
|
32
32
|
@money_plan_records = @money_plan_records.where("payer_name like ?", "%#{params[:q][:payer_name]}%")
|
33
33
|
end
|
34
34
|
|
35
|
+
if params[:q].present? && params[:q][:school].present?
|
36
|
+
@money_plan_records = @money_plan_records.joins(business: [department: :school]).where("schools.name like ?", "%#{params[:q][:school]}%")
|
37
|
+
end
|
38
|
+
|
35
39
|
if params[:q].present? && params[:q][:date_at].present?
|
36
40
|
date = params[:q][:date_at].split(" - ")
|
37
41
|
@money_plan_records = @money_plan_records.where("date_at BETWEEN ? AND ?", date[0], date[1])
|
@@ -78,6 +82,10 @@ module EducodeSales
|
|
78
82
|
gon.money_plan_ids << d.money_plan_id.to_s
|
79
83
|
gon.money_plan_claim_amount << [d.amount]
|
80
84
|
end
|
85
|
+
|
86
|
+
gon.edit_record = can?(:update_record, EducodeSales::MoneyPlan)
|
87
|
+
gon.edit_record_self = can?(:update_record_self, EducodeSales::MoneyPlan)
|
88
|
+
gon.staff_id = @current_admin.id
|
81
89
|
render layout: false
|
82
90
|
end
|
83
91
|
|
@@ -127,6 +135,7 @@ module EducodeSales
|
|
127
135
|
def confirm
|
128
136
|
money_plan_record = MoneyPlanRecord.find(params[:id])
|
129
137
|
money_plan_record.money_plan_claims.where.not(money_plan_id: params[:money_plan_ids]).delete_all
|
138
|
+
businesses = []
|
130
139
|
(params[:num].to_i + 1).times do |i|
|
131
140
|
claim = money_plan_record.money_plan_claims.find_or_initialize_by(money_plan_id: params[:money_plan_ids][i])
|
132
141
|
claim.amount = params["amount[#{i}]"]
|
@@ -134,8 +143,9 @@ module EducodeSales
|
|
134
143
|
claim.save
|
135
144
|
business = claim.money_plan.business
|
136
145
|
if business
|
146
|
+
businesses << business
|
137
147
|
money_plan_record.update(business_id: business.id)
|
138
|
-
business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
|
148
|
+
# business.update(return_money: claim.money_plan.money_plan_claims.sum(:amount))
|
139
149
|
|
140
150
|
|
141
151
|
# # 生成跟进信息
|
@@ -164,10 +174,12 @@ module EducodeSales
|
|
164
174
|
# business.update(last_follow_up_id: follow_up.id)
|
165
175
|
# end
|
166
176
|
# end
|
167
|
-
|
168
|
-
|
169
177
|
end
|
170
178
|
end
|
179
|
+
|
180
|
+
businesses.uniq.each do |d|
|
181
|
+
d.update(return_money: d.money_plans.joins(:money_plan_claims).sum("educode_sales_money_plan_claims.amount") )
|
182
|
+
end
|
171
183
|
render_success
|
172
184
|
end
|
173
185
|
|
@@ -45,7 +45,7 @@ module EducodeSales
|
|
45
45
|
@staff_manages = {}
|
46
46
|
role = EducodeSales::Role.find_by(name: '生态经理')
|
47
47
|
EducodeSales::Common.joins(market_areas: :staff).includes(market_areas: :staff).where(clazz: '区域').where("educode_sales_staffs.role_id = #{role.id}").each do |d|
|
48
|
-
@staff_manages[d.name] = d.market_areas.map { |d| d.staff&.
|
48
|
+
@staff_manages[d.name] = d.market_areas.map { |d| d.staff&.name }.uniq.compact
|
49
49
|
end if role
|
50
50
|
|
51
51
|
if @current_admin.is_admin?
|
@@ -29,13 +29,13 @@ module EducodeSales
|
|
29
29
|
common = Common.find_by(clazz: 'staff_type', name: '运营')
|
30
30
|
role = EducodeSales::Role.find_by(name: '生态经理')
|
31
31
|
if role
|
32
|
-
@staff_manage = Staff.
|
32
|
+
@staff_manage = Staff.where(role_id: role.id).map { |d| [d.name, d.id]}
|
33
33
|
else
|
34
34
|
@staff_manage = Staff.none
|
35
35
|
end
|
36
36
|
|
37
|
-
@follow_upers = Staff.
|
38
|
-
@staffs = Staff.
|
37
|
+
@follow_upers = Staff.map { |d| [d.name, d.id]}
|
38
|
+
@staffs = Staff.where(job_type: common.id).map { |d| [d.name, d.id]}
|
39
39
|
@more = can?(:create, EducodeSales::OperationPlan) || can?(:update, EducodeSales::Teacher) || can?(:destroy, EducodeSales::Teacher)
|
40
40
|
gon.menus = []
|
41
41
|
if can?(:create, EducodeSales::OperationPlan)
|
@@ -69,7 +69,7 @@ module EducodeSales
|
|
69
69
|
@sales_manages = {}
|
70
70
|
role = EducodeSales::Role.find_by(name: '生态经理')
|
71
71
|
EducodeSales::Common.joins(market_areas: :staff).includes(market_areas: :staff).where(clazz: '区域').where("educode_sales_staffs.role_id = #{role.id}").each do |d|
|
72
|
-
@staff_manages[d.name] = d.market_areas.map { |d| d.staff&.
|
72
|
+
@staff_manages[d.name] = d.market_areas.map { |d| d.staff&.name }.uniq.compact
|
73
73
|
end if role
|
74
74
|
|
75
75
|
sales_common = EducodeSales::Common.find_by(clazz: 'staff_type', name: '销售')
|
@@ -10,7 +10,8 @@ module EducodeSales
|
|
10
10
|
private
|
11
11
|
|
12
12
|
def update_return_money
|
13
|
-
self.money_plan.business.
|
13
|
+
amount = self.money_plan.business.money_plans.joins(:money_plan_claims).sum("educode_sales_money_plan_claims.amount")
|
14
|
+
self.money_plan.business.update(return_money: amount)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -20,6 +20,12 @@
|
|
20
20
|
<input type="text" name="date_at" class="layui-input" id="date">
|
21
21
|
</div>
|
22
22
|
</div>
|
23
|
+
<div class="layui-inline">
|
24
|
+
<label class="layui-form-label">客户名称</label>
|
25
|
+
<div class="layui-input-inline">
|
26
|
+
<input type="text" name="school" class="layui-input">
|
27
|
+
</div>
|
28
|
+
</div>
|
23
29
|
<div class="layui-inline">
|
24
30
|
<label class="layui-form-label required">匹配状态</label>
|
25
31
|
<div class="layui-input-inline">
|
@@ -27,7 +27,7 @@ json.data do
|
|
27
27
|
|
28
28
|
assign_staff_manages = []
|
29
29
|
d.assign_staffs.each do |assign|
|
30
|
-
assign_staff_manages << assign.staff&.
|
30
|
+
assign_staff_manages << assign.staff&.name
|
31
31
|
end
|
32
32
|
json.staff_manage @staff_manages[d.department&.school&.province].present? ? (@staff_manages[d.department&.school&.province] + assign_staff_manages).uniq.join(",") : assign_staff_manages
|
33
33
|
json.sales_manage @sales_manages[d.department&.school&.province]&.join(",")
|
@@ -40,7 +40,7 @@ json.data do
|
|
40
40
|
|
41
41
|
json.majors d.department&.department_majors&.pluck(:name).present? ? d.department&.department_majors&.pluck(:name).join(",") : ""
|
42
42
|
|
43
|
-
json.follow_person d.follow_up&.staff&.
|
43
|
+
json.follow_person d.follow_up&.staff&.name || ''
|
44
44
|
json.created_on d.user.present? ? d.user.created_on.to_s(:date) : ''
|
45
45
|
json.last_login_on (d.user.present? && d.user.last_login_on.present?) ? d.user.last_login_on.to_s(:date) : ''
|
46
46
|
json.teacher_used d.teacher_used
|
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: 1.10.
|
4
|
+
version: 1.10.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- anke1460
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|