';
$columns = array(
'name' => 'Name',
'contact_details' => 'Contact Details',
'requirements' => 'Requirements'
);
$columns = apply_filters( 'propertyhive_matching_applicants_row_headings', $columns );
echo '
';
foreach ( $columns as $key => $column )
{
echo '| ' . $column . ' | ';
}
echo '
Actions |
';
$percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' );
$percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' );
foreach ( $applicants as $applicant )
{
$previously_sent = array();
$applicant_profile_match_history = get_post_meta( $applicant['contact_id'], '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '_match_history', TRUE );
if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) )
{
$previously_sent = $applicant_profile_match_history[$property->id];
}
$email_address = get_post_meta( $applicant['contact_id'], '_email_address', TRUE );
$forbidden_contact_methods = get_post_meta( $applicant['contact_id'], '_forbidden_contact_methods', TRUE );
$do_not_email = false;
if ( is_array($forbidden_contact_methods) && in_array('email', $forbidden_contact_methods) )
{
$do_not_email = true;
}
$requirements = array();
if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' )
{
$requirements[] = 'Max Price: £' . number_format($applicant['applicant_profile']['max_price']);
}
if ( $percentage_lower != '' && $percentage_higher != '' )
{
$match_price_range_lower = '';
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'] == '' ) )
{
if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
{
$match_price_range_lower = $applicant['applicant_profile']['max_price_actual'] - ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_lower / 100 ) );
}
}
else
{
$match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower_actual'];
}
$match_price_range_higher = '';
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'] == '' ) )
{
if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' )
{
$match_price_range_higher = $applicant['applicant_profile']['max_price_actual'] + ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_higher / 100 ) );
}
}
else
{
$match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher_actual'];
}
if (
$match_price_range_lower != '' && $match_price_range_higher != ''
)
{
$requirements[] = 'Match Price Range: £' . number_format($match_price_range_lower) . ' to £' . number_format($match_price_range_higher);
}
}
if ( isset($applicant['applicant_profile']['min_beds']) && $applicant['applicant_profile']['min_beds'] != '' )
{
$requirements[] = 'Min Beds: ' . $applicant['applicant_profile']['min_beds'];
}
if ( isset($applicant['applicant_profile']['property_types']) && is_array($applicant['applicant_profile']['property_types']) && !empty($applicant['applicant_profile']['property_types']) )
{
//$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
}
if ( isset($applicant['applicant_profile']['locations']) && is_array($applicant['applicant_profile']['locations']) && !empty($applicant['applicant_profile']['locations']) )
{
//$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price'];
}
if ( isset($applicant['applicant_profile']['notes']) && $applicant['applicant_profile']['notes'] != '' )
{
$requirements[] = 'Notes: ' . nl2br($applicant['applicant_profile']['notes']);
}
$requirements = implode("
", $requirements);
if ( $requirements == '' )
{
$requirements = '-';
}
$columns = array(
'name' => '' . get_the_title($applicant['contact_id']) . '' . ( ( isset($applicant['applicant_profile']['grading']) && $applicant['applicant_profile']['grading'] == 'hot' ) ? '
('. __( 'Hot Applicant', 'propertyhive' ) . ')' : '' ) . '',
'contact_details' => 'T: ' . get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE ) . '
E: ' . $email_address,
'requirements' => $requirements,
);
$columns = apply_filters( 'propertyhive_matching_applicants_row_data', $columns, $applicant, $property->id );
echo '';
foreach ( $columns as $key => $column )
{
echo '| ' . $column . ' | ';
}
echo '';
echo '
';
do_action( 'propertyhive_property_match_send_methods', $applicant['contact_id'], $applicant['applicant_profile']['applicant_profile_id'], $property->id );
echo '';
echo ' | ';
echo '
';
}
echo '
';
}
else
{
echo __( 'No matching applicants found', 'propertyhive' );
}
?>