c80_estate 0.1.0.28 → 0.1.0.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/admin/c80_estate/areas.rb +1 -1
- data/app/helpers/c80_estate/app_helper.rb +4 -4
- data/app/models/c80_estate/property.rb +12 -0
- data/lib/c80_estate/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 369b7eee549a751f657741e22a0101841b37be5d
|
4
|
+
data.tar.gz: 31ff7efbc1e816261f8ce438dadc70f9fd0ba618
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1e91158b43738a18a46649ab4ab68a8561eb052a5d9029742b46edd9e56863fdce616e832f2adc25f7b67daaded7810d41890c0a3a78dd29368ec8c58a53e2b
|
7
|
+
data.tar.gz: b9dfc87f7f2811c4aaa01efcf7241b429512bc382d2b56788dac3c334ffa2f394585eeeac1235bc7f642a84c21f901fdf5c926f7f9ef68b4b62cf97eec0ee6f1
|
@@ -192,7 +192,7 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
|
|
192
192
|
f.input :atype, :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'}
|
193
193
|
f.input :property,
|
194
194
|
:input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
|
195
|
-
:collection => C80Estate::Property.
|
195
|
+
:collection => C80Estate::Property.where_assig_user(current_admin_user).map { |p| ["#{p.title}", p.id] }
|
196
196
|
# f.input :assigned_person,
|
197
197
|
# :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
|
198
198
|
# :collection => AdminUser.all.map { |u| ["#{u.email}", u.id] }
|
@@ -27,7 +27,7 @@ module C80Estate
|
|
27
27
|
list << {
|
28
28
|
id: prop.id,
|
29
29
|
title: prop.title,
|
30
|
-
busy_coef: busy_coef,
|
30
|
+
busy_coef: "#{busy_coef.to_s(:rounded, :precision => 2)} %",
|
31
31
|
props: {
|
32
32
|
all_areas: pstat.free_areas + pstat.busy_areas,
|
33
33
|
free_areas: pstat.free_areas,
|
@@ -68,11 +68,11 @@ module C80Estate
|
|
68
68
|
list << {
|
69
69
|
id: prop.id,
|
70
70
|
title: prop.title,
|
71
|
-
busy_coef: busy_coef,
|
71
|
+
busy_coef: "#{busy_coef.to_s(:rounded, :precision => 2)} %",
|
72
72
|
props: {
|
73
73
|
all_areas_sq: pstat.free_areas_sq + pstat.busy_areas_sq,
|
74
|
-
|
75
|
-
|
74
|
+
free_areas_sq: pstat.free_areas_sq.to_s(:rounded, :precision => 2),
|
75
|
+
busy_areas_sq: pstat.busy_areas_sq.to_s(:rounded, :precision => 2)
|
76
76
|
}
|
77
77
|
}
|
78
78
|
# Rails.logger.debug "<render_table_prop_busy_coef> #{prop.title}"
|
@@ -88,6 +88,18 @@ module C80Estate
|
|
88
88
|
res
|
89
89
|
end
|
90
90
|
|
91
|
+
# для селекта формы админки Area выдать
|
92
|
+
# список объектов, на которые назначен пользователь
|
93
|
+
# если юзер - админ - ему выдаются все объекты
|
94
|
+
def self.where_assig_user(user)
|
95
|
+
if user.can_create_properties?
|
96
|
+
C80Estate::Property.all
|
97
|
+
else
|
98
|
+
C80Estate::Property.where(:assigned_person_id => current_admin_user.id)
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
|
91
103
|
def average_price(atype_id: nil)
|
92
104
|
|
93
105
|
if atype_id.nil?
|
data/lib/c80_estate/version.rb
CHANGED