PluginProbe
Property Hive / 1.4.62
Property Hive v1.4.62
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-applicants.php

html-admin-matching-applicants.php in Property Hive 1.4.62, at includes/admin/views/html-admin-matching-applicants.php

266 lines 13.7 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 Applicants For <?php echo $property->get_formatted_full_address(); ?> (<?php echo count($applicants); ?>)</h1>
4
5 <form method="post" id="mainform" action="" enctype="multipart/form-data">
6
7 <div id="poststuff">
8
9 <?php
10 if ( !empty($applicants) )
11 {
12 // var_dump($applicants);
13 echo '<table width="100%">';
14
15 $columns = array(
16 'name' => 'Name',
17 'contact_details' => 'Contact Details',
18 'requirements' => 'Requirements'
19 );
20
21 $columns = apply_filters( 'propertyhive_matching_applicants_row_headings', $columns );
22
23 echo '<thead>
24 <tr>';
25 foreach ( $columns as $key => $column )
26 {
27 echo '<th style="text-align:left">' . $column . '</th>';
28 }
29 echo '
30 <th style="text-align:left">Actions</th>
31 </tr>
32 </thead>
33 <tbody>
34 ';
35
36 $percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' );
37 $percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' );
38
39 foreach ( $applicants as $applicant )
40 {
41 $previously_sent = array();
42
43 $applicant_profile_match_history = get_post_meta( $applicant['contact_id'], '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '_match_history', TRUE );
44 if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) )
45 {
46 $previously_sent = $applicant_profile_match_history[$property->id];
47 }
48
49 $email_address = get_post_meta( $applicant['contact_id'], '_email_address', TRUE );
50 $forbidden_contact_methods = get_post_meta( $applicant['contact_id'], '_forbidden_contact_methods', TRUE );
51 $do_not_email = false;
52 if ( is_array($forbidden_contact_methods) && in_array('email', $forbidden_contact_methods) )
53 {
54 $do_not_email = true;
55 }
56
57 $requirements = array();
58 if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
59 {
60 $requirements[] = array(
61 'label' => __( 'Maximum Price', 'propertyhive' ),
62 'value' => '&pound;' . number_format($applicant['applicant_profile']['max_price']),
63 );
64 }
65 if ( $percentage_lower != '' && $percentage_higher != '' )
66 {
67 $match_price_range_lower = '';
68 if ( !isset($applicant['applicant_profile']['match_price_range_lower_actual']) || ( isset($applicant['applicant_profile']['match_price_range_lower_actual']) && $applicant['applicant_profile']['match_price_range_lower_actual'] == '' ) )
69 {
70 if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
71 {
72 $match_price_range_lower = $applicant['applicant_profile']['max_price_actual'] - ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_lower / 100 ) );
73 }
74 }
75 else
76 {
77 $match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower_actual'];
78 }
79
80 $match_price_range_higher = '';
81 if ( !isset($applicant['applicant_profile']['match_price_range_higher_actual']) || ( isset($applicant['applicant_profile']['match_price_range_higher_actual']) && $applicant['applicant_profile']['match_price_range_higher_actual'] == '' ) )
82 {
83 if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
84 {
85 $match_price_range_higher = $applicant['applicant_profile']['max_price_actual'] + ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_higher / 100 ) );
86 }
87 }
88 else
89 {
90 $match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher_actual'];
91 }
92
93 if (
94 $match_price_range_lower != '' && $match_price_range_higher != ''
95 )
96 {
97 $requirements[] = array(
98 'label' => __( 'Maximum Price Range', 'propertyhive' ),
99 'value' => '&pound;' . number_format($match_price_range_lower) . ' to &pound;' . number_format($match_price_range_higher),
100 );
101 }
102 }
103 if ( isset($applicant['applicant_profile']['min_beds']) && $applicant['applicant_profile']['min_beds'] != '' )
104 {
105 $requirements[] = array(
106 'label' => __( 'Minimum Beds', 'propertyhive' ),
107 'value' => $applicant['applicant_profile']['min_beds'],
108 );
109 }
110 if ( isset($applicant['applicant_profile']['property_types']) && is_array($applicant['applicant_profile']['property_types']) && !empty($applicant['applicant_profile']['property_types']) )
111 {
112 //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
113 }
114 if ( isset($applicant['applicant_profile']['locations']) && is_array($applicant['applicant_profile']['locations']) && !empty($applicant['applicant_profile']['locations']) )
115 {
116 //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
117 }
118
119 $requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $applicant['contact_id'], $applicant['applicant_profile'] );
120
121 if ( isset($applicant['applicant_profile']['notes']) && $applicant['applicant_profile']['notes'] != '' )
122 {
123 $requirements[] = array(
124 'label' => __( 'Notes', 'propertyhive' ),
125 'value' => nl2br( strip_tags($applicant['applicant_profile']['notes']) ),
126 );
127 }
128
129 $requirements_output = '';
130 if ( empty($requirements) )
131 {
132 $requirements_output = '-';
133 }
134 else
135 {
136 foreach ( $requirements as $requirement )
137 {
138 $requirements_output .= $requirement['label'] . ': ' . $requirement['value'] . '<br>';
139 }
140 }
141
142 $columns = array(
143 'name' => '<strong><a href="' . get_edit_post_link($applicant['contact_id']) . '" target="_blank">' . get_the_title($applicant['contact_id']) . '</a>' . ( ( isset($applicant['applicant_profile']['grading']) && $applicant['applicant_profile']['grading'] == 'hot' ) ? '<br><span style="color:#C00;">('. __( 'Hot Applicant', 'propertyhive' ) . ')</span>' : '' ) . '</strong>',
144 'contact_details' => 'T: ' . get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE ) . '<br>E: ' . $email_address,
145 'requirements' => $requirements_output,
146 );
147
148 $columns = apply_filters( 'propertyhive_matching_applicants_row_data', $columns, $applicant, $property->id );
149
150 echo '<tr id="matching_contact_' . $applicant['contact_id'] . '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '">';
151 foreach ( $columns as $key => $column )
152 {
153 echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">' . $column . '</td>';
154 }
155 echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">';
156
157 echo '<label><input type="checkbox" name="email_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '" ';
158
159 $post_tip = '';
160 if ( strpos($email_address, '@') === FALSE )
161 {
162 echo ' disabled title="Invalid email address: ' . $email_address . '"';
163 //$post_tip = 'Invalid email address: ' . $email_address;
164 }
165 elseif ( $do_not_email )
166 {
167 echo ' disabled title="Contact via email not permitted - Set under contact details"';
168 //$post_tip = 'Contact via email not permitted - Set under contact details';
169 }
170 else
171 {
172 if ( !empty($previously_sent) )
173 {
174 $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']));
175
176 if (
177 $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ||
178 $price_change_date > $previously_sent[count($previously_sent) - 1]['date']
179 )
180 {
181 if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
182 {
183 $post_tip .= ', however a price change occurred on ' . date("jS F Y", strtotime($price_change_date));
184 }
185 elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] )
186 {
187 $post_tip .= ', however a change to the on market status occurred on ' . date("jS F Y", strtotime($on_market_change_date));
188 }
189 echo ' checked';
190 }
191 }
192 else
193 {
194 echo ' checked';
195 }
196 }
197
198 echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label>
199
200 <br>';
201
202 do_action( 'propertyhive_property_match_send_methods', $applicant['contact_id'], $applicant['applicant_profile']['applicant_profile_id'], $property->id );
203
204 echo '<label><input type="checkbox" name="not_interested_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '"> Property Not Suitable</label>';
205
206 echo '</td>';
207 echo '</tr>';
208 }
209
210 echo '
211 </tbody>
212 </table>
213 ';
214 }
215 else
216 {
217 echo __( 'No matching applicants found', 'propertyhive' );
218 }
219 ?>
220
221 <p class="submit">
222
223 <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" />
224
225 <a href="<?php echo get_edit_post_link((int)$_GET['property_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a>
226
227 <input type="hidden" name="step" value="one" />
228 <?php wp_nonce_field( 'propertyhive-matching-applicants' ); ?>
229
230 </p>
231
232 <p>
233 <?php echo __( "If you've opted to email any of the applicants you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' ); ?>
234 </p>
235
236 </div>
237
238 </form>
239
240 </div>
241
242 <script>
243
244 jQuery('body').on('change', 'input[name=\'not_interested_contact_applicant_profile_id[]\']', function()
245 {
246 var applicant_contact_profile_id = jQuery(this).val();
247 var applicant_contact_profile_id_split = applicant_contact_profile_id.split('|');
248
249 jQuery('input[name=\'email_contact_applicant_profile_id[]\'][value=\'' + applicant_contact_profile_id + '\']').attr('checked', false);
250
251 opacity = 0.4;
252 if ( !jQuery(this).is(':checked') )
253 {
254 opacity = 1;
255 }
256 jQuery('#matching_contact_' + applicant_contact_profile_id_split[0] + '_applicant_profile_' + applicant_contact_profile_id_split[1]).animate({
257 opacity: opacity
258 },
259 {
260 duration: 250
261 });
262
263 return false;
264 });
265
266 </script>