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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/admin/c80_estate/dashboard.rb +65 -0
  3. data/app/admin/c80_estate/properties.rb +9 -1
  4. data/app/admin/c80_estate/sevents.rb +18 -12
  5. data/app/assets/images/property_default_logo.png +0 -0
  6. data/app/assets/javascript/c80_estate/backend/admin/pstats.js +231 -40
  7. data/app/assets/javascript/c80_estate/backend/admin/sevents.js +127 -1
  8. data/app/assets/javascript/c80_estate/lib/Chart.bundle.js +14282 -0
  9. data/app/assets/javascript/c80_estate/lib/jquery.canvasjs.min.js +560 -0
  10. data/app/assets/stylesheets/c80_estate/backend/admin_pstats.scss +55 -5
  11. data/app/assets/stylesheets/c80_estate/backend/admin_sevents.scss +5 -0
  12. data/app/assets/stylesheets/c80_estate/backend/dashboard/atype_in_list.scss +29 -0
  13. data/app/assets/stylesheets/c80_estate/backend/dashboard/common.scss +43 -0
  14. data/app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss +52 -0
  15. data/app/controllers/c80_estate/ajax_view_controller.rb +23 -0
  16. data/app/helpers/c80_estate/app_helper.rb +55 -0
  17. data/app/models/c80_estate/area.rb +40 -15
  18. data/app/models/c80_estate/plogo.rb +6 -0
  19. data/app/models/c80_estate/pphoto.rb +1 -0
  20. data/app/models/c80_estate/property.rb +14 -0
  21. data/app/models/c80_estate/pstat.rb +419 -30
  22. data/app/models/c80_estate/sevent.rb +65 -1
  23. data/app/uploaders/c80_estate/plogo_uploader.rb +25 -0
  24. data/app/views/admin/dashboard/_atype_in_list.html.erb +3 -0
  25. data/app/views/admin/dashboard/_prop_in_list.html.erb +10 -0
  26. data/app/views/c80_estate/ajax_view/table_properties_coef_busy.js.erb +3 -0
  27. data/app/views/c80_estate/ajax_view/table_properties_coef_busy_sq.js.erb +3 -0
  28. data/app/views/c80_estate/shared/_table_properties_coef_busy.html.erb +25 -0
  29. data/app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb +25 -0
  30. data/config/routes.rb +4 -0
  31. data/db/migrate/20160630012728_create_c80_estate_plogos.rb +9 -0
  32. data/lib/c80_estate/version.rb +1 -1
  33. metadata +20 -2
@@ -7,6 +7,7 @@ module C80Estate
7
7
  belongs_to :auser, :polymorphic => true
8
8
  has_many :pstats, :dependent => :destroy
9
9
 
10
+ # нужен только при заполнении из rake db:seed:85_fill_sevents
10
11
  after_create :generate_pstat
11
12
 
12
13
  =begin
@@ -358,7 +359,7 @@ module C80Estate
358
359
  "%dд %dч %dмин % dс" % [dd,hh,mm,ss]
359
360
  end
360
361
 
361
- def self._parse_for_js_graph(sevents)
362
+ def self._parse_for_js_graph_google(sevents)
362
363
  # res = [
363
364
  # ['Year', 'Sales', 'Expenses'],
364
365
  # ['2013', 1000, 400],
@@ -377,8 +378,71 @@ module C80Estate
377
378
  res
378
379
  end
379
380
 
381
+ def self._parse_for_js_graph_graphjs(sevents)
382
+
383
+
384
+ # res = {
385
+ # labels: ['2016/12/22',...]
386
+ # points: [12,13,...]
387
+ # }
388
+
389
+ res = {
390
+ labels:[],
391
+ points:[]
392
+ }
393
+ sevents.each do |sevent|
394
+ label = sevent.created_at.strftime('%Y/%m/%d')
395
+ v = 1
396
+ if sevent.astatus.tag == 'free'
397
+ v = 0
398
+ end
399
+ res[:labels] << label
400
+ res[:points] << v
401
+ Rails.logger.debug "<Sevent.parse_for_js_graph> label = #{label}, point = #{v}"
402
+ end
403
+ res
404
+
405
+
406
+ end
407
+
408
+ def self._parse_for_js_graph(sevents)
409
+
410
+ # res: [
411
+ # {
412
+ # year
413
+ # month
414
+ # day
415
+ # val
416
+ # }
417
+ # ]
418
+
419
+ res = []
420
+
421
+ sevents.each do |sevent|
422
+
423
+ v = 1
424
+ if sevent.astatus.tag == 'free'
425
+ v = 0
426
+ end
427
+
428
+ res << {
429
+ year: sevent.created_at.strftime('%Y'),
430
+ month: sevent.created_at.strftime('%m').to_i-1,
431
+ day: sevent.created_at.strftime('%d'),
432
+ val: v
433
+ }
434
+
435
+ end
436
+
437
+ Rails.logger.debug "<Sevent.parse_for_js_graph> res = #{res}"
438
+ res
439
+
440
+ end
441
+
380
442
  protected
381
443
 
