| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 4 |
|
| 5 |
$readonly = isset($readonly) ? $readonly : false; |
| 6 |
|
| 7 |
echo '<div class="propertyhive_meta_box">'; |
| 8 |
|
| 9 |
echo '<div class="options_group">'; |
| 10 |
|
| 11 |
echo '<p class="form-field"> |
| 12 |
|
| 13 |
<label for="">' . esc_html(__('Status', 'propertyhive')) . '</label> |
| 14 |
|
| 15 |
' . esc_html(__( ucwords(str_replace("_", " ", $viewing->status)), 'propertyhive' )); |
| 16 |
|
| 17 |
// Add text if this a second, third etc viewing |
| 18 |
$related_viewings = get_post_meta( $viewing->id, '_related_viewings', TRUE ); |
| 19 |
if ( isset($related_viewings['previous']) && count($related_viewings['previous']) > 0 ) |
| 20 |
{ |
| 21 |
echo ' - ' . esc_html(ph_ordinal_suffix(count($related_viewings['previous'])+1) . ' ' . __( 'Viewing', 'propertyhive' )); |
| 22 |
} |
| 23 |
|
| 24 |
if ( $viewing->status == 'offer_made' ) |
| 25 |
{ |
| 26 |
if ( get_option('propertyhive_module_disabled_offers_sales', '') != 'yes' ) |
| 27 |
{ |
| 28 |
$offer_id = get_post_meta( $viewing->id, '_offer_id', TRUE ); |
| 29 |
if ( $offer_id != '' && get_post_status($offer_id) != 'publish' ) |
| 30 |
{ |
| 31 |
$offer_id = ''; |
| 32 |
} |
| 33 |
|
| 34 |
if ( $offer_id != '' ) |
| 35 |
{ |
| 36 |
echo ' (<a href="' . esc_url(get_edit_post_link($offer_id)) . '">' . esc_html(__('View Offer', 'propertyhive')) . '</a>)'; |
| 37 |
} |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
echo '</p>'; |
| 42 |
|
| 43 |
if ( $viewing->status == 'cancelled' ) |
| 44 |
{ |
| 45 |
if ( $readonly ) |
| 46 |
{ |
| 47 |
echo '<p class="form-field"> |
| 48 |
|
| 49 |
<label for="">' . esc_html(__('Reason Cancelled', 'propertyhive')) . '</label> |
| 50 |
|
| 51 |
' . nl2br(esc_html($viewing->cancelled_reason)) . ' |
| 52 |
|
| 53 |
</p>'; |
| 54 |
|
| 55 |
echo '<p class="form-field"> |
| 56 |
|
| 57 |
<label for="">' . esc_html(__('Make Reason Public?', 'propertyhive')) . '</label> |
| 58 |
|
| 59 |
' . ( $viewing->cancelled_reason_public == 'yes' ? esc_html(__('Yes', 'propertyhive')) : esc_html(__('No', 'propertyhive')) ) . ' |
| 60 |
|
| 61 |
</p>'; |
| 62 |
} |
| 63 |
else |
| 64 |
{ |
| 65 |
$args = array( |
| 66 |
'id' => '_cancelled_reason', |
| 67 |
'label' => __( 'Reason Cancelled', 'propertyhive' ), |
| 68 |
'desc_tip' => false, |
| 69 |
'class' => '', |
| 70 |
'value' => $viewing->cancelled_reason, |
| 71 |
'custom_attributes' => array( |
| 72 |
'style' => 'width:95%; max-width:500px;' |
| 73 |
) |
| 74 |
); |
| 75 |
propertyhive_wp_textarea_input( $args ); |
| 76 |
|
| 77 |
$args = array( |
| 78 |
'id' => '_cancelled_reason_public', |
| 79 |
'label' => __( 'Make Reason Public?', 'propertyhive' ), |
| 80 |
'description' => __( 'If checked, the reason for cancellation entered will be visible to applicants and owners/landlords in their login area and any cancellation emails sent.', 'propertyhive' ), |
| 81 |
'value' => $viewing->_cancelled_reason_public, |
| 82 |
); |
| 83 |
propertyhive_wp_checkbox( $args ); |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
if ( $viewing->status == 'carried_out' || $viewing->status == 'offer_made' ) |
| 88 |
{ |
| 89 |
echo '<p class="form-field"> |
| 90 |
|
| 91 |
<label for="">' . esc_html(__('Applicant Feedback', 'propertyhive')) . '</label>'; |
| 92 |
|
| 93 |
switch ( $viewing->feedback_status ) |
| 94 |
{ |
| 95 |
case "interested": |
| 96 |
{ |
| 97 |
echo esc_html(__( 'Interested', 'propertyhive' )); |
| 98 |
break; |
| 99 |
} |
| 100 |
case "not_interested": |
| 101 |
{ |
| 102 |
echo esc_html(__( 'Not Interested', 'propertyhive' )); |
| 103 |
break; |
| 104 |
} |
| 105 |
case "not_required": |
| 106 |
{ |
| 107 |
echo esc_html(__( 'Feedback Not Required', 'propertyhive' )); |
| 108 |
break; |
| 109 |
} |
| 110 |
default: |
| 111 |
{ |
| 112 |
echo esc_html(__( 'Awaiting Feedback', 'propertyhive' )); |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
echo '</p>'; |
| 117 |
|
| 118 |
if ( $viewing->feedback_status == 'interested' || $viewing->feedback_status == 'not_interested' ) |
| 119 |
{ |
| 120 |
if ( $readonly ) |
| 121 |
{ |
| 122 |
echo '<p class="form-field"> |
| 123 |
|
| 124 |
<label for="">' . esc_html(__('Feedback', 'propertyhive')) . '</label> |
| 125 |
|
| 126 |
' . nl2br(esc_html($viewing->feedback)) . ' |
| 127 |
|
| 128 |
</p>'; |
| 129 |
} |
| 130 |
else |
| 131 |
{ |
| 132 |
$args = array( |
| 133 |
'id' => '_feedback', |
| 134 |
'label' => __( 'Feedback', 'propertyhive' ), |
| 135 |
'desc_tip' => false, |
| 136 |
'class' => '', |
| 137 |
'value' => $viewing->feedback, |
| 138 |
'custom_attributes' => array( |
| 139 |
'style' => 'width:95%; max-width:500px;' |
| 140 |
) |
| 141 |
); |
| 142 |
propertyhive_wp_textarea_input( $args ); |
| 143 |
} |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
if ( ($viewing->status == 'carried_out' || $viewing->status == 'offer_made') && ( $viewing->feedback_status == 'interested' || $viewing->feedback_status == 'not_interested' ) ) |
| 148 |
{ |
| 149 |
$datetime_format = get_option('date_format')." \a\\t ".get_option('time_format'); |
| 150 |
|
| 151 |
echo '<p class="form-field"> |
| 152 |
|
| 153 |
<label for="">' . esc_html(__('Date Feedback Received', 'propertyhive')) . '</label>'; |
| 154 |
|
| 155 |
echo esc_html( !empty($viewing->feedback_received_date) ? date( $datetime_format, strtotime($viewing->feedback_received_date) ) : __( 'Unknown', 'propertyhive' ) ); |
| 156 |
|
| 157 |
echo '</p>'; |
| 158 |
|
| 159 |
echo '<p class="form-field"> |
| 160 |
|
| 161 |
<label for="">' . esc_html(__('Feedback Passed On', 'propertyhive')) . '</label>'; |
| 162 |
|
| 163 |
echo esc_html( $viewing->feedback_passed_on == 'yes' ? __( 'Yes', 'propertyhive' ) : __( 'No', 'propertyhive' ) ); |
| 164 |
|
| 165 |
echo '</p>'; |
| 166 |
} |
| 167 |
|
| 168 |
do_action('propertyhive_viewing_details_fields'); |
| 169 |
|
| 170 |
echo '</div>'; |
| 171 |
|
| 172 |
echo '</div>'; |