| 1 |
<?php |
| 2 |
/** |
| 3 |
* Booking Listing Template - Booking Row |
| 4 |
* |
| 5 |
* @version 1.0 |
| 6 |
* @package Any |
| 7 |
* @category Templates for Booking Listing |
| 8 |
* @author wpdevelop |
| 9 |
* |
| 10 |
* @web-site https://wpbookingcalendar.com/ |
| 11 |
* @email info@wpbookingcalendar.com |
| 12 |
* |
| 13 |
* @modified 2025-03-24 |
| 14 |
*/ |
| 15 |
|
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; // Exit, if accessed directly. |
| 18 |
} |
| 19 |
|
| 20 |
function wpbc_template__booking_listing_header() { |
| 21 |
|
| 22 |
// Header |
| 23 |
?><script type="text/html" id="tmpl-wpbc_ajx_booking_list_header"> |
| 24 |
<div class="wpbc__list__head wpbc_selectable_head"> |
| 25 |
<div class="wpbc__list__row"> |
| 26 |
<div class="wpbc__list__col wpbc_col_id check-column"> |
| 27 |
<div class="content_text"><input type="checkbox" /></div> |
| 28 |
</div> |
| 29 |
<div class="wpbc__list__col"> |
| 30 |
<div class="content_text"><?php WPBC_Listing_Actions__Bulk_Actions::get_button(); ?></div> |
| 31 |
<div class="wpbc_ui_el__divider"><div class="wpbc_ui_el__vertical_space"></div></div> |
| 32 |
<div class="content_text"><?php WPBC_Listing_Filters__Expand_Colapse_All::get_button(); ?></div> |
| 33 |
</div> |
| 34 |
<div class="wpbc__list__col col__right"> |
| 35 |
<div class="content_text"><?php WPBC_Listing_Filters__Sort_By::get_button(); ?></div> |
| 36 |
<div class="wpbc_ui_el__divider"><div class="wpbc_ui_el__vertical_line"></div></div> |
| 37 |
<div class="wpbc_ajx_booking_pagination_header wpbc__list__col"></div> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
</div> |
| 41 |
</script><?php |
| 42 |
} |
| 43 |
|
| 44 |
/** |
| 45 |
* Footer Template for listing Table. |
| 46 |
* |
| 47 |
* @return void |
| 48 |
*/ |
| 49 |
function wpbc_template__booking_listing_footer() { |
| 50 |
|
| 51 |
// Footer. |
| 52 |
?> |
| 53 |
<script type="text/html" id="tmpl-wpbc_ajx_booking_list_footer"> |
| 54 |
<div class="wpbc__list__foot wpbc_selectable_foot"> |
| 55 |
<div class="wpbc__list__row"> |
| 56 |
<?php /* ?> |
| 57 |
<div class="wpbc__list__col wpbc_col_id check-column"> |
| 58 |
<div class="content_text"><input type="checkbox"/></div> |
| 59 |
</div> |
| 60 |
<?php */ ?> |
| 61 |
<div class="wpbc__list__col col__right"> |
| 62 |
<div class="wpbc_ajx_booking_pagination_footer wpbc__list__col"></div> |
| 63 |
</div> |
| 64 |
</div> |
| 65 |
</div> |
| 66 |
</script> |
| 67 |
<?php |
| 68 |
} |
| 69 |
|
| 70 |
|
| 71 |
function wpbc_template__booking_listing_row() { |
| 72 |
|
| 73 |
// Rows. |
| 74 |
?> |
| 75 |
<script type="text/html" id="tmpl-wpbc_ajx_booking_list_row"> |
| 76 |
<div id="row_id_{{{data.parsed_fields.booking_id}}}" |
| 77 |
class="wpbc_listing_usual_row wpbc_list_row wpbc_row wpbc_ui_el__listing_row |
| 78 |
<# if ( '1' === data.parsed_fields.trash ) { #> wpbc_row_booking_trash <# } #> |
| 79 |
<# if ( '1' == data.approved ) { #>wpbc_row_booking_approved<# } else { #>wpbc_row_booking_pending<# } #> |
| 80 |
"> |
| 81 |
<?php wpbc_for_booking_template__action_read(); ?> |
| 82 |
<span class="wpbc_row_wrap max_height_a"> |
| 83 |
<div class="wpbc_a_row wpbc_a_row__booking wpbc_a_row_nowrap"> |
| 84 |
<div class="wpbc_a_col wpbc_a_col__check check-column "><?php wpbc_template__booking_listing_row__section_col__checkrow(); ?></div> |
| 85 |
<div class="wpbc_a_col wpbc_a_col__dates"><?php wpbc_template__booking_listing_row__section_col__dates(); ?></div> |
| 86 |
<div class="wpbc_a_col wpbc_a_col__data wpbc_a_overflow_hide"> |
| 87 |
<div class="wpbc_a_row wpbc_a_row_nowrap"> |
| 88 |
<div class="wpbc_a_col wpbc_a_col__details_lables wpbc_a_overflow_hide"> |
| 89 |
<div class="wpbc_a_row"> |
| 90 |
<div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__booking_data(); ?></div> |
| 91 |
</div> |
| 92 |
<div class="wpbc_a_row"> |
| 93 |
<div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__labels(); ?></div> |
| 94 |
</div> |
| 95 |
</div> |
| 96 |
<div class="wpbc_a_col wpbc_a_col__cost"><?php wpbc_template__booking_listing_row__section_col__cost(); ?></div> |
| 97 |
<div class="wpbc_a_col wpbc_a_col__action"><?php wpbc_template__booking_listing_row__section_col__action_button(); ?></div> |
| 98 |
</div> |
| 99 |
<div class="wpbc_a_row wpbc_a_row__notes"> |
| 100 |
<div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__note_readonly(); ?></div> |
| 101 |
</div> |
| 102 |
<div class="wpbc_a_row wpbc_a_row__system"> |
| 103 |
<div class="wpbc_a_col"><?php wpbc_template__booking_listing_row__section_col__sys_info(); ?></div> |
| 104 |
</div> |
| 105 |
<?php wpbc_template__booking_listing_row__section_col__hidden_fields(); ?> |
| 106 |
</div> |
| 107 |
</div> |
| 108 |
</span> |
| 109 |
</div> |
| 110 |
</script> |
| 111 |
<?php |
| 112 |
|
| 113 |
/** |
| 114 |
* data objet = { "booking_db": { |
| 115 |
"booking_id": "3", |
| 116 |
"trash": "0", |
| 117 |
"sync_gid": "", |
| 118 |
"is_new": "0", |
| 119 |
"status": "", |
| 120 |
"sort_date": "2022-02-03 12:00:01", |
| 121 |
"modification_date": "2022-03-14 17:48:23", |
| 122 |
"form": "selectbox-one^rangetime2^12:00 - 14:00~text^name2^Anthony~text^secondname2^Gomez~text^email2^Gomez.example@wpbookingcalendar.com~text^address2^144 Hitchcock Rd~text^city2^Jacksonville~text^postcode2^38374~text^country2^US~text^phone2^988-48-45~selectbox-one^visitors2^3~checkbox^children2[]^2~textarea^details2^", |
| 123 |
"hash": "993086af7a382f3956e6a0010932c856", |
| 124 |
"booking_type": "2", |
| 125 |
"remark": null, |
| 126 |
"cost": "58.00", |
| 127 |
"pay_status": "", |
| 128 |
"pay_request": "0" |
| 129 |
}, |
| 130 |
"id": "3", |
| 131 |
"approved": "0", |
| 132 |
"dates": [ "2022-02-03 12:00:01", "2022-02-03 14:00:02" ], |
| 133 |
"child_id": [ "", "" ], |
| 134 |
"short_dates": [ "2022-02-03 12:00:01", "-", "2022-02-03 14:00:02" ], |
| 135 |
"short_dates_child_id": [ "", "", "" ], |
| 136 |
"parsed_fields": { |
| 137 |
"rangetime": "12:00 PM - 2:00 PM", |
| 138 |
"name": "Anthony", |
| 139 |
"secondname": "Gomez", |
| 140 |
"email": "Gomez.example@wpbookingcalendar.com", |
| 141 |
"address": "144 Hitchcock Rd", |
| 142 |
"city": "Jacksonville", |
| 143 |
"postcode": "38374", |
| 144 |
"country": "US", |
| 145 |
"phone": "988-48-45", |
| 146 |
"visitors": "3", |
| 147 |
"children": "2", |
| 148 |
"details": "", |
| 149 |
"booking_id": "3", |
| 150 |
"trash": "0", |
| 151 |
"sync_gid": "", |
| 152 |
"is_new": "0", |
| 153 |
"status": "", |
| 154 |
"sort_date": "2022-02-03 12:00:01", |
| 155 |
"modification_date": "March 14, 2022 5:48 PM", |
| 156 |
"hash": "993086af7a382f3956e6a0010932c856", |
| 157 |
"booking_type": "2", |
| 158 |
"cost": "58.00", |
| 159 |
"pay_status": "", |
| 160 |
"pay_request": "0", |
| 161 |
"id": "3", |
| 162 |
"approved": "0" |
| 163 |
}, |
| 164 |
"templates": { |
| 165 |
"form_show": "<div class=\"standard-content-form\"> \r\n\t<strong>First Name</strong>:<span class=\"fieldvalue\">Anthony</span> \r\n\t<strong>Last Name</strong>:<span class=\"fieldvalue\">Gomez</span> \r\n\t<strong>Email</strong>:<span class=\"fieldvalue\">Gomez.example@wpbookingcalendar.com</span> \r\n\t<strong>Adults</strong>:<span class=\"fieldvalue\"> 3</span> \r\n\t<strong>Children</strong>:<span class=\"fieldvalue\"> 2</span> \r\n\t<strong>Details</strong>: <span class=\"fieldvalue\"> </span> \r\n</div>" |
| 166 |
}, |
| 167 |
"__search_request_keyword__": "" |
| 168 |
} |
| 169 |
*/ |
| 170 |
} |
| 171 |
|
| 172 |
// --------------------------------------------------------------------------------------------------------------------- |
| 173 |
// Booking Row Elements |
| 174 |
// --------------------------------------------------------------------------------------------------------------------- |
| 175 |
function wpbc_template__booking_listing_row__section_col__checkrow(){ |
| 176 |
|
| 177 |
?> |
| 178 |
<div class="content_text"><input type="checkbox"/></div> |
| 179 |
<?php |
| 180 |
} |
| 181 |
|
| 182 |
function wpbc_template__booking_listing_row__section_col__dates() { |
| 183 |
|
| 184 |
?> |
| 185 |
<div class="booking_dates_small booking_dates_expand_section" style="<# /* if ( 'short' !== wpbc_ajx_booking_listing.search_get_param('ui_usr__dates_short_wide') ) { #>display: none;<# } */ #>" > |
| 186 |
<div class="content_text">{{{data.templates.short_dates_content}}}</div> |
| 187 |
</div> |
| 188 |
<div class="booking_dates_full booking_dates_expand_section" style="<# /* if ( 'wide' !== wpbc_ajx_booking_listing.search_get_param('ui_usr__dates_short_wide') ) { #>display: none;<# } */ #>" > |
| 189 |
<div class="content_text">{{{data.templates.wide_dates_content}}}</div> |
| 190 |
</div> |
| 191 |
<div class="wpbc_btn_expand_down"> |
| 192 |
<a class="wpbc_btn_expand_down_a" |
| 193 |
href="javascript:void(0)" |
| 194 |
onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery( this ).find('.menu_icon').toggle();"> |
| 195 |
<i class="menu_icon icon-1x wpbc_icn_expand_more" title="<?php echo esc_js( __( 'Expand', 'booking' ) ); ?>"></i> |
| 196 |
<i class="menu_icon icon-1x wpbc_icn_expand_less" title="<?php echo esc_js( __( 'Colapse', 'booking' ) ); ?>" style="display:none;"></i> |
| 197 |
</a> |
| 198 |
</div> |
| 199 |
<?php |
| 200 |
} |
| 201 |
|
| 202 |
function wpbc_template__booking_listing_row__section_col__booking_data(){ |
| 203 |
|
| 204 |
?> |
| 205 |
<div class="wpbc_listing_col wpbc_col_data"> |
| 206 |
<div class="content_text"> |
| 207 |
<# |
| 208 |
var booking_details_simple = data.templates.form_show_simple; |
| 209 |
var booking_details = data.templates.form_show; |
| 210 |
var booking_keyword = data[ '__search_request_keyword__' ]; |
| 211 |
booking_details = wpbc_get_highlighted_search_keyword( booking_details, booking_keyword ); |
| 212 |
booking_details_simple = wpbc_get_highlighted_search_keyword( booking_details_simple, booking_keyword ); |
| 213 |
#> |
| 214 |
<a title="<?php echo esc_js( __( 'Expand', 'booking' ) ); ?>" |
| 215 |
href="javascript:void(0)" |
| 216 |
onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery(this).parents('.wpbc_row_wrap').find('.wpbc_btn_expand_down_a .menu_icon').toggle();" |
| 217 |
class="booking_details_simple__expand" |
| 218 |
><div class="booking_details_simple">{{{booking_details_simple}}}</div></a> |
| 219 |
<span <?php /* ?> |
| 220 |
title="<?php echo esc_js( __( 'Collapse', 'booking' ) ); ?>" |
| 221 |
href="javascript:void(0)" |
| 222 |
onclick="javascript:jQuery(this).parents('.wpbc_row_wrap').toggleClass('max_height_a');jQuery(this).parents('.wpbc_row_wrap').find('.wpbc_btn_expand_down_a .menu_icon').toggle();" |
| 223 |
<?php // FixIn: 10.11.3.2 */ ?> |
| 224 |
class="booking_details_simple__expand" |
| 225 |
><div class="booking_details_full">{{{booking_details}}}</div></span> |
| 226 |
</div> |
| 227 |
</div> |
| 228 |
<?php |
| 229 |
} |
| 230 |
|
| 231 |
function wpbc_template__booking_listing_row__section_col__labels(){ |
| 232 |
|
| 233 |
?> |
| 234 |
<div class="wpbc_listing_col wpbc_col_booking_labels wpbc_col_labels"> |
| 235 |
<div class="content_text"> |
| 236 |
<span class="wpbc_label wpbc_label_booking_id"><span class="label_sup">ID:</span>{{data['parsed_fields']['booking_id']}}</span><?php |
| 237 |
?> |
| 238 |
<# |
| 239 |
var resource_title_listing = ( undefined != data.parsed_fields.resource_title_listing && '' != data.parsed_fields.resource_title_listing ) |
| 240 |
? data.parsed_fields.resource_title_listing |
| 241 |
: data.parsed_fields.resource_title; |
| 242 |
var resource_id_listing = ( undefined != data.parsed_fields.resource_id_listing && '' != data.parsed_fields.resource_id_listing ) |
| 243 |
? data.parsed_fields.resource_id_listing |
| 244 |
: data.parsed_fields.resource_id; |
| 245 |
|
| 246 |
if ( '<?php echo esc_js(__( 'Resource not exist', 'booking' )); ?>' == resource_title_listing ) { |
| 247 |
#><span class="wpbc_label wpbc_label_resource wpbc_label_deleted_resource">{{{resource_title_listing}}}</span><# |
| 248 |
} else if ( '' != resource_title_listing ) { |
| 249 |
#><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Change resource', 'booking' ) ); ?>' |
| 250 |
onclick="wpbc_boo_listing__click__change_booking_resource( {{data['parsed_fields']['booking_id']}}, {{resource_id_listing}} );"> |
| 251 |
<span class="wpbc_label wpbc_label_resource">{{{resource_title_listing}}}</span></a><# |
| 252 |
} |
| 253 |
|
| 254 |
if ( '' != data.templates.payment_label_template ) { |
| 255 |
#><a href="javascript:void(0)" class="wpbc_label_link " title='<?php echo esc_attr( __( 'Update payment status', 'booking' ) ); ?>' |
| 256 |
onclick="javascript:wpbc_boo_listing__click__set_payment_status( {{data.parsed_fields.booking_id}}, '{{data.parsed_fields.pay_status}}' );"> |
| 257 |
{{{data.templates.payment_label_template}}} |
| 258 |
</a><# |
| 259 |
} |
| 260 |
|
| 261 |
if ( '' != data.parsed_fields.sync_gid ) { |
| 262 |
#><span class="wpbc_label wpbc_label_imported"><i class="menu_icon icon-1x wpbc_icn_cloud_download system_update_alt"></i><?php echo esc_js(__( 'Imported', 'booking' )); ?></span><# |
| 263 |
} |
| 264 |
|
| 265 |
#><span class="wpbc_label wpbc_label_trash<# if ( '1' != data.parsed_fields.trash ) { #> hidden_items <# } #>"><i style="color: #f6efe8;" class="menu_icon icon-1x wpbc_icn_delete_forever"></i><?php echo esc_js(__( 'In Trash', 'booking' )); ?></span><# |
| 266 |
|
| 267 |
#><span class="wpbc_label wpbc_label_approved<# if ( '0' == data.approved ) { #> hidden_items <# } #>"><i style="color: #def5d4;" class="menu_icon icon-1x wpbc_icn_done_all"></i><?php echo esc_js(__( 'Approved', 'booking' )); ?></span><# |
| 268 |
#><span class="wpbc_label wpbc_label_pending<# if ( '1' == data.approved ) { #> hidden_items <# } #>"><i style="color: #f6efe8;" class="menu_icon icon-1x wpbc_icn_hourglass_empty"></i><?php echo esc_js(__( 'Pending', 'booking' )); ?></span><# |
| 269 |
|
| 270 |
#><?php |
| 271 |
|
| 272 |
|
| 273 |
$labels = get_bk_option( 'wpbc_ajx_booking_labels' ); |
| 274 |
$labels = explode( "\n", $labels ); |
| 275 |
$labels = array_map( 'trim', $labels ); |
| 276 |
|
| 277 |
// Check for Labels and colors. |
| 278 |
foreach ( $labels as $label ) { |
| 279 |
|
| 280 |
if ( ( ! empty( $label ) ) && ( false !== strpos( ':', $label ) ) ) { |
| 281 |
list( $label, $color, $text_color ) = explode( ':', $label ); |
| 282 |
} else { |
| 283 |
$color = ''; |
| 284 |
$text_color = ''; |
| 285 |
} |
| 286 |
|
| 287 |
if ( ! empty( $label ) ) { |
| 288 |
?><span class="wpbc_label" style="color:<?php echo esc_attr( $text_color ); ?>;background-color:<?php echo esc_attr( $color ); ?>;">{{{data.parsed_fields<?php |
| 289 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 290 |
echo $label; |
| 291 |
?>}}}</span><?php |
| 292 |
} |
| 293 |
} |
| 294 |
|
| 295 |
// Predefined internal Labels. |
| 296 |
?> |
| 297 |
<# |
| 298 |
if ( ( undefined != data._paid ) |
| 299 |
&& ( -1 != data._paid.toLowerCase().indexOf( 'refund' ) ) |
| 300 |
) { |
| 301 |
#><span class="wpbc_label booking_label__refund"><?php echo esc_js(__('Refund','booking')); ?></span><# |
| 302 |
} |
| 303 |
console.log( 'row listing', data ); // LISTING_ROWS |
| 304 |
#> |
| 305 |
</div> |
| 306 |
</div> |
| 307 |
<?php |
| 308 |
} |
| 309 |
|
| 310 |
function wpbc_template__booking_listing_row__section_col__note_readonly(){ |
| 311 |
|
| 312 |
if ( ! class_exists( 'wpdev_bk_personal' ) ) { |
| 313 |
return false; |
| 314 |
} |
| 315 |
|
| 316 |
$booking_action = 'set_booking_note'; |
| 317 |
|
| 318 |
$el_id = 'ui_btn_' . $booking_action . '__note_readonly'; |
| 319 |
|
| 320 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 321 |
return false; |
| 322 |
} |
| 323 |
|
| 324 |
$params_textarea = array( |
| 325 |
'id' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}", |
| 326 |
'name' => "{$booking_action}_text_{{data.parsed_fields.booking_id}}", |
| 327 |
'label' => '', |
| 328 |
'style' => '', |
| 329 |
'class' => "{$booking_action}_text", |
| 330 |
'disabled' => ! false, |
| 331 |
'attr' => array(), |
| 332 |
'rows' => '3', |
| 333 |
'cols' => '50', |
| 334 |
'placeholder' => '', |
| 335 |
'value' => '{{{data.parsed_fields.remark}}}', |
| 336 |
'is_escape_value' => true, |
| 337 |
//, 'onfocus' => "console.log( 'ON FOCUS:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code. |
| 338 |
//, 'onchange' => "console.log( 'ON CHANGE:', jQuery( this ).val() , 'in element:' , jQuery( this ) );" // JavaScript code. |
| 339 |
); |
| 340 |
|
| 341 |
?> |
| 342 |
<div class="wpbc_listing_col wpbc_col_note_readonly"> |
| 343 |
<div class="content_text"> |
| 344 |
<div class="ui_remark_section ui_remark_section__note_readonly is_expand_remarks_<?php //echo ($is_expand_remarks) ? 'on' : 'off'; ?>" |
| 345 |
style="<# if ( 'Off' === wpbc_ajx_booking_listing.search_get_param('ui_usr__is_expand_remarks') ) { #>display0: none;<# } #><# if ( '' == data.parsed_fields.remark.trim() ) { #>display: none;<# } #>" |
| 346 |
> |
| 347 |
<label><?php esc_html_e( 'Notes', 'booking' ); ?></label> |
| 348 |
<a href="javascript:void(0)" |
| 349 |
onclick="javascript:wpbc_boo_listing__click__set_booking_note( {{data.parsed_fields.booking_id}}, jQuery( '#set_booking_note_text_{{data.parsed_fields.booking_id}}').val() );" |
| 350 |
style="text-de" |
| 351 |
> |
| 352 |
<span><?php esc_html_e('Edit note','booking'); ?> </span> |
| 353 |
<i class="menu_icon icon-1x wpbc_icn_edit"></i> |
| 354 |
</a> |
| 355 |
<?php |
| 356 |
wpbc_flex_textarea( $params_textarea ); |
| 357 |
?> |
| 358 |
</div> |
| 359 |
</div> |
| 360 |
</div> |
| 361 |
<?php |
| 362 |
} |
| 363 |
|
| 364 |
function wpbc_template__booking_listing_row__section_col__sys_info(){ |
| 365 |
|
| 366 |
?> |
| 367 |
<div class="wpbc_listing_col wpbc_col_sys_info"> |
| 368 |
<div class="content_text"> |
| 369 |
<div class="wpbc_actions_sysinfo"> |
| 370 |
<span class="sysinfo_id"><?php echo esc_js(__( 'Booking ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['booking_id']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_id"></div> |
| 371 |
<span class="sysinfo_edited"><?php echo esc_js(__( 'Edited', 'booking' )); ?>: <strong>{{data['parsed_fields']['modification_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_edited"></div> |
| 372 |
<span class="sysinfo_created"><?php echo esc_js(__( 'Created', 'booking' )); ?>: <strong>{{data['parsed_fields']['creation_date']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_created"></div> |
| 373 |
<span class="sysinfo_hash"><?php echo esc_js(__( 'Hash', 'booking' )); ?>: <strong>{{data['parsed_fields']['hash']}}</strong></span><div class="wpbc_ui_el__vetical_line sysinfo_hash"></div> |
| 374 |
<span class="sysinfo_sync_id"><?php echo esc_js(__( 'Sync ID', 'booking' )); ?>: <strong>{{data['parsed_fields']['sync_id']}}</strong></span> |
| 375 |
</div> |
| 376 |
</div> |
| 377 |
</div> |
| 378 |
<?php |
| 379 |
} |
| 380 |
|
| 381 |
function wpbc_template__booking_listing_row__section_col__hidden_fields(){ |
| 382 |
?> |
| 383 |
<# |
| 384 |
var selected_locale_value = ''; |
| 385 |
if ( |
| 386 |
( 'undefined' !== typeof( data.parsed_fields.booking_options) ) |
| 387 |
&& ( 'undefined' !== typeof( data.parsed_fields.booking_options.booking_meta_locale ) ) |
| 388 |
){ |
| 389 |
var selected_locale_value = data.parsed_fields.booking_options.booking_meta_locale; |
| 390 |
} |
| 391 |
#> |
| 392 |
<input type="hidden" id="locale_for_booking{{data['parsed_fields']['booking_id']}}" name="locale_for_booking{{data['parsed_fields']['booking_id']}}" value="{{selected_locale_value}}" /> |
| 393 |
<?php |
| 394 |
} |
| 395 |
|
| 396 |
function wpbc_template__booking_listing_row__section_col__cost() { |
| 397 |
|
| 398 |
if ( ! class_exists( 'wpdev_bk_biz_s' ) ) { |
| 399 |
return false; |
| 400 |
} |
| 401 |
|
| 402 |
?> |
| 403 |
<div class="wpbc_listing_col wpbc_col_cost"> |
| 404 |
<a href="javascript:void(0)" |
| 405 |
onclick="javascript:wpbc_boo_listing__click__set_booking_cost( {{data.parsed_fields.booking_id}}, '{{data.parsed_fields.cost}}' );"> |
| 406 |
{{{data.parsed_fields.currency_symbol}}} |
| 407 |
{{data.parsed_fields.cost}} |
| 408 |
</a> |
| 409 |
</div> |
| 410 |
<?php |
| 411 |
} |
| 412 |
|
| 413 |
function wpbc_template__booking_listing_row__section_col__action_button() { |
| 414 |
|
| 415 |
?> |
| 416 |
<div class="wpbc_listing_col wpbc_col_action"> |
| 417 |
<?php |
| 418 |
wpbc_template__booking_listing__el__btn_action() |
| 419 |
?> |
| 420 |
</div> |
| 421 |
<?php |
| 422 |
} |
| 423 |
|
| 424 |
// --------------------------------------------------------------------------------------------------------------------- |
| 425 |
// Action Button |
| 426 |
// --------------------------------------------------------------------------------------------------------------------- |
| 427 |
|
| 428 |
function wpbc_template__booking_listing__el__btn_action(){ |
| 429 |
|
| 430 |
$el_arr = array( |
| 431 |
'title' => '', |
| 432 |
'font_icon' => 'wpbc_icn_more_vert', |
| 433 |
'position' => 'right', |
| 434 |
'has_down_arrow' => false, |
| 435 |
'container_style' => 'position:absolute;', |
| 436 |
'items' => array(), |
| 437 |
); |
| 438 |
|
| 439 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_approved() ); |
| 440 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_pending() ); |
| 441 |
$el_arr['items'][] = array( 'type' => 'divider' ); |
| 442 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_edit_booking() ); |
| 443 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Booking_Note::get_button() ); |
| 444 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_print() ); |
| 445 |
if ( class_exists( 'wpdev_bk_biz_s' ) ) { |
| 446 |
$el_arr['items'][] = array( 'type' => 'header', 'title' => __( 'Collect Payment', 'booking' ) ); |
| 447 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Payment_Request::get_button() ); |
| 448 |
$el_arr['items'][] = array( 'type' => 'divider' ); |
| 449 |
$el_arr['items'][] = array( 'type' => 'header', 'title' => __( 'Payment Price and Status', 'booking' ) ); |
| 450 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Booking_Cost::get_button() ); |
| 451 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Payment_Satatus::get_button() ); |
| 452 |
} |
| 453 |
$el_arr['items'][] = array( 'type' => 'divider' ); |
| 454 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_add_google_calendar() ); |
| 455 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Change_Resource::get_button() ); |
| 456 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Duplicate_Booking::get_button() ); |
| 457 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => WPBC_Action_Change_Locale::get_button() ); |
| 458 |
$el_arr['items'][] = array( 'type' => 'divider' ); |
| 459 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_trash() ); |
| 460 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_trash_restore() ); |
| 461 |
$el_arr['items'][] = array( 'type' => 'html', 'html' => wpbc_template__booking_listing__action_delete() ); |
| 462 |
|
| 463 |
$el_arr = apply_filters( 'wpbc_template__booking_listing__el__btn_action' , $el_arr ); |
| 464 |
|
| 465 |
wpbc_ui_el__dropdown_menu( $el_arr ); |
| 466 |
} |
| 467 |
|
| 468 |
// --------------------------------------------------------------------------------------------------------------------- |
| 469 |
// -- Action for Options in Dropdown Menu |
| 470 |
// --------------------------------------------------------------------------------------------------------------------- |
| 471 |
|
| 472 |
/** |
| 473 |
* -- Approve -- Option for "Actions Dropdown Menu" |
| 474 |
* |
| 475 |
* @return string |
| 476 |
*/ |
| 477 |
function wpbc_template__booking_listing__action_approved() { |
| 478 |
|
| 479 |
$booking_action = 'set_booking_approved'; |
| 480 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 481 |
return false; |
| 482 |
} |
| 483 |
$html_for_drop_down_option = "<# if ( '0' == data['approved']) { #>"; |
| 484 |
$html_for_drop_down_option .= "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 485 |
href=\"javascript:void(0)\" |
| 486 |
onclick=\"wpbc_ajx_booking_ajax_action_request( { |
| 487 |
'booking_action' : '{$booking_action}', |
| 488 |
'booking_id' : {{data['parsed_fields']['booking_id']}} |
| 489 |
} ); |
| 490 |
wpbc_button_enable_loading_icon( this );\" |
| 491 |
>" . |
| 492 |
esc_js( __( 'Approve', 'booking' ) ) . |
| 493 |
"<i class='menu_icon icon-1x wpbc_icn_done_all'></i>" . |
| 494 |
'</a>'; |
| 495 |
$html_for_drop_down_option .= '<# } #>'; |
| 496 |
|
| 497 |
return $html_for_drop_down_option; |
| 498 |
} |
| 499 |
|
| 500 |
/** |
| 501 |
* -- Pending -- Option for "Actions Dropdown Menu" |
| 502 |
* |
| 503 |
* @return string |
| 504 |
*/ |
| 505 |
function wpbc_template__booking_listing__action_pending() { |
| 506 |
|
| 507 |
$booking_action = 'set_booking_pending'; |
| 508 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 509 |
return false; |
| 510 |
} |
| 511 |
|
| 512 |
$html_for_drop_down_option = "<# if ( '1' == data['approved']) { #>"; |
| 513 |
$html_for_drop_down_option .= "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 514 |
href=\"javascript:void(0)\" |
| 515 |
onclick=\"if ( ! wpbc_is_modal_accessible( '#wpbc_modal__set_booking_pending__section' ) ) { |
| 516 |
return false; |
| 517 |
} |
| 518 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + {{data.parsed_fields.booking_id}} ); |
| 519 |
jQuery( '#wpbc_modal__set_booking_pending__booking_id').val('{{data.parsed_fields.booking_id}}'); |
| 520 |
jQuery( '#wpbc_modal__set_booking_pending__section' ).wpbc_my_modal( 'show' ); |
| 521 |
jQuery( '#wpbc_modal__set_booking_pending__value' ).trigger( 'focus' ); |
| 522 |
\" |
| 523 |
>" . |
| 524 |
esc_js( __( 'Set as Pending', 'booking' ) ) . |
| 525 |
"<i class='menu_icon icon-1x wpbc_icn_hourglass_empty'></i>" . |
| 526 |
'</a>'; |
| 527 |
$html_for_drop_down_option .= '<# } #>'; |
| 528 |
|
| 529 |
return $html_for_drop_down_option; |
| 530 |
} |
| 531 |
|
| 532 |
/** |
| 533 |
* -- Edit Booking -- Option for "Actions Dropdown Menu" |
| 534 |
* |
| 535 |
* @return string |
| 536 |
*/ |
| 537 |
function wpbc_template__booking_listing__action_edit_booking() { |
| 538 |
|
| 539 |
$booking_action = 'edit_booking'; |
| 540 |
|
| 541 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 542 |
return false; |
| 543 |
} |
| 544 |
|
| 545 |
$edit_booking_onclick = "if ( '' == '{{data.parsed_fields.hash}}' ) { return false; }" |
| 546 |
. " wpbc_boo_listing__click__add_booking_modal_from_row(" |
| 547 |
. " '{{data.parsed_fields.booking_id}}'," |
| 548 |
. " '{{data.parsed_fields.resource_id}}'," |
| 549 |
. " '{{data.parsed_fields.hash}}'," |
| 550 |
. " '{{data.parsed_fields.wpbc_custom_booking_form}}'" |
| 551 |
. ' );'; |
| 552 |
// FixIn: 10.10.1.2 $edit_booking_url .= ( 'Off' !== get_bk_option( 'booking_is_resource_no_update__during_editing' ) ) ? '&resource_no_update=1' : ''; // FixIn: 9.4.2.3. |
| 553 |
|
| 554 |
$html_for_drop_down_option = "<a href='javascript:void(0)' |
| 555 |
onclick=\"" . $edit_booking_onclick . "\" |
| 556 |
class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . |
| 557 |
" <# if ( '' == data['parsed_fields']['hash']) { #>wpbc_field_disabled<# } #>\" >" . |
| 558 |
esc_js( __( 'Edit booking', 'booking' ) ) . |
| 559 |
"<i class='menu_icon icon-1x wpbc_icn_draw'></i>" . |
| 560 |
'</a>'; |
| 561 |
|
| 562 |
return $html_for_drop_down_option; |
| 563 |
} |
| 564 |
|
| 565 |
/** |
| 566 |
* -- Add to Google Calendar -- Option for "Actions Dropdown Menu" |
| 567 |
* |
| 568 |
* @return string |
| 569 |
*/ |
| 570 |
function wpbc_template__booking_listing__action_add_google_calendar() { |
| 571 |
|
| 572 |
$booking_action = 'booking_add_google_calendar'; |
| 573 |
|
| 574 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 575 |
return false; |
| 576 |
} |
| 577 |
|
| 578 |
$edit_booking_url = '{{{data.parsed_fields.google_calendar_link}}}'; |
| 579 |
|
| 580 |
$html_for_drop_down_option = "<a href='" . $edit_booking_url . "' |
| 581 |
target='_blank' |
| 582 |
class='ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "' >" . |
| 583 |
esc_js( __( 'Add to Google Calendar', 'booking' ) ) . |
| 584 |
"<i class='menu_icon icon-1x wpbc_icn_event'></i>" . |
| 585 |
'</a>'; |
| 586 |
|
| 587 |
return $html_for_drop_down_option; |
| 588 |
} |
| 589 |
|
| 590 |
/** |
| 591 |
* -- Trash -- Option for "Actions Dropdown Menu" |
| 592 |
* |
| 593 |
* @return string |
| 594 |
*/ |
| 595 |
function wpbc_template__booking_listing__action_trash() { |
| 596 |
|
| 597 |
$booking_action = 'move_booking_to_trash'; |
| 598 |
|
| 599 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 600 |
return false; |
| 601 |
} |
| 602 |
|
| 603 |
$html_for_drop_down_option = "<# if ( '0' == data['parsed_fields']['trash'] ) { #>"; |
| 604 |
$html_for_drop_down_option .= "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 605 |
href=\"javascript:void(0)\" |
| 606 |
onclick=\"if ( ! wpbc_is_modal_accessible( '#wpbc_modal__move_booking_to_trash__section' ) ) { |
| 607 |
return false; |
| 608 |
} |
| 609 |
jQuery( '#wpbc_modal__move_booking_to_trash__booking_id').val('{{data.parsed_fields.booking_id}}'); |
| 610 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + {{data['parsed_fields']['booking_id']}} ); |
| 611 |
jQuery( '#wpbc_modal__move_booking_to_trash__section' ).wpbc_my_modal( 'show' ); |
| 612 |
jQuery( '#wpbc_modal__move_booking_to_trash__value' ).trigger( 'focus' ); |
| 613 |
\" |
| 614 |
>" . |
| 615 |
esc_js( __( 'Reject - move to trash', 'booking' ) ) . |
| 616 |
"<i class='menu_icon icon-1x wpbc_icn_delete_outline'></i>" . |
| 617 |
'</a>'; |
| 618 |
$html_for_drop_down_option .= '<# } #>'; |
| 619 |
|
| 620 |
return $html_for_drop_down_option; |
| 621 |
} |
| 622 |
|
| 623 |
/** |
| 624 |
* -- Restore -- Option for "Actions Dropdown Menu" |
| 625 |
* |
| 626 |
* @return string |
| 627 |
*/ |
| 628 |
function wpbc_template__booking_listing__action_trash_restore() { |
| 629 |
|
| 630 |
$booking_action = 'restore_booking_from_trash'; |
| 631 |
|
| 632 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 633 |
return false; |
| 634 |
} |
| 635 |
|
| 636 |
$html_for_drop_down_option = "<# if ( '1' == data['parsed_fields']['trash'] ) { #>"; |
| 637 |
$html_for_drop_down_option .= "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 638 |
href=\"javascript:void(0)\" |
| 639 |
onclick=\"if ( ! wpbc_is_modal_accessible( '#wpbc_modal__restore_booking_from_trash__section' ) ) { |
| 640 |
return false; |
| 641 |
} |
| 642 |
jQuery( '#wpbc_modal__restore_booking_from_trash__booking_id').val('{{data.parsed_fields.booking_id}}'); |
| 643 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + {{data.parsed_fields.booking_id}} ); |
| 644 |
jQuery( '#wpbc_modal__restore_booking_from_trash__section' ).wpbc_my_modal( 'show' ); |
| 645 |
jQuery( '#wpbc_modal__restore_booking_from_trash__value' ).trigger( 'focus' ); |
| 646 |
\" |
| 647 |
>" . |
| 648 |
esc_js( __( 'Restore', 'booking' ) ) . |
| 649 |
"<i class='menu_icon icon-1x wpbc_icn_rotate_left'></i>" . |
| 650 |
'</a>'; |
| 651 |
$html_for_drop_down_option .= '<# } #>'; |
| 652 |
|
| 653 |
return $html_for_drop_down_option; |
| 654 |
} |
| 655 |
|
| 656 |
/** |
| 657 |
* -- Completely Delete -- Option for "Actions Dropdown Menu" |
| 658 |
* |
| 659 |
* @return string |
| 660 |
*/ |
| 661 |
function wpbc_template__booking_listing__action_delete() { |
| 662 |
|
| 663 |
$booking_action = 'delete_booking_completely'; |
| 664 |
|
| 665 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 666 |
return false; |
| 667 |
} |
| 668 |
|
| 669 |
$html_for_drop_down_option = "<# if ( '1' == data['parsed_fields']['trash'] ) { #>"; |
| 670 |
$html_for_drop_down_option .= "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 671 |
href=\"javascript:void(0)\" |
| 672 |
onclick=\"if ( ! wpbc_is_modal_accessible( '#wpbc_modal__delete_booking_completely__section' ) ) { |
| 673 |
return false; |
| 674 |
} |
| 675 |
jQuery( '#wpbc_modal__delete_booking_completely__booking_id').val('{{data.parsed_fields.booking_id}}'); |
| 676 |
jQuery( '.wpbc_modal__title__reason__booking_id' ).html( 'ID: ' + {{data['parsed_fields']['booking_id']}} ); |
| 677 |
jQuery( '#wpbc_modal__delete_booking_completely__section' ).wpbc_my_modal( 'show' ); |
| 678 |
jQuery( '#wpbc_modal__delete_booking_completely__value' ).trigger( 'focus' ); |
| 679 |
\" |
| 680 |
>" . |
| 681 |
esc_js( __( 'Completely Delete', 'booking' ) ) . |
| 682 |
"<i class='menu_icon icon-1x wpbc_icn_close'></i>" . |
| 683 |
'</a>'; |
| 684 |
$html_for_drop_down_option .= '<# } #>'; |
| 685 |
|
| 686 |
return $html_for_drop_down_option; |
| 687 |
} |
| 688 |
|
| 689 |
/** |
| 690 |
* -- Print one booking -- Option for "Actions Dropdown Menu" |
| 691 |
* |
| 692 |
* @return string |
| 693 |
*/ |
| 694 |
function wpbc_template__booking_listing__action_print() { |
| 695 |
|
| 696 |
$booking_action = 'set_print'; |
| 697 |
|
| 698 |
if ( ! wpbc_is_user_can( $booking_action, wpbc_get_current_user_id() ) ) { |
| 699 |
return false; |
| 700 |
} |
| 701 |
|
| 702 |
$html_for_drop_down_option = "<a class=\"ul_dropdown_menu_li_action ul_dropdown_menu_li_action_" . $booking_action . "\" |
| 703 |
href=\"javascript:void(0)\" |
| 704 |
onclick=\"wpbc_print_dialog__show( {{data['parsed_fields']['booking_id']}} );\" |
| 705 |
>" . |
| 706 |
esc_js( __( 'Print', 'booking' ) ) . |
| 707 |
"<i class='menu_icon icon-1x wpbc_icn_print'></i>" . |
| 708 |
'</a>'; |
| 709 |
|
| 710 |
return $html_for_drop_down_option; |
| 711 |
} |
| 712 |
|