c80_estate 0.1.0.19 → 0.1.0.20

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 606728f116f37187d185f9278f7c0ad8190e983c
4
- data.tar.gz: 83b98586222f9051c675234c7650c9127e367a2f
3
+ metadata.gz: a4e89d64f1f216b65d06a87e02e3b026ddf25ce7
4
+ data.tar.gz: 1218f83763a3a9dd8d94e50e0325d74cda6c520c
5
5
  SHA512:
6
- metadata.gz: 7685f707657c138eb975d53ce6072a9cc720eab820380898f23ac27247e83e01b3827d6d5cf1915acf32fccf261d383bcb5a70999e5c740c92ad3755304899d4
7
- data.tar.gz: 1023a25ae7b3698b411121aa7bdc7e2c3b4a1b96a4d1df973a1745fc0492be03e7b899fc3a93958fb849fe41e6d70b24ac1133dc913468cd9b569b98543846c4
6
+ metadata.gz: f13201dc5240646a00b483102d1e4695483b9927507c0fb0b0b95d62ca756fb4f9393d06f0787f767017f385c6d337ea469dcc46c8096e40574d3f228ef4a834
7
+ data.tar.gz: 9cd8dfdf5252228d4b4af62f77c9250fcbb4f9364420f109c5a73c68537209dae775b900c5a6f096429b62555704f30a238b1b540c35a0e036b8f23b087f55c9
@@ -34,6 +34,9 @@ ActiveAdmin.register AdminUser do
34
34
  column :role do |user|
35
35
  user.role_type_title
36
36
  end
37
+ column 'Площадей' do |user|
38
+ user.assigned_areas_count
39
+ end
37
40
  actions
38
41
  end
39
42
 
@@ -127,10 +127,10 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
127
127
  :input_html => {:class => 'selectpicker', 'data-size' => "3", 'data-width' => '100%'}
128
128
 
129
129
  # filter :title
130
- filter :assigned_person_id,
130
+ filter :assigned_person_id_in,
131
131
  :label => 'Назначенный пользователь',
132
132
  :as => :select,
133
- :collection => -> { AdminUser.all.map { |u| ["#{u.email}", u.id] } },
133
+ :collection => -> { AdminUser.all.map { |u| ["#{u.email} (#{u.assigned_areas_count})", u.id] } },
134
134
  :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '100%'}
135
135
  filter :created_at
136
136
  filter :updated_at
@@ -147,9 +147,12 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
147
147
  column :atype do |area|
148
148
  area.atype_title
149
149
  end
150
- column 'Цена' do |area|
150
+ column '<abbr title="За м.кв. в месяц">Цена м.кв.</abbr>'.html_safe do |area|
151
151
  "#{area.price_value} руб"
152
152
  end
153
+ column '<abbr title="Стоимость всей площади в месяц. Число PxS, где P - цена за м.кв. в месяц, S - метраж площади в м.кв.">Цена площади</abbr>'.html_safe do |area|
154
+ "#{area.power_price_value} руб"
155
+ end
153
156
  column 'Метраж' do |area|
154
157
  "#{area.square_value} м<sup>2</sup>".html_safe
155
158
  end
@@ -44,11 +44,23 @@ ActiveAdmin.register C80Estate::Property, as: 'Property' do
44
44
  <span></span><img src='#{image_path(prop.logo_path)}'>
45
45
  </div>".html_safe
46
46
  end
47
- column :title
48
- column :address
49
- column :gps do |prop|
50
- "#{prop.latitude},#{prop.longitude}"
47
+ # column :title
48
+ column :title do |prop|
49
+ link_to prop.title, "/admin/properties/#{prop.id}", title: I18n.t("active_admin.view")
51
50
  end
51
+ column 'Площадей' do |prop|
52
+ prop.areas.count
53
+ end
54
+ column 'Метраж' do |prop|
55
+ "#{prop.square_value} м.кв."
56
+ end
57
+ column '<abbr title="Сумма всех цен площадей">Цена объекта</abbr>'.html_safe do |prop|
58
+ "#{prop.power_price_value} руб"
59
+ end
60
+ # column :address
61
+ # column :gps do |prop|
62
+ # "#{prop.latitude},#{prop.longitude}"
63
+ # end
52
64
  column :assigned_person do |prop|
53
65
  prop.assigned_person_title
54
66
  end
@@ -57,9 +69,9 @@ ActiveAdmin.register C80Estate::Property, as: 'Property' do
57
69
  # end
58
70
  # actions
59
71
 
60
- column '' do |property|
61
- link_to I18n.t("active_admin.view"), "/admin/properties/#{property.id}", class: 'member_link'
62
- end
72
+ # column '' do |property|
73
+ # link_to I18n.t("active_admin.view"), "/admin/properties/#{property.id}", class: 'member_link'
74
+ # end
63
75
  column '' do |property|
64
76
  if current_admin_user.can_edit_property?(property)
65
77
  link_to I18n.t("active_admin.edit"), "/admin/properties/#{property.id}/edit", class: 'member_link'
