c80_estate 0.1.0.14 → 0.1.0.15

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.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/admin/c80_estate/properties.rb +5 -0
  3. data/app/assets/javascript/c80_estate/backend/admin/shared/areas/gallery3.js +27 -26
  4. data/app/assets/javascript/c80_estate/backend/admin/shared/properties/property_show.js +480 -0
  5. data/app/assets/javascript/c80_estate/backend/admin/src/properties.js +5 -0
  6. data/app/assets/javascript/c80_estate/backend/admin/src/pstats.js +67 -3
  7. data/app/assets/javascript/c80_estate/lib/highstock.js +434 -0
  8. data/app/assets/stylesheets/c80_estate/backend/admin_pstats.scss +0 -132
  9. data/app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss +1 -1
  10. data/app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_comments.scss +3 -1
  11. data/app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_main.scss +4 -2
  12. data/app/assets/stylesheets/c80_estate/backend/shared/index_adds_like_pstats.scss +131 -0
  13. data/app/helpers/c80_estate/app_helper.rb +38 -0
  14. data/app/helpers/c80_estate/properties_helper.rb +67 -0
  15. data/app/models/c80_estate/area.rb +15 -8
  16. data/app/models/c80_estate/property.rb +28 -0
  17. data/app/models/c80_estate/pstat.rb +96 -10
  18. data/app/uploaders/c80_estate/pphoto_uploader.rb +2 -2
  19. data/app/views/admin/properties/_show_property.html.erb +1 -0
  20. data/app/views/c80_estate/shared/areas/_single_area_on_page.html.erb +1 -1
  21. data/app/views/c80_estate/shared/properties/_single_property_on_page.html.erb +38 -0
  22. data/lib/c80_estate/version.rb +1 -1
  23. metadata +9 -2
@@ -11,138 +11,6 @@ body.admin_pstats {
11
11
  -o-transition: opacity .2s ease-in;
12
12
  transition: opacity .2s ease-in;
13
13
 
14
- div#index_adds {
15
- height: calc(483px + 15px);
16
- min-height: calc(183px + 15px);
17
- margin-bottom: 0;
18
-
19
- > div {
20
- float: left;
21
- padding: 10px;
22
- border-radius: 2px;
23
- border: 2px solid #f1f1f1;
24
- height: 183px;
25
-
26
- &#coef {
27
- width: 33%;
28
- text-align: center;
29
- margin-bottom: 15px;
30
-
31
- p {
32
- width: 100%;
33
-
34
- &.val {
35
- margin-top: 15px;
36
- margin-bottom: 0;
37
- font-size: 40px;
38
- }
39
-
40
- }
41
- }
42
-
43
- &#coef_sq {
44
- width: 33%;
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(33% - 30px);
61
- margin-left: 30px;
62
- margin-bottom: 15px;
63
-
64
- ul {
65
- padding: 0 5px;
66
- list-style: none;
67
- #title {
68
- font-weight: bold;
69
- }
70
- }
71
-
72
- }
73
-
74
- &#graph_radial {
75
- width: calc(33% - 30px);
76
- margin-left: 30px;
77
- margin-bottom: 15px;
78
- padding: 0;
79
-
80
- -webkit-transition: opacity .2s ease-in;
81
- -moz-transition: opacity .2s ease-in;
82
- -ms-transition: opacity .2s ease-in;
83
- -o-transition: opacity .2s ease-in;
84
- transition: opacity .2s ease-in;
85
- }
86
-
87
- &#graph_radial_sq {
88
- width: calc(33% - 30px);
89
- margin-left: 30px;
90
- padding: 0;
91
-
92
- -webkit-transition: opacity .2s ease-in;
93
- -moz-transition: opacity .2s ease-in;
94
- -ms-transition: opacity .2s ease-in;
95
- -o-transition: opacity .2s ease-in;
96
- transition: opacity .2s ease-in;
97
- }
98
-
99
- &#graph2 {
100
- width: 100%;
101
- height: 198px;
102
-
103
- margin-top: 15px;
104
- margin-bottom: 15px;
105
- padding: 0;
106
- display: none;
107
- opacity: 0;
108
-
109
- -webkit-transition: opacity .2s ease-in;
110
- -moz-transition: opacity .2s ease-in;
111
- -ms-transition: opacity .2s ease-in;
112
- -o-transition: opacity .2s ease-in;
113
- transition: opacity .2s ease-in;
114
-
115
- #graph2canvas {
116
- width: 100%;
117
- }
118
-
119
- }
120
-
121
- &#graph3 {
122
- width: 100%;
123
- height: 198px;
124
-
125
- margin-top: 15px;
126
- margin-bottom: 15px;
127
- padding: 0;
128
- display: none;
129
- opacity: 0;
130
-
131
- -webkit-transition: opacity .2s ease-in;
132
- -moz-transition: opacity .2s ease-in;
133
- -ms-transition: opacity .2s ease-in;
134
- -o-transition: opacity .2s ease-in;
135
- transition: opacity .2s ease-in;
136
-
137
- #graph3canvas {
138
- width: 100%;
139
- }
140
-
141
- }
142
-
143
- }
144
- }
145
-
146
14
  }
