PluginProbe
Property Hive / 1.4.59
Property Hive v1.4.59
2.3.1 2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 All 261 releases
propertyhive / includes / admin / views / html-admin-matching-properties.php

html-admin-matching-properties.php in Property Hive 1.4.59, at includes/admin/views/html-admin-matching-properties.php

387 lines 19.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <div class="wrap propertyhive">
2
3 <h1>Matching Properties For <?php echo get_the_title($contact_id); ?> (<?php echo count($properties); ?>)</h1>
4
5 <form method="post" id="mainform" action="" enctype="multipart/form-data">
6
7 <div id="poststuff">
8
9 <?php
10 $percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' );
11 $percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' );
12
13 echo '<div style="background:#F3F3F3; border:1px solid #DDD; padding:20px;">
14
15 <h3 style="padding-top:0; margin-top:0;">Applicant Requirements</h3>';
16
17 $requirements = array();
18
19 if (
20 isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-sales' &&
21 isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0
22 )
23 {
24 $requirements[] = array(
25 'label' => __( 'Maximum Price', 'propertyhive' ),
26 'value' => '&pound;' . number_format($applicant_profile['max_price']),
27 );
28 }
29 if (
30 isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-sales'
31 )
32 {
33 if ( $percentage_lower != '' && $percentage_higher != '' )
34 {
35 $match_price_range_lower = '';
36 if ( !isset($applicant_profile['match_price_range_lower_actual']) || ( isset($applicant_profile['match_price_range_lower_actual']) && $applicant_profile['match_price_range_lower_actual'] == '' ) )
37 {
38 if ( isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' )
39 {
40 $match_price_range_lower = $applicant_profile['max_price_actual'] - ( $applicant_profile['max_price_actual'] * ( $percentage_lower / 100 ) );
41 }
42 }
43 else
44 {
45 $match_price_range_lower = $applicant_profile['match_price_range_lower_actual'];
46 }
47
48 $match_price_range_higher = '';
49 if ( !isset($applicant_profile['match_price_range_higher_actual']) || ( isset($applicant_profile['match_price_range_higher_actual']) && $applicant_profile['match_price_range_higher_actual'] == '' ) )
50 {
51 if ( isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' )
52 {
53 $match_price_range_higher = $applicant_profile['max_price_actual'] + ( $applicant_profile['max_price_actual'] * ( $percentage_higher / 100 ) );
54 }
55 }
56 else
57 {
58 $match_price_range_higher = $applicant_profile['match_price_range_higher_actual'];
59 }
60
61 if (
62 $match_price_range_lower != '' && $match_price_range_higher != ''
63 )
64 {
65 $requirements[] = array(
66 'label' => __( 'Match Price Range', 'propertyhive' ),
67 'value' => '&pound;' . number_format($match_price_range_lower) . ' to &pound;' . number_format($match_price_range_higher),
68 );
69 }
70 }
71 }
72 if (
73 isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-lettings' &&
74 isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0
75 )
76 {
77 $requirements[] = array(
78 'label' => __( 'Maximum Rent', 'propertyhive' ),
79 'value' => '&pound;' . number_format($applicant_profile['max_rent']) . ' ' . $applicant_profile['rent_frequency'],
80 );
81 }
82 if (
83 isset($applicant_profile['department']) &&
84 ( $applicant_profile['department'] == 'residential-sales' || $applicant_profile['department'] == 'residential-lettings' )
85 )
86 {
87 if ( isset($applicant_profile['min_beds']) && $applicant_profile['min_beds'] != '' && $applicant_profile['min_beds'] != 0 )
88 {
89 $requirements[] = array(
90 'label' => __( 'Minimum Beds', 'propertyhive' ),
91 'value' => $applicant_profile['min_beds'],
92 );
93 }
94 if ( isset($applicant_profile['property_types']) && is_array($applicant_profile['property_types']) && !empty($applicant_profile['property_types']) )
95 {
96 $terms = get_terms('property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['property_types']));
97 if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
98 {
99 $sliced_terms = array_slice( $terms, 0, 2 );
100
101 $requirements[] = array(
102 'label' => __( 'Property Types', 'propertyhive' ),
103 'value' => implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ),
104 );
105 }
106 }
107 }
108 if (
109 isset($applicant_profile['department']) &&
110 ( $applicant_profile['department'] == 'commercial' )
111 )
112 {
113 if ( isset($applicant_profile['available_as']) && is_array($applicant_profile['available_as']) && !empty($applicant_profile['available_as']) )
114 {
115 $available_as = array();
116 if ( in_array('sale', $applicant_profile['available_as']) )
117 {
118 $available_as[] = 'For Sale';
119 }
120 if ( in_array('rent', $applicant_profile['available_as']) )
121 {
122 $available_as[] = 'To Rent';
123 }
124
125 $requirements[] = array(
126 'label' => __( 'Available As', 'propertyhive' ),
127 'value' => implode(", ", $available_as),
128 );
129 }
130
131 if (
132 (isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '')
133 ||
134 (isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '')
135 )
136 {
137 $sizes = array('min' => '', 'max' => '');
138 $value = '';
139 if ( isset($applicant_profile['min_floor_area_actual']) && $applicant_profile['min_floor_area_actual'] != '' )
140 {
141 $sizes['min'] = $applicant_profile['min_floor_area_actual'];
142 }
143 if ( isset($applicant_profile['max_floor_area_actual']) && $applicant_profile['max_floor_area_actual'] != '' )
144 {
145 $sizes['max'] = $applicant_profile['max_floor_area_actual'];
146 }
147 if ( $sizes['min'] != '' && $sizes['max'] != '' )
148 {
149 $value = number_format($sizes['min']) . ' - ' . number_format($sizes['max']) . ' Sq Ft';
150 }
151 if ( $sizes['min'] != '' && $sizes['max'] == '' )
152 {
153 $value = 'From ' . number_format($sizes['min']) . ' Sq Ft';
154 }
155 if ( $sizes['min'] == '' && $sizes['max'] != '' )
156 {
157 $value = 'Up To ' . number_format($sizes['max']) . ' Sq Ft';
158 }
159
160 if ( $value != '' )
161 {
162 $requirements[] = array(
163 'label' => __( 'Floor Area', 'propertyhive' ),
164 'value' => $value,
165 );
166 }
167 }
168
169 if ( isset($applicant_profile['commercial_property_types']) && is_array($applicant_profile['commercial_property_types']) && !empty($applicant_profile['commercial_property_types']) )
170 {
171 $terms = get_terms('commercial_property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['commercial_property_types']));
172 if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
173 {
174 $sliced_terms = array_slice( $terms, 0, 2 );
175
176 $requirements[] = array(
177 'label' => __( 'Property Types', 'propertyhive' ),
178 'value' => implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ),
179 );
180 }
181 }
182 }
183 if ( isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) )
184 {
185 $terms = get_terms('location', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['locations']));
186 if ( ! empty( $terms ) && ! is_wp_error( $terms ) )
187 {
188 $sliced_terms = array_slice( $terms, 0, 2 );
189
190 $requirements[] = array(
191 'label' => __( 'Locations', 'propertyhive' ),
192 'value' => implode(", ", $sliced_terms) . ( (count($terms) > 2) ? ' <span title="' . addslashes( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ),
193 );
194
195 /*echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
196 <strong>Locations:</strong><br>
197 ' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? ' <span title="' . addslashes( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ) . '
198 </div>';*/
199 }
200 }
201
202 $requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $contact_id, $applicant_profile );
203
204 if ( !empty($requirements) )
205 {
206 foreach ( $requirements as $requirement )
207 {
208 echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top">
209 <strong>' . $requirement['label'] . ':</strong><br>
210 ' . $requirement['value'] . '
211 </div>';
212 }
213 }
214
215 if ( isset($applicant_profile['notes']) && $applicant_profile['notes'] != '' )
216 {
217 echo '<div style="display:inline-block; width:100%; vertical-align:top; margin-top:15px;">
218 <strong>Additional Requirement Notes:</strong><br>
219 ' . nl2br( strip_tags( $applicant_profile['notes'] ) ) . '
220 </div>';
221 }
222
223 echo '</div>';
224 ?>
225
226 <?php
227 if ( !empty($properties) )
228 {
229 foreach ( $properties as $property )
230 {
231 $previously_sent = array();
232 if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) )
233 {
234 $previously_sent = $applicant_profile_match_history[$property->id];
235 }
236
237 $on_market_change_date = $property->_on_market_change_date;
238 $price_change_date = $property->_price_change_date;
239
240 echo '<div id="matching_applicant_' . $contact_id . '_property_' . $property->id . '" style="padding:20px 0; border-bottom:1px solid #CCC;">';
241
242 echo '<div style="float:left; width:18%;">';
243
244 $image_url = $property->get_main_photo_src();
245 if ( $image_url !== FALSE )
246 {
247 echo '<a href="' . get_edit_post_link( $property->id ) . '" target="_blank"><img src="' . $image_url . '" style="max-width:100%; margin:0 auto; display:block;" alt="' . addslashes($property->get_formatted_summary_address()) . '"></a>';
248 }
249
250 echo '</div>';
251
252 echo '<div style="float:right; width:80%;">';
253
254 echo '<h3 style="margin:0; padding:0; margin-bottom:9px;"><a href="' . get_edit_post_link( $property->id ) . '" target="_blank">' . $property->get_formatted_summary_address() . '</a></h3>';
255
256 echo '<div style="margin-bottom:7px; font-size:15px;">
257 <strong>' . ( ($property->_department == 'residential-lettings') ? __('Rent', 'propertyhive') : __('Price', 'propertyhive') ) . ': ' . $property->price_qualifier . ' ' . $property->get_formatted_price() . '</strong>
258 | ';
259 if ($property->department != 'commercial')
260 {
261 echo $property->bedrooms . ' bed | ';
262 }
263 else
264 {
265 $floor_area = $property->get_formatted_floor_area();
266 if ( $floor_area != '' )
267 {
268 echo $floor_area . ' | ';
269 }
270 }
271 $property_type = $property->get_property_type();
272 if ( $property_type != '' )
273 {
274 echo $property_type . ' | ';
275 }
276 echo ' ' . $property->get_availability() . '
277 </div>';
278
279 echo '<div style="margin-bottom:7px;">' . strip_tags(get_the_excerpt($property->id)) . '</div>';
280
281 echo '<div style="background:#F8F8F8; padding:12px 11px; line-height:1.7em; border:1px solid #DDD; font-weight:700">
282
283 <label><input type="checkbox" name="email_property_id[]" value="' . $property->id . '" ';
284
285 $post_tip = '';
286 if ( strpos($email_address, '@') === FALSE )
287 {
288 echo ' disabled title="Invalid email address: ' . $email_address . '"';
289 $post_tip = 'Invalid email address: ' . $email_address;
290 }
291 elseif ( $do_not_email )
292 {
293 echo ' disabled title="Contact via email not permitted - Set under contact details"';
294 $post_tip = 'Contact via email not permitted - Set under contact details';
295 }
296 else
297 {
298 if ( !empty($previously_sent) )
299 {
300 $post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . date("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date']));
301
302 if (
303 $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ||
304 $price_change_date > $previously_sent[count($previously_sent) - 1]['date']
305 )
306 {
307 if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
308 {
309 $post_tip .= ', however a price change occurred on ' . date("jS F Y", strtotime($price_change_date));
310 }
311 elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
312 {
313 $post_tip .= ', however a change to the on market status occurred on ' . date("jS F Y", strtotime($on_market_change_date));
314 }
315 echo ' checked';
316 }
317 }
318 else
319 {
320 echo ' checked';
321 }
322 }
323
324 echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label>
325
326 <br>';
327
328 do_action( 'propertyhive_applicant_match_send_methods', $contact_id, $applicant_profile_id, $property->id );
329
330 echo '<label><input type="checkbox" name="not_interested_property_id[]" value="' . $property->id . '"> Property Not Suitable</label>
331
332 </div>';
333
334 echo '</div>';
335
336 echo '<div style="clear:both"></div>';
337
338 echo '</div>';
339 }
340 }
341 ?>
342
343 <p class="submit">
344
345 <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" />
346
347 <a href="<?php echo get_edit_post_link((int)$_GET['contact_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a>
348
349 <input type="hidden" name="step" value="one" />
350 <?php wp_nonce_field( 'propertyhive-matching-properties' ); ?>
351
352 </p>
353
354 <p>
355 <?php echo __( "If you've opted to email any of the properties you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' ); ?>
356 </p>
357
358 </div>
359
360 </form>
361
362 </div>
363
364 <script>
365
366 jQuery('body').on('change', 'input[name=\'not_interested_property_id[]\']', function()
367 {
368 var property_id = jQuery(this).val();
369
370 jQuery('input[name=\'email_property_id[]\'][value=\'' + property_id + '\']').attr('checked', false);
371
372 opacity = 0.4;
373 if ( !jQuery(this).is(':checked') )
374 {
375 opacity = 1;
376 }
377 jQuery('#matching_applicant_<?php echo $contact_id; ?>_property_' + property_id).animate({
378 opacity: opacity
379 },
380 {
381 duration: 250
382 });
383
384 return false;
385 });
386
387 </script>