@@ -0,0 +1,14 @@
1
+ $(document).ready(function(){
2
+
3
+ var $divfaq = $(".wrap_collapse");
4
+ var $div_anser = $divfaq.find('.collapse');
5
+
6
+ $div_anser.on("hide.bs.collapse", function(){
7
+ //$(".btn").html('<span class="glyphicon glyphicon-collapse-down"></span> Open');
8
+ $divfaq.find(".btn").find("span").attr("class","fa fa-chevron-right");
9
+ });
10
+ $div_anser.on("show.bs.collapse", function(){
11
+ //$(".btn").html('<span class="glyphicon glyphicon-collapse-up"></span> Close');
12
+ $divfaq.find(".btn").find("span").attr("class","fa fa-chevron-down");
13
+ });
14
+ });
@@ -0,0 +1,495 @@
1
+ /*
2
+ SortTable
3
+ version 2
4
+ 7th April 2007
5
+ Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
6
+
7
+ Instructions:
8
+ Download this file
9
+ Add <script src="sorttable.js"></script> to your HTML
10
+ Add class="sortable" to any table you'd like to make sortable
11
+ Click on the headers to sort
12
+
13
+ Thanks to many, many people for contributions and suggestions.
14
+ Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
15
+ This basically means: do what you want with it.
16
+ */
17
+
18
+
19
+ var stIsIE = /*@cc_on!@*/false;
20
+
21
+ sorttable = {
22
+ init: function() {
23
+ // quit if this function has already been called
24
+ if (arguments.callee.done) return;
25
+ // flag this function so we don't do the same thing twice
26
+ arguments.callee.done = true;
27
+ // kill the timer
28
+ if (_timer) clearInterval(_timer);
29
+
30
+ if (!document.createElement || !document.getElementsByTagName) return;
31
+
32
+ sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
33
+
34
+ forEach(document.getElementsByTagName('table'), function(table) {
35
+ if (table.className.search(/\bsortable\b/) != -1) {
36
+ sorttable.makeSortable(table);
37
+ }
38
+ });
39
+
40
+ },
41
+
42
+ makeSortable: function(table) {
43
+ if (table.getElementsByTagName('thead').length == 0) {
44
+ // table doesn't have a tHead. Since it should have, create one and
45
+ // put the first table row in it.
46
+ the = document.createElement('thead');
47
+ the.appendChild(table.rows[0]);
48
+ table.insertBefore(the,table.firstChild);
49
+ }
50
+ // Safari doesn't support table.tHead, sigh
51
+ if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
52
+
53
+ if (table.tHead.rows.length != 1) return; // can't cope with two header rows
54
+
55
+ // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
56
+ // "total" rows, for example). This is B&R, since what you're supposed
57
+ // to do is put them in a tfoot. So, if there are sortbottom rows,
58
+ // for backwards compatibility, move them to tfoot (creating it if needed).
59
+ sortbottomrows = [];
60
+ for (var i=0; i<table.rows.length; i++) {
61
+ if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
62
+ sortbottomrows[sortbottomrows.length] = table.rows[i];
63
+ }
64
+ }
65
+ if (sortbottomrows) {
66
+ if (table.tFoot == null) {
67
+ // table doesn't have a tfoot. Create one.
68
+ tfo = document.createElement('tfoot');
69
+ table.appendChild(tfo);
70
+ }
71
+ for (var i=0; i<sortbottomrows.length; i++) {
72
+ tfo.appendChild(sortbottomrows[i]);
73
+ }
74
+ delete sortbottomrows;
75
+ }
76
+
77
+ // work through each column and calculate its type
78
+ headrow = table.tHead.rows[0].cells;
79
+ for (var i=0; i<headrow.length; i++) {
80
+ // manually override the type with a sorttable_type attribute
81
+ if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
82
+ mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
83
+ if (mtch) { override = mtch[1]; }
84
+ if (mtch && typeof sorttable["sort_"+override] == 'function') {
85
+ headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
86
+ } else {
87
+ headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
88
+ }
89
+ // make it clickable to sort
90
+ headrow[i].sorttable_columnindex = i;
91
+ headrow[i].sorttable_tbody = table.tBodies[0];
92
+ dean_addEvent(headrow[i],"click", sorttable.innerSortFunction = function(e) {
93
+
94
+ if (this.className.search(/\bsorttable_sorted\b/) != -1) {
95
+ // if we're already sorted by this column, just
96
+ // reverse the table, which is quicker
97
+ sorttable.reverse(this.sorttable_tbody);
98
+ this.className = this.className.replace('sorttable_sorted',
99
+ 'sorttable_sorted_reverse');
100
+ this.removeChild(document.getElementById('sorttable_sortfwdind'));
101
+ sortrevind = document.createElement('span');
102
+ sortrevind.id = "sorttable_sortrevind";
103
+ sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
104
+ this.appendChild(sortrevind);
105
+ return;
106
+ }
107
+ if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
108
+ // if we're already sorted by this column in reverse, just
109
+ // re-reverse the table, which is quicker
110
+ sorttable.reverse(this.sorttable_tbody);
111
+ this.className = this.className.replace('sorttable_sorted_reverse',
112
+ 'sorttable_sorted');
113
+ this.removeChild(document.getElementById('sorttable_sortrevind'));
114
+ sortfwdind = document.createElement('span');
115
+ sortfwdind.id = "sorttable_sortfwdind";
116
+ sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
117
+ this.appendChild(sortfwdind);
118
+ return;
119
+ }
120
+
121
+ // remove sorttable_sorted classes
122
+ theadrow = this.parentNode;
123
+ forEach(theadrow.childNodes, function(cell) {
124
+ if (cell.nodeType == 1) { // an element
125
+ cell.className = cell.className.replace('sorttable_sorted_reverse','');
126
+ cell.className = cell.className.replace('sorttable_sorted','');
127
+ }
128
+ });
129
+ sortfwdind = document.getElementById('sorttable_sortfwdind');
130
+ if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
131
+ sortrevind = document.getElementById('sorttable_sortrevind');
132
+ if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
133
+
134
+ this.className += ' sorttable_sorted';
135
+ sortfwdind = document.createElement('span');
136
+ sortfwdind.id = "sorttable_sortfwdind";
137
+ sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
138
+ this.appendChild(sortfwdind);
139
+
140
+ // build an array to sort. This is a Schwartzian transform thing,
141
+ // i.e., we "decorate" each row with the actual sort key,
142
+ // sort based on the sort keys, and then put the rows back in order
143
+ // which is a lot faster because you only do getInnerText once per row
144
+ row_array = [];
145
+ col = this.sorttable_columnindex;
146
+ rows = this.sorttable_tbody.rows;
147
+ for (var j=0; j<rows.length; j++) {
148
+ row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
149
+ }
150
+ /* If you want a stable sort, uncomment the following line */
151
+ //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
152
+ /* and comment out this one */
153
+ row_array.sort(this.sorttable_sortfunction);
154
+
155
+ tb = this.sorttable_tbody;
156
+ for (var j=0; j<row_array.length; j++) {
157
+ tb.appendChild(row_array[j][1]);
158
+ }
159
+
160
+ delete row_array;
161
+ });
162
+ }
163
+ }
164
+ },
165
+
166
+ guessType: function(table, column) {
167
+ // guess the type of a column based on its first non-blank row
168
+ sortfn = sorttable.sort_alpha;
169
+ for (var i=0; i<table.tBodies[0].rows.length; i++) {
170
+ text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
171
+ if (text != '') {
172
+ if (text.match(/^-?[Ј$¤]?[\d,.]+%?$/)) {
173
+ return sorttable.sort_numeric;
174
+ }
175
+ // check for a date: dd/mm/yyyy or dd/mm/yy
176
+ // can have / or . or - as separator
177
+ // can be mm/dd as well
178
+ possdate = text.match(sorttable.DATE_RE)
179
+ if (possdate) {
180
+ // looks like a date
181
+ first = parseInt(possdate[1]);
182
+ second = parseInt(possdate[2]);
183
+ if (first > 12) {
184
+ // definitely dd/mm
185
+ return sorttable.sort_ddmm;
186
+ } else if (second > 12) {
187
+ return sorttable.sort_mmdd;
188
+ } else {
189
+ // looks like a date, but we can't tell which, so assume
190
+ // that it's dd/mm (English imperialism!) and keep looking
191
+ sortfn = sorttable.sort_ddmm;
192
+ }
193
+ }
194
+ }
195
+ }
196
+ return sortfn;
197
+ },
198
+
199
+ getInnerText: function(node) {
200
+ // gets the text we want to use for sorting for a cell.
201
+ // strips leading and trailing whitespace.
202
+ // this is *not* a generic getInnerText function; it's special to sorttable.
203
+ // for example, you can override the cell text with a customkey attribute.
204
+ // it also gets .value for <input> fields.
205
+
206
+ if (!node) return "";
207
+
208
+ hasInputs = (typeof node.getElementsByTagName == 'function') &&
209
+ node.getElementsByTagName('input').length;
210
+
211
+ if (node.getAttribute("sorttable_customkey") != null) {
212
+ return node.getAttribute("sorttable_customkey");
213
+ }
214
+ else if (typeof node.textContent != 'undefined' && !hasInputs) {
215
+ return node.textContent.replace(/^\s+|\s+$/g, '');
216
+ }
217
+ else if (typeof node.innerText != 'undefined' && !hasInputs) {
218
+ return node.innerText.replace(/^\s+|\s+$/g, '');
219
+ }
220
+ else if (typeof node.text != 'undefined' && !hasInputs) {
221
+ return node.text.replace(/^\s+|\s+$/g, '');
222
+ }
223
+ else {
224
+ switch (node.nodeType) {
225
+ case 3:
226
+ if (node.nodeName.toLowerCase() == 'input') {
227
+ return node.value.replace(/^\s+|\s+$/g, '');
228
+ }
229
+ case 4:
230
+ return node.nodeValue.replace(/^\s+|\s+$/g, '');
231
+ break;
232
+ case 1:
233
+ case 11:
234
+ var innerText = '';
235
+ for (var i = 0; i < node.childNodes.length; i++) {
236
+ innerText += sorttable.getInnerText(node.childNodes[i]);
237
+ }
238
+ return innerText.replace(/^\s+|\s+$/g, '');
239
+ break;
240
+ default:
241
+ return '';
242
+ }
243
+ }
244
+ },
245
+
246
+ reverse: function(tbody) {
247
+ // reverse the rows in a tbody
248
+ newrows = [];
249
+ for (var i=0; i<tbody.rows.length; i++) {
250
+ newrows[newrows.length] = tbody.rows[i];
251
+ }
252
+ for (var i=newrows.length-1; i>=0; i--) {
253
+ tbody.appendChild(newrows[i]);
254
+ }
255
+ delete newrows;
256
+ },
257
+
258
+ /* sort functions
259
+ each sort function takes two parameters, a and b
260
+ you are comparing a[0] and b[0] */
261
+ sort_numeric: function(a,b) {
262
+ aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
263
+ if (isNaN(aa)) aa = 0;
264
+ bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
265
+ if (isNaN(bb)) bb = 0;
266
+ return aa-bb;
267
+ },
268
+ sort_alpha: function(a,b) {
269
+ if (a[0]==b[0]) return 0;
270
+ if (a[0]<b[0]) return -1;
271
+ return 1;
272
+ },
273
+ sort_ddmm: function(a,b) {
274
+ mtch = a[0].match(sorttable.DATE_RE);
275
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
276
+ if (m.length == 1) m = '0'+m;
277
+ if (d.length == 1) d = '0'+d;
278
+ dt1 = y+m+d;
279
+ mtch = b[0].match(sorttable.DATE_RE);
280
+ y = mtch[3]; m = mtch[2]; d = mtch[1];
281
+ if (m.length == 1) m = '0'+m;
282
+ if (d.length == 1) d = '0'+d;
283
+ dt2 = y+m+d;
284
+ if (dt1==dt2) return 0;
285
+ if (dt1<dt2) return -1;
286
+ return 1;
287
+ },
288
+ sort_mmdd: function(a,b) {
289
+ mtch = a[0].match(sorttable.DATE_RE);
290
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
291
+ if (m.length == 1) m = '0'+m;
292
+ if (d.length == 1) d = '0'+d;
293
+ dt1 = y+m+d;
294
+ mtch = b[0].match(sorttable.DATE_RE);
295
+ y = mtch[3]; d = mtch[2]; m = mtch[1];
296
+ if (m.length == 1) m = '0'+m;
297
+ if (d.length == 1) d = '0'+d;
298
+ dt2 = y+m+d;
299
+ if (dt1==dt2) return 0;
300
+ if (dt1<dt2) return -1;
301
+ return 1;
302
+ },
303
+
304
+ shaker_sort: function(list, comp_func) {
305
+ // A stable sort function to allow multi-level sorting of data
306
+ // see: http://en.wikipedia.org/wiki/Cocktail_sort
307
+ // thanks to Joseph Nahmias
308
+ var b = 0;
309
+ var t = list.length - 1;
310
+ var swap = true;
311
+
312
+ while(swap) {
313
+ swap = false;
314
+ for(var i = b; i < t; ++i) {
315
+ if ( comp_func(list[i], list[i+1]) > 0 ) {
316
+ var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
317
+ swap = true;
318
+ }
319
+ } // for
320
+ t--;
321
+
322
+ if (!swap) break;
323
+
324
+ for(var i = t; i > b; --i) {
325
+ if ( comp_func(list[i], list[i-1]) < 0 ) {
326
+ var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
327
+ swap = true;
328
+ }
329
+ } // for
330
+ b++;
331
+
332
+ } // while(swap)
333
+ }
334
+ }
335
+
336
+ /* ******************************************************************
337
+ Supporting functions: bundled here to avoid depending on a library
338
+ ****************************************************************** */
339
+
340
+ // Dean Edwards/Matthias Miller/John Resig
341
+
342
+ /* for Mozilla/Opera9 */
343
+ if (document.addEventListener) {
344
+ document.addEventListener("DOMContentLoaded", sorttable.init, false);
345
+ }
346
+
347
+ /* for Internet Explorer */
348
+ /*@cc_on @*/
349
+ /*@if (@_win32)
350
+ document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
351
+ var script = document.getElementById("__ie_onload");
352
+ script.onreadystatechange = function() {
353
+ if (this.readyState == "complete") {
354
+ sorttable.init(); // call the onload handler
355
+ }
356
+ };
357
+ /*@end @*/
358
+
359
+ /* for Safari */
360
+ if (/WebKit/i.test(navigator.userAgent)) { // sniff
361
+ var _timer = setInterval(function() {
362
+ if (/loaded|complete/.test(document.readyState)) {
363
+ sorttable.init(); // call the onload handler
364
+ }
365
+ }, 10);
366
+ }
367
+
368
+ /* for other browsers */
369
+ window.onload = sorttable.init;
370
+
371
+ // written by Dean Edwards, 2005
372
+ // with input from Tino Zijdel, Matthias Miller, Diego Perini
373
+
374
+ // http://dean.edwards.name/weblog/2005/10/add-event/
375
+
376
+ function dean_addEvent(element, type, handler) {
377
+ if (element.addEventListener) {
378
+ element.addEventListener(type, handler, false);
379
+ } else {
380
+ // assign each event handler a unique ID
381
+ if (!handler.$$guid) handler.$$guid = dean_addEvent.guid++;
382
+ // create a hash table of event types for the element
383
+ if (!element.events) element.events = {};
384
+ // create a hash table of event handlers for each element/event pair
385
+ var handlers = element.events[type];
386
+ if (!handlers) {
387
+ handlers = element.events[type] = {};
388
+ // store the existing event handler (if there is one)
389
+ if (element["on" + type]) {
390
+ handlers[0] = element["on" + type];
391
+ }
392
+ }
393
+ // store the event handler in the hash table
394
+ handlers[handler.$$guid] = handler;
395
+ // assign a global event handler to do all the work
396
+ element["on" + type] = handleEvent;
397
+ }
398
+ };
399
+ // a counter used to create unique IDs
400
+ dean_addEvent.guid = 1;
401
+
402
+ function removeEvent(element, type, handler) {
403
+ if (element.removeEventListener) {
404
+ element.removeEventListener(type, handler, false);
405
+ } else {
406
+ // delete the event handler from the hash table
407
+ if (element.events && element.events[type]) {
408
+ delete element.events[type][handler.$$guid];
409
+ }
410
+ }
411
+ };
412
+
413
+ function handleEvent(event) {
414
+ var returnValue = true;
415
+ // grab the event object (IE uses a global event object)
416
+ event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
417
+ // get a reference to the hash table of event handlers
418
+ var handlers = this.events[event.type];
419
+ // execute each event handler
420
+ for (var i in handlers) {
421
+ this.$$handleEvent = handlers[i];
422
+ if (this.$$handleEvent(event) === false) {
423
+ returnValue = false;
424
+ }
425
+ }
426
+ return returnValue;
427
+ };
428
+
429
+ function fixEvent(event) {
430
+ // add W3C standard event methods
431
+ event.preventDefault = fixEvent.preventDefault;
432
+ event.stopPropagation = fixEvent.stopPropagation;
433
+ return event;
434
+ };
435
+ fixEvent.preventDefault = function() {
436
+ this.returnValue = false;
437
+ };
438
+ fixEvent.stopPropagation = function() {
439
+ this.cancelBubble = true;
440
+ }
441
+
442
+ // Dean's forEach: http://dean.edwards.name/base/forEach.js
443
+ /*
444
+ forEach, version 1.0
445
+ Copyright 2006, Dean Edwards
446
+ License: http://www.opensource.org/licenses/mit-license.php
447
+ */
448
+
449
+ // array-like enumeration
450
+ if (!Array.forEach) { // mozilla already supports this
451
+ Array.forEach = function(array, block, context) {
452
+ for (var i = 0; i < array.length; i++) {
453
+ block.call(context, array[i], i, array);
454
+ }
455
+ };
456
+ }
457
+
458
+ // generic enumeration
459
+ Function.prototype.forEach = function(object, block, context) {
460
+ for (var key in object) {
461
+ if (typeof this.prototype[key] == "undefined") {
462
+ block.call(context, object[key], key, object);
463
+ }
464
+ }
465
+ };
466
+
467
+ // character enumeration
468
+ String.forEach = function(string, block, context) {
469
+ Array.forEach(string.split(""), function(chr, index) {
470
+ block.call(context, chr, index, string);
471
+ });
472
+ };
473
+
474
+ // globally resolve forEach enumeration
475
+ var forEach = function(object, block, context) {
476
+ if (object) {
477
+ var resolve = Object; // default
478
+ if (object instanceof Function) {
479
+ // functions have a "length" property
480
+ resolve = Function;
481
+ } else if (object.forEach instanceof Function) {
482
+ // the object implements a custom forEach method so use that
483
+ object.forEach(block, context);
484
+ return;
485
+ } else if (typeof object == "string") {
486
+ // the object is a string
487
+ resolve = String;
488
+ } else if (typeof object.length == "number") {
489
+ // the object is array-like
490
+ resolve = Array;
491
+ }
492
+ resolve.forEach(object, block, context);
493
+ }
494
+ };
495
+
@@ -136,44 +136,6 @@ body.admin_areas {
136
136
  /*display: none;*/
137
137
  }
