educode_sales 1.10.10 → 1.10.12
Sign up to get free protection for your applications and to get access to all the features.
- 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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 527f28a2fd7c3c37f33e50c8e548738f4a1cc0f3c9abdea333a0923556931111
|
4
|
+
data.tar.gz: 0bd0f7f605e9824cf213efd5cc7545da1a6bf6c27497de5379c4245b94825e9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6d96d56c3dce18d9af2130eb82a3027aa9df79835053064eebbf0e8a7d6403da499433f241f2890c036a5b76a4aefb1f0724cc1bfb3deaf74245838f2784665
|
7
|
+
data.tar.gz: 0d1e0bb773080e9fd5b8ebed30623fc449b4b59bb57c04d76b0f7bef5d4382dfd4d88fe4b4a508f9dee739e5ffef92dcaf55ee1ca0fbeb74e046848b877406dd
|
@@ -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.all.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.12
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -759,7 +759,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
759
759
|
- !ruby/object:Gem::Version
|
760
760
|
version: '0'
|
761
761
|
requirements: []
|
762
|
-
rubygems_version: 3.0.
|
762
|
+
rubygems_version: 3.0.0
|
763
763
|
signing_key:
|
764
764
|
specification_version: 4
|
765
765
|
summary: Summary of EducodeSales.
|