147
15
 
148
16
  .batch_actions_selector {
@@ -32,7 +32,7 @@ div.prop_in_list {
32
32
 
33
33
  .text_content {
34
34
  margin-top: 45px;
35
- padding: 0 35px;
35
+ padding: 0 7px;
36
36
  text-align: center;
37
37
 
38
38
  h4 {
@@ -1,4 +1,6 @@
1
- div.comments.c80_estate_area {
1
+ div.comments.c80_estate_area,
2
+ div.comments.c80_estate_property,
3
+ {
2
4
  clear: both;
3
5
 
4
6
  form.active_admin_comment {
@@ -3,7 +3,9 @@ $gallery_wrapper_margin_left: 45px;
3
3
  $gallery_frame_width: 310px;
4
4
  $gallery_frame_height: 188px;
5
5
 
6
- body.admin_areas.show {
6
+ body.admin_areas.show,
7
+ body.admin_properties.show,
8
+ {
7
9
 
8
10
  h4 {
9
11
  background-color: transparent !important;
@@ -22,7 +24,7 @@ body.admin_areas.show {
22
24
 
23
25
  div#div_main_show_area {
24
26
  width: 1085px;
25
- border-right: 1px solid #C2C2C2;
27
+ /*border-right: 1px solid #C2C2C2;*/
26
28
  float: left;
27
29
 
28
30
  a {
@@ -0,0 +1,131 @@
1
+ div.index_adds_like_pstats {
2
+ height: calc(483px + 15px);
3
+ min-height: calc(183px + 15px);
4
+ margin-bottom: 0;
5
+
6
+ > div {
7
+ float: left;
8
+ padding: 10px;
9
+ border-radius: 2px;
10
+ border: 2px solid #f1f1f1;
11
+ height: 183px;
12
+
13
+ &#coef {
14
+ width: 33%;
15
+ text-align: center;
16
+ margin-bottom: 15px;
17
+
18
+ p {
19
+ width: 100%;
20
+
21
+ &.val {
22
+ margin-top: 15px;
23
+ margin-bottom: 0;
24
+ font-size: 40px;
25
+ }
26
+
27
+ }
28
+ }
29
+
30
+ &#coef_sq {
31
+ width: 33%;
32
+ text-align: center;
33
+
34
+ p {
35
+ width: 100%;
36
+
37
+ &.val {
38
+ margin-top: 15px;
39
+ margin-bottom: 0;
40
+ font-size: 40px;
41
+ }
42
+
43
+ }
44
+ }
45
+
46
+ &#text_stats, &#text_stats_sq {
47
+ width: calc(33% - 30px);
48
+ margin-left: 30px;
49
+ margin-bottom: 15px;
50
+
51
+ ul {
52
+ padding: 0 5px;
53
+ list-style: none;
54
+ #title {
55
+ font-weight: bold;
56
+ }
57
+ }
58
+
59
+ }
60
+
61
+ &#graph_radial {
62
+ width: calc(33% - 30px);
63
+ margin-left: 30px;
64
+ margin-bottom: 15px;
65
+ padding: 0;
66
+
67
+ -webkit-transition: opacity .2s ease-in;
68
+ -moz-transition: opacity .2s ease-in;
69
+ -ms-transition: opacity .2s ease-in;
70
+ -o-transition: opacity .2s ease-in;
71
+ transition: opacity .2s ease-in;
72
+ }
73
+
74
+ &#graph_radial_sq {
75
+ width: calc(33% - 30px);
76
+ margin-left: 30px;
77
+ padding: 0;
78
+
79
+ -webkit-transition: opacity .2s ease-in;
80
+ -moz-transition: opacity .2s ease-in;
81
+ -ms-transition: opacity .2s ease-in;
82
+ -o-transition: opacity .2s ease-in;
83
+ transition: opacity .2s ease-in;
84
+ }
85
+
86
+ &#graph2 {
87
+ width: 100%;
88
+ height: 350px;
89
+
90
+ margin-top: 15px;
91
+ margin-bottom: 15px;
92
+ padding: 0;
93
+ display: none;
94
+ opacity: 0;
95
+
96
+ -webkit-transition: opacity .2s ease-in;
97
+ -moz-transition: opacity .2s ease-in;
98
+ -ms-transition: opacity .2s ease-in;
99
+ -o-transition: opacity .2s ease-in;
100
+ transition: opacity .2s ease-in;
101
+
102
+ #graph2canvas {
103
+ width: 100%;
104
+ }
105
+
106
+ }
107
+
108
+ &#graph3 {
109
+ width: 100%;
110
+ height: 350px;
111
+
112
+ margin-top: 15px;
113
+ margin-bottom: 15px;
114
+ padding: 0;
115
+ display: none;
116
+ opacity: 0;
117
+
118
+ -webkit-transition: opacity .2s ease-in;
119
+ -moz-transition: opacity .2s ease-in;
120
+ -ms-transition: opacity .2s ease-in;
121
+ -o-transition: opacity .2s ease-in;
122
+ transition: opacity .2s ease-in;
123
+
124
+ #graph3canvas {
125
+ width: 100%;
126
+ }
127
+
128
+ }
129
+
130
+ }
131
+ }
@@ -2,6 +2,7 @@ module C80Estate
2
2
  module AppHelper
3
3
 
4
4
  include AreasHelper
5
+ include PropertiesHelper
5
6
 
6
7
  def render_table_prop_busy_coef(atype_id: nil)
7
8
  # Rails.logger.debug "<render_table_prop_busy_coef> atype_id = #{atype_id}"
@@ -99,5 +100,42 @@ module C80Estate
99
100
  render :partial => 'c80_estate/shared/areas/single_area_on_page'
100
101
  end
101
102
 
103
+ def render_show_property(property)
104
+
105
+ slug = 'stroitelnye-materialy'
106
+ @page = Page.where(:slug => slug).first
107
+
108
+ @item = property #strh_item_get(@sub_cat.id,params[:item_id]) #Item.find(params[:item_id])
109
+ # @sub_cat = area.atype #Strsubcat.where(:slug => params[:sub_cat_slug]).first
110
+
111
+ # puts "<SiteController.stroitelnye_materialy_item> @item = #{@item}"
112
+ # {"id"=>5, "item_id"=>5, "item_title"=>"Кирпич длинного формата Alt Berlin GS стандарт качества Qbricks",
113
+ # "is_main"=>0, "is_hit"=>1, "is_sale"=>0, "strsubcat_id"=>1, "strsubcat_slug"=>"kirpich",
114
+ # "vendor_id"=>-1,
115
+ # "prop_18"=>"93,98", "prop_19"=>"0", "prop_20"=>"51", "prop_21"=>"0",
116
+ # "prop_23"=>"290 x 90 x 52 мм", "prop_24"=>"Германия", "prop_25"=>"1000",
117
+ # "prop_26"=>"0,10", "prop_27"=>"F300", "prop_28"=>"2,9", "prop_29"=>"чёрный",
118
+ # "prop_30"=>"пустотелый", "prop_31"=>"пластичное формование", "prop_32"=>"шероховатая",
119
+ # "prop_33"=>"2,50", "prop_34"=>"450", "prop_35"=>"длинный, ригельный", "prop_36"=>"Не указан",
120
+ # "prop_37"=>"PR12010-1", "prop_38"=>"NF"}
121
+
122
+ # @vparams[:body_class] += ' stroitelnye_materialy_item'
123
+
124
+ # add_breadcrumb 'Строительные материалы', '/stroitelnye-materialy', :title => 'Строительные материалы'
125
+ # add_breadcrumb @sub_cat.title, apph_my_url_strsubcat(@sub_cat), :title => @sub_cat.title
126
+ # add_breadcrumb @item["item_title"]
127
+
128
+ @vparams = {}
129
+ # @vparams[:page_slug] = 'stroitelnye-materialy' # помогаем слайдеру страницы найти соответствующие картинки
130
+ # @vparams[:sub_cat_slug] = params[:sub_cat_slug]
131
+ # @vparams[:c80_order_form_subj] = "#{root_url}stroitelnye-materialy/#{params[:sub_cat_slug]}/#{params[:item_id]}"
132
+ # @vparams[:c80_order_form_comment_text] = "Заявка на '#{@item["item_title"]}'. Кол-во: "
133
+
134
+ # найдём галереи товара
135
+ @vparams[:galleries] = @item.pphotos #Gallery.where_item(params[:item_id])
136
+
137
+ render :partial => 'c80_estate/shared/properties/single_property_on_page'
138
+ end
139
+
102
140
  end
103
141
  end
@@ -0,0 +1,67 @@
1
+ module C80Estate
2
+ module PropertiesHelper
3
+
4
+ def smiph_render_property_props(property)
5
+
6
+ result = ''
7
+
8
+ # area.item_props.each do |prop|
9
+ # title = prop.prop_name.title
10
+ # value = prop.value
11
+ # uom = prop.prop_name.uom.title
12
+ # result += "<li><span class='ptitle bold'>#{title}</span>: <span class='pvalue'>#{value}</span> <span class='puom'>#{uom}</span></li>"
13
+ # end
14
+
15
+ result += "<li><span class='ptitle bold'>Объём</span>: <span class='pvalue'>#{property.square_value}</span> <span class='puom'>м.кв.</span></li>"
16
+ result += "<li><span class='ptitle bold'>Доход при 100% занятости</span>: <span class='pvalue'>#{property.power_price_value}</span> <span class='puom'>руб</span></li>"
17
+ result += "<li><span class='ptitle bold'>Всего площадей</span>: <span class='pvalue'>#{property.areas.all.count}</span></li>"
18
+ result += "<li><span class='ptitle bold'>Свободно площадей</span>: <span class='pvalue'>#{property.areas.free_areas.count}</span></li>"
19
+ result += "<li><span class='ptitle bold'>Занято площадей</span>: <span class='pvalue'>#{property.areas.busy_areas.count}</span></li>"
20
+ result += "<li><span class='ptitle bold'>Свободно метров</span>: <span class='pvalue'>#{property.areas.free_areas_sq}</span> <span class='puom'>м.кв.</span></li>"
21
+ result += "<li><span class='ptitle bold'>Занято метров</span>: <span class='pvalue'>#{property.areas.busy_areas_sq}</span> <span class='puom'>м.кв.</span></li>"
22
+ result += "<li><span style='font-weight:bold;'>Площади объекта по типам:</span></li><ul>"
23
+
24
+ Atype.all.each do |atype|
25
+ aa = Area.where_atype(atype.id)
26
+ c = aa.count
27
+ cb = aa.busy_areas.count
28
+ result +=
29
+ "<li><span class='ptitle bold'>#{atype.title}</span>: <span class='pvalue'>#{c}</span>
30
+ <abbr title='Занятых'><span class='puom'>(#{cb})</span></abbr></li>"
31
+ end
32
+
33
+ result = "<ul>#{result}</ul></ul>"
34
+ result.html_safe
35
+
36
+ end
37
+
38
+ def ph_render_tech_props(property)
39
+
40
+ result = ''
41
+ index = 0
42
+
43
+ area_item_props = [
44
+ { title: 'ID объекта', value: property.id },
45
+ { title: 'Название', value: property.title },
46
+ { title: 'Адрес', value: property.address },
47
+ { title: 'Кто создал', value: property.owner.email },
48
+ { title: 'Время создания', value: property.created_at.strftime('%Y/%m/%d %H:%M:%S') },
49
+ { title: 'Время последнего изменения', value: property.updated_at.strftime('%Y/%m/%d %H:%M:%S') },
50
+ { title: 'Кто последний раз вносил изменения', value: property.last_updater },
51
+ { title: 'Ответственный', value: property.assigned_person_title }
52
+ ]
53
+
54
+ area_item_props.each do |prop|
55
+ title = prop[:title]
56
+ value = prop[:value]
57
+ result += "<tr class='p#{index % 2}'><td><span class='ptitle medium'>#{title}</span></td> <td><span class='pvalue'>#{value}</span></td></tr>"
58
+ index += 1
59
+ end
60
+
61
+ result = "<table>#{result}</table>"
62
+ result.html_safe
63
+
64
+ end
65
+
66
+ end
67
+ end
@@ -41,10 +41,9 @@ module C80Estate
41
41
  def self.free_areas_sq
42
42
  sum = 0
43
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
44
+ # area_prop_square = area.item_props.where(:prop_name_id => 9)
45
+ area_prop_square = area.square_value
46
+ sum += area_prop_square.first.value.to_i
48
47
  end
49
48
  sum
50
49
  end
@@ -172,6 +171,10 @@ module C80Estate
172
171
 
173
172
  end
174
173
 
174
+ def self.where_atype(atype_id)
175
+ self.where(:atype_id => atype_id)
176
+ end
177
+
175
178
  def atype_title
176
179
  res = "-"
177
180
  if atype.present?
@@ -233,23 +236,27 @@ module C80Estate
233
236
  end
234
237
 
235
238
  def price_value
236
- res = '-'
239
+ res = 0
237
240
  p = item_props.where(:prop_name_id => 1)
238
241
  if p.count > 0
239
- res = p.first.value
242
+ res = p.first.value.to_i
240
243
  end
241
244
  res
242
245
  end
243
246
 
244
247
  def square_value
245
- res = '-'
248
+ res = 0
246
249
  p = item_props.where(:prop_name_id => 9)
247
250
  if p.count > 0
248
- res = p.first.value
251
+ res = p.first.value.to_f
249
252
  end
250
253
  res
251
254
  end
252
255
 
256
+ def power_price_value
257
+ price_value * 1.0 * square_value
258
+ end
259
+
253
260
  def main_image_url
254
261
  url = 'no_thumb.png'
255
262
  if aphotos.count > 0