138
138
 
139
- span.status_free {
140
- display: block;
141
- position: relative;
142
- padding: 0 0 0 17px;
143
-
144
- &:after {
145
- display: block;
146
- position: absolute;
147
- top:0;
148
- left:0;
149
- width: 20px;
150
- height: 20px;
151
- font-family: FontAwesome;
152
- content: '\f059';
153
- color: #51e471;
154
- }
155
-
156
- }
157
-
158
- span.status_busy {
159
- display: block;
160
- position: relative;
161
- padding: 0 0 0 17px;
162
-
163
- &:after {
164
- display: block;
165
- position: absolute;
166
- top:0;
167
- left:0;
168
- width: 20px;
169
- height: 20px;
170
- font-family: FontAwesome;
171
- content: '\f058';
172
- color: #ff2d2d;
173
- }
174
-
175
- }
176
-
177
139
  .blank_slate_container {
178
140
  display: none !important;
179
141
  }
@@ -0,0 +1,45 @@
1
+ .wrap_collapse {
2
+
3
+ clear:both;
4
+ background: none !important;
5
+ filter: none !important;
6
+ border: none;
7
+ margin-bottom: 20px;
8
+
9
+ .fa {
10
+ margin-right: 5px;
11
+ color: #FBCB17;
12
+ width: 14px;
13
+ }
14
+
15
+ .btn {
16
+ width: 100%;
17
+ max-width: 100%;
18
+ white-space: normal;
19
+ text-align: left;
20
+ font-weight: bold;
21
+ color: #43474f;
22
+ background-color: transparent;
23
+ outline: 0;
24
+ font-size: 20px !important;
25
+ text-shadow: none !important;
26
+
27
+ }
28
+
29
+ p, ul, ol {
30
+ margin-left: 35px;
31
+ margin-right: 15px;
32
+
33
+ }
34
+
35
+ table {
36
+ margin-top: 20px;
37
+ }
38
+
39
+ }
40
+
41
+ button:not(.disabled):hover {
42
+ background: #f4f4f4;
43
+ filter: none !important;
44
+
45
+ }
@@ -0,0 +1,38 @@
1
+
2
+ span.status_free {
3
+ display: block;
4
+ position: relative;
5
+ padding: 0 0 0 17px;
6
+
7
+ &:after {
8
+ display: block;
9
+ position: absolute;
10
+ top:0;
11
+ left:0;
12
+ width: 20px;
13
+ height: 20px;
14
+ font-family: FontAwesome;
15
+ content: '\f059';
16
+ color: #51e471;
17
+ }
18
+
19
+ }
20
+
21
+ span.status_busy {
22
+ display: block;
23
+ position: relative;
24
+ padding: 0 0 0 17px;
25
+
26
+ &:after {
27
+ display: block;
28
+ position: absolute;
29
+ top:0;
30
+ left:0;
31
+ width: 20px;
32
+ height: 20px;
33
+ font-family: FontAwesome;
34
+ content: '\f058';
35
+ color: #ff2d2d;
36
+ }
37
+
38
+ }
@@ -55,6 +55,20 @@ div#div_main_show_area {
55
55
 