444
+ # раскомментировать перед исполнением rake db:seed:85_fill_sevents
445
+ # после - закомментить обратно
382
446
  def generate_pstat
383
447
 
384
448
  # pparams = {
@@ -0,0 +1,25 @@
1
+ module C80Estate
2
+ class PlogoUploader < BaseFileUploader
3
+
4
+ # ограничение оригинальной картинки
5
+ process :resize_to_limit => [1024, 1024]
6
+
7
+ version :thumb512 do
8
+ process :resize_to_limit => [512, 512]
9
+ end
10
+
11
+ version :thumb256 do
12
+ process :resize_to_limit => [256, 256]
13
+ end
14
+
15
+ version :thumb128 do
16
+ process :resize_to_limit => [128, 128]
17
+ end
18
+
19
+ def store_dir
20
+ "uploads/properties/logos/#{model.id}"
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,3 @@
1
+ <a class ='atype_in_list' href="/admin/pstats?utf8=✓&q%5Batype_id_eq%5D=<%= atype.id %>&commit=Фильтровать&order=id_asc">
2
+ <%= atype.title %>
3
+ </a>
@@ -0,0 +1,10 @@
1
+ <div class="prop_in_list">
2
+ <%# link_to image_tag(image_path(prop.logo_path)), "/admin/properties/#{prop.id}" %>
3
+ <!--<a href="/admin/properties/<%= prop.id %>">-->
4
+ <a href="/admin/pstats?utf8=✓&q%5Bproperty_id_eq%5D=<%= prop.id %>&commit=Фильтровать&order=id_asc">
5
+ <span></span><img src="<%= image_path(prop.logo_path) %>">
6
+ </a>
7
+ <div class="text_content">
8
+ <h4><%= link_to prop.title, "/admin/pstats?utf8=✓&q%5Bproperty_id_eq%5D=#{prop.id}&commit=Фильтровать&order=id_asc" %></h4>
9
+ </div>
10
+ </div>
@@ -0,0 +1,3 @@
1
+ var $cc = $("#ajax_div");
2
+ var html_str = "<%= j render_table_prop_busy_coef(atype_id: @atype_id) %>";
3
+ $cc.html(html_str);
@@ -0,0 +1,3 @@
1
+ var $cc = $("#ajax_div2");
2
+ var html_str = "<%= j render_table_prop_busy_coef_sq(atype_id: @atype_id) %>";
3
+ $cc.html(html_str);
@@ -0,0 +1,25 @@
1
+ <table border="0" cellspacing="0" cellpadding="0" id="index_table_sevents" class="index_table index" paginator="true">
2
+ <thead>
3
+ <tr>
4
+ <th class="col col-prop">Объект</th>
5
+ <th class="col col-coef">Занятость</th>
6
+ <th class="col col-all">Площадей</th>
7
+ <th class="col col-free">Свободно</th>
8
+ <th class="col col-busy">Занято</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+
13
+ <% list.each do |obj| %>
14
+ <%# Rails.logger.debug "#{obj}" %>
15
+ <tr>
16
+ <td><%= obj[:title] %></td>
17
+ <td><%= obj[:busy_coef] %></td>
18
+ <% obj[:props].each_key do |key| %>
19
+ <td><%= obj[:props][key] %></td>
20
+ <% end %>
21
+ </tr>
22
+ <% end %>
23
+
24
+ </tbody>
25
+ </table>
@@ -0,0 +1,25 @@
1
+ <table border="0" cellspacing="0" cellpadding="0" id="index_table_sevents" class="index_table index" paginator="true">
2
+ <thead>
3
+ <tr>
4
+ <th class="col col-prop">Объект</th>
5
+ <th class="col col-coef">Занятость в м.кв.</th>
6
+ <th class="col col-all">Всего м.кв.</th>
7
+ <th class="col col-free">Свободно</th>
8
+ <th class="col col-busy">Занято</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+
13
+ <% list.each do |obj| %>
14
+ <%# Rails.logger.debug "#{obj}" %>
15
+ <tr>
16
+ <td><%= obj[:title] %></td>
17
+ <td><%= obj[:busy_coef] %></td>
18
+ <% obj[:props].each_key do |key| %>
19
+ <td><%= obj[:props][key] %></td>
20
+ <% end %>
21
+ </tr>
22
+ <% end %>
23
+
24
+ </tbody>
25
+ </table>
@@ -2,4 +2,8 @@ C80Estate::Engine.routes.draw do
2
2
  match '/estate/get_atype_propnames', :to => 'ajax#get_atype_propnames', :via => :post
3
3
  match '/estate/areas_ecoef', :to => 'ajax#areas_ecoef', :via => :post
4
4
  match '/estate/properties_busy_coef', :to => 'ajax#properties_busy_coef', :via => :post
5
+
6
+ match '/estate/table_properties_coef_busy', :to => 'ajax_view#table_properties_coef_busy', :via => :post
7
+ match '/estate/table_properties_coef_busy_sq', :to => 'ajax_view#table_properties_coef_busy_sq', :via => :post
8
+
5
9
  end
