caboose-rets 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/caboose_rets/admin_media.js +7 -7
- data/app/assets/javascripts/caboose_rets/caboose_rets.js +8 -8
- data/app/controllers/caboose_rets/agents_controller.rb +67 -75
- data/app/controllers/caboose_rets/offices_controller.rb +4 -4
- data/app/controllers/caboose_rets/open_houses_controller.rb +3 -3
- data/app/controllers/caboose_rets/properties_controller.rb +160 -0
- data/app/controllers/caboose_rets/rets_controller.rb +2 -2
- data/app/controllers/caboose_rets/rets_media_controller.rb +13 -13
- data/app/controllers/caboose_rets/saved_properties_controller.rb +35 -35
- data/app/models/caboose_rets/agent.rb +42 -55
- data/app/models/caboose_rets/agent_meta.rb +7 -7
- data/app/models/caboose_rets/media.rb +63 -57
- data/app/models/caboose_rets/office.rb +35 -21
- data/app/models/caboose_rets/open_house.rb +15 -15
- data/app/models/caboose_rets/property.rb +203 -0
- data/app/models/caboose_rets/rets_importer.rb +193 -233
- data/app/models/caboose_rets/rets_importer_bak.rb +77 -77
- data/app/models/caboose_rets/rets_importer_old.rb +625 -0
- data/app/models/caboose_rets/saved_property.rb +4 -4
- data/app/models/caboose_rets/saved_search.rb +36 -33
- data/app/models/caboose_rets/schema.rb +324 -855
- data/app/models/caboose_rets/schema_past.rb +918 -0
- data/app/models/caboose_rets/search_option.rb +6 -6
- data/app/views/caboose/blocks/_layout_rets.html.erb +9 -6
- data/app/views/caboose/blocks/_rets_agent_listings.html.erb +3 -3
- data/app/views/caboose_rets/agents/index.html.erb +23 -40
- data/app/views/caboose_rets/media/admin_property_media.html.erb +2 -2
- data/app/views/caboose_rets/{residential → properties}/_search_form.html.erb +42 -42
- data/app/views/caboose_rets/{residential → properties}/admin_edit.html.erb +7 -7
- data/app/views/caboose_rets/{land → properties}/admin_index.html.erb +11 -11
- data/app/views/caboose_rets/properties/details.html.erb +127 -0
- data/app/views/caboose_rets/{land → properties}/index.html.erb +0 -0
- data/app/views/caboose_rets/{residential/residential_not_exists.html.erb → properties/property_not_exists.html.erb} +4 -5
- data/app/views/caboose_rets/{residential → properties}/test_form.html.erb +1 -1
- data/app/views/caboose_rets/rets/admin_import_form.html.erb +1 -1
- data/config/routes.rb +70 -55
- data/lib/caboose-rets.rb +1 -1
- data/lib/caboose_rets/engine.rb +3 -3
- data/lib/caboose_rets/version.rb +1 -1
- data/lib/rets/base/core.rb +1 -1
- data/lib/rets/base/sax_search.rb +1 -1
- data/lib/tasks/caboose_rets.rake +106 -17
- metadata +16 -50
- data/app/controllers/caboose_rets/commercial_controller.rb +0 -349
- data/app/controllers/caboose_rets/land_controller.rb +0 -144
- data/app/controllers/caboose_rets/multi_family_controller.rb +0 -107
- data/app/controllers/caboose_rets/residential_controller.rb +0 -163
- data/app/models/caboose_rets/commercial_property.rb +0 -214
- data/app/models/caboose_rets/land_property.rb +0 -144
- data/app/models/caboose_rets/multi_family_property.rb +0 -199
- data/app/models/caboose_rets/residential_property.rb +0 -236
- data/app/views/caboose/blocks/_rets_commercial_details.html.erb +0 -192
- data/app/views/caboose/blocks/_rets_commercial_headers.html.erb +0 -17
- data/app/views/caboose/blocks/_rets_commercial_index.html.erb +0 -71
- data/app/views/caboose/blocks/_rets_commercial_row.html.erb +0 -39
- data/app/views/caboose/blocks/_rets_commercial_search_form.html.erb +0 -201
- data/app/views/caboose/blocks/_rets_land_details.html.erb +0 -165
- data/app/views/caboose/blocks/_rets_land_index.html.erb +0 -63
- data/app/views/caboose/blocks/_rets_land_row.html.erb +0 -58
- data/app/views/caboose/blocks/_rets_land_search_form.html.erb +0 -194
- data/app/views/caboose/blocks/_rets_multifamily_details.html.erb +0 -161
- data/app/views/caboose/blocks/_rets_multifamily_index.html.erb +0 -63
- data/app/views/caboose/blocks/_rets_multifamily_row.html.erb +0 -56
- data/app/views/caboose/blocks/_rets_multifamily_search_form.html.erb +0 -273
- data/app/views/caboose/blocks/_rets_openhouse_details.html.erb +0 -12
- data/app/views/caboose/blocks/_rets_openhouses_index.html.erb +0 -79
- data/app/views/caboose/blocks/_rets_residential_details.html.erb +0 -243
- data/app/views/caboose/blocks/_rets_residential_index.html.erb +0 -65
- data/app/views/caboose/blocks/_rets_residential_row.html.erb +0 -59
- data/app/views/caboose/blocks/_rets_residential_search_form.html.erb +0 -304
- data/app/views/caboose_rets/commercial/admin_edit.html.erb +0 -269
- data/app/views/caboose_rets/commercial/admin_index.html.erb +0 -51
- data/app/views/caboose_rets/commercial/admin_new.html.erb +0 -57
- data/app/views/caboose_rets/commercial/details.html.erb +0 -0
- data/app/views/caboose_rets/commercial/index.html.erb +0 -87
- data/app/views/caboose_rets/land/admin_edit.html.erb +0 -156
- data/app/views/caboose_rets/land/details.html.erb +0 -0
- data/app/views/caboose_rets/multi_family/admin_edit.html.erb +0 -211
- data/app/views/caboose_rets/multi_family/admin_index.html.erb +0 -46
- data/app/views/caboose_rets/residential/admin_index.html.erb +0 -46
- data/app/views/caboose_rets/residential/details.html.erb +0 -0
- data/app/views/caboose_rets/residential/index.html.erb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d7f0af5009de721e3eeccd3950f7b190e430b9e
|
4
|
+
data.tar.gz: ee72a1ce4b2f82a4efc9b183a51154aae960e0d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5f12dbd2fcd814f89db2d3515a13c53e611f1149dcb30debe8975fa8b3765953bf917471ff99b6490256da22270412bdc11f6ee2851916d0ec32aa229e030c
|
7
|
+
data.tar.gz: c4001da2f08953647d8aa3e8aadefdb791f6e24253166ca089d1b573d2fd7d9f31b797390b250fef17ddd5475e9a4f8f5325a5b433afaf600ed62559df3276b9
|
@@ -5,7 +5,7 @@ MediaController.prototype = {
|
|
5
5
|
|
6
6
|
cdn_domain: false,
|
7
7
|
s3_domain: false,
|
8
|
-
|
8
|
+
mls: false,
|
9
9
|
|
10
10
|
s3_url: function(url)
|
11
11
|
{
|
@@ -34,7 +34,7 @@ MediaController.prototype = {
|
|
34
34
|
handle: '.sort_handle',
|
35
35
|
update: function(e, ui) {
|
36
36
|
$.ajax({
|
37
|
-
url: '/admin/properties/' + that.
|
37
|
+
url: '/admin/properties/' + that.mls + '/media/order',
|
38
38
|
type: 'put',
|
39
39
|
data: $('#images').sortable('serialize', { key: 'sort[]' }),
|
40
40
|
success: function(resp) {}
|
@@ -51,7 +51,7 @@ MediaController.prototype = {
|
|
51
51
|
handle: '.sort_handle',
|
52
52
|
update: function(e, ui) {
|
53
53
|
$.ajax({
|
54
|
-
url: '/admin/properties/' + that.
|
54
|
+
url: '/admin/properties/' + that.mls + '/media/order',
|
55
55
|
type: 'put',
|
56
56
|
data: $('#files').sortable('serialize', { key: 'sort[]' }),
|
57
57
|
success: function(resp) {}
|
@@ -116,7 +116,7 @@ MediaController.prototype = {
|
|
116
116
|
$('#images').empty().append($('<p/>').addClass('loading').html('Getting images...'));
|
117
117
|
var that = this;
|
118
118
|
$.ajax({
|
119
|
-
url: '/admin/properties/' + this.
|
119
|
+
url: '/admin/properties/' + this.mls + '/photos',
|
120
120
|
success: function(media) {
|
121
121
|
$('#images').empty();
|
122
122
|
$(media).each(function(i,m) {
|
@@ -150,7 +150,7 @@ MediaController.prototype = {
|
|
150
150
|
$('#files').empty().append($('<p/>').addClass('loading').html('Getting files...'));
|
151
151
|
var that = this;
|
152
152
|
$.ajax({
|
153
|
-
url: '/admin/properties/' + this.
|
153
|
+
url: '/admin/properties/' + this.mls + '/files',
|
154
154
|
success: function(media) {
|
155
155
|
$('#files').empty();
|
156
156
|
if (!media || media.length == 0)
|
@@ -186,7 +186,7 @@ MediaController.prototype = {
|
|
186
186
|
var that = this;
|
187
187
|
var form = $('<form/>')
|
188
188
|
.attr('id', 'new_image_form')
|
189
|
-
.attr('action', '/admin/properties/' + this.
|
189
|
+
.attr('action', '/admin/properties/' + this.mls +'/photos')
|
190
190
|
.attr('method', 'post')
|
191
191
|
.attr('target', 'image_upload_iframe')
|
192
192
|
.attr('enctype', 'multipart/form-data')
|
@@ -218,7 +218,7 @@ MediaController.prototype = {
|
|
218
218
|
var that = this;
|
219
219
|
var form = $('<form/>')
|
220
220
|
.attr('id', 'new_file_form')
|
221
|
-
.attr('action', '/admin/properties/' + this.
|
221
|
+
.attr('action', '/admin/properties/' + this.mls +'/files')
|
222
222
|
.attr('method', 'post')
|
223
223
|
.attr('target', 'file_upload_iframe')
|
224
224
|
.attr('enctype', 'multipart/form-data')
|
@@ -19,10 +19,10 @@ CabooseRets.save_search = function(uri, property_type, params)
|
|
19
19
|
});
|
20
20
|
};
|
21
21
|
|
22
|
-
CabooseRets.get_save_property = function(
|
22
|
+
CabooseRets.get_save_property = function(mls, el)
|
23
23
|
{
|
24
24
|
$.ajax({
|
25
|
-
url: '/saved-properties/' +
|
25
|
+
url: '/saved-properties/' + mls + '/status',
|
26
26
|
type: 'get',
|
27
27
|
success: function(resp) {
|
28
28
|
if (resp.saved == true) el.html("<span style='color: #e5cd58; font-size: 2em;'>★</span> Saved");
|
@@ -31,10 +31,10 @@ CabooseRets.get_save_property = function(mls_acct, el)
|
|
31
31
|
});
|
32
32
|
}
|
33
33
|
|
34
|
-
CabooseRets.toggle_save_property = function(
|
34
|
+
CabooseRets.toggle_save_property = function(mls, el)
|
35
35
|
{
|
36
36
|
$.ajax({
|
37
|
-
url: '/saved-properties/' +
|
37
|
+
url: '/saved-properties/' + mls + '/toggle',
|
38
38
|
type: 'get',
|
39
39
|
success: function(resp) {
|
40
40
|
if (resp.saved == true) el.html("<span style='color: #e5cd58; font-size: 2em;'>★</span> Saved");
|
@@ -54,13 +54,13 @@ $(document).ready(function() {
|
|
54
54
|
|
55
55
|
$('.toggle_save_property').click(function(e) {
|
56
56
|
e.preventDefault();
|
57
|
-
var
|
58
|
-
CabooseRets.toggle_save_property(
|
57
|
+
var mls = $(e.target).data('mls');
|
58
|
+
CabooseRets.toggle_save_property(mls, $(e.target));
|
59
59
|
});
|
60
60
|
|
61
61
|
$('.toggle_save_property').each(function(i, el) {
|
62
|
-
var
|
63
|
-
CabooseRets.get_save_property(
|
62
|
+
var mls = $(el).data('mls');
|
63
|
+
CabooseRets.get_save_property(mls, $(el));
|
64
64
|
});
|
65
65
|
|
66
66
|
});
|
@@ -1,107 +1,99 @@
|
|
1
1
|
|
2
2
|
module CabooseRets
|
3
|
-
class AgentsController < ApplicationController
|
4
|
-
|
3
|
+
class AgentsController < ApplicationController
|
4
|
+
|
5
5
|
# GET /agents
|
6
6
|
def index
|
7
|
-
@agents = Agent.where("
|
8
|
-
@agent = Agent.where(:
|
7
|
+
@agents = Agent.where("office_mls_id = '46' ").order("last_name, first_name")
|
8
|
+
@agent = Agent.where(:mls_id => '048540000').first
|
9
9
|
@assistants = Agent.where(:assistant_to => '048540000').order("last_name, first_name")
|
10
10
|
end
|
11
|
-
|
12
|
-
# GET /agents/:
|
11
|
+
|
12
|
+
# GET /agents/:mls_id
|
13
13
|
def details
|
14
|
-
|
15
|
-
@agents = Agent.where("
|
16
|
-
@agent = Agent.where(:
|
17
|
-
@assistants = Agent.where(:assistant_to => la_code).order("last_name, first_name")
|
18
|
-
@next = Agent.where("\'
|
19
|
-
@prev = Agent.where("\'
|
14
|
+
mls_id = params[:mls_id]
|
15
|
+
@agents = Agent.where("mls_id = '46'").order("last_name, first_name")
|
16
|
+
@agent = Agent.where(:mls_id => mls_id).first || Agent.where(:mls_id => '048540000').first
|
17
|
+
# @assistants = Agent.where(:assistant_to => la_code).order("last_name, first_name")
|
18
|
+
@next = Agent.where("\'mls_id\' > \'#{mls_id}\' AND \'mls_id\' <> \'048540000\' AND \'office_mls_id\' = \'46\'").order("last_name, first_name").first
|
19
|
+
@prev = Agent.where("\'mls_id\' < \'#{mls_id}\' AND \'mls_id\' <> \'048540000\' AND \'office_mls_id\' = \'46\'").order("last_name, first_name").first
|
20
20
|
end
|
21
|
-
|
22
|
-
# GET /agents/:
|
21
|
+
|
22
|
+
# GET /agents/:mls_id/listings
|
23
23
|
def listings
|
24
|
-
@agent = Agent.where(:
|
25
|
-
is_agents = "
|
26
|
-
is_coagents = "co_la_code = ? AND status = 'Active'"
|
27
|
-
|
28
|
-
|
29
|
-
residential_properties +=
|
30
|
-
|
31
|
-
commercial_properties = CommercialProperty.where(is_agents, params[:la_code])
|
32
|
-
commercial_properties += CommercialProperty.where(is_coagents, params[:la_code]).select{ |p| defined? p && p.mls_acct }
|
33
|
-
|
34
|
-
land_properties = LandProperty.where(is_agents, params[:la_code])
|
35
|
-
land_properties += LandProperty.where(is_coagents, params[:la_code]).select{ |p| defined? p && p.mls_acct }
|
36
|
-
|
24
|
+
@agent = Agent.where(:mls_id => params[:mls_id]).first
|
25
|
+
is_agents = "mls_id = ? AND status = 'Active'"
|
26
|
+
# is_coagents = "co_la_code = ? AND status = 'Active'"
|
27
|
+
|
28
|
+
properties = Property.where(is_agents, params[:mls_id])
|
29
|
+
# residential_properties += Property.where(is_coagents, params[:mls_id]).select{ |p| defined? p && p.mls_acct }
|
30
|
+
|
37
31
|
@property_groups = [
|
38
|
-
{ type: '
|
39
|
-
|
40
|
-
{ type: 'LND' , title: 'Land Listings' , url_prefix: 'land' , properties: land_properties },
|
41
|
-
]
|
32
|
+
{ type: 'Listing' , title: 'Property Listings' , url_prefix: 'properties' , properties: properties }
|
33
|
+
]
|
42
34
|
end
|
43
|
-
|
35
|
+
|
44
36
|
#=============================================================================
|
45
37
|
# Admin functions
|
46
38
|
#=============================================================================
|
47
|
-
|
39
|
+
|
48
40
|
# GET /admin/agents
|
49
41
|
def admin_index
|
50
42
|
return if !user_is_allowed('agents', 'view')
|
51
|
-
|
43
|
+
|
52
44
|
@gen = Caboose::PageBarGenerator.new(params, {
|
53
|
-
'
|
54
|
-
'
|
45
|
+
'office_mls_id' => '',
|
46
|
+
'mls_id' => '',
|
55
47
|
'first_name_like' => '',
|
56
|
-
|
48
|
+
'last_name_like' => ''
|
57
49
|
},{
|
58
|
-
|
59
|
-
'sort'
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
'model' => 'CabooseRets::Agent',
|
51
|
+
'sort' => 'last_name, first_name',
|
52
|
+
'desc' => false,
|
53
|
+
'base_url' => '/admin/agents',
|
54
|
+
'use_url_params' => false
|
63
55
|
})
|
64
|
-
@agents = @gen.items
|
56
|
+
@agents = @gen.items
|
65
57
|
render :layout => 'caboose/admin'
|
66
58
|
end
|
67
|
-
|
59
|
+
|
68
60
|
# GET /admin/agents/:id/edit
|
69
61
|
def admin_edit
|
70
|
-
return if !user_is_allowed('agents', 'edit')
|
62
|
+
return if !user_is_allowed('agents', 'edit')
|
71
63
|
@agent = Agent.find(params[:id])
|
72
|
-
@boss = @agent.assistant_to.nil? || @agent.assistant_to.strip.length == 0 ? nil : Agent.where(:
|
64
|
+
@boss = @agent.assistant_to.nil? || @agent.assistant_to.strip.length == 0 ? nil : Agent.where(:mls_id => @agent.assistant_to).first
|
73
65
|
render :layout => 'caboose/admin'
|
74
66
|
end
|
75
|
-
|
67
|
+
|
76
68
|
# GET /admin/agents/:id/edit-bio
|
77
69
|
def admin_edit_bio
|
78
|
-
return if !user_is_allowed('agents', 'edit')
|
70
|
+
return if !user_is_allowed('agents', 'edit')
|
79
71
|
@agent = Agent.find(params[:id])
|
80
72
|
render :layout => 'caboose/admin'
|
81
73
|
end
|
82
|
-
|
74
|
+
|
83
75
|
# GET /admin/agents/:id/edit-contact-info
|
84
76
|
def admin_edit_contact_info
|
85
|
-
return if !user_is_allowed('agents', 'edit')
|
77
|
+
return if !user_is_allowed('agents', 'edit')
|
86
78
|
@agent = Agent.find(params[:id])
|
87
79
|
render :layout => 'caboose/admin'
|
88
80
|
end
|
89
|
-
|
81
|
+
|
90
82
|
# GET /admin/agents/:id/edit-mls-info
|
91
|
-
def admin_edit_mls_info
|
92
|
-
return if !user_is_allowed('agents', 'edit')
|
83
|
+
def admin_edit_mls_info
|
84
|
+
return if !user_is_allowed('agents', 'edit')
|
93
85
|
@agent = Agent.find(params[:id])
|
94
86
|
render :layout => 'caboose/admin'
|
95
87
|
end
|
96
|
-
|
88
|
+
|
97
89
|
# POST /admin/agents/:id
|
98
90
|
def admin_update
|
99
91
|
Caboose.log(params)
|
100
92
|
return if !user_is_allowed('agents', 'edit')
|
101
|
-
|
93
|
+
|
102
94
|
resp = Caboose::StdClass.new({'attributes' => {}})
|
103
|
-
agent = Agent.find(params[:id])
|
104
|
-
|
95
|
+
agent = Agent.find(params[:id])
|
96
|
+
|
105
97
|
save = true
|
106
98
|
params.each do |name,value|
|
107
99
|
case name
|
@@ -115,55 +107,55 @@ module CabooseRets
|
|
115
107
|
agent.designation = value
|
116
108
|
when 'assistant_to'
|
117
109
|
agent.assistant_to = value
|
118
|
-
if !value.nil? && value.length > 0 && Agent.exists?(:
|
119
|
-
boss = Agent.where(:
|
110
|
+
if !value.nil? && value.length > 0 && Agent.exists?(:mls_id => value)
|
111
|
+
boss = Agent.where(:mls_id => value).first
|
120
112
|
resp.attributes['assistant_to'] = { 'text' => "#{boss.first_name} #{boss.last_name}" }
|
121
113
|
else
|
122
114
|
resp.attributes['assistant_to'] = { 'text' => "Not an assistant" }
|
123
115
|
end
|
124
|
-
|
125
|
-
|
126
|
-
|
116
|
+
end
|
117
|
+
end
|
118
|
+
resp.success = save && agent.save
|
127
119
|
render :json => resp
|
128
120
|
end
|
129
|
-
|
121
|
+
|
130
122
|
# GET /admin/agents/:id/refresh
|
131
123
|
def admin_refresh
|
132
|
-
agent = Agent.find(params[:id])
|
133
|
-
RetsImporter.import("(LA_LA_CODE=#{agent.
|
124
|
+
agent = Agent.find(params[:id])
|
125
|
+
RetsImporter.import("(LA_LA_CODE=#{agent.mls_id})", 'Agent', 'AGT')
|
134
126
|
RetsImporter.download_agent_images(agent)
|
135
127
|
render :json => Caboose::StdClass.new({ 'success' => "The agent's info has been updated from MLS." })
|
136
128
|
end
|
137
|
-
|
129
|
+
|
138
130
|
# GET /admin/agents/assistant-to-options
|
139
131
|
def admin_assistant_to_options
|
140
132
|
options = [{
|
141
133
|
'value' => '',
|
142
134
|
'text' => '-- Not an assistant --'
|
143
135
|
}]
|
144
|
-
Agent.where(:
|
136
|
+
Agent.where(:office_mls_id => '46').reorder('last_name, first_name').all.each do |a|
|
145
137
|
options << {
|
146
|
-
'value' => a.
|
138
|
+
'value' => a.mls_id,
|
147
139
|
'text' => "#{a.first_name} #{a.last_name}"
|
148
140
|
}
|
149
141
|
end
|
150
|
-
|
142
|
+
render :json => options
|
151
143
|
end
|
152
|
-
|
144
|
+
|
153
145
|
# GET /admin/agents/agent_options
|
154
146
|
def agent_options
|
155
147
|
options = [{
|
156
148
|
'value' => '',
|
157
149
|
'text' => '-- No Agent --'
|
158
150
|
}]
|
159
|
-
Agent.where(:
|
160
|
-
options << {
|
161
|
-
'value' => a.
|
151
|
+
Agent.where(:office_mls_id => '46').reorder('last_name, first_name').all.each do |a|
|
152
|
+
options << {
|
153
|
+
'value' => a.mls_id,
|
162
154
|
'text' => "#{a.first_name} #{a.last_name}"
|
163
155
|
}
|
164
156
|
end
|
165
|
-
render :json => options
|
157
|
+
render :json => options
|
166
158
|
end
|
167
|
-
|
159
|
+
|
168
160
|
end
|
169
161
|
end
|
@@ -11,7 +11,7 @@ module CabooseRets
|
|
11
11
|
return if !user_is_allowed('offices', 'view')
|
12
12
|
|
13
13
|
@gen = Caboose::PageBarGenerator.new(params, {
|
14
|
-
'
|
14
|
+
'lo_mls_id' => '',
|
15
15
|
'lo_name_like' => ''
|
16
16
|
},{
|
17
17
|
'model' => 'CabooseRets::Office',
|
@@ -24,17 +24,17 @@ module CabooseRets
|
|
24
24
|
render :layout => 'caboose/admin'
|
25
25
|
end
|
26
26
|
|
27
|
-
# GET /admin/offices/:
|
27
|
+
# GET /admin/offices/:mls_number/edit
|
28
28
|
def admin_edit
|
29
29
|
return if !user_is_allowed('offices', 'edit')
|
30
30
|
@office = Office.find(params[:id])
|
31
31
|
render :layout => 'caboose/admin'
|
32
32
|
end
|
33
33
|
|
34
|
-
# GET /admin/offices/:
|
34
|
+
# GET /admin/offices/:mls_number/refresh
|
35
35
|
def admin_refresh
|
36
36
|
office = Office.find(params[:id])
|
37
|
-
RetsImporter.import("(
|
37
|
+
RetsImporter.import('Office', "(Matrix_Unique_ID=#{office.matrix_unique_id})")
|
38
38
|
render :json => Caboose::StdClass.new({ 'success' => "The office's info has been updated from MLS." })
|
39
39
|
end
|
40
40
|
|
@@ -8,9 +8,9 @@ module CabooseRets
|
|
8
8
|
@open_houses = OpenHouse.where("open_house_type = 'PUB' and open_house_date >= '#{DateTime.now.strftime("%F")}'").reorder("open_house_date, start_time").all
|
9
9
|
end
|
10
10
|
|
11
|
-
# get /open-houses/:
|
11
|
+
# get /open-houses/:mls_number
|
12
12
|
def details
|
13
|
-
@open_houses = OpenHouse.find(params[:
|
13
|
+
@open_houses = OpenHouse.find(params[:mls_number])
|
14
14
|
end
|
15
15
|
|
16
16
|
# get /admin/open-houses
|
@@ -20,7 +20,7 @@ module CabooseRets
|
|
20
20
|
|
21
21
|
# get /admin/open-houses/refresh
|
22
22
|
def admin_refresh
|
23
|
-
RetsImporter.update_helper('
|
23
|
+
RetsImporter.update_helper('OpenHouse', DateTime.parse(1.month.ago.strftime('%F %T')))
|
24
24
|
resp = Caboose::StdClass.new
|
25
25
|
resp.success = "The open houses have been refreshed successfully."
|
26
26
|
render :json => resp
|
@@ -0,0 +1,160 @@
|
|
1
|
+
|
2
|
+
module CabooseRets
|
3
|
+
class PropertiesController < ApplicationController
|
4
|
+
|
5
|
+
# @route GET /properties/search-options
|
6
|
+
# q=rock quary
|
7
|
+
def search_options
|
8
|
+
count = params[:count_per_name] ? params[:count_per_name] : 10
|
9
|
+
arr = SearchOption.results(params[:q], count)
|
10
|
+
render :json => arr
|
11
|
+
end
|
12
|
+
|
13
|
+
# @route GET /properties
|
14
|
+
def index
|
15
|
+
params[:street_num_like] = params[:street_name_like].tr('A-z', '').tr(' ', '') unless params[:street_name_like].nil?
|
16
|
+
unless params[:street_name_like].nil?
|
17
|
+
params[:street_name_like] = params[:street_name_like].tr('0-9', "")
|
18
|
+
until params[:street_name_like][0] != " " || params[:street_name_like] == ''
|
19
|
+
params[:street_name_like][0] = '' if params[:street_name_like][0].to_i == 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
@pager = Caboose::PageBarGenerator.new(params, {
|
24
|
+
'area' => '',
|
25
|
+
'area_like' => '',
|
26
|
+
'acreage_gte' => '',
|
27
|
+
'acreage_lte' => '',
|
28
|
+
'city' => '',
|
29
|
+
'city_like' => '',
|
30
|
+
'county_or_parish' => '',
|
31
|
+
'county_or_parishy_like' => '',
|
32
|
+
'current_price_gte' => '',
|
33
|
+
'current_price_lte' => '',
|
34
|
+
'bedrooms_gte' => '',
|
35
|
+
'bedrooms_lte' => '',
|
36
|
+
'property_type' => '',
|
37
|
+
'property_subtype' => '',
|
38
|
+
'sqft_total_gte' => '',
|
39
|
+
'sqft_total_gte_lte' => '',
|
40
|
+
'neighborhood' => '',
|
41
|
+
'elementary_school' => '',
|
42
|
+
'middle_school' => '',
|
43
|
+
'high_school' => '',
|
44
|
+
'list_agent_mls_id' => '',
|
45
|
+
'list_office_mls_id' => '',
|
46
|
+
'public_remarks_like' => '',
|
47
|
+
'waterfronts' => '',
|
48
|
+
'waterfronts_not_null' => '',
|
49
|
+
'lot_desc_like' => '',
|
50
|
+
'mls_number' => '',
|
51
|
+
'subdivision' => '',
|
52
|
+
'style' => '',
|
53
|
+
'foreclosure_yn' => '',
|
54
|
+
'address_like' => '',
|
55
|
+
'street_name_like' => '',
|
56
|
+
'street_num_like' => '',
|
57
|
+
'postal_code' => '',
|
58
|
+
'postal_code_like' => '',
|
59
|
+
'status' => 'Active'
|
60
|
+
},{
|
61
|
+
'model' => 'CabooseRets::Property',
|
62
|
+
'sort' => CabooseRets::default_property_sort,
|
63
|
+
'desc' => false,
|
64
|
+
'abbreviations' => {
|
65
|
+
'address_like' => 'street_num_concat_street_name_like'
|
66
|
+
},
|
67
|
+
'skip' => ['status'],
|
68
|
+
'base_url' => '/properties',
|
69
|
+
'items_per_page' => 10
|
70
|
+
})
|
71
|
+
|
72
|
+
@properties = @pager.items
|
73
|
+
if params[:waterfronts].present? then @properties.reject!{|p| p.waterfronts.blank?} end
|
74
|
+
# if params[:ftr_lotdesc] == 'golf' then @properties.reject!{|p| p.ftr_lotdesc != 'golf'} end
|
75
|
+
if params[:foreclosure_yn] then @properties.reject!{|p| p.foreclosure_yn != "Y"} end
|
76
|
+
|
77
|
+
@saved_search = nil
|
78
|
+
if CabooseRets::SavedSearch.exists?(:uri => request.fullpath)
|
79
|
+
@saved_search = CabooseRets::SavedSearch.where(:uri => request.fullpath).first
|
80
|
+
end
|
81
|
+
|
82
|
+
@block_options = {
|
83
|
+
:properties => @properties,
|
84
|
+
:saved_search => @saved_search,
|
85
|
+
:pager => @pager
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# @route GET /properties/:mls_number/details
|
90
|
+
def details
|
91
|
+
@property = Property.where(:mls_number => params[:mls_number]).first
|
92
|
+
@saved = logged_in? && SavedProperty.where(:user_id => logged_in_user.id, :mls_number => params[:mls_number]).exists?
|
93
|
+
if @property && @property.list_office_code == '46'
|
94
|
+
@agent = Property.where(:la_code => @property.list_agent_mls_id).first
|
95
|
+
end
|
96
|
+
if @property.nil?
|
97
|
+
@mls_number = params[:mls_number]
|
98
|
+
CabooseRets::RetsImporter.delay(:queue => 'rets').import_property(@mls_number.to_i)
|
99
|
+
render 'properties/property_not_exists'
|
100
|
+
return
|
101
|
+
end
|
102
|
+
|
103
|
+
@block_options = {
|
104
|
+
:mls_number => params[:mls_number],
|
105
|
+
:property => @property,
|
106
|
+
:saved => @saved,
|
107
|
+
:agent => @property ? @property.where(:list_agent_mls_id => @property.list_agent_mls_id).first : nil,
|
108
|
+
:form_authenticity_token => form_authenticity_token
|
109
|
+
}
|
110
|
+
|
111
|
+
if @property.nil?
|
112
|
+
@mls = params[:mls]
|
113
|
+
CabooseRets::RetsImporter.delay(:queue => 'rets').import_property(@mls_number.to_i)
|
114
|
+
render 'properties/property_not_exists'
|
115
|
+
return
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
#=============================================================================
|
120
|
+
# Admin actions
|
121
|
+
#=============================================================================
|
122
|
+
|
123
|
+
# @route GET /admin/properties
|
124
|
+
def admin_index
|
125
|
+
return if !user_is_allowed('properties', 'view')
|
126
|
+
|
127
|
+
@gen = Caboose::PageBarGenerator.new(params, {
|
128
|
+
'mls_number' => ''
|
129
|
+
},{
|
130
|
+
'model' => 'CabooseRets::Property',
|
131
|
+
'sort' => 'mls_number',
|
132
|
+
'desc' => false,
|
133
|
+
'base_url' => '/admin/properties',
|
134
|
+
'use_url_params' => false
|
135
|
+
})
|
136
|
+
@properties = @gen.items
|
137
|
+
render :layout => 'caboose/admin'
|
138
|
+
end
|
139
|
+
|
140
|
+
# @route GET /admin/properties/:mls_number/edit
|
141
|
+
def admin_edit
|
142
|
+
return if !user_is_allowed('properties', 'edit')
|
143
|
+
@property = Property.where(:mls => params[:mls_number]).first
|
144
|
+
render :layout => 'caboose/admin'
|
145
|
+
end
|
146
|
+
|
147
|
+
# @route GET /admin/properties/:mls_number/refresh
|
148
|
+
def admin_refresh
|
149
|
+
return if !user_is_allowed('properties', 'edit')
|
150
|
+
|
151
|
+
p = Property.find(params[:mls_number])
|
152
|
+
p.delay(:queue => 'rets').refresh_from_mls
|
153
|
+
|
154
|
+
resp = Caboose::StdClass.new
|
155
|
+
resp.success = "The property's info is being updated from MLS. This may take a few minutes depending on how many images it has."
|
156
|
+
render :json => resp
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
160
|
+
end
|