56
56
  li {
57
57
 
58
+ > a {
59
+ text-decoration: none !important;
60
+ color: #6f6c79 !important;
61
+ display: inline !important;
62
+ border: none !important;
63
+ font-size: 16px !important;
64
+ font-weight: bold;
65
+ margin: 0 !important;
66
+ float: none !important;
67
+ &:hover {
68
+ text-decoration: underline !important;
69
+ }
70
+ }
71
+
58
72
  abbr {
59
73
  font-size: 16px;
60
74
  }
@@ -13,9 +13,13 @@ module C80Estate
13
13
  # result += "<li><span class='ptitle bold'>#{title}</span>: <span class='pvalue'>#{value}</span> <span class='puom'>#{uom}</span></li>"
14
14
  # end
15
15
 
16
- result += "<li><span class='ptitle bold'>Объект недвижимости</span>: <span class='pvalue'>#{area.property.title}</span></li>"
17
- result += "<li><span class='ptitle bold'>Объём площади</span>: <span class='pvalue'>#{area.square_value}</span> <span class='puom'>м.кв.</span></li>"
18
- result += "<li><span class='ptitle bold'><abbr title='За м.кв. в месяц'>Цена</abbr></span>: <span class='pvalue'>#{area.price_value} </span> <span class='puom'>руб</span></li>"
16
+ result += "<li><span class='ptitle bold'>Объект недвижимости</span>: "
17
+ result += "<a href='/admin/properties/#{area.property.id}'"
18
+ result += "<span class='pvalue'>"
19
+ result += "#{ area.property.title }"
20
+ result += "</a></span></li>"
21
+ # result += "<li><span class='ptitle bold'>Объём площади</span>: <span class='pvalue'>#{area.square_value}</span> <span class='puom'>м.кв.</span></li>"
22
+ # result += "<li><span class='ptitle bold'><abbr title='За м.кв. в месяц'>Цена</abbr></span>: <span class='pvalue'>#{area.price_value} </span> <span class='puom'>руб</span></li>"
19
23
 
20
24
  area.atype.prop_names.each do |atype_propname|
21
25
  title = atype_propname.title
@@ -105,5 +109,68 @@ module C80Estate
105
109
 
106
110
  end
107
111
 
112
+ # для подкатегории strsubcat сформировать список цен, которые выводятся под картинкой
113
+ def smiph_render_price_props(area)
114
+
115
+ result = ""
116
+
117
+ # rows = PriceProp.gget_pprops_for_strsubcat(strsubcat_id)
118
+ # rows.each(:as => :hash) do |row|
119
+
120
+ rows = [
121
+ {
122
+ title: 'Метраж',
123
+ abbr: 'Объем площади',
124
+ value: area.square_value,
125
+ uom: 'м.кв.'
126
+ },
127
+ {
128
+ title: 'Цена',
129
+ abbr: 'За метр квадратный в месяц',
130
+ value: area.price_value,
131
+ uom: 'руб'
132
+ },
133
+ {
134
+ title: 'Цена площади',
135
+ abbr: 'Стоимость всей площади в месяц. Число PxS, где P - цена за м.кв. в месяц, S - метраж площади в м.кв.',
136
+ value: area.power_price_value,
137
+ uom: 'руб'
138
+ }
139
+ ]
140
+ rows.each do |row|
141
+
142
+ title = row[:title]
143
+ value = row[:value]
144
+ abbr = row[:abbr]
145
+ uom = row[:uom]
146
+
147
+ # нормальная цена
148
+ result += '<li>'
149
+ result += "<p class='ptitle medium'><abbr title='#{abbr}'>#{title}</abbr></p>" # Цена за шт | Цена за м²
150
+ result += "<p><span class='pvalue bold'>#{value}<span> <span class='puom'>#{uom}</span></p>" # 1212,80 руб
151
+
152
+ # старая цена
153
+
154
+ # if item_as_hash['is_sale'] == 1
155
+ # if related.present?
156
+ # related_value = item_as_hash['prop_'+related.to_s]
157
+ # if related_value.present?
158
+ # v = related_value.gsub(',', '.')
159
+ # if v.to_f > 0
160
+ # result += "<p class='old'><span class='pvalue bold'>#{related_value}</span> <span class='puom'>#{uom}</span></p>" # 1212,80 руб
161
+ # end
162
+ # end
163
+ # end
164
+ # end
165
+
166
+ result += '</li>'
167
+
168
+ end
169
+
170
+ result = "<ul>#{result}</ul>"
171
+ result.html_safe
172
+
173
+ end
174
+
108
175
  end
109
176
  end
@@ -12,22 +12,26 @@ module C80Estate
12
12
  # result += "<li><span class='ptitle bold'>#{title}</span>: <span class='pvalue'>#{value}</span> <span class='puom'>#{uom}</span></li>"
13
13
  # end
14
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>"
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
+
18
19
  result += "<li><span class='ptitle bold'>Свободно площадей</span>: <span class='pvalue'>#{property.areas.free_areas.count}</span></li>"
19
20
  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>"
21
+ result += "<li><span class='ptitle bold'>Свободно метров</span>: <span class='pvalue'>#{property.areas.free_areas_sq.to_s(:rounded, precision: 2)}</span> <span class='puom'>м.кв.</span></li>"
22
+ result += "<li><span class='ptitle bold'>Занято метров</span>: <span class='pvalue'>#{property.areas.busy_areas_sq.to_s(:rounded, precision: 2)}</span> <span class='puom'>м.кв.</span></li>"
23
+ result += '<li style="opacity:0.0">.</li>'
22
24
  result += "<li><span style='font-weight:bold;'>Площади объекта по типам:</span></li><ul>"
23
25
 
24
26
  Atype.all.each do |atype|
25
- aa = Area.where_atype(atype.id)
27
+ aa = Area.where(:property_id => property.id).where_atype(atype.id)
26
28
  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>"
29
+ if c > 0
30
+ cb = aa.free_areas.count
31
+ result +=
32
+ "<li><span class='ptitle bold'>#{atype.title}</span>: <span class='pvalue'>#{c}</span>
33
+ <abbr title='Свободно'><span class='puom'>(#{cb})</span></abbr></li>"
34
+ end
31
35
  end
32
36
 
33
37
  result = "<ul>#{result}</ul></ul>"
@@ -63,5 +67,109 @@ module C80Estate
63
67
 
64
68
  end
65
69
 
70
+ #
71
+ def ph_render_price_props(property)
72
+
73
+ result = ''
74
+
75
+ # rows = PriceProp.gget_pprops_for_strsubcat(strsubcat_id)
76
+ # rows.each(:as => :hash) do |row|
77
+
78
+ rows = [
79
+ {
80
+ title: 'Метраж',
81
+ abbr: 'Объем площади: сумма по всем площадям объекта',
82
+ value: property.square_value.to_s(:rounded, precision: 2),
83
+ uom: 'м.кв.'
84
+ },
85
+ {
86
+ title: 'Площадей',
87
+ abbr: 'Количество площадей на объекте',
88
+ value: property.areas.count,
89
+ uom: ''
90
+ },
91
+ {
92
+ title: 'Цена объекта',
93
+ abbr: 'Сумма всех цен площадей объекта',
94
+ value: property.power_price_value.to_s(:rounded, precision: 2),
95
+ uom: 'руб'
96
+ }
97
+ ]
98
+ rows.each do |row|
99
+
100
+ title = row[:title]
101
+ value = row[:value]
102
+ abbr = row[:abbr]
103
+ uom = row[:uom]
104
+
105
+ # нормальная цена
106
+ result += '<li>'
107
+ result += "<p class='ptitle medium'><abbr title='#{abbr}'>#{title}</abbr></p>" # Цена за шт | Цена за м²
108
+ result += "<p><span class='pvalue bold'>#{value}<span> <span class='puom'>#{uom}</span></p>" # 1212,80 руб
109
+
110
+ # старая цена
111
+
112
+ # if item_as_hash['is_sale'] == 1
113
+ # if related.present?
114
+ # related_value = item_as_hash['prop_'+related.to_s]
115
+ # if related_value.present?
116
+ # v = related_value.gsub(',', '.')
117
+ # if v.to_f > 0
118
+ # result += "<p class='old'><span class='pvalue bold'>#{related_value}</span> <span class='puom'>#{uom}</span></p>" # 1212,80 руб
119
+ # end
120
+ # end
121
+ # end
122
+ # end
123
+
124
+ result += '</li>'
125
+
126
+ end
127
+
128
+ result = "<ul>#{result}</ul>"
129
+ result.html_safe
130
+
131
+ end
132
+
133
+ #
134
+ def ph_render_areas_table(property)
135
+
136
+ result = '<thead>
137
+ <tr>
138
+ <th class="col col-title"><a href="/admin/areas?order=title_desc">Название</a></th>
139
+ <th class="col col-atype">Тип</th>
140
+ <th class="col col-abbr_title_abbr"><abbr title="За м.кв. в месяц">Цена м.кв.</abbr></th>
141
+ <th class="col"><abbr title="Стоимость всей площади в месяц. Число PxS, где P - цена за м.кв. в месяц, S - метраж площади в м.кв.">Цена площади</abbr></th>
142
+ <th class="col col-">Метраж</th>
143
+ <th class="col col-astatuses">Статус</th>
144
+ <th class="col col-assigned_person">Ответственный</th>
145
+ <th class="col"></th>
146
+ </tr>
147
+ </thead>'
148
+
149
+ result += '<tbody>'
150
+ property.areas.all.each_with_index do |area,index|
151
+ klass = 'odd'
152
+ if index%2 == 0
153
+ klass = 'even'
154
+ end
155
+ result += '<tr>'
156
+ result += "<td>#{ link_to area.title, "/admin/areas/#{area.id}", title: I18n.t("active_admin.view") }</td>"
157
+ result += "<td>#{ area.atype_title }</td>"
158
+ result += "<td style='white-space: nowrap;'>#{area.price_value} руб</td>"
159
+ result += "<td style='white-space: nowrap;'>#{area.power_price_value} руб</td>"
160
+ result += "<td style='white-space: nowrap;'>#{area.square_value} м.кв.</td>"
161
+ result += "<td><span class='status_#{area.astatus_tag}'>#{area.astatus_title}</span></td>"
162
+ result += "<td>#{area.property.assigned_person_title}</td>"
163
+ result += '</tr>'
164
+ end
165
+ result += '</tbody>'
166
+
167
+ result = "<table class='sortable index_table index'>#{result}</table>"
168
+ result += "<div class='table_footer'>"
169
+ result += "<span>Количество: #{ property.areas.all.count }</span>"
170
+ result += '</div>'
171
+ result.html_safe
172
+ end
173
+
66
174
  end
67
175
  end
@@ -108,6 +108,12 @@ module C80Estate
108
108
  .where(c80_estate_item_props: {value: v})
109
109
  end
110
110
 
111
+ def self.where_assigned_person_id(id)
112
+ # Rails.logger.debug "\t\t [2]: v = #{v}"
113
+ C80Estate::Area.joins(:property)
114
+ .where(:c80_estate_properties => {assigned_person_id: id})
115
+ end
116
+
111
117
  def self.import_excel(file)
112
118
 
113
119
  Rails.logger.debug "------------------------------------------------------------- self.import [BEGIN] "
@@ -289,6 +295,14 @@ module C80Estate
289
295
  parent.table[:id]
290
296
  end
291
297
 
298
+ ransacker :assigned_person_id,
299
+ formatter: proc { |v|
300
+ results = C80Estate::Area.where_assigned_person_id(v).map(&:id)
301
+ results = results.present? ? results : nil
302
+ }, splat_params: true do |parent|
303
+ parent.table[:id]
304
+ end
305
+
292
306
  ransacker :item_prop_oenter,
293
307
  formatter: proc { |option|
294
308
  # Неважно: -1
@@ -48,6 +48,10 @@ module C80Estate
48
48
  roles << r
49
49
  end
50
50
 
51
+ def assigned_areas_count
52
+ assigned_properties.areas_count
53
+ end
54
+
51
55
  def can_view_statistics?
52
56
  r1 = roles.where(role_type: 1)
53
57
  r2 = roles.where(role_type: 2)
@@ -21,6 +21,15 @@ module C80Estate
21
21
  has_many :sevents, :dependent => :destroy
22
22
  has_many :pstats, :dependent => :destroy
23
23
 
24
+ # этот метод для ActiveRecordCollection of Properties
25
+ def self.areas_count
26
+ ac = 0
27
+ self.all.each do |prop|
28
+ ac += prop.areas.count
29
+ end
30
+ ac
31
+ end
32
+
24
33
  def assigned_person_title
25
34
  res = "-"
26
35
  if assigned_person.present?
@@ -1,3 +1,4 @@
1
1
  var $cc = $("#ajax_div");
2
2
  var html_str = "<%= j render_table_prop_busy_coef(atype_id: @atype_id) %>";
3
3
  $cc.html(html_str);
4
+ sorttable.makeSortable(document.getElementById('table_properties_coef_busy'));
@@ -1,3 +1,4 @@
1
1
  var $cc = $("#ajax_div2");
2
2
  var html_str = "<%= j render_table_prop_busy_coef_sq(atype_id: @atype_id) %>";
3
3
  $cc.html(html_str);
4
+ sorttable.makeSortable(document.getElementById('table_properties_coef_busy_sq'));
@@ -1,4 +1,4 @@
1
- <table border="0" cellspacing="0" cellpadding="0" id="index_table_sevents" class="index_table index" paginator="true">
1
+ <table border="0" cellspacing="0" cellpadding="0" id="table_properties_coef_busy" class="index_table index sortable" paginator="true">
2
2
  <thead>
3
3
  <tr>
4
4
  <th class="col col-prop">Объект</th>
@@ -1,4 +1,4 @@
1
- <table border="0" cellspacing="0" cellpadding="0" id="index_table_sevents" class="index_table index" paginator="true">
1
+ <table border="0" cellspacing="0" cellpadding="0" id="table_properties_coef_busy_sq" class="sortable index_table index" paginator="true">
2
2
  <thead>
3
3
  <tr>
4
4
  <th class="col col-prop">Объект</th>
@@ -25,8 +25,8 @@
25
25
  <div id="gallery_block" class="hidden"><%= lh_render_gallery4(@vparams[:galleries]) %></div>
26
26
  </div>
27
27
 
28
- <div id="price_info hidden" class="clearfix">
29
- <%# smiph_render_price_props(@item,@sub_cat.id) %>
28
+ <div id="price_info" class="clearfix">
29
+ <%= smiph_render_price_props(@item) %>
30
30
  </div>
31
31
 
32
32
  <div id="div_button_order" class="hidden">
@@ -24,6 +24,10 @@
24
24
  </div>
25
25
  </div>
26
26
 
27
+ <div id="price_info" class="clearfix">
28
+ <%= ph_render_price_props(@item) %>
29
+ </div>
30
+
27
31
  <div id="div_desc">
28
32
  <%= @item.desc.html_safe if @item.desc.present? %>
29
33
  </div>
@@ -33,6 +37,16 @@
33
37
  <%= ph_render_tech_props(@item) %>
34
38
  </div>
35
39
 
40
+ <div id="div_all_areas_table" class="wrap_collapse">
41
+ <button type="button" class="btn" data-toggle="collapse" data-target="#iid">
42
+ <span class="fa fa-chevron-right"></span>
43
+ Площади объекта <%= @item.title %> (<%= @item.areas.count %>)
44
+ </button>
45
+ <div class="collapse" id="iid">
46
+ <%= ph_render_areas_table(@item) %>
47
+ </div>
48
+ </div>
49
+
36
50
  <div id="related_items" class="hidden">
37
51
  <%# smiph_render_related_items(@item) %>
38
52
  </div>
@@ -1,3 +1,3 @@
1
1
  module C80Estate
2
- VERSION = "0.1.0.19"
2
+ VERSION = "0.1.0.20"
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.19
4
+ version: 0.1.0.20
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-29 00:00:00.000000000 Z
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,6 +81,7 @@ files:
81
81
  - app/assets/images/property_default_logo.png
82
82
  - app/assets/images/w227x182px.gif
83
83
  - app/assets/images/w621x377.gif
84
+ - app/assets/javascript/c80_estate/backend/admin/common/collapse.js
84
85
  - app/assets/javascript/c80_estate/backend/admin/shared/areas/_area_show_common.js
85
86
  - app/assets/javascript/c80_estate/backend/admin/shared/areas/area_show.js
86
87
  - app/assets/javascript/c80_estate/backend/admin/shared/areas/gallery3.js
@@ -98,6 +99,7 @@ files:
98
99
  - app/assets/javascript/c80_estate/lib/jalert.js
99
100
  - app/assets/javascript/c80_estate/lib/jquery.canvasjs.min.js
100
101
  - app/assets/javascript/c80_estate/lib/jquery.magnific-popup.js
102
+ - app/assets/javascript/c80_estate/lib/sorttable.js
101
103
  - app/assets/javascript/c80_estate_active_admin.js.coffee
102
104
  - app/assets/stylesheets/c80_estate/backend/admin_areas.scss
103
105
  - app/assets/stylesheets/c80_estate/backend/admin_prop_names.scss
@@ -106,6 +108,8 @@ files:
106
108
  - app/assets/stylesheets/c80_estate/backend/admin_sevents.scss
107
109
  - app/assets/stylesheets/c80_estate/backend/admin_users.scss
108
110
  - app/assets/stylesheets/c80_estate/backend/common.scss
111
+ - app/assets/stylesheets/c80_estate/backend/common/collapse.scss
112
+ - app/assets/stylesheets/c80_estate/backend/common/free_busy.scss
109
113
  - app/assets/stylesheets/c80_estate/backend/common/minor_fix.scss
110
114
  - app/assets/stylesheets/c80_estate/backend/common/panel.scss
111
115
  - app/assets/stylesheets/c80_estate/backend/dashboard/atype_in_list.scss