c80_estate 0.1.0.34 → 0.1.0.35

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 (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/admin/c80_estate/areas.rb +4 -0
  3. data/app/admin/c80_estate/dashboard.rb +12 -0
  4. data/app/admin/c80_estate/sevents.rb +2 -1
  5. data/app/assets/stylesheets/c80_estate/backend/admin_properties.scss +3 -1
  6. data/app/assets/stylesheets/c80_estate/backend/common/collapse.scss +1 -1
  7. data/app/assets/stylesheets/c80_estate/backend/common/panel.scss +1 -1
  8. data/app/assets/stylesheets/c80_estate/backend/common/{free_busy.scss → text_styling/free_busy.scss} +0 -0
  9. data/app/assets/stylesheets/c80_estate/backend/common/text_styling/span_time_date.scss +13 -0
  10. data/app/assets/stylesheets/c80_estate/backend/common/text_styling/white_link.scss +26 -0
  11. data/app/assets/stylesheets/c80_estate/backend/dashboard/common.scss +0 -11
  12. data/app/assets/stylesheets/c80_estate/backend/dashboard/index_table.scss +28 -0
  13. data/app/assets/stylesheets/c80_estate/backend/dashboard/table_last_sevents.scss +13 -0
  14. data/app/helpers/c80_estate/app_helper.rb +32 -0
  15. data/app/helpers/c80_estate/areas_helper.rb +1 -1
  16. data/app/models/c80_estate/area.rb +11 -7
  17. data/app/models/c80_estate/owner.rb +2 -2
  18. data/app/models/c80_estate/sevent.rb +2 -13
  19. data/app/views/c80_estate/shared/_table_last_sevents.html.erb +25 -0
  20. data/app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb +1 -0
  21. data/app/views/c80_estate/shared/areas/_single_area_on_page.html.erb +12 -0
  22. data/app/views/c80_estate/shared/properties/_single_property_on_page.html.erb +12 -0
  23. data/db/migrate/20160810064747_add_last_editor_to_c80_estate_areas.rb +6 -0
  24. data/lib/c80_estate/version.rb +1 -1
  25. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 832f4348a9023325a7bbb127efb6c10234eb27b8
4
- data.tar.gz: a716de7341084ea34df0bf2d2b71f7e70c6fd723
3
+ metadata.gz: a63ef92bdfb5688fb9a777edb2f0fe55a1853b60
4
+ data.tar.gz: 0e6a05f89a444b4bb1c1bf0ccb0426519f152310
5
5
  SHA512:
6
- metadata.gz: 273b0fd67f31a3b0d1fa0f5e8ce3ccab77996ceb10546154149cf31fa9ceb27677c8b2c5fd262bc3494dee098a1527309e3c637df71c645492e0624d29e21667
7
- data.tar.gz: 8b3c499e0e165c338bde6113941723e4477a934cabb5be9b28035dd2100ccd0d53876f3f3dde10aa81b8c025d8396ab37fefe59e18c4043a9377ce289d71bbb5
6
+ metadata.gz: 719fa3098fdf9b9b50fbea6ee3ef9ef1bee4d006e6a147e09d9c81132acfc2c9750890916684dcad83914d263dce79e04af487bd34f4da7aa7eea6cec6c36c47
7
+ data.tar.gz: 42254bee3a70f7aae32832c2115a04b5d07f8d15d6a86dc3a65596e8f7fed264f7f5ba60f233b46405c38a7aec221fb94892be32915e6940d79b4318239010ad
@@ -13,6 +13,8 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
13
13
  :owner_type,
14
14
  :assigned_person_id,
15
15
  :assigned_person_type,
16
+ :last_updater_id,
17
+ :last_updater_type,
16
18
  :atype_id,
17
19
  :property_id,
18
20
  :astatus_ids => [],
@@ -244,6 +246,8 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
244
246
  f.input :owner_id, :input_html => {:value => current_admin_user.id}, as: :hidden
245
247
  f.input :owner_type, :input_html => {:value => "AdminUser"}, as: :hidden
246
248
  end
249
+ f.input :last_updater_id, :input_html => {:value => current_admin_user.id}, as: :hidden
250
+ f.input :last_updater_type, :input_html => {:value => "AdminUser"}, as: :hidden
247
251
 
248
252
  end
249
253
 
@@ -35,6 +35,18 @@ ActiveAdmin.register_page "Dashboard" do
35
35
 
36
36
  end
37
37
 
38
+ if current_admin_user.can_view_statistics?
39
+ section '' do
40
+ columns do
41
+ column do
42
+ panel "10 последних событий изменения статуса площадей (<a class='white_link' href='/admin/sevents'>Просмотреть все</a>)".html_safe do
43
+ render_table_last_sevents
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
38
50
  # section '', if: -> { current_admin_user.email == 'tz007@mail.ru' } do
39
51
  # columns do
40
52
  # column do
@@ -54,7 +54,8 @@ ActiveAdmin.register C80Estate::Sevent, as: 'Sevent' do
54
54
  end
55
55
  column :created_at
56
56
  column :property do |sevent|
57
- sevent.property_title
57
+ # sevent.property_title
58
+ link_to sevent.property.title, "/admin/properties/#{sevent.property.id}"
58
59
  end
59
60
  actions
60
61
  end
@@ -14,7 +14,9 @@ div.properties_index_logo {
14
14
  span.properties_index_logo_title {
15
15
  }
16
16
 
17
- body.admin_properties {
17
+ body.admin_properties,
18
+ body.admin_areas // т.к. подобную кнопку я теперь стал рисовать и на странице просмотра площади
19
+ {
18
20
 
19
21
  button {
20
22
  span.fa.fa-chevron-right {
@@ -19,7 +19,7 @@
19
19
  text-align: left;
20
20
  font-weight: bold;
21
21
  color: #43474f;
22
- background-color: transparent;
22
+ background-color: rgba(109, 155, 161, 0.06);
23
23
  outline: 0;
24
24
  font-size: 20px !important;
25
25
  text-shadow: none !important;
@@ -23,7 +23,7 @@
23
23
  th {
24
24
  background-color: #ffffff !important;
25
25
  border-bottom: 1px solid #cecece !important;
26
- line-height: 5px !important;
26
+ line-height: 15px !important;
27
27
  background-image: none !important;
28
28
  color: #288feb !important;
29
29
  }
@@ -0,0 +1,13 @@
1
+ span {
2
+
3
+ &.span_time {
4
+ color: #b7c3ca;
5
+ font-weight: bold;
6
+ }
7
+
8
+ &.span_date {
9
+ color: #808080;
10
+ font-weight: bold;
11
+ }
12
+
13
+ }
@@ -0,0 +1,26 @@
1
+ a.white_link {
2
+ color: #ddd !important;
3
+ text-decoration: underline !important;
4
+
5
+ -webkit-transition: opacity .2s ease-out;
6
+ -moz-transition: opacity .2s ease-out;
7
+ -ms-transition: opacity .2s ease-out;
8
+ -o-transition: opacity .2s ease-out;
9
+ transition: opacity .2s ease-out;
10
+
11
+ &:hover {
12
+ color: #ffd7a7 !important;
13
+ text-decoration: underline !important;
14
+ }
15
+ &:focus {
16
+ color: #a3ff96 !important;
17
+ }
18
+ &:active {
19
+ color: #7affe4 !important;
20
+ }
21
+ }
22
+
23
+ // в dashboard в заголовке панели это встречается
24
+ h3 a.white_link {
25
+ font-size: 12px;
26
+ }
@@ -14,15 +14,4 @@ body.admin_dashboard {
14
14
  }
15
15
  }
16
16
 
17
- table.index_table {
18
- a {
19
- text-decoration: none !important;
20
- color: #323537 !important;
21
- &:hover {
22
- text-decoration: underline !important;
23
- color: #124068 !important;
24
- }
25
- }
26
- }
27
-
28
17
  }
@@ -0,0 +1,28 @@
1
+ body.admin_dashboard {
2
+
3
+ table.index_table {
4
+
5
+ a {
6
+
7
+ // обычные ссылки без стилизации
8
+ text-decoration: none !important;
9
+ color: #323537 !important;
10
+ &:hover {
11
+ text-decoration: underline !important;
12
+ color: #124068 !important;
13
+ }
14
+
15
+ // чтобы стилизовать - надо явно указывать класс
16
+ &.link {
17
+ text-decoration: underline !important;
18
+ color: #3e7de5 !important;
19
+ &:hover {
20
+ text-decoration: underline !important;
21
+ color: #4498ff !important;
22
+ }
23
+ }
24
+ }
25
+
26
+ }
27
+
28
+ }
@@ -0,0 +1,13 @@
1
+ body.admin_dashboard {
2
+
3
+ #table_last_sevents {
4
+ thead {
5
+ tr {
6
+ th {
7
+ color: #424C58 !important;
8
+ }
9
+ }
10
+ }
11
+ }
12
+
13
+ }
@@ -164,5 +164,37 @@ module C80Estate
164
164
  render :partial => 'c80_estate/shared/properties/single_property_on_page'
165
165
  end
166
166
 
167
+ def render_table_last_sevents(property = nil, area = nil, limit = nil)
168
+ # Rails.logger.debug "[TRACE] <AppHelper.render_table_last_sevents> current_admin_user.can_view_statistics? = #{current_admin_user.can_view_statistics?}"
169
+
170
+ # сначал выберем из базы
171
+
172
+ sevents_list = Sevent.all
173
+
174
+ if property.present?
175
+ sevents_list = sevents_list.where(:property_id => property.id)
176
+ end
177
+
178
+ if area.present?
179
+ sevents_list = sevents_list.where(:area_id => area.id)
180
+ end
181
+
182
+ lim = 10
183
+
184
+ if limit.present?
185
+ lim = limit
186
+ end
187
+
188
+ sevents_list = sevents_list.limit(lim).created_at_desc
189
+
190
+ # теперь нарисуем
191
+
192
+ render :partial => 'c80_estate/shared/table_last_sevents',
193
+ :locals => {
194
+ sevents_list: sevents_list
195
+ }
196
+
197
+ end
198
+
167
199
  end
168
200
  end
@@ -58,7 +58,7 @@ module C80Estate
58
58
  { title: 'Кто создал', value: area.owner.email },
59
59
  { title: 'Время создания', value: area.created_at.strftime('%Y/%m/%d %H:%M:%S') },
60
60
  { title: 'Время последнего изменения', value: area.updated_at.strftime('%Y/%m/%d %H:%M:%S') },
61
- { title: 'Кто последний раз вносил изменения', value: area.last_updater },
61
+ { title: 'Кто последний раз вносил изменения', value: area.last_updater_title },
62
62
  { title: 'Ответственный', value: area.assigned_person_title }
63
63
  ]
64
64
 
@@ -4,6 +4,7 @@ module C80Estate
4
4
  belongs_to :atype
5
5
  belongs_to :owner, :polymorphic => true
6
6
  belongs_to :assigned_person, :polymorphic => true
7
+ belongs_to :last_updater, :polymorphic => true
7
8
  has_many :item_props, :dependent => :destroy
8
9
  accepts_nested_attributes_for :item_props,
9
10
  :reject_if => lambda { |attributes|
@@ -312,8 +313,10 @@ module C80Estate
312
313
  res
313
314
  end
314
315
 
315
- def last_updater
316
- sevents.last.auser.email
316
+ def last_updater_title
317
+ if last_updater.present?
318
+ last_updater.email
319
+ end
317
320
  end
318
321
 
319
322
  # выдать цену за м.кв. в месяц
@@ -443,13 +446,13 @@ module C80Estate
443
446
 
444
447
  protected
445
448
 
446
- # при создании площади генерится начальное событие
449
+ # после создания площади генерится начальное событие
447
450
  def create_initial_sevent
448
- Rails.logger.debug "<Area.create_initial_sevent> self.astatuses.count = #{self.astatuses.count}"
451
+ # Rails.logger.debug "<Area.create_initial_sevent> self.astatuses.count = #{self.astatuses.count}"
449
452
 
450
453
  # [**]
451
454
  if self.astatuses.count > 0
452
- Rails.logger.debug "<Area.create_initial_sevent> aga: self.astatuses.first.title = #{self.astatuses.first.title}"
455
+ # Rails.logger.debug "<Area.create_initial_sevent> aga: self.astatuses.first.title = #{self.astatuses.first.title}"
453
456
 
454
457
  s = Sevent.create!({
455
458
  area_id: self.id,
@@ -477,6 +480,7 @@ module C80Estate
477
480
 
478
481
  end
479
482
 
483
+ # после обновления данных площади генерится Sevent событие
480
484
  def check_and_generate_sevent
481
485
 
482
486
  # находим последнее известное событие
@@ -491,13 +495,13 @@ module C80Estate
491
495
  Rails.logger.debug "<Area.check_and_generate_sevent> last_known_sevent = #{last_known_sevent}, self.astatuses.first.tag = #{self.astatuses.first.tag}"
492
496
 
493
497
  if last_known_sevent != self.astatuses.first.tag
494
- Rails.logger.debug "<Area.check_and_generate_sevent> aga"
498
+ Rails.logger.debug "<Area.check_and_generate_sevent> [STATUS_CHANGED] self.last_updater_id = #{self.last_updater_id}"
495
499
  sparams = {
496
500
  area_id: self.id,
497
501
  atype_id: self.atype_id,
498
502
  property_id: self.property_id,
499
503
  astatus_id: self.astatus_id,
500
- auser_id: self.owner_id, # инициатор события - редактор Площади
504
+ auser_id: self.last_updater_id, # инициатор события - редактор Площади
501
505
  auser_type: 'AdminUser'
502
506
  }
503
507
 
@@ -35,9 +35,10 @@ module C80Estate
35
35
  # эта взаимосвязь трактуется, как "площадь, назначенная сотруднику"
36
36
  has_many :assigned_areas, :as => :assigned_person, :class_name => 'C80Estate::Area', :dependent => :nullify
37
37
 
38
- # эта взаимосвязь трактуется, как "площадь, назначенная сотруднику"
38
+ # эта взаимосвязь трактуется, как "объект, назначенная сотруднику"
39
39
  has_many :assigned_properties, :as => :assigned_person, :class_name => 'C80Estate::Property', :dependent => :nullify
40
40
 
41
+ # эта взаимосвязь трактуется как "Пользователь, создавая\меняя\удаяя площади, генерит Sevent события"
41
42
  has_many :sevents, :as => :auser, :class_name => 'C80Estate::Sevent', :dependent => :nullify
42
43
 
43
44
  after_create :create_role
@@ -86,7 +87,6 @@ module C80Estate
86
87
  # true
87
88
  end
88
89
 
89
-
90
90
  def can_edit_property?(property)
91
91
  r1 = roles.where(role_type: 1)
92
92
  # mark_is_owner = property.owner.id == id
@@ -10,19 +10,8 @@ module C80Estate
10
10
  # нужен только при заполнении из rake db:seed:85_fill_sevents
11
11
  after_create :generate_pstat
12
12
 
13
- =begin
14
- def self.all_areas
15
- self.all
16
- end
17
-
18
- def self.free_areas
19
- self.joins(:astatuses).where(:c80_estate_astatuses => { tag: 'free'})
20
- end
21
-
22
- def self.busy_areas
23
- self.joins(:astatuses).where(:c80_estate_astatuses => { tag: 'busy'})
24
- end
25
- =end
13
+ scope :created_at_asc, -> {order(:created_at => :asc)}
14
+ scope :created_at_desc, -> {order(:created_at => :desc)}
26
15
 
27
16
  def self.ecoef(area_id: nil, prop_id: nil, atype_id: nil, start_date: nil, end_date: nil)
28
17
  # start_date: строка вида 2015-12-12
@@ -0,0 +1,25 @@
1
+ <%# AppHelper.render_table_last_sevents %>
2
+
3
+ <table border="0" cellspacing="0" cellpadding="0" id="table_last_sevents" class="index_table index sortable">
4
+ <thead>
5
+ <tr>
6
+ <th><abbr title="Показано время события изменения статуса">Время</abbr></th>
7
+ <th><abbr title="Площадь, чей статус был изменён">Площадь</abbr></th>
8
+ <th><abbr title="Статус, который приобрела площадь">Статус</abbr></th>
9
+ <th><abbr title="Показан актуальный тип площади ПОСЛЕ события изменения статуса">Тип площади</abbr></th>
10
+ <th><abbr title="Пользователь, который изменил статус площади">Инициатор</abbr></th>
11
+ <th><abbr title="Объект недвижимости, которому принадлежит площадь">Объект</abbr></th>
12
+ </tr>
13
+ </thead>
14
+ <% sevents_list.each do |sevent| %>
15
+ <tr>
16
+ <%# Rails.logger.debug "[TRACE] <_table_last_sevents.html.erb> #{sevent}" %>
17
+ <td><%= "<span class='span_date'>#{sevent.created_at.strftime('%d/%b/%Y')}</span> <span class='span_time'>#{sevent.created_at.strftime('%H:%M:%S')}</span> ".html_safe %></td>
18
+ <td><%= link_to sevent.area_title, "/admin/areas/#{sevent.area.id}", class:'link' %></td>
19
+ <td><%= sevent.astatus_title %></td>
20
+ <td><%= sevent.atype.title %></td>
21
+ <td><%= sevent.auser_title %></td>
22
+ <td><%= link_to sevent.property.title, "/admin/properties/#{sevent.property.id}", class:'link' %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
@@ -1,3 +1,4 @@
1
+ <%# AppHelper::render_table_prop_busy_coef_sq %>
1
2
  <table border="0" cellspacing="0" cellpadding="0" id="table_properties_coef_busy_sq" class="sortable index_table index" paginator="true">
2
3
  <thead>
3
4
  <tr>
@@ -48,6 +48,18 @@
48
48
  <%= smiph_render_common_props(@item) %>
49
49
  </div>
50
50
 
51
+ <% if current_admin_user.can_view_statistics? %>
52
+ <div id="div_all_sevents_table" class="wrap_collapse">
53
+ <button type="button" class="btn" data-toggle="collapse" data-target="#iid2">
54
+ <span class="fa fa-chevron-right"></span>
55
+ Все события изменения статуса (<%= @item.sevents.count %>)
56
+ </button>
57
+ <div class="collapse" id="iid2">
58
+ <%= render_table_last_sevents(nil, @item, 99999) %>
59
+ </div>
60
+ </div>
61
+ <% end %>
62
+
51
63
  <div id="related_items" class="hidden">
52
64
  <%# smiph_render_related_items(@item) %>
53
65
  </div>
@@ -49,6 +49,18 @@
49
49
  </div>
50
50
  <% end %>
51
51
 
52
+ <% if current_admin_user.can_view_statistics? %>
53
+ <div id="div_all_sevents_table" class="wrap_collapse">
54
+ <button type="button" class="btn" data-toggle="collapse" data-target="#iid2">
55
+ <span class="fa fa-chevron-right"></span>
56
+ Все события изменения статусов всех площадей объекта (<%= @item.sevents.count %>)
57
+ </button>
58
+ <div class="collapse" id="iid2">
59
+ <%= render_table_last_sevents(@item, nil, 99999) %>
60
+ </div>
61
+ </div>
62
+ <% end %>
63
+
52
64
  <div id="related_items" class="hidden">
53
65
  <%# smiph_render_related_items(@item) %>
54
66
  </div>
@@ -0,0 +1,6 @@
1
+ class AddLastEditorToC80EstateAreas < ActiveRecord::Migration
2
+ def change
3
+ add_reference :c80_estate_areas, :last_updater, index: true
4
+ add_column :c80_estate_areas, :last_updater_type, :string
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module C80Estate
2
- VERSION = '0.1.0.34'
2
+ VERSION = '0.1.0.35'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_estate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.34
4
+ version: 0.1.0.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A
@@ -115,12 +115,16 @@ files:
115
115
  - app/assets/stylesheets/c80_estate/backend/admin_users.scss
116
116
  - app/assets/stylesheets/c80_estate/backend/common.scss
117
117
  - app/assets/stylesheets/c80_estate/backend/common/collapse.scss
118
- - app/assets/stylesheets/c80_estate/backend/common/free_busy.scss
119
118
  - app/assets/stylesheets/c80_estate/backend/common/minor_fix.scss
120
119
  - app/assets/stylesheets/c80_estate/backend/common/panel.scss
120
+ - app/assets/stylesheets/c80_estate/backend/common/text_styling/free_busy.scss
121
+ - app/assets/stylesheets/c80_estate/backend/common/text_styling/span_time_date.scss
122
+ - app/assets/stylesheets/c80_estate/backend/common/text_styling/white_link.scss
121
123
  - app/assets/stylesheets/c80_estate/backend/dashboard/atype_in_list.scss
122
124
  - app/assets/stylesheets/c80_estate/backend/dashboard/common.scss
125
+ - app/assets/stylesheets/c80_estate/backend/dashboard/index_table.scss
123
126
  - app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss
127
+ - app/assets/stylesheets/c80_estate/backend/dashboard/table_last_sevents.scss
124
128
  - app/assets/stylesheets/c80_estate/backend/shared/areas/gallery3.scss
125
129
  - app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item.scss
126
130
  - app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_all_areas_table.scss
@@ -181,6 +185,7 @@ files:
181
185
  - app/views/c80_estate/ajax_view/table_properties_coef_busy.js.erb
182
186
  - app/views/c80_estate/ajax_view/table_properties_coef_busy_sq.js.erb
183
187
  - app/views/c80_estate/shared/_form_upload_areas_excel.erb
188
+ - app/views/c80_estate/shared/_table_last_sevents.html.erb
184
189
  - app/views/c80_estate/shared/_table_properties_coef_busy.html.erb
185
190
  - app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb
186
191
  - app/views/c80_estate/shared/areas/_gallery4.html.erb
@@ -210,6 +215,7 @@ files:
210
215
  - db/migrate/20160713043333_create_c80_estate_sevents.rb
211
216
  - db/migrate/20160717094647_create_c80_estate_pstats.rb
212
217
  - db/migrate/20160803093131_change_c80_estate_pstats_column_types.rb
218
+ - db/migrate/20160810064747_add_last_editor_to_c80_estate_areas.rb
213
219
  - db/seeds/50_fill_uoms.rb.example
214
220
  - db/seeds/55_fill_prop_names.rb.example
215
221
  - db/seeds/60_fill_atypes.rb.example