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