c80_estate 0.1.0.3 → 0.1.0.4
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/dashboard.rb +65 -0
- data/app/admin/c80_estate/properties.rb +9 -1
- data/app/admin/c80_estate/sevents.rb +18 -12
- data/app/assets/images/property_default_logo.png +0 -0
- data/app/assets/javascript/c80_estate/backend/admin/pstats.js +231 -40
- data/app/assets/javascript/c80_estate/backend/admin/sevents.js +127 -1
- data/app/assets/javascript/c80_estate/lib/Chart.bundle.js +14282 -0
- data/app/assets/javascript/c80_estate/lib/jquery.canvasjs.min.js +560 -0
- data/app/assets/stylesheets/c80_estate/backend/admin_pstats.scss +55 -5
- data/app/assets/stylesheets/c80_estate/backend/admin_sevents.scss +5 -0
- data/app/assets/stylesheets/c80_estate/backend/dashboard/atype_in_list.scss +29 -0
- data/app/assets/stylesheets/c80_estate/backend/dashboard/common.scss +43 -0
- data/app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss +52 -0
- data/app/controllers/c80_estate/ajax_view_controller.rb +23 -0
- data/app/helpers/c80_estate/app_helper.rb +55 -0
- data/app/models/c80_estate/area.rb +40 -15
- data/app/models/c80_estate/plogo.rb +6 -0
- data/app/models/c80_estate/pphoto.rb +1 -0
- data/app/models/c80_estate/property.rb +14 -0
- data/app/models/c80_estate/pstat.rb +419 -30
- data/app/models/c80_estate/sevent.rb +65 -1
- data/app/uploaders/c80_estate/plogo_uploader.rb +25 -0
- data/app/views/admin/dashboard/_atype_in_list.html.erb +3 -0
- data/app/views/admin/dashboard/_prop_in_list.html.erb +10 -0
- data/app/views/c80_estate/ajax_view/table_properties_coef_busy.js.erb +3 -0
- data/app/views/c80_estate/ajax_view/table_properties_coef_busy_sq.js.erb +3 -0
- data/app/views/c80_estate/shared/_table_properties_coef_busy.html.erb +25 -0
- data/app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb +25 -0
- data/config/routes.rb +4 -0
- data/db/migrate/20160630012728_create_c80_estate_plogos.rb +9 -0
- data/lib/c80_estate/version.rb +1 -1
- metadata +20 -2
@@ -12,7 +12,7 @@ body.admin_pstats {
|
|
12
12
|
transition: opacity .2s ease-in;
|
13
13
|
|
14
14
|
div#index_adds {
|
15
|
-
height: calc(
|
15
|
+
height: calc(483px + 15px);
|
16
16
|
min-height: calc(183px + 15px);
|
17
17
|
margin-bottom: 0;
|
18
18
|
|
@@ -24,7 +24,7 @@ body.admin_pstats {
|
|
24
24
|
height: 183px;
|
25
25
|
|
26
26
|
&#coef {
|
27
|
-
width:
|
27
|
+
width: 25%;
|
28
28
|
text-align: center;
|
29
29
|
|
30
30
|
p {
|
@@ -39,8 +39,25 @@ body.admin_pstats {
|
|
39
39
|
}
|
40
40
|
}
|
41
41
|
|
42
|
-
&#
|
43
|
-
width:
|
42
|
+
&#coef_sq {
|
43
|
+
width: calc(25% - 30px);
|
44
|
+
margin-left: 30px;
|
45
|
+
text-align: center;
|
46
|
+
|
47
|
+
p {
|
48
|
+
width: 100%;
|
49
|
+
|
50
|
+
&.val {
|
51
|
+
margin-top: 15px;
|
52
|
+
margin-bottom: 0;
|
53
|
+
font-size: 40px;
|
54
|
+
}
|
55
|
+
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
&#text_stats, &#text_stats_sq {
|
60
|
+
width: calc(25% - 30px);
|
44
61
|
margin-left: 30px;
|
45
62
|
|
46
63
|
ul {
|
@@ -54,7 +71,7 @@ body.admin_pstats {
|
|
54
71
|
}
|
55
72
|
|
56
73
|
&#graph {
|
57
|
-
width: calc(100% - 200px -
|
74
|
+
width: calc(100% - 200px - 200px - 30px - 30px);
|
58
75
|
/*width: 100%;*/
|
59
76
|
/*height: 200px;*/
|
60
77
|
/*margin-top: 15px;*/
|
@@ -73,7 +90,32 @@ body.admin_pstats {
|
|
73
90
|
|
74
91
|
&#graph2 {
|
75
92
|
width: 100%;
|
93
|
+
height: 198px;
|
94
|
+
|
95
|
+
margin-top: 15px;
|
96
|
+
margin-bottom: 15px;
|
97
|
+
padding: 0;
|
98
|
+
display: none;
|
99
|
+
opacity: 0;
|
100
|
+
|
101
|
+
-webkit-transition: opacity .2s ease-in;
|
102
|
+
-moz-transition: opacity .2s ease-in;
|
103
|
+
-ms-transition: opacity .2s ease-in;
|
104
|
+
-o-transition: opacity .2s ease-in;
|
105
|
+
transition: opacity .2s ease-in;
|
106
|
+
|
107
|
+
#graph2canvas {
|
108
|
+
width: 100%;
|
109
|
+
}
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
&#graph3 {
|
114
|
+
width: 100%;
|
115
|
+
height: 198px;
|
116
|
+
|
76
117
|
margin-top: 15px;
|
118
|
+
margin-bottom: 15px;
|
77
119
|
padding: 0;
|
78
120
|
display: none;
|
79
121
|
opacity: 0;
|
@@ -84,6 +126,10 @@ body.admin_pstats {
|
|
84
126
|
-o-transition: opacity .2s ease-in;
|
85
127
|
transition: opacity .2s ease-in;
|
86
128
|
|
129
|
+
#graph3canvas {
|
130
|
+
width: 100%;
|
131
|
+
}
|
132
|
+
|
87
133
|
}
|
88
134
|
|
89
135
|
}
|
@@ -126,6 +172,10 @@ body.admin_pstats {
|
|
126
172
|
display: none !important;
|
127
173
|
}
|
128
174
|
|
175
|
+
#collection_selection {
|
176
|
+
display: none !important;
|
177
|
+
}
|
178
|
+
|
129
179
|
}
|
130
180
|
|
131
181
|
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
a.atype_in_list {
|
2
|
+
display: block;
|
3
|
+
float: left;
|
4
|
+
min-width: 150px;
|
5
|
+
margin-right: 30px;
|
6
|
+
border: 2px solid #ededed;
|
7
|
+
border-radius: 3px;
|
8
|
+
line-height: 44px;
|
9
|
+
padding: 0 20px;
|
10
|
+
margin-bottom: 10px;
|
11
|
+
|
12
|
+
text-align: center;
|
13
|
+
white-space: nowrap;
|
14
|
+
text-decoration: none;
|
15
|
+
font-weight: bold;
|
16
|
+
color: #288feb;
|
17
|
+
font-size: 15px;
|
18
|
+
|
19
|
+
&:hover { color: #2990ed; background-color: #e4e4e4; text-decoration: none;}
|
20
|
+
&:active { color: #18558c; }
|
21
|
+
&:focus { color: #164f82; }
|
22
|
+
|
23
|
+
-webkit-transition: all .2s ease-in;
|
24
|
+
-moz-transition: all .2s ease-in;
|
25
|
+
-ms-transition: all .2s ease-in;
|
26
|
+
-o-transition: all .2s ease-in;
|
27
|
+
transition: all .2s ease-in;
|
28
|
+
|
29
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
body.admin_dashboard {
|
2
|
+
|
3
|
+
p.title {
|
4
|
+
font-size: 17px;
|
5
|
+
}
|
6
|
+
|
7
|
+
.columns {
|
8
|
+
margin-bottom: 30px;
|
9
|
+
}
|
10
|
+
|
11
|
+
.panel {
|
12
|
+
-webkit-box-shadow: none !important;
|
13
|
+
box-shadow: none !important;
|
14
|
+
|
15
|
+
> h3 {
|
16
|
+
background-color: #5e7188 !important;
|
17
|
+
background-image: none !important;
|
18
|
+
text-shadow: none !important;
|
19
|
+
border: none !important;
|
20
|
+
box-shadow: none !important;
|
21
|
+
line-height: 30px !important;;
|
22
|
+
margin-bottom: 0.5em;
|
23
|
+
color: #ffffff !important;
|
24
|
+
padding: 5px 10px 3px 10px;
|
25
|
+
}
|
26
|
+
|
27
|
+
.panel_contents {
|
28
|
+
padding: 10px 0 !important;
|
29
|
+
border-bottom: none !important;
|
30
|
+
}
|
31
|
+
|
32
|
+
table {
|
33
|
+
th {
|
34
|
+
background-color: #ffffff !important;
|
35
|
+
border-bottom: 1px solid #cecece !important;
|
36
|
+
line-height: 5px !important;
|
37
|
+
background-image: none !important;
|
38
|
+
color: #288feb !important;
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
div.prop_in_list {
|
2
|
+
float: left;
|
3
|
+
width: 200px;
|
4
|
+
height: 214px;
|
5
|
+
margin-right: 30px;
|
6
|
+
margin-bottom: 15px;
|
7
|
+
border: 2px solid #ededed;
|
8
|
+
border-radius: 3px;
|
9
|
+
|
10
|
+
> a {
|
11
|
+
width: 100px;
|
12
|
+
height: 100px;
|
13
|
+
display: block;
|
14
|
+
position: relative;
|
15
|
+
margin: 0 46px;
|
16
|
+
top: 35px;
|
17
|
+
text-align: center; /*!*/
|
18
|
+
white-space: nowrap; /*!*/
|
19
|
+
|
20
|
+
span {
|
21
|
+
display: inline-block; /*!*/
|
22
|
+
vertical-align: middle; /*!*/
|
23
|
+
height: 100%; /*!*/
|
24
|
+
}
|
25
|
+
|
26
|
+
img {
|
27
|
+
max-width: 100%;
|
28
|
+
vertical-align: middle; /*!*/
|
29
|
+
}
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
.text_content {
|
34
|
+
margin-top: 45px;
|
35
|
+
padding: 0 35px;
|
36
|
+
text-align: center;
|
37
|
+
|
38
|
+
h4 {
|
39
|
+
> a {
|
40
|
+
font-weight: bold;
|
41
|
+
color: #288feb;
|
42
|
+
text-decoration: none;
|
43
|
+
font-size: 15px;
|
44
|
+
&:hover { color: #1c62a1; }
|
45
|
+
&:active { color: #18558c; }
|
46
|
+
&:focus { color: #164f82; }
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module C80Estate
|
2
|
+
class AjaxViewController < ActionController::Base
|
3
|
+
|
4
|
+
def table_properties_coef_busy
|
5
|
+
|
6
|
+
@atype_id = request.params[:atype_id] == "" ? nil:request.params[:atype_id]
|
7
|
+
|
8
|
+
respond_to do |format|
|
9
|
+
format.js
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def table_properties_coef_busy_sq
|
14
|
+
|
15
|
+
@atype_id = request.params[:atype_id] == "" ? nil:request.params[:atype_id]
|
16
|
+
|
17
|
+
respond_to do |format|
|
18
|
+
format.js
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module C80Estate
|
2
|
+
module AppHelper
|
3
|
+
|
4
|
+
def render_table_prop_busy_coef(atype_id: nil)
|
5
|
+
# Rails.logger.debug "<render_table_prop_busy_coef> atype_id = #{atype_id}"
|
6
|
+
|
7
|
+
props = Property.all
|
8
|
+
list = []
|
9
|
+
|
10
|
+
props.all.each do |prop|
|
11
|
+
pp = Pstat.busy_coef(prop_id: prop.id, atype_id: atype_id)
|
12
|
+
# Rails.logger.debug "<render_table_prop_busy_coef> pp = #{pp}"
|
13
|
+
busy_coef = pp[:busy_coef]
|
14
|
+
props = pp[:raw_props]
|
15
|
+
list << {
|
16
|
+
title: prop.title,
|
17
|
+
busy_coef: busy_coef,
|
18
|
+
props: props
|
19
|
+
}
|
20
|
+
# Rails.logger.debug "<render_table_prop_busy_coef> #{prop.title}"
|
21
|
+
end
|
22
|
+
|
23
|
+
render :partial => 'c80_estate/shared/table_properties_coef_busy',
|
24
|
+
:locals => {
|
25
|
+
list: list
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def render_table_prop_busy_coef_sq(atype_id: nil)
|
30
|
+
Rails.logger.debug "<render_table_prop_busy_coef_sq> atype_id = #{atype_id}"
|
31
|
+
|
32
|
+
props = Property.all
|
33
|
+
list = []
|
34
|
+
|
35
|
+
props.all.each do |prop|
|
36
|
+
pp = Pstat.busy_coef(prop_id: prop.id, atype_id: atype_id)
|
37
|
+
# Rails.logger.debug "<render_table_prop_busy_coef> pp = #{pp}"
|
38
|
+
busy_coef_sq = pp[:busy_coef_sq]
|
39
|
+
props = pp[:raw_props_sq]
|
40
|
+
list << {
|
41
|
+
title: prop.title,
|
42
|
+
busy_coef: busy_coef_sq,
|
43
|
+
props: props
|
44
|
+
}
|
45
|
+
# Rails.logger.debug "<render_table_prop_busy_coef> #{prop.title}"
|
46
|
+
end
|
47
|
+
|
48
|
+
render :partial => 'c80_estate/shared/table_properties_coef_busy_sq',
|
49
|
+
:locals => {
|
50
|
+
list: list
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
@@ -14,14 +14,14 @@ module C80Estate
|
|
14
14
|
!attributes[:prop_name_id].present?
|
15
15
|
},
|
16
16
|
:allow_destroy => true
|
17
|
-
has_many :aphotos, :dependent => :destroy
|
17
|
+
has_many :aphotos, :dependent => :destroy # одна или несколько фоток
|
18
18
|
accepts_nested_attributes_for :aphotos,
|
19
19
|
:reject_if => lambda { |attributes|
|
20
20
|
!attributes.present?
|
21
21
|
},
|
22
22
|
:allow_destroy => true
|
23
|
-
has_many :comments, :dependent => :destroy
|
24
|
-
has_and_belongs_to_many :astatuses,
|
23
|
+
has_many :comments, :dependent => :destroy # площадь можно прокомментировать
|
24
|
+
has_and_belongs_to_many :astatuses, # единственный статус: либо занята, либо свободна
|
25
25
|
:join_table => 'c80_estate_areas_astatuses'
|
26
26
|
|
27
27
|
has_many :sevents, :dependent => :destroy
|
@@ -34,21 +34,46 @@ module C80Estate
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.free_areas
|
37
|
-
self.joins(:astatuses).where(:c80_estate_astatuses => {
|
37
|
+
self.joins(:astatuses).where(:c80_estate_astatuses => {tag: 'free'})
|
38
38
|
end
|
39
39
|
|
40
40
|
# посчитает кол-во свободных метров
|
41
41
|
def self.free_areas_sq
|
42
|
-
|
42
|
+
sum = 0
|
43
|
+
self.free_areas.each do |area|
|
44
|
+
area_prop_square = area.item_props.where(:prop_name_id => 9)
|
45
|
+
if area_prop_square.present?
|
46
|
+
sum += area_prop_square.first.value.to_i
|
47
|
+
end
|
48
|
+
end
|
49
|
+
sum
|
43
50
|
end
|
44
51
|
|
45
52
|
def self.busy_areas
|
46
|
-
self.joins(:astatuses).where(:c80_estate_astatuses => {
|
53
|
+
self.joins(:astatuses).where(:c80_estate_astatuses => {tag: 'busy'})
|
47
54
|
end
|
48
55
|
|
49
56
|
# посчитает кол-во занятых метров
|
50
57
|
def self.busy_areas_sq
|
51
|
-
|
58
|
+
sum = 0
|
59
|
+
self.busy_areas.each do |area|
|
60
|
+
area_prop_square = area.item_props.where(:prop_name_id => 9)
|
61
|
+
if area_prop_square.present?
|
62
|
+
sum += area_prop_square.first.value.to_i
|
63
|
+
end
|
64
|
+
end
|
65
|
+
sum
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.all_areas_sq
|
69
|
+
sum = 0
|
70
|
+
self.all.each do |area|
|
71
|
+
area_prop_square = area.item_props.where(:prop_name_id => 9)
|
72
|
+
if area_prop_square.present?
|
73
|
+
sum += area_prop_square.first.value.to_i
|
74
|
+
end
|
75
|
+
end
|
76
|
+
sum
|
52
77
|
end
|
53
78
|
|
54
79
|
def atype_title
|
@@ -110,14 +135,14 @@ module C80Estate
|
|
110
135
|
Rails.logger.debug "<Area.create_initial_sevent> aga: self.astatuses.first.title = #{self.astatuses.first.title}"
|
111
136
|
|
112
137
|
s = Sevent.create!({
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
138
|
+
area_id: self.id,
|
139
|
+
atype_id: self.atype_id,
|
140
|
+
property_id: self.property_id,
|
141
|
+
astatus_id: self.astatus_id,
|
142
|
+
auser_id: self.owner_id, # инициатор события - создатель Площади
|
143
|
+
auser_type: 'AdminUser',
|
144
|
+
created_at: self.created_at
|
145
|
+
})
|
121
146
|
|
122
147
|
# см [*]
|
123
148
|
# if last_known_sevent == ''
|
@@ -10,6 +10,12 @@ module C80Estate
|
|
10
10
|
!attributes.present?
|
11
11
|
},
|
12
12
|
:allow_destroy => true
|
13
|
+
has_many :plogos, :dependent => :destroy # одна или несколько фоток
|
14
|
+
accepts_nested_attributes_for :plogos,
|
15
|
+
:reject_if => lambda { |attributes|
|
16
|
+
!attributes.present?
|
17
|
+
},
|
18
|
+
:allow_destroy => true
|
13
19
|
has_many :areas, :dependent => :destroy
|
14
20
|
has_many :comments, :dependent => :destroy
|
15
21
|
has_many :sevents, :dependent => :destroy
|
@@ -23,5 +29,13 @@ module C80Estate
|
|
23
29
|
res
|
24
30
|
end
|
25
31
|
|
32
|
+
def logo_path
|
33
|
+
url = 'property_default_logo.png'
|
34
|
+
if plogos.count > 0
|
35
|
+
url = plogos.first.image.thumb256
|
36
|
+
end
|
37
|
+
url
|
38
|
+
end
|
39
|
+
|
26
40
|
end
|
27
41
|
end
|