@@ -0,0 +1,9 @@
1
+ class CreateC80EstatePlogos < ActiveRecord::Migration
2
+ def change
3
+ create_table :c80_estate_plogos, :options => 'COLLATE=utf8_unicode_ci' do |t|
4
+ t.string :image
5
+ t.references :property, index: true
6
+ t.timestamps null: false
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module C80Estate
2
- VERSION = "0.1.0.3"
2
+ VERSION = "0.1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_estate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.3
4
+ version: 0.1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-19 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -68,28 +68,37 @@ files:
68
68
  - app/admin/c80_estate/areas.rb
69
69
  - app/admin/c80_estate/astatuses.rb
70
70
  - app/admin/c80_estate/atypes.rb
71
+ - app/admin/c80_estate/dashboard.rb
71
72
  - app/admin/c80_estate/prop_names.rb
72
73
  - app/admin/c80_estate/properties.rb
73
74
  - app/admin/c80_estate/pstats.rb
74
75
  - app/admin/c80_estate/role_types.rb
75
76
  - app/admin/c80_estate/sevents.rb
76
77
  - app/admin/c80_estate/uoms.rb
78
+ - app/assets/images/property_default_logo.png
77
79
  - app/assets/javascript/c80_estate/backend/admin/areas.js
78
80
  - app/assets/javascript/c80_estate/backend/admin/pstats.js
79
81
  - app/assets/javascript/c80_estate/backend/admin/sevents.js
80
82
  - app/assets/javascript/c80_estate/backend/init.js
81
83
  - app/assets/javascript/c80_estate/backend/init_selectpicker.js
84
+ - app/assets/javascript/c80_estate/lib/Chart.bundle.js
82
85
  - app/assets/javascript/c80_estate/lib/google_charts_loader.js
83
86
  - app/assets/javascript/c80_estate/lib/jalert.js
87
+ - app/assets/javascript/c80_estate/lib/jquery.canvasjs.min.js
84
88
  - app/assets/javascript/c80_estate_active_admin.js.coffee
85
89
  - app/assets/stylesheets/c80_estate/backend/admin_areas.scss
86
90
  - app/assets/stylesheets/c80_estate/backend/admin_pstats.scss
87
91
  - app/assets/stylesheets/c80_estate/backend/admin_sevents.scss
88
92
  - app/assets/stylesheets/c80_estate/backend/admin_users.scss
89
93
  - app/assets/stylesheets/c80_estate/backend/common.scss
94
+ - app/assets/stylesheets/c80_estate/backend/dashboard/atype_in_list.scss
95
+ - app/assets/stylesheets/c80_estate/backend/dashboard/common.scss
96
+ - app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss
90
97
  - app/assets/stylesheets/c80_estate/lib/mixins.scss
91
98
  - app/assets/stylesheets/c80_estate_active_admin.scss
92
99
  - app/controllers/c80_estate/ajax_controller.rb
100
+ - app/controllers/c80_estate/ajax_view_controller.rb
101
+ - app/helpers/c80_estate/app_helper.rb
93
102
  - app/models/c80_estate/aphoto.rb
94
103
  - app/models/c80_estate/area.rb
95
104
  - app/models/c80_estate/astatus.rb
@@ -98,6 +107,7 @@ files:
98
107
  - app/models/c80_estate/comment.rb
99
108
  - app/models/c80_estate/item_prop.rb
100
109
  - app/models/c80_estate/owner.rb
110
+ - app/models/c80_estate/plogo.rb
101
111
  - app/models/c80_estate/pphoto.rb
102
112
  - app/models/c80_estate/prop_name.rb
103
113
  - app/models/c80_estate/property.rb
@@ -108,7 +118,14 @@ files:
108
118
  - app/models/c80_estate/uom.rb
109
119
  - app/uploaders/c80_estate/aphoto_uploader.rb
110
120
  - app/uploaders/c80_estate/atphoto_uploader.rb
121
+ - app/uploaders/c80_estate/plogo_uploader.rb
111
122
  - app/uploaders/c80_estate/pphoto_uploader.rb
123
+ - app/views/admin/dashboard/_atype_in_list.html.erb
124
+ - app/views/admin/dashboard/_prop_in_list.html.erb
125
+ - app/views/c80_estate/ajax_view/table_properties_coef_busy.js.erb
126
+ - app/views/c80_estate/ajax_view/table_properties_coef_busy_sq.js.erb
127
+ - app/views/c80_estate/shared/_table_properties_coef_busy.html.erb
128
+ - app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb
112
129
  - bin/console
113
130
  - bin/setup
114
131
  - c80_estate.gemspec
@@ -124,6 +141,7 @@ files:
124
141
  - db/migrate/20160629100505_create_c80_atypes.rb
125
142
  - db/migrate/20160629205151_create_c80_estate_atphotos.rb
126
143
  - db/migrate/20160630012727_create_c80_estate_pphotos.rb
144
+ - db/migrate/20160630012728_create_c80_estate_plogos.rb
127
145
  - db/migrate/20160630013636_create_join_table_areas_astatuses.rb
128
146
  - db/migrate/20160630013737_create_join_table_atypes_prop_names.rb
129
147
  - db/migrate/20160704050000_create_c80_estate_role_types.rb