| 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 |
echo '<div style="background:#F3F3F3; border:1px solid #DDD; padding:20px;"> |
| 11 |
|
| 12 |
<h3 style="padding-top:0; margin-top:0;">Applicant Requirements</h3>'; |
| 13 |
if ( |
| 14 |
isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-sales' && |
| 15 |
isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0 |
| 16 |
) |
| 17 |
{ |
| 18 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 19 |
<strong>Maximum Price:</strong><br> |
| 20 |
£' . number_format($applicant_profile['max_price']) . ' |
| 21 |
</div>'; |
| 22 |
} |
| 23 |
if ( |
| 24 |
isset($applicant_profile['department']) && $applicant_profile['department'] == 'residential-lettings' && |
| 25 |
isset($applicant_profile['max_price_actual']) && $applicant_profile['max_price_actual'] != '' && $applicant_profile['max_price_actual'] != 0 |
| 26 |
) |
| 27 |
{ |
| 28 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 29 |
<strong>Maximum Rent:</strong><br> |
| 30 |
£' . number_format($applicant_profile['max_rent']) . ' ' . $applicant_profile['rent_frequency'] . ' |
| 31 |
</div>'; |
| 32 |
} |
| 33 |
if ( |
| 34 |
isset($applicant_profile['department']) && |
| 35 |
( $applicant_profile['department'] == 'residential-sales' || $applicant_profile['department'] == 'residential-lettings' ) |
| 36 |
) |
| 37 |
{ |
| 38 |
if ( isset($applicant_profile['min_beds']) && $applicant_profile['min_beds'] != '' && $applicant_profile['min_beds'] != 0 ) |
| 39 |
{ |
| 40 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 41 |
<strong>Minimum Beds:</strong><br> |
| 42 |
' . $applicant_profile['min_beds'] . ' |
| 43 |
</div>'; |
| 44 |
} |
| 45 |
if ( isset($applicant_profile['property_types']) && is_array($applicant_profile['property_types']) && !empty($applicant_profile['property_types']) ) |
| 46 |
{ |
| 47 |
$terms = get_terms('property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['property_types'])); |
| 48 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 49 |
{ |
| 50 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 51 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 52 |
<strong>Property Types:</strong><br> |
| 53 |
' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ) . ' |
| 54 |
</div>'; |
| 55 |
} |
| 56 |
} |
| 57 |
} |
| 58 |
if ( |
| 59 |
isset($applicant_profile['department']) && |
| 60 |
( $applicant_profile['department'] == 'commercial' ) |
| 61 |
) |
| 62 |
{ |
| 63 |
if ( isset($applicant_profile['available_as']) && is_array($applicant_profile['available_as']) && !empty($applicant_profile['available_as']) ) |
| 64 |
{ |
| 65 |
$available_as = array(); |
| 66 |
if ( in_array('sale', $applicant_profile['available_as']) ) |
| 67 |
{ |
| 68 |
$available_as[] = 'For Sale'; |
| 69 |
} |
| 70 |
if ( in_array('rent', $applicant_profile['available_as']) ) |
| 71 |
{ |
| 72 |
$available_as[] = 'To Rent'; |
| 73 |
} |
| 74 |
|
| 75 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 76 |
<strong>Available As:</strong><br> |
| 77 |
' . implode(", ", $available_as) .' |
| 78 |
</div>'; |
| 79 |
} |
| 80 |
|
| 81 |
if ( isset($applicant_profile['commercial_property_types']) && is_array($applicant_profile['commercial_property_types']) && !empty($applicant_profile['commercial_property_types']) ) |
| 82 |
{ |
| 83 |
$terms = get_terms('commercial_property_type', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['commercial_property_types'])); |
| 84 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 85 |
{ |
| 86 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 87 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 88 |
<strong>Property Types:</strong><br> |
| 89 |
' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? '<span title="' . addslashes( implode(", ", $terms) ) .'"> + ' . (count($terms) - 2) . ' more</span>' : '' ) . ' |
| 90 |
</div>'; |
| 91 |
} |
| 92 |
} |
| 93 |
} |
| 94 |
if ( isset($applicant_profile['locations']) && is_array($applicant_profile['locations']) && !empty($applicant_profile['locations']) ) |
| 95 |
{ |
| 96 |
$terms = get_terms('location', array('hide_empty' => false, 'fields' => 'names', 'include' => $applicant_profile['locations'])); |
| 97 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) |
| 98 |
{ |
| 99 |
$sliced_terms = array_slice( $terms, 0, 2 ); |
| 100 |
echo '<div style="display:inline-block; width:23%; margin-right:2%; vertical-align:top"> |
| 101 |
<strong>Locations:</strong><br> |
| 102 |
' . implode(", ", $sliced_terms) . ( (count($terms) > 2) ? ' <span title="' . addslashes( implode(", ", $terms) ) .'">+ ' . (count($terms) - 2) . ' more</span>' : '' ) . ' |
| 103 |
</div>'; |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
if ( isset($applicant_profile['notes']) && $applicant_profile['notes'] != '' ) |
| 108 |
{ |
| 109 |
echo '<div style="display:inline-block; width:100%; vertical-align:top; margin-top:15px;"> |
| 110 |
<strong>Additional Requirement Notes:</strong><br> |
| 111 |
' . strip_tags( $applicant_profile['notes'] ) . ' |
| 112 |
</div>'; |
| 113 |
} |
| 114 |
|
| 115 |
echo '</div>'; |
| 116 |
?> |
| 117 |
|
| 118 |
<?php |
| 119 |
if ( !empty($properties) ) |
| 120 |
{ |
| 121 |
foreach ( $properties as $property ) |
| 122 |
{ |
| 123 |
$previously_sent = array(); |
| 124 |
if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) ) |
| 125 |
{ |
| 126 |
$previously_sent = $applicant_profile_match_history[$property->id]; |
| 127 |
} |
| 128 |
|
| 129 |
echo '<div id="matching_applicant_' . $contact_id . '_property_' . $property->id . '" style="padding:20px 0; border-bottom:1px solid #CCC;">'; |
| 130 |
|
| 131 |
echo '<div style="float:left; width:18%;"><a href="' . get_edit_post_link( $property->id ) . '" target="_blank"><img src="' . $property->get_main_photo_src() . '" style="max-width:100%; margin:0 auto; display:block;" alt="' . addslashes($property->get_formatted_summary_address()) . '"></a></div>'; |
| 132 |
|
| 133 |
echo '<div style="float:right; width:80%;">'; |
| 134 |
|
| 135 |
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>'; |
| 136 |
|
| 137 |
echo '<div style="margin-bottom:7px; font-size:15px;"> |
| 138 |
<strong>' . ( ($property->_department == 'residential-lettings') ? __('Rent', 'propertyhive') : __('Price', 'propertyhive') ) . ': ' . $property->price_qualifier . ' ' . $property->get_formatted_price() . '</strong> |
| 139 |
| '; |
| 140 |
if ($property->department != 'commercial') |
| 141 |
{ |
| 142 |
echo $property->bedrooms . ' bed | '; |
| 143 |
} |
| 144 |
else |
| 145 |
{ |
| 146 |
$floor_area = $property->get_formatted_floor_area(); |
| 147 |
if ( $floor_area != '' ) |
| 148 |
{ |
| 149 |
echo $floor_area . ' | '; |
| 150 |
} |
| 151 |
} |
| 152 |
$property_type = $property->get_property_type(); |
| 153 |
if ( $property_type != '' ) |
| 154 |
{ |
| 155 |
echo $property_type . ' | '; |
| 156 |
} |
| 157 |
echo ' ' . $property->get_availability() . ' |
| 158 |
</div>'; |
| 159 |
|
| 160 |
echo '<div style="margin-bottom:7px;">' . strip_tags(get_the_excerpt()) . '</div>'; |
| 161 |
|
| 162 |
echo '<div style="background:#F8F8F8; padding:12px 11px; line-height:1.7em; border:1px solid #DDD; font-weight:700"> |
| 163 |
|
| 164 |
<label><input type="checkbox" name="email_property_id[]" value="' . $property->id . '" '; |
| 165 |
|
| 166 |
$post_tip = ''; |
| 167 |
if ( strpos($email_address, '@') === FALSE ) |
| 168 |
{ |
| 169 |
echo ' disabled title="Invalid email address: ' . $email_address . '"'; |
| 170 |
$post_tip = 'Invalid email address: ' . $email_address; |
| 171 |
} |
| 172 |
elseif ( $do_not_email ) |
| 173 |
{ |
| 174 |
echo ' disabled title="Contact via email not permitted - Set under contact details"'; |
| 175 |
$post_tip = 'Contact via email not permitted - Set under contact details'; |
| 176 |
} |
| 177 |
else |
| 178 |
{ |
| 179 |
if ( !empty($previously_sent) ) |
| 180 |
{ |
| 181 |
$post_tip = 'Sent previously on ' . date("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date'])); |
| 182 |
} |
| 183 |
else |
| 184 |
{ |
| 185 |
echo ' checked'; |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label> |
| 190 |
|
| 191 |
<br> |
| 192 |
|
| 193 |
<label><input type="checkbox" name="not_interested_property_id[]" value="' . $property->id . '"> Property Not Suitable</label> |
| 194 |
|
| 195 |
</div>'; |
| 196 |
|
| 197 |
echo '</div>'; |
| 198 |
|
| 199 |
echo '<div style="clear:both"></div>'; |
| 200 |
|
| 201 |
echo '</div>'; |
| 202 |
} |
| 203 |
} |
| 204 |
?> |
| 205 |
|
| 206 |
<p class="submit"> |
| 207 |
|
| 208 |
<input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" /> |
| 209 |
|
| 210 |
<a href="<?php echo get_edit_post_link($_GET['contact_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a> |
| 211 |
|
| 212 |
<input type="hidden" name="step" value="one" /> |
| 213 |
<?php wp_nonce_field( 'propertyhive-matching-properties' ); ?> |
| 214 |
|
| 215 |
</p> |
| 216 |
|
| 217 |
<p> |
| 218 |
<?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' ); ?> |
| 219 |
</p> |
| 220 |
|
| 221 |
</div> |
| 222 |
|
| 223 |
</form> |
| 224 |
|
| 225 |
</div> |
| 226 |
|
| 227 |
<script> |
| 228 |
|
| 229 |
jQuery('body').on('change', 'input[name=\'not_interested_property_id[]\']', function() |
| 230 |
{ |
| 231 |
var property_id = jQuery(this).val(); |
| 232 |
|
| 233 |
jQuery('input[name=\'email_property_id[]\'][value=\'' + property_id + '\']').attr('checked', false); |
| 234 |
|
| 235 |
opacity = 0.4; |
| 236 |
if ( !jQuery(this).is(':checked') ) |
| 237 |
{ |
| 238 |
opacity = 1; |
| 239 |
} |
| 240 |
jQuery('#matching_applicant_<?php echo $contact_id; ?>_property_' + property_id).animate({ |
| 241 |
opacity: opacity |
| 242 |
}, |
| 243 |
{ |
| 244 |
duration: 250 |
| 245 |
}); |
| 246 |
|
| 247 |
return false; |
| 248 |
}); |
| 249 |
|
| 250 |